Codestyle fix (#1797)

Warning:
Dont change this PR as draft to make it testable


DONT REVIEW UNTIL Codestyle C++ workflow dont pass
This commit is contained in:
kadeshar 2025-11-05 21:10:17 +01:00 committed by GitHub
parent ce51191e8f
commit 85c7009fe1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
149 changed files with 443 additions and 557 deletions

View File

@ -14,7 +14,7 @@ jobs:
triage: triage:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: C++ name: C++
if: github.repository == 'mod-playerbots/mod-playerbots' && !github.event.pull_request.draft if: github.event.pull_request.draft == false
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup python - name: Setup python

View File

@ -413,10 +413,12 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
break; break;
} }
if (PlayerbotAI::IsTank(player, true)) { if (PlayerbotAI::IsTank(player, true))
{
engine->addStrategy("tank face", false); engine->addStrategy("tank face", false);
} }
if (PlayerbotAI::IsMelee(player, true) && PlayerbotAI::IsDps(player, true)) { if (PlayerbotAI::IsMelee(player, true) && PlayerbotAI::IsDps(player, true))
{
engine->addStrategy("behind", false); engine->addStrategy("behind", false);
} }
if (PlayerbotAI::IsHeal(player, true)) if (PlayerbotAI::IsHeal(player, true))
@ -706,7 +708,9 @@ void AiFactory::AddDefaultNonCombatStrategies(Player* player, PlayerbotAI* const
// { // {
// // nonCombatEngine->addStrategy("travel"); // // nonCombatEngine->addStrategy("travel");
// nonCombatEngine->addStrategy("rpg"); // nonCombatEngine->addStrategy("rpg");
// } else { // }
// else
// {
// nonCombatEngine->addStrategy("move random"); // nonCombatEngine->addStrategy("move random");
// } // }

View File

@ -70,7 +70,7 @@ bool BroadcastHelper::BroadcastToChannelWithGlobalChance(PlayerbotAI* ai, std::s
return false; return false;
} }
for (const auto& pair : toChannels) for (auto const& pair : toChannels)
{ {
uint32 roll = urand(1, 100); uint32 roll = urand(1, 100);
uint32 chance = pair.second; uint32 chance = pair.second;
@ -166,7 +166,7 @@ bool BroadcastHelper::BroadcastToChannelWithGlobalChance(PlayerbotAI* ai, std::s
return false; return false;
} }
bool BroadcastHelper::BroadcastLootingItem(PlayerbotAI* ai, Player* bot, const ItemTemplate *proto) bool BroadcastHelper::BroadcastLootingItem(PlayerbotAI* ai, Player* bot, ItemTemplate const* proto)
{ {
if (!sPlayerbotAIConfig->enableBroadcasts) if (!sPlayerbotAIConfig->enableBroadcasts)
return false; return false;
@ -410,7 +410,6 @@ bool BroadcastHelper::BroadcastQuestUpdateComplete(PlayerbotAI* ai, Player* bot,
placeholders["%my_race"] = ai->GetChatHelper()->FormatRace(bot->getRace()); placeholders["%my_race"] = ai->GetChatHelper()->FormatRace(bot->getRace());
placeholders["%my_level"] = std::to_string(bot->GetLevel()); placeholders["%my_level"] = std::to_string(bot->GetLevel());
return BroadcastToChannelWithGlobalChance( return BroadcastToChannelWithGlobalChance(
ai, ai,
BOT_TEXT2("broadcast_quest_update_complete", placeholders), BOT_TEXT2("broadcast_quest_update_complete", placeholders),

View File

@ -373,7 +373,7 @@ private:
bool ParseSpecPrefix(const std::string& message, std::string& specPrefix, std::string& rest) bool ParseSpecPrefix(const std::string& message, std::string& specPrefix, std::string& rest)
{ {
std::string msgLower = ToLower(message); std::string msgLower = ToLower(message);
for (const auto& entry : specTabNames) for (auto const& entry : specTabNames)
{ {
std::string prefix = "@" + entry.second; std::string prefix = "@" + entry.second;
if (msgLower.find(ToLower(prefix)) == 0) if (msgLower.find(ToLower(prefix)) == 0)
@ -555,7 +555,7 @@ public:
const float radius = 100.0f; const float radius = 100.0f;
GuidVector npcs = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get(); GuidVector npcs = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
bool match = false; bool match = false;
for (const auto& guid : npcs) for (auto const& guid : npcs)
{ {
Creature* c = botAI->GetCreature(guid); Creature* c = botAI->GetCreature(guid);
if (!c) if (!c)

View File

@ -329,9 +329,11 @@ ItemWithRandomProperty ChatHelper::parseItemWithRandomProperty(std::string const
while (currentPos < text.length()) { while (currentPos < text.length()) {
size_t nextColon = text.find(':', currentPos); size_t nextColon = text.find(':', currentPos);
if (nextColon == std::string::npos) { if (nextColon == std::string::npos)
{
size_t hTag = text.find("|h", currentPos); size_t hTag = text.find("|h", currentPos);
if (hTag != std::string::npos) { if (hTag != std::string::npos)
{
params.push_back(text.substr(currentPos, hTag - currentPos)); params.push_back(text.substr(currentPos, hTag - currentPos));
} }
break; break;
@ -341,7 +343,8 @@ ItemWithRandomProperty ChatHelper::parseItemWithRandomProperty(std::string const
currentPos = nextColon + 1; currentPos = nextColon + 1;
} }
if (params.size() >= 6) { if (params.size() >= 6)
{
res.randomPropertyId = atoi(params[5].c_str()); res.randomPropertyId = atoi(params[5].c_str());
} }

View File

@ -1067,7 +1067,7 @@ void GuildTaskMgr::SendCompletionMessage(Player* player, std::string const verb)
void GuildTaskMgr::CheckKillTaskInternal(Player* player, Unit* victim) void GuildTaskMgr::CheckKillTaskInternal(Player* player, Unit* victim)
{ {
ObjectGuid::LowType owner = player->GetGUID().GetCounter(); ObjectGuid::LowType owner = player->GetGUID().GetCounter();
if (victim->GetTypeId() != TYPEID_UNIT) if (victim->IsCreature())
return; return;
Creature* creature = reinterpret_cast<Creature*>(victim); Creature* creature = reinterpret_cast<Creature*>(victim);

View File

@ -3097,8 +3097,10 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
SpellCastResult result = spell->CheckCast(true); SpellCastResult result = spell->CheckCast(true);
delete spell; delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) { // {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK)
// {
// LOG_DEBUG("playerbots", "CanCastSpell - target name: {}, spellid: {}, bot name: {}, result: {}", // LOG_DEBUG("playerbots", "CanCastSpell - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellid, bot->GetName(), result); // target->GetName(), spellid, bot->GetName(), result);
// } // }
@ -3121,7 +3123,6 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
default: default:
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
{ {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) {
LOG_DEBUG("playerbots", LOG_DEBUG("playerbots",
"CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, result: {}", "CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, result: {}",
target->GetName(), spellid, bot->GetName(), result); target->GetName(), spellid, bot->GetName(), result);
@ -3304,7 +3305,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
if (bot->IsFlying() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) if (bot->IsFlying() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
{ {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// {
// LOG_DEBUG("playerbots", "Spell cast is flying - target name: {}, spellid: {}, bot name: {}}", // LOG_DEBUG("playerbots", "Spell cast is flying - target name: {}, spellid: {}, bot name: {}}",
// target->GetName(), spellId, bot->GetName()); // target->GetName(), spellId, bot->GetName());
// } // }
@ -3349,7 +3351,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
{ {
bot->GetTradeData()->SetSpell(spellId); bot->GetTradeData()->SetSpell(spellId);
delete spell; delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// {
// LOG_DEBUG("playerbots", "Spell cast no item - target name: {}, spellid: {}, bot name: {}", // LOG_DEBUG("playerbots", "Spell cast no item - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellId, bot->GetName()); // target->GetName(), spellId, bot->GetName());
// } // }
@ -3418,7 +3421,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
// spell->m_targets.SetUnitTarget(target); // spell->m_targets.SetUnitTarget(target);
// SpellCastResult spellSuccess = spell->CheckCast(true); // SpellCastResult spellSuccess = spell->CheckCast(true);
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// {
// LOG_DEBUG("playerbots", "Spell cast result - target name: {}, spellid: {}, bot name: {}, result: {}", // LOG_DEBUG("playerbots", "Spell cast result - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellId, bot->GetName(), spellSuccess); // target->GetName(), spellId, bot->GetName(), spellSuccess);
// } // }
@ -3429,7 +3433,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
if (result != SPELL_CAST_OK) if (result != SPELL_CAST_OK)
{ {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// {
// LOG_DEBUG("playerbots", "Spell cast failed. - target name: {}, spellid: {}, bot name: {}, result: {}", // LOG_DEBUG("playerbots", "Spell cast failed. - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellId, bot->GetName(), result); // target->GetName(), spellId, bot->GetName(), result);
// } // }
@ -3496,7 +3501,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
// { // {
// spell->cancel(); // spell->cancel();
// delete spell; // delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// {
// LOG_DEBUG("playerbots", "Spell cast loot - target name: {}, spellid: {}, bot name: {}", // LOG_DEBUG("playerbots", "Spell cast loot - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellId, bot->GetName()); // target->GetName(), spellId, bot->GetName());
// } // }
@ -4727,7 +4733,6 @@ uint32 PlayerbotAI::GetEquipGearScore(Player* player)
sum += gearScore[i]; sum += gearScore[i];
} }
if (count) if (count)
{ {
uint32 res = uint32(sum / count); uint32 res = uint32(sum / count);
@ -5264,7 +5269,7 @@ Item* PlayerbotAI::FindOpenableItem() const
return FindItemInInventory( return FindItemInInventory(
[this](ItemTemplate const* itemTemplate) -> bool [this](ItemTemplate const* itemTemplate) -> bool
{ {
return (itemTemplate->Flags & ITEM_FLAG_HAS_LOOT) && return itemTemplate->HasFlag(ITEM_FLAG_HAS_LOOT) &&
(itemTemplate->LockID == 0 || !this->bot->GetItemByEntry(itemTemplate->ItemId)->IsLocked()); (itemTemplate->LockID == 0 || !this->bot->GetItemByEntry(itemTemplate->ItemId)->IsLocked());
}); });
} }
@ -5415,7 +5420,7 @@ Item* PlayerbotAI::FindOilFor(Item* weapon) const
if (prioritizedOils) if (prioritizedOils)
{ {
for (const auto& id : *prioritizedOils) for (auto const& id : *prioritizedOils)
{ {
oil = FindConsumable(id); oil = FindConsumable(id);
if (oil) if (oil)

View File

@ -1736,7 +1736,8 @@ PlayerbotAI* PlayerbotsMgr::GetPlayerbotAI(Player* player)
{ {
return nullptr; return nullptr;
} }
// if (player->GetSession()->isLogingOut() || player->IsDuringRemoveFromWorld()) { // if (player->GetSession()->isLogingOut() || player->IsDuringRemoveFromWorld())
// {
// return nullptr; // return nullptr;
// } // }
auto itr = _playerbotsAIMap.find(player->GetGUID()); auto itr = _playerbotsAIMap.find(player->GetGUID());

View File

@ -982,7 +982,7 @@ void RandomItemMgr::BuildItemInfoCache()
continue; continue;
} }
if (proto->Flags & ITEM_FLAG_DEPRECATED) if (proto->HasFlag(ITEM_FLAG_DEPRECATED))
{ {
itemForTest.insert(proto->ItemId); itemForTest.insert(proto->ItemId);
continue; continue;
@ -1072,10 +1072,10 @@ void RandomItemMgr::BuildItemInfoCache()
// cacheInfo.team = TEAM_NEUTRAL; // cacheInfo.team = TEAM_NEUTRAL;
// // check faction // // check faction
// if (proto->Flags2 & ITEM_FLAG2_FACTION_HORDE) // if (proto->HasFlag2(ITEM_FLAG2_FACTION_HORDE))
// cacheInfo.team = TEAM_HORDE; // cacheInfo.team = TEAM_HORDE;
// if (proto->Flags2 & ITEM_FLAG2_FACTION_ALLIANCE) // if (proto->HasFlag2(ITEM_FLAG2_FACTION_ALLIANCE))
// cacheInfo.team = TEAM_ALLIANCE; // cacheInfo.team = TEAM_ALLIANCE;
// if (cacheInfo.team == TEAM_NEUTRAL && proto->AllowableRace > 1 && proto->AllowableRace < 8388607) // if (cacheInfo.team == TEAM_NEUTRAL && proto->AllowableRace > 1 && proto->AllowableRace < 8388607)
@ -1099,7 +1099,7 @@ void RandomItemMgr::BuildItemInfoCache()
// // check item source // // check item source
// if (proto->Flags & ITEM_FLAG_NO_DISENCHANT) // if (proto->HasFlag(ITEM_FLAG_NO_DISENCHANT))
// { // {
// cacheInfo.source = ITEM_SOURCE_PVP; // cacheInfo.source = ITEM_SOURCE_PVP;
// LOG_DEBUG("playerbots", "Item: {}, source: PvP Reward", proto->ItemId); // LOG_DEBUG("playerbots", "Item: {}, source: PvP Reward", proto->ItemId);
@ -1367,7 +1367,7 @@ uint32 RandomItemMgr::CalculateStatWeight(uint8 playerclass, uint8 spec, ItemTem
} }
// check item spells // check item spells
for (const auto& spellData : proto->Spells) for (auto const& spellData : proto->Spells)
{ {
// no spell // no spell
if (!spellData.SpellId) if (!spellData.SpellId)
@ -2374,7 +2374,6 @@ void RandomItemMgr::BuildPotionCache()
if (proto->Duration & 0x80000000) if (proto->Duration & 0x80000000)
continue; continue;
if (proto->AllowableClass != -1) if (proto->AllowableClass != -1)
continue; continue;

View File

@ -633,7 +633,7 @@ void RandomPlayerbotMgr::AssignAccountTypes()
uint32 existingRndBotAccounts = 0; uint32 existingRndBotAccounts = 0;
uint32 existingAddClassAccounts = 0; uint32 existingAddClassAccounts = 0;
for (const auto& [accountId, accountType] : currentAssignments) for (auto const& [accountId, accountType] : currentAssignments)
{ {
if (accountType == 1) existingRndBotAccounts++; if (accountType == 1) existingRndBotAccounts++;
else if (accountType == 2) existingAddClassAccounts++; else if (accountType == 2) existingAddClassAccounts++;
@ -688,7 +688,7 @@ void RandomPlayerbotMgr::AssignAccountTypes()
} }
// Populate filtered account lists with ALL accounts of each type // Populate filtered account lists with ALL accounts of each type
for (const auto& [accountId, accountType] : currentAssignments) for (auto const& [accountId, accountType] : currentAssignments)
{ {
if (accountType == 1) rndBotTypeAccounts.push_back(accountId); if (accountType == 1) rndBotTypeAccounts.push_back(accountId);
else if (accountType == 2) addClassTypeAccounts.push_back(accountId); else if (accountType == 2) addClassTypeAccounts.push_back(accountId);
@ -798,7 +798,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
std::vector<CharacterInfo> allianceChars; std::vector<CharacterInfo> allianceChars;
std::vector<CharacterInfo> hordeChars; std::vector<CharacterInfo> hordeChars;
for (const auto& charInfo : allCharacters) for (auto const& charInfo : allCharacters)
{ {
if (IsAlliance(charInfo.rRace)) if (IsAlliance(charInfo.rRace))
allianceChars.push_back(charInfo); allianceChars.push_back(charInfo);
@ -832,7 +832,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
}; };
// PHASE 1: Log-in Alliance bots up to allowedAllianceCount // PHASE 1: Log-in Alliance bots up to allowedAllianceCount
for (const auto& charInfo : allianceChars) for (auto const& charInfo : allianceChars)
{ {
if (!allowedAllianceCount) if (!allowedAllianceCount)
break; break;
@ -845,7 +845,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
} }
// PHASE 2: Log-in Horde bots up to maxAllowedBotCount // PHASE 2: Log-in Horde bots up to maxAllowedBotCount
for (const auto& charInfo : hordeChars) for (auto const& charInfo : hordeChars)
{ {
if (!maxAllowedBotCount) if (!maxAllowedBotCount)
break; break;
@ -855,7 +855,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
} }
// PHASE 3: If maxAllowedBotCount wasn't reached, log-in more Alliance bots // PHASE 3: If maxAllowedBotCount wasn't reached, log-in more Alliance bots
for (const auto& charInfo : allianceChars) for (auto const& charInfo : allianceChars)
{ {
if (!maxAllowedBotCount) if (!maxAllowedBotCount)
break; break;
@ -1248,7 +1248,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
void RandomPlayerbotMgr::LogBattlegroundInfo() void RandomPlayerbotMgr::LogBattlegroundInfo()
{ {
for (const auto& queueTypePair : BattlegroundData) for (auto const& queueTypePair : BattlegroundData)
{ {
uint8 queueType = queueTypePair.first; uint8 queueType = queueTypePair.first;
@ -1256,7 +1256,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
if (uint8 type = BattlegroundMgr::BGArenaType(queueTypeId)) if (uint8 type = BattlegroundMgr::BGArenaType(queueTypeId))
{ {
for (const auto& bracketIdPair : queueTypePair.second) for (auto const& bracketIdPair : queueTypePair.second)
{ {
auto& bgInfo = bracketIdPair.second; auto& bgInfo = bracketIdPair.second;
if (bgInfo.minLevel == 0) if (bgInfo.minLevel == 0)
@ -1306,7 +1306,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
break; break;
} }
for (const auto& bracketIdPair : queueTypePair.second) for (auto const& bracketIdPair : queueTypePair.second)
{ {
auto& bgInfo = bracketIdPair.second; auto& bgInfo = bracketIdPair.second;
if (bgInfo.minLevel == 0) if (bgInfo.minLevel == 0)
@ -1704,7 +1704,6 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
return; return;
} }
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomTeleportByLocations"); PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomTeleportByLocations");
std::shuffle(std::begin(tlocs), std::end(tlocs), RandomEngine::Instance()); std::shuffle(std::begin(tlocs), std::end(tlocs), RandomEngine::Instance());
@ -2256,7 +2255,7 @@ void RandomPlayerbotMgr::RandomTeleportForLevel(Player* bot)
// Pick a weighted city randomly, then a random banker in that city // Pick a weighted city randomly, then a random banker in that city
// then teleport to that banker // then teleport to that banker
CityId selectedCity = weightedCities[urand(0, weightedCities.size() - 1)]; CityId selectedCity = weightedCities[urand(0, weightedCities.size() - 1)];
const auto& bankers = cityToBankers.at(selectedCity); auto const& bankers = cityToBankers.at(selectedCity);
uint32 selectedBankerEntry = bankers[urand(0, bankers.size() - 1)]; uint32 selectedBankerEntry = bankers[urand(0, bankers.size() - 1)];
auto locIt = bankerEntryToLocation.find(selectedBankerEntry); auto locIt = bankerEntryToLocation.find(selectedBankerEntry);
if (locIt != bankerEntryToLocation.end()) if (locIt != bankerEntryToLocation.end())

View File

@ -56,7 +56,7 @@ Unit* ServerFacade::GetChaseTarget(Unit* target)
MovementGenerator* movementGen = target->GetMotionMaster()->top(); MovementGenerator* movementGen = target->GetMotionMaster()->top();
if (movementGen && movementGen->GetMovementGeneratorType() == CHASE_MOTION_TYPE) if (movementGen && movementGen->GetMovementGeneratorType() == CHASE_MOTION_TYPE)
{ {
if (target->GetTypeId() == TYPEID_PLAYER) if (target->IsPlayer())
{ {
return static_cast<ChaseMovementGenerator<Player> const*>(movementGen)->GetTarget(); return static_cast<ChaseMovementGenerator<Player> const*>(movementGen)->GetTarget();
} }

View File

@ -2076,7 +2076,6 @@ void TravelMgr::LoadQuestTravelTable()
continue; continue;
} }
if (r.role == 0) if (r.role == 0)
{ {
container->questGivers.push_back(loc); container->questGivers.push_back(loc);

View File

@ -470,7 +470,6 @@ bool TravelNode::cropUselessLinks()
for (auto& firstLink : getLinks()) for (auto& firstLink : getLinks())
{ {
TravelNode* firstNode = firstLink.first; TravelNode* firstNode = firstLink.first;
float firstLength = firstLink.second.getDistance(); float firstLength = firstLink.second.getDistance();
for (auto& secondLink : getLinks()) for (auto& secondLink : getLinks())
@ -1302,7 +1301,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Pla
return TravelNodeRoute(path); return TravelNodeRoute(path);
} }
for (const auto& link : *currentNode->dataNode->getLinks()) // for each successor n' of n for (auto const& link : *currentNode->dataNode->getLinks()) // for each successor n' of n
{ {
TravelNode* linkNode = link.first; TravelNode* linkNode = link.first;
float linkCost = link.second->getCost(bot, currentNode->currentGold); float linkCost = link.second->getCost(bot, currentNode->currentGold);

View File

@ -180,7 +180,7 @@ void PlayerbotFactory::Init()
continue; continue;
} }
if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE) if (proto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE))
{ {
continue; continue;
} }
@ -1600,7 +1600,8 @@ void Shuffle(std::vector<uint32>& items)
// bool noItem = false; // bool noItem = false;
// uint32 quality = urand(ITEM_QUALITY_UNCOMMON, ITEM_QUALITY_EPIC); // uint32 quality = urand(ITEM_QUALITY_UNCOMMON, ITEM_QUALITY_EPIC);
// uint32 attempts = 10; // uint32 attempts = 10;
// if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomGearLoweringChance && quality > ITEM_QUALITY_NORMAL) { // if (urand(0, 100) < 100 * sPlayerbotAIConfig->randomGearLoweringChance && quality > ITEM_QUALITY_NORMAL)
// {
// quality--; // quality--;
// } // }
// // current item; // // current item;
@ -1705,7 +1706,8 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance)
if (incremental && !sPlayerbotAIConfig->incrementalGearInit) if (incremental && !sPlayerbotAIConfig->incrementalGearInit)
return; return;
if (level < 5) { if (level < 5)
{
// original items // original items
if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(bot->getRace(), bot->getClass(), bot->getGender())) if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(bot->getRace(), bot->getClass(), bot->getGender()))
{ {
@ -1734,7 +1736,8 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance)
continue; continue;
} }
if (bot->HasItemCount(itemId, count)) { if (bot->HasItemCount(itemId, count))
{
continue; continue;
} }
@ -2771,7 +2774,8 @@ void PlayerbotFactory::InitTalents(uint32 specNo)
void PlayerbotFactory::InitTalentsByTemplate(uint32 specTab) void PlayerbotFactory::InitTalentsByTemplate(uint32 specTab)
{ {
// if (sPlayerbotAIConfig->parsedSpecLinkOrder[bot->getClass()][specNo][80].size() == 0) { // if (sPlayerbotAIConfig->parsedSpecLinkOrder[bot->getClass()][specNo][80].size() == 0)
// {
// return; // return;
// } // }
uint32 cls = bot->getClass(); uint32 cls = bot->getClass();

View File

@ -77,7 +77,8 @@ Engine::~Engine(void)
// for (std::map<std::string, Strategy*>::iterator i = strategies.begin(); i != strategies.end(); i++) // for (std::map<std::string, Strategy*>::iterator i = strategies.begin(); i != strategies.end(); i++)
// { // {
// Strategy* strategy = i->second; // Strategy* strategy = i->second;
// if (strategy) { // if (strategy)
// {
// delete strategy; // delete strategy;
// } // }
// } // }
@ -402,7 +403,6 @@ void Engine::addStrategiesNoInit(std::string first, ...)
va_end(vl); va_end(vl);
} }
bool Engine::removeStrategy(std::string const name, bool init) bool Engine::removeStrategy(std::string const name, bool init)
{ {
std::map<std::string, Strategy*>::iterator i = strategies.find(name); std::map<std::string, Strategy*>::iterator i = strategies.find(name);

View File

@ -148,7 +148,7 @@ public:
void Add(NamedObjectContext<T>* context) void Add(NamedObjectContext<T>* context)
{ {
contexts.push_back(context); contexts.push_back(context);
for (const auto& iter : context->creators) for (auto const& iter : context->creators)
creators[iter.first] = iter.second; creators[iter.first] = iter.second;
} }
}; };
@ -294,7 +294,7 @@ public:
void Add(NamedObjectFactory<T>* context) void Add(NamedObjectFactory<T>* context)
{ {
factories.push_back(context); factories.push_back(context);
for (const auto& iter : context->creators) for (auto const& iter : context->creators)
creators[iter.first] = iter.second; creators[iter.first] = iter.second;
} }

View File

@ -161,17 +161,21 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
bot->Attack(target, shouldMelee); bot->Attack(target, shouldMelee);
/* prevent pet dead immediately in group */ /* prevent pet dead immediately in group */
// if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat()) { // if (bot->GetMap()->IsDungeon() && bot->GetGroup() && !target->IsInCombat())
// {
// with_pet = false; // with_pet = false;
// } // }
// if (Pet* pet = bot->GetPet()) // if (Pet* pet = bot->GetPet())
// { // {
// if (with_pet) { // if (with_pet)
// {
// pet->SetReactState(REACT_DEFENSIVE); // pet->SetReactState(REACT_DEFENSIVE);
// pet->SetTarget(target->GetGUID()); // pet->SetTarget(target->GetGUID());
// pet->GetCharmInfo()->SetIsCommandAttack(true); // pet->GetCharmInfo()->SetIsCommandAttack(true);
// pet->AI()->AttackStart(target); // pet->AI()->AttackStart(target);
// } else { // }
// else
// {
// pet->SetReactState(REACT_PASSIVE); // pet->SetReactState(REACT_PASSIVE);
// pet->GetCharmInfo()->SetIsCommandFollow(true); // pet->GetCharmInfo()->SetIsCommandFollow(true);
// pet->GetCharmInfo()->IsReturning(); // pet->GetCharmInfo()->IsReturning();

View File

@ -176,4 +176,3 @@ void AutoMaintenanceOnLevelupAction::AutoUpgradeEquip()
factory.InitEquipment(true); factory.InitEquipment(true);
} }
} }

View File

@ -17,7 +17,7 @@ bool BankAction::Execute(Event event)
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++) for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
{ {
Unit* npc = botAI->GetUnit(*i); Unit* npc = botAI->GetUnit(*i);
if (!npc || !npc->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_BANKER)) if (!npc || !npc->HasNpcFlag(UNIT_NPC_FLAG_BANKER))
continue; continue;
return ExecuteBank(text, npc); return ExecuteBank(text, npc);

View File

@ -1894,13 +1894,13 @@ bool BGTactics::selectObjective(bool reset)
bool isDefender = role < defendersProhab; bool isDefender = role < defendersProhab;
bool isAdvanced = !isDefender && role > 8; bool isAdvanced = !isDefender && role > 8;
const auto& attackObjectives = auto const& attackObjectives =
(team == TEAM_HORDE) ? AV_AttackObjectives_Horde : AV_AttackObjectives_Alliance; (team == TEAM_HORDE) ? AV_AttackObjectives_Horde : AV_AttackObjectives_Alliance;
const auto& defendObjectives = auto const& defendObjectives =
(team == TEAM_HORDE) ? AV_DefendObjectives_Horde : AV_DefendObjectives_Alliance; (team == TEAM_HORDE) ? AV_DefendObjectives_Horde : AV_DefendObjectives_Alliance;
uint32 destroyedNodes = 0; uint32 destroyedNodes = 0;
for (const auto& [nodeId, _] : defendObjectives) for (auto const& [nodeId, _] : defendObjectives)
if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED) if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED)
destroyedNodes++; destroyedNodes++;
@ -2000,7 +2000,7 @@ bool BGTactics::selectObjective(bool reset)
std::vector<GameObject*> contestedObjectives; std::vector<GameObject*> contestedObjectives;
std::vector<GameObject*> availableObjectives; std::vector<GameObject*> availableObjectives;
for (const auto& [nodeId, goId] : defendObjectives) for (auto const& [nodeId, goId] : defendObjectives)
{ {
const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId); const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId);
if (node.State == POINT_DESTROYED) if (node.State == POINT_DESTROYED)
@ -2026,7 +2026,7 @@ bool BGTactics::selectObjective(bool reset)
if (!BgObjective) if (!BgObjective)
{ {
uint32 towersDown = 0; uint32 towersDown = 0;
for (const auto& [nodeId, _] : attackObjectives) for (auto const& [nodeId, _] : attackObjectives)
if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED) if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED)
towersDown++; towersDown++;
@ -2053,7 +2053,7 @@ bool BGTactics::selectObjective(bool reset)
{ {
std::vector<GameObject*> candidates; std::vector<GameObject*> candidates;
for (const auto& [nodeId, goId] : attackObjectives) for (auto const& [nodeId, goId] : attackObjectives)
{ {
const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId); const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId);
GameObject* go = bg->GetBGObject(goId); GameObject* go = bg->GetBGObject(goId);
@ -2105,13 +2105,13 @@ bool BGTactics::selectObjective(bool reset)
Position objPos = BgObjective->GetPosition(); Position objPos = BgObjective->GetPosition();
Optional<uint8> linkedNodeId; Optional<uint8> linkedNodeId;
for (const auto& [nodeId, goId] : attackObjectives) for (auto const& [nodeId, goId] : attackObjectives)
if (bg->GetBGObject(goId) == BgObjective) if (bg->GetBGObject(goId) == BgObjective)
linkedNodeId = nodeId; linkedNodeId = nodeId;
if (!linkedNodeId) if (!linkedNodeId)
{ {
for (const auto& [nodeId, goId] : defendObjectives) for (auto const& [nodeId, goId] : defendObjectives)
if (bg->GetBGObject(goId) == BgObjective) if (bg->GetBGObject(goId) == BgObjective)
linkedNodeId = nodeId; linkedNodeId = nodeId;
} }
@ -2543,7 +2543,7 @@ bool BGTactics::selectObjective(bool reset)
float bestDist = FLT_MAX; float bestDist = FLT_MAX;
uint32 bestTrigger = 0; uint32 bestTrigger = 0;
for (const auto& [nodeId, _, areaTrigger] : EY_AttackObjectives) for (auto const& [nodeId, _, areaTrigger] : EY_AttackObjectives)
{ {
if (!IsOwned(nodeId)) if (!IsOwned(nodeId))
continue; continue;
@ -2610,7 +2610,7 @@ bool BGTactics::selectObjective(bool reset)
// --- PRIORITY 2: Nearby unowned contested node --- // --- PRIORITY 2: Nearby unowned contested node ---
if (!foundObjective) if (!foundObjective)
{ {
for (const auto& [nodeId, _, __] : EY_AttackObjectives) for (auto const& [nodeId, _, __] : EY_AttackObjectives)
{ {
if (IsOwned(nodeId)) if (IsOwned(nodeId))
continue; continue;
@ -2711,7 +2711,7 @@ bool BGTactics::selectObjective(bool reset)
if (!foundObjective && strategy == EY_STRATEGY_FLAG_FOCUS) if (!foundObjective && strategy == EY_STRATEGY_FLAG_FOCUS)
{ {
bool ownsAny = false; bool ownsAny = false;
for (const auto& [nodeId, _, __] : EY_AttackObjectives) for (auto const& [nodeId, _, __] : EY_AttackObjectives)
{ {
if (IsOwned(nodeId)) if (IsOwned(nodeId))
{ {
@ -2739,7 +2739,7 @@ bool BGTactics::selectObjective(bool reset)
float bestDist = FLT_MAX; float bestDist = FLT_MAX;
Optional<uint32> bestNode; Optional<uint32> bestNode;
for (const auto& [nodeId, _, __] : EY_AttackObjectives) for (auto const& [nodeId, _, __] : EY_AttackObjectives)
{ {
if (IsOwned(nodeId)) if (IsOwned(nodeId))
continue; continue;
@ -2974,7 +2974,7 @@ bool BGTactics::selectObjective(bool reset)
uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives); uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives);
for (uint32 i = 0; i < len; i++) for (uint32 i = 0; i < len; i++)
{ {
const auto& objective = auto const& objective =
IC_AttackObjectives[(i + role) % IC_AttackObjectives[(i + role) %
len]; // use role to determine which objective checked first len]; // use role to determine which objective checked first
if (isleOfConquestBG->GetICNodePoint(objective.first).nodeState != NODE_STATE_CONTROLLED_H) if (isleOfConquestBG->GetICNodePoint(objective.first).nodeState != NODE_STATE_CONTROLLED_H)
@ -3126,7 +3126,7 @@ bool BGTactics::selectObjective(bool reset)
uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives); uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives);
for (uint32 i = 0; i < len; i++) for (uint32 i = 0; i < len; i++)
{ {
const auto& objective = auto const& objective =
IC_AttackObjectives[(i + role) % IC_AttackObjectives[(i + role) %
len]; // use role to determine which objective checked first len]; // use role to determine which objective checked first
if (isleOfConquestBG->GetICNodePoint(objective.first).nodeState != NODE_STATE_CONTROLLED_H) if (isleOfConquestBG->GetICNodePoint(objective.first).nodeState != NODE_STATE_CONTROLLED_H)

View File

@ -370,7 +370,7 @@ bool CheckMountStateAction::TryPreferredMount(Player* master) const
bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::vector<uint32>>& spells, int32 masterSpeed) const bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::vector<uint32>>& spells, int32 masterSpeed) const
{ {
for (const auto& pair : spells) for (auto const& pair : spells)
{ {
int32 currentSpeed = pair.first; int32 currentSpeed = pair.first;
@ -378,7 +378,7 @@ bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::ve
continue; continue;
// Pick a random mount from the candidate group. // Pick a random mount from the candidate group.
const auto& ids = pair.second; auto const& ids = pair.second;
if (!ids.empty()) if (!ids.empty())
{ {
// Required here as otherwise bots won't mount in BG's due to them constant moving // Required here as otherwise bots won't mount in BG's due to them constant moving

View File

@ -120,7 +120,6 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
} }
} }
//Continue current target. 90% chance //Continue current target. 90% chance
if (!foundTarget && urand(1, 100) > 10) if (!foundTarget && urand(1, 100) > 10)
{ {

View File

@ -58,7 +58,6 @@ bool DropQuestAction::Execute(Event event)
return true; return true;
} }
bool CleanQuestLogAction::Execute(Event event) bool CleanQuestLogAction::Execute(Event event)
{ {
Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
@ -165,7 +164,6 @@ bool CleanQuestLogAction::Execute(Event event)
return true; return true;
} }
void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isGreen, bool hasProgress, bool isComplete) void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isGreen, bool hasProgress, bool isComplete)
{ {
std::vector<uint8> slots; std::vector<uint8> slots;

View File

@ -837,8 +837,8 @@ uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote)
types.push_back(TEXT_EMOTE_TALKEX); types.push_back(TEXT_EMOTE_TALKEX);
types.push_back(TEXT_EMOTE_TALKQ); types.push_back(TEXT_EMOTE_TALKQ);
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) || if (unit && (unit->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) ||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))) unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER)))
{ {
types.push_back(TEXT_EMOTE_SALUTE); types.push_back(TEXT_EMOTE_SALUTE);
} }
@ -864,8 +864,8 @@ uint32 TalkAction::GetRandomEmote(Unit* unit, bool textEmote)
types.push_back(EMOTE_ONESHOT_EXCLAMATION); types.push_back(EMOTE_ONESHOT_EXCLAMATION);
types.push_back(EMOTE_ONESHOT_QUESTION); types.push_back(EMOTE_ONESHOT_QUESTION);
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) || if (unit && (unit->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) ||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))) unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER)))
{ {
types.push_back(EMOTE_ONESHOT_SALUTE); types.push_back(EMOTE_ONESHOT_SALUTE);
} }

View File

@ -328,7 +328,6 @@ void EquipAction::EquipItem(Item* item)
botAI->TellMaster(out); botAI->TellMaster(out);
} }
bool EquipUpgradesAction::Execute(Event event) bool EquipUpgradesAction::Execute(Event event)
{ {
if (!sPlayerbotAIConfig->autoEquipUpgradeLoot && !sRandomPlayerbotMgr->IsRandomBot(bot)) if (!sPlayerbotAIConfig->autoEquipUpgradeLoot && !sRandomPlayerbotMgr->IsRandomBot(bot))
@ -357,9 +356,12 @@ bool EquipUpgradesAction::Execute(Event event)
int32 randomProperty = item->GetItemRandomPropertyId(); int32 randomProperty = item->GetItemRandomPropertyId();
uint32 itemId = item->GetTemplate()->ItemId; uint32 itemId = item->GetTemplate()->ItemId;
std::string itemUsageParam; std::string itemUsageParam;
if (randomProperty != 0) { if (randomProperty != 0)
{
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty); itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
} else { }
else
{
itemUsageParam = std::to_string(itemId); itemUsageParam = std::to_string(itemId);
} }
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam); ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
@ -388,9 +390,12 @@ bool EquipUpgradeAction::Execute(Event event)
int32 randomProperty = item->GetItemRandomPropertyId(); int32 randomProperty = item->GetItemRandomPropertyId();
uint32 itemId = item->GetTemplate()->ItemId; uint32 itemId = item->GetTemplate()->ItemId;
std::string itemUsageParam; std::string itemUsageParam;
if (randomProperty != 0) { if (randomProperty != 0)
{
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty); itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
} else { }
else
{
itemUsageParam = std::to_string(itemId); itemUsageParam = std::to_string(itemId);
} }
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam); ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);

View File

@ -29,7 +29,6 @@ namespace ai::buff
// Returns false if the spellId is invalid. // Returns false if the spellId is invalid.
bool HasRequiredReagents(Player* bot, uint32 spellId); bool HasRequiredReagents(Player* bot, uint32 spellId);
// Applies the "switch to group buff" policy if: the bot is in a group of size x+, // Applies the "switch to group buff" policy if: the bot is in a group of size x+,
// the group variant is known/useful, and reagents are available. Otherwise, returns baseName. // the group variant is known/useful, and reagents are available. Otherwise, returns baseName.
// If announceOnMissing == true and reagents are missing, calls the 'announce' callback // If announceOnMissing == true and reagents are missing, calls the 'announce' callback

View File

@ -190,8 +190,8 @@ CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string con
bool CastEnchantItemAction::isPossible() bool CastEnchantItemAction::isPossible()
{ {
// if (!CastSpellAction::isPossible()) { // if (!CastSpellAction::isPossible())
// {
// botAI->TellMasterNoFacing("Impossible: " + spell); // botAI->TellMasterNoFacing("Impossible: " + spell);
// return false; // return false;
// } // }
@ -364,7 +364,8 @@ bool UseTrinketAction::UseTrinket(Item* item)
for (int i = 0; i < MAX_SPELL_EFFECTS; i++) for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
{ {
const SpellEffectInfo& effectInfo = spellInfo->Effects[i]; const SpellEffectInfo& effectInfo = spellInfo->Effects[i];
if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA) { if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA)
{
applyAura = true; applyAura = true;
break; break;
} }

View File

@ -16,7 +16,6 @@
using namespace lfg; using namespace lfg;
bool LfgJoinAction::Execute(Event event) { return JoinLFG(); } bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
uint32 LfgJoinAction::GetRoles() uint32 LfgJoinAction::GetRoles()
@ -113,7 +112,7 @@ bool LfgJoinAction::JoinLFG()
dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID)) dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID))
continue; continue;
const auto& botLevel = bot->GetLevel(); auto const& botLevel = bot->GetLevel();
/*LFG_TYPE_RANDOM on classic is 15-58 so bot over level 25 will never queue*/ /*LFG_TYPE_RANDOM on classic is 15-58 so bot over level 25 will never queue*/
if (dungeon->MinLevel && (botLevel < dungeon->MinLevel || botLevel > dungeon->MaxLevel) || if (dungeon->MinLevel && (botLevel < dungeon->MinLevel || botLevel > dungeon->MaxLevel) ||
@ -180,7 +179,6 @@ bool LfgRoleCheckAction::Execute(Event event)
// if (currentRoles == newRoles) // if (currentRoles == newRoles)
// return false; // return false;
WorldPacket* packet = new WorldPacket(CMSG_LFG_SET_ROLES); WorldPacket* packet = new WorldPacket(CMSG_LFG_SET_ROLES);
*packet << (uint8)newRoles; *packet << (uint8)newRoles;
bot->GetSession()->QueuePacket(packet); bot->GetSession()->QueuePacket(packet);
@ -267,7 +265,6 @@ bool LfgAcceptAction::Execute(Event event)
return false; return false;
} }
bool LfgLeaveAction::Execute(Event event) bool LfgLeaveAction::Execute(Event event)
{ {
// Don't leave if lfg strategy enabled // Don't leave if lfg strategy enabled

View File

@ -41,9 +41,12 @@ bool LootRollAction::Execute(Event event)
continue; continue;
std::string itemUsageParam; std::string itemUsageParam;
if (randomProperty != 0) { if (randomProperty != 0)
{
itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty); itemUsageParam = std::to_string(itemId) + "," + std::to_string(randomProperty);
} else { }
else
{
itemUsageParam = std::to_string(itemId); itemUsageParam = std::to_string(itemId);
} }
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam); ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", itemUsageParam);
@ -120,7 +123,6 @@ bool LootRollAction::Execute(Event event)
return false; return false;
} }
RollVote LootRollAction::CalculateRollVote(ItemTemplate const* proto) RollVote LootRollAction::CalculateRollVote(ItemTemplate const* proto)
{ {
std::ostringstream out; std::ostringstream out;

View File

@ -530,7 +530,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
// { // {
// AI_VALUE(LastMovement&, "last area trigger").lastAreaTrigger = entry; // AI_VALUE(LastMovement&, "last area trigger").lastAreaTrigger = entry;
// } // }
// else { // else
// {
// LOG_DEBUG("playerbots", "!entry"); // LOG_DEBUG("playerbots", "!entry");
// return bot->TeleportTo(movePosition.getMapId(), movePosition.getX(), movePosition.getY(), // return bot->TeleportTo(movePosition.getMapId(), movePosition.getX(), movePosition.getY(),
// movePosition.getZ(), movePosition.getO(), 0); // movePosition.getZ(), movePosition.getO(), 0);
@ -876,7 +877,8 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
deltaAngle -= 2.0f * M_PI; // -PI..PI deltaAngle -= 2.0f * M_PI; // -PI..PI
// if target is moving forward and moving far away, predict the position // if target is moving forward and moving far away, predict the position
bool behind = fabs(deltaAngle) > M_PI_2; bool behind = fabs(deltaAngle) > M_PI_2;
if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD) && behind) { if (target->HasUnitMovementFlag(MOVEMENTFLAG_FORWARD) && behind)
{
float predictDis = std::min(3.0f, target->GetObjectSize() * 2); float predictDis = std::min(3.0f, target->GetObjectSize() * 2);
tx += cos(target->GetOrientation()) * predictDis; tx += cos(target->GetOrientation()) * predictDis;
ty += sin(target->GetOrientation()) * predictDis; ty += sin(target->GetOrientation()) * predictDis;
@ -1009,7 +1011,8 @@ bool MovementAction::IsMovingAllowed()
return false; return false;
} }
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) { // if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
// {
// return false; // return false;
// } // }
return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE; return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE;
@ -1094,9 +1097,12 @@ void MovementAction::UpdateMovementState()
wasMovementRestricted = isCurrentlyRestricted; wasMovementRestricted = isCurrentlyRestricted;
// Temporary speed increase in group // Temporary speed increase in group
// if (botAI->HasRealPlayerMaster()) { // if (botAI->HasRealPlayerMaster())
// {
// bot->SetSpeedRate(MOVE_RUN, 1.1f); // bot->SetSpeedRate(MOVE_RUN, 1.1f);
// } else { // }
// else
// {
// bot->SetSpeedRate(MOVE_RUN, 1.0f); // bot->SetSpeedRate(MOVE_RUN, 1.0f);
// } // }
// check if target is not reachable (from Vmangos) // check if target is not reachable (from Vmangos)
@ -1105,7 +1111,7 @@ void MovementAction::UpdateMovementState()
// { // {
// if (Unit* pTarget = sServerFacade->GetChaseTarget(bot)) // if (Unit* pTarget = sServerFacade->GetChaseTarget(bot))
// { // {
// if (!bot->IsWithinMeleeRange(pTarget) && pTarget->GetTypeId() == TYPEID_UNIT) // if (!bot->IsWithinMeleeRange(pTarget) && pTarget->IsCreature())
// { // {
// float angle = bot->GetAngle(pTarget); // float angle = bot->GetAngle(pTarget);
// float distance = 5.0f; // float distance = 5.0f;
@ -1721,7 +1727,8 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
// float MovementAction::SearchBestGroundZForPath(float x, float y, float z, bool generatePath, float range, bool // float MovementAction::SearchBestGroundZForPath(float x, float y, float z, bool generatePath, float range, bool
// normal_only, float step) // normal_only, float step)
// { // {
// if (!generatePath) { // if (!generatePath)
// {
// return z; // return z;
// } // }
// float min_length = 100000.0f; // float min_length = 100000.0f;
@ -1732,10 +1739,12 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
// modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta); // modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta);
// PathGenerator gen(bot); // PathGenerator gen(bot);
// gen.CalculatePath(x, y, modified_z); // gen.CalculatePath(x, y, modified_z);
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) { // if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length)
// {
// min_length = gen.getPathLength(); // min_length = gen.getPathLength();
// current_z = modified_z; // current_z = modified_z;
// if (abs(current_z - z) < 0.5f) { // if (abs(current_z - z) < 0.5f)
// {
// return current_z; // return current_z;
// } // }
// } // }
@ -1744,10 +1753,12 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
// modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta); // modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta);
// PathGenerator gen(bot); // PathGenerator gen(bot);
// gen.CalculatePath(x, y, modified_z); // gen.CalculatePath(x, y, modified_z);
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) { // if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length)
// {
// min_length = gen.getPathLength(); // min_length = gen.getPathLength();
// current_z = modified_z; // current_z = modified_z;
// if (abs(current_z - z) < 0.5f) { // if (abs(current_z - z) < 0.5f)
// {
// return current_z; // return current_z;
// } // }
// } // }
@ -1756,18 +1767,22 @@ bool MovementAction::MoveInside(uint32 mapId, float x, float y, float z, float d
// modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta); // modified_z = bot->GetMapWaterOrGroundLevel(x, y, z + delta);
// PathGenerator gen(bot); // PathGenerator gen(bot);
// gen.CalculatePath(x, y, modified_z); // gen.CalculatePath(x, y, modified_z);
// if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length) { // if (gen.GetPathType() == PATHFIND_NORMAL && gen.getPathLength() < min_length)
// {
// min_length = gen.getPathLength(); // min_length = gen.getPathLength();
// current_z = modified_z; // current_z = modified_z;
// if (abs(current_z - z) < 0.5f) { // if (abs(current_z - z) < 0.5f)
// {
// return current_z; // return current_z;
// } // }
// } // }
// } // }
// if (current_z == INVALID_HEIGHT && normal_only) { // if (current_z == INVALID_HEIGHT && normal_only)
// {
// return INVALID_HEIGHT; // return INVALID_HEIGHT;
// } // }
// if (current_z == INVALID_HEIGHT && !normal_only) { // if (current_z == INVALID_HEIGHT && !normal_only)
// {
// return z; // return z;
// } // }
// return current_z; // return current_z;
@ -2818,7 +2833,7 @@ bool MoveAwayFromCreatureAction::Execute(Event event)
// Find all creatures with the specified Id // Find all creatures with the specified Id
std::vector<Unit*> creatures; std::vector<Unit*> creatures;
for (const auto& guid : targets) for (auto const& guid : targets)
{ {
Unit* unit = botAI->GetUnit(guid); Unit* unit = botAI->GetUnit(guid);
if (unit && (alive && unit->IsAlive()) && unit->GetEntry() == creatureId) if (unit && (alive && unit->IsAlive()) && unit->GetEntry() == creatureId)

View File

@ -119,7 +119,6 @@ protected:
int moveInterval; int moveInterval;
}; };
class CombatFormationMoveAction : public MovementAction class CombatFormationMoveAction : public MovementAction
{ {
public: public:

View File

@ -48,7 +48,7 @@ bool QuestAction::Execute(Event event)
// Check the nearest NPCs // Check the nearest NPCs
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs"); GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
for (const auto& npc : npcs) for (auto const& npc : npcs)
{ {
Unit* unit = botAI->GetUnit(npc); Unit* unit = botAI->GetUnit(npc);
if (unit && bot->GetDistance(unit) <= INTERACTION_DISTANCE) if (unit && bot->GetDistance(unit) <= INTERACTION_DISTANCE)
@ -59,7 +59,7 @@ bool QuestAction::Execute(Event event)
// Checks the nearest game objects // Checks the nearest game objects
GuidVector gos = AI_VALUE(GuidVector, "nearest game objects"); GuidVector gos = AI_VALUE(GuidVector, "nearest game objects");
for (const auto& go : gos) for (auto const& go : gos)
{ {
GameObject* gameobj = botAI->GetGameObject(go); GameObject* gameobj = botAI->GetGameObject(go);
if (gameobj && bot->GetDistance(gameobj) <= INTERACTION_DISTANCE) if (gameobj && bot->GetDistance(gameobj) <= INTERACTION_DISTANCE)
@ -359,7 +359,7 @@ bool QuestUpdateAddItemAction::Execute(Event event)
uint32 availableItemsCount = botAI->GetInventoryItemsCountWithId(itemId); uint32 availableItemsCount = botAI->GetInventoryItemsCountWithId(itemId);
placeholders["%quest_obj_available"] = std::to_string(availableItemsCount); placeholders["%quest_obj_available"] = std::to_string(availableItemsCount);
for (const auto& pair : botAI->GetCurrentQuestsRequiringItemId(itemId)) for (auto const& pair : botAI->GetCurrentQuestsRequiringItemId(itemId))
{ {
placeholders["%quest_link"] = chat->FormatQuest(pair.first); placeholders["%quest_link"] = chat->FormatQuest(pair.first);
uint32 requiredItemsCount = pair.second; uint32 requiredItemsCount = pair.second;

View File

@ -49,7 +49,7 @@ class QuestUpdateAddItemAction : public Action
{ {
public: public:
QuestUpdateAddItemAction(PlayerbotAI* ai) : Action(ai, "quest update add item") {} QuestUpdateAddItemAction(PlayerbotAI* ai) : Action(ai, "quest update add item") {}
bool Execute(Event event) override;; bool Execute(Event event) override;
}; };
class QuestUpdateFailedAction : public Action class QuestUpdateFailedAction : public Action
@ -70,7 +70,7 @@ class QuestItemPushResultAction : public Action
{ {
public: public:
QuestItemPushResultAction(PlayerbotAI* ai) : Action(ai, "quest item push result") {} QuestItemPushResultAction(PlayerbotAI* ai) : Action(ai, "quest item push result") {}
bool Execute(Event event) override;; bool Execute(Event event) override;
}; };
#endif #endif

View File

@ -128,7 +128,7 @@ bool AutoReleaseSpiritAction::HandleBattlegroundSpiritHealer()
GuidVector npcs = NearestNpcsValue(botAI, bgRange); GuidVector npcs = NearestNpcsValue(botAI, bgRange);
Unit* spiritHealer = nullptr; Unit* spiritHealer = nullptr;
for (const auto& guid : npcs) for (auto const& guid : npcs)
{ {
Unit* unit = botAI->GetUnit(guid); Unit* unit = botAI->GetUnit(guid);
if (unit && unit->IsFriendlyTo(bot) && unit->IsSpiritService()) if (unit && unit->IsFriendlyTo(bot) && unit->IsSpiritService())

View File

@ -12,24 +12,7 @@
#include "GridNotifiersImpl.h" #include "GridNotifiersImpl.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "ServerFacade.h" #include "ServerFacade.h"
#include "NearestGameObjects.h"
class AnyGameObjectInObjectRangeCheck
{
public:
AnyGameObjectInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(GameObject* go)
{
if (go && i_obj->IsWithinDistInMap(go, i_range) && go->isSpawned() && go->GetGOInfo())
return true;
return false;
}
private:
WorldObject const* i_obj;
float i_range;
};
bool RevealGatheringItemAction::Execute(Event event) bool RevealGatheringItemAction::Execute(Event event)
{ {

View File

@ -314,7 +314,7 @@ bool SpiritHealerAction::Execute(Event event)
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++) for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); i++)
{ {
Unit* unit = botAI->GetUnit(*i); Unit* unit = botAI->GetUnit(*i);
if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER)) if (unit && unit->HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER))
{ {
LOG_DEBUG("playerbots", "Bot {} {}:{} <{}> revives at spirit healer", bot->GetGUID().ToString().c_str(), LOG_DEBUG("playerbots", "Bot {} {}:{} <{}> revives at spirit healer", bot->GetGUID().ToString().c_str(),
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName()); bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName());

View File

@ -50,7 +50,6 @@ bool RpgAction::SetNextRpgAction()
std::vector<uint32> relevances; std::vector<uint32> relevances;
std::vector<TriggerNode*> triggerNodes; std::vector<TriggerNode*> triggerNodes;
for (auto& strategy : botAI->GetAiObjectContext()->GetSupportedStrategies()) for (auto& strategy : botAI->GetAiObjectContext()->GetSupportedStrategies())
{ {
if (strategy.find("rpg") == std::string::npos) if (strategy.find("rpg") == std::string::npos)

View File

@ -24,7 +24,7 @@ bool SetHomeAction::Execute(Event event)
} }
if (Unit* unit = botAI->GetUnit(selection)) if (Unit* unit = botAI->GetUnit(selection))
if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER)) if (unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
{ {
if (isRpgAction) if (isRpgAction)
{ {

View File

@ -120,7 +120,8 @@ void SuggestWhatToDoAction::grindMaterials()
for (std::map<std::string, double>::iterator i = categories.begin(); i != categories.end(); ++i) for (std::map<std::string, double>::iterator i = categories.begin(); i != categories.end(); ++i)
{ {
if (urand(0, 10) < 3) { if (urand(0, 10) < 3)
{
std::string name = i->first; std::string name = i->first;
double multiplier = i->second; double multiplier = i->second;

View File

@ -81,7 +81,7 @@ bool TameAction::Execute(Event event)
std::ostringstream oss; std::ostringstream oss;
oss << "Available pet families: "; oss << "Available pet families: ";
size_t count = 0; size_t count = 0;
for (const auto& name : normalFamilies) for (auto const& name : normalFamilies)
{ {
if (count++ != 0) if (count++ != 0)
oss << ", "; oss << ", ";
@ -93,7 +93,7 @@ bool TameAction::Execute(Event event)
oss << " | "; oss << " | ";
oss << "Exotic: "; oss << "Exotic: ";
count = 0; count = 0;
for (const auto& name : exoticFamilies) for (auto const& name : exoticFamilies)
{ {
if (count++ != 0) if (count++ != 0)
oss << ", "; oss << ", ";

View File

@ -18,4 +18,3 @@ public:
}; };
#endif #endif

View File

@ -15,7 +15,7 @@ bool TradeAction::Execute(Event event)
std::string const text = event.getParam(); std::string const text = event.getParam();
// If text starts with any excluded prefix, don't process it further. // If text starts with any excluded prefix, don't process it further.
for (const auto& prefix : sPlayerbotAIConfig->tradeActionExcludedPrefixes) for (auto const& prefix : sPlayerbotAIConfig->tradeActionExcludedPrefixes)
{ {
if (text.find(prefix) == 0) if (text.find(prefix) == 0)
return false; return false;

View File

@ -9,6 +9,7 @@
#include "Event.h" #include "Event.h"
#include "GridNotifiers.h" #include "GridNotifiers.h"
#include "GridNotifiersImpl.h" #include "GridNotifiersImpl.h"
#include "NearestGameObjects.h"
#include "PlayerbotAIConfig.h" #include "PlayerbotAIConfig.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "PositionValue.h" #include "PositionValue.h"
@ -54,24 +55,6 @@ bool UseMeetingStoneAction::Execute(Event event)
return Teleport(master, bot); return Teleport(master, bot);
} }
class AnyGameObjectInObjectRangeCheck
{
public:
AnyGameObjectInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(GameObject* go)
{
if (go && i_obj->IsWithinDistInMap(go, i_range) && go->isSpawned() && go->GetGOInfo())
return true;
return false;
}
private:
WorldObject const* i_obj;
float i_range;
};
bool SummonAction::Execute(Event event) bool SummonAction::Execute(Event event)
{ {
Player* master = GetMaster(); Player* master = GetMaster();
@ -134,7 +117,7 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
for (Unit* unit : targets) for (Unit* unit : targets)
{ {
if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER)) if (unit && unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
{ {
if (!player->HasItemCount(6948, 1, false)) if (!player->HasItemCount(6948, 1, false))
{ {

View File

@ -97,4 +97,3 @@ std::vector<uint32> WorldBuffAction::NeedWorldBuffs(Unit* unit)
return retVec; return retVec;
} }

View File

@ -15,7 +15,6 @@ bool XpGainAction::Execute(Event event)
{ {
context->GetValue<uint32>("death count")->Set(0); context->GetValue<uint32>("death count")->Set(0);
WorldPacket p(event.getPacket()); // (8+4+1+4+8) WorldPacket p(event.getPacket()); // (8+4+1+4+8)
ObjectGuid guid; ObjectGuid guid;
// uint32 xpgain; // uint32 xpgain;

View File

@ -43,7 +43,7 @@ bool CastRaiseDeadAction::Execute(Event event)
return false; return false;
} }
uint32 spellId = AI_VALUE2(uint32, "spell id", spell); uint32 spellId = AI_VALUE2(uint32, "spell id", spell);
// const SpellInfo *spellInfo = sSpellMgr->GetSpellInfo(spellId); // SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
bot->AddSpellCooldown(spellId, 0, 3 * 60 * 1000); bot->AddSpellCooldown(spellId, 0, 3 * 60 * 1000);
return true; return true;
} }

View File

@ -311,7 +311,6 @@ public:
CastEnrageAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "enrage") {} CastEnrageAction(PlayerbotAI* ai) : CastBuffSpellAction(ai, "enrage") {}
}; };
class CastRejuvenationOnNotFullAction : public HealPartyMemberAction class CastRejuvenationOnNotFullAction : public HealPartyMemberAction
{ {
public: public:

View File

@ -35,8 +35,6 @@ Bronjahm, Devourer of Souls
*/ */
class DungeonStrategyContext : public NamedObjectContext<Strategy> class DungeonStrategyContext : public NamedObjectContext<Strategy>
{ {
public: public:
@ -84,8 +82,6 @@ class DungeonStrategyContext : public NamedObjectContext<Strategy>
static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonToCStrategy(botAI); } static Strategy* wotlk_toc(PlayerbotAI* botAI) { return new WotlkDungeonToCStrategy(botAI); }
// NYI from here down // NYI from here down
static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); } static Strategy* wotlk_hor(PlayerbotAI* botAI) { return new WotlkDungeonUKStrategy(botAI); }
}; };
#endif #endif

View File

@ -18,5 +18,4 @@
#include "trialofthechampion/TrialOfTheChampionTriggerContext.h" #include "trialofthechampion/TrialOfTheChampionTriggerContext.h"
// #include "hallsofreflection/HallsOfReflectionTriggerContext.h" // #include "hallsofreflection/HallsOfReflectionTriggerContext.h"
#endif #endif

View File

@ -2,7 +2,6 @@
#include "AzjolNerubActions.h" #include "AzjolNerubActions.h"
#include "AzjolNerubStrategy.h" #include "AzjolNerubStrategy.h"
bool AttackWebWrapAction::isUseful() { return !botAI->IsHeal(bot); } bool AttackWebWrapAction::isUseful() { return !botAI->IsHeal(bot); }
bool AttackWebWrapAction::Execute(Event event) bool AttackWebWrapAction::Execute(Event event)
{ {

View File

@ -1,7 +1,6 @@
#include "AzjolNerubStrategy.h" #include "AzjolNerubStrategy.h"
#include "AzjolNerubMultipliers.h" #include "AzjolNerubMultipliers.h"
void WotlkDungeonANStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonANStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Krik'thir the Gatewatcher // Krik'thir the Gatewatcher

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonANStrategy : public Strategy class WotlkDungeonANStrategy : public Strategy
{ {
public: public:

View File

@ -3,7 +3,6 @@
#include "AiObject.h" #include "AiObject.h"
#include "AiObjectContext.h" #include "AiObjectContext.h"
bool KrikthirWebWrapTrigger::IsActive() bool KrikthirWebWrapTrigger::IsActive()
{ {
if (!botAI->IsDps(bot)) { return false; } if (!botAI->IsDps(bot)) { return false; }

View File

@ -2,7 +2,6 @@
#include "CullingOfStratholmeActions.h" #include "CullingOfStratholmeActions.h"
#include "CullingOfStratholmeStrategy.h" #include "CullingOfStratholmeStrategy.h"
bool ExplodeGhoulSpreadAction::Execute(Event event) bool ExplodeGhoulSpreadAction::Execute(Event event)
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "salramm the fleshcrafter"); Unit* boss = AI_VALUE2(Unit*, "find target", "salramm the fleshcrafter");

View File

@ -1,7 +1,6 @@
#include "CullingOfStratholmeStrategy.h" #include "CullingOfStratholmeStrategy.h"
#include "CullingOfStratholmeMultipliers.h" #include "CullingOfStratholmeMultipliers.h"
void WotlkDungeonCoSStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonCoSStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Meathook // Meathook

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonCoSStrategy : public Strategy class WotlkDungeonCoSStrategy : public Strategy
{ {
public: public:

View File

@ -3,7 +3,6 @@
#include "AiObject.h" #include "AiObject.h"
#include "AiObjectContext.h" #include "AiObjectContext.h"
bool ExplodeGhoulTrigger::IsActive() bool ExplodeGhoulTrigger::IsActive()
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "salramm the fleshcrafter"); Unit* boss = AI_VALUE2(Unit*, "find target", "salramm the fleshcrafter");

View File

@ -2,7 +2,6 @@
#include "DrakTharonKeepActions.h" #include "DrakTharonKeepActions.h"
#include "DrakTharonKeepStrategy.h" #include "DrakTharonKeepStrategy.h"
bool CorpseExplodeSpreadAction::Execute(Event event) bool CorpseExplodeSpreadAction::Execute(Event event)
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "trollgore"); Unit* boss = AI_VALUE2(Unit*, "find target", "trollgore");

View File

@ -1,7 +1,6 @@
#include "DrakTharonKeepStrategy.h" #include "DrakTharonKeepStrategy.h"
#include "DrakTharonKeepMultipliers.h" #include "DrakTharonKeepMultipliers.h"
void WotlkDungeonDTKStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonDTKStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Trollgore // Trollgore

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonDTKStrategy : public Strategy class WotlkDungeonDTKStrategy : public Strategy
{ {
public: public:

View File

@ -3,7 +3,6 @@
#include "AiObject.h" #include "AiObject.h"
#include "AiObjectContext.h" #include "AiObjectContext.h"
bool CorpseExplodeTrigger::IsActive() bool CorpseExplodeTrigger::IsActive()
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "trollgore"); Unit* boss = AI_VALUE2(Unit*, "find target", "trollgore");

View File

@ -17,7 +17,6 @@ bool MoveFromBronjahmAction::Execute(Event event)
return false; return false;
} }
bool AttackCorruptedSoulFragmentAction::Execute(Event event) bool AttackCorruptedSoulFragmentAction::Execute(Event event)
{ {
Unit* currentTarget = AI_VALUE(Unit*, "current target"); Unit* currentTarget = AI_VALUE(Unit*, "current target");
@ -52,7 +51,6 @@ bool AttackCorruptedSoulFragmentAction::Execute(Event event)
return false; return false;
} }
bool BronjahmGroupPositionAction::Execute(Event event) bool BronjahmGroupPositionAction::Execute(Event event)
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm"); Unit* boss = AI_VALUE2(Unit*, "find target", "bronjahm");
@ -165,5 +163,3 @@ bool DevourerOfSoulsAction::Execute(Event event)
return false; return false;
} }

View File

@ -6,7 +6,6 @@
#include "ForgeOfSoulsTriggers.h" #include "ForgeOfSoulsTriggers.h"
#include "ForgeOfSoulsActions.h" #include "ForgeOfSoulsActions.h"
float BronjahmMultiplier::GetValue(Action* action) { float BronjahmMultiplier::GetValue(Action* action) {
Unit* boss = AI_VALUE2(Unit *, "find target", "bronjahm"); Unit* boss = AI_VALUE2(Unit *, "find target", "bronjahm");
if (!boss) if (!boss)

View File

@ -20,5 +20,4 @@ public:
float GetValue(Action* action) override; float GetValue(Action* action) override;
}; };
#endif #endif

View File

@ -1,7 +1,6 @@
#include "GundrakStrategy.h" #include "GundrakStrategy.h"
#include "GundrakMultipliers.h" #include "GundrakMultipliers.h"
void WotlkDungeonGDStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonGDStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Moorabi // Moorabi

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonGDStrategy : public Strategy class WotlkDungeonGDStrategy : public Strategy
{ {
public: public:

View File

@ -152,7 +152,6 @@ bool LokenStackAction::Execute(Event event)
return false; return false;
} }
bool AvoidLightningNovaAction::Execute(Event event) bool AvoidLightningNovaAction::Execute(Event event)
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "loken"); Unit* boss = AI_VALUE2(Unit*, "find target", "loken");

View File

@ -123,4 +123,3 @@ float LokenMultiplier::GetValue(Action* action)
return 1.0f; // Default multiplier value for other cases. return 1.0f; // Default multiplier value for other cases.
} }

View File

@ -1,7 +1,6 @@
#include "HallsOfLightningStrategy.h" #include "HallsOfLightningStrategy.h"
#include "HallsOfLightningMultipliers.h" #include "HallsOfLightningMultipliers.h"
void WotlkDungeonHoLStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonHoLStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// General Bjarngrim // General Bjarngrim

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonHoLStrategy : public Strategy class WotlkDungeonHoLStrategy : public Strategy
{ {
public: public:

View File

@ -1,7 +1,6 @@
#include "HallsOfStoneStrategy.h" #include "HallsOfStoneStrategy.h"
#include "HallsOfStoneMultipliers.h" #include "HallsOfStoneMultipliers.h"
void WotlkDungeonHoSStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonHoSStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Maiden of Grief // Maiden of Grief

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonHoSStrategy : public Strategy class WotlkDungeonHoSStrategy : public Strategy
{ {
public: public:

View File

@ -94,4 +94,3 @@ float OrmorokMultiplier::GetValue(Action* action)
} }
return 1.0f; return 1.0f;
} }

View File

@ -1,7 +1,6 @@
#include "NexusStrategy.h" #include "NexusStrategy.h"
#include "NexusMultipliers.h" #include "NexusMultipliers.h"
void WotlkDungeonNexStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonNexStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Horde Commander (Alliance N)/Commander Kolurg (Alliance H) // Horde Commander (Alliance N)/Commander Kolurg (Alliance H)

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonNexStrategy : public Strategy class WotlkDungeonNexStrategy : public Strategy
{ {
public: public:

View File

@ -1,7 +1,6 @@
#include "OculusStrategy.h" #include "OculusStrategy.h"
#include "OculusMultipliers.h" #include "OculusMultipliers.h"
void WotlkDungeonOccStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonOccStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Drakos the Interrogator // Drakos the Interrogator

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonOccStrategy : public Strategy class WotlkDungeonOccStrategy : public Strategy
{ {
public: public:

View File

@ -2,7 +2,6 @@
#include "OldKingdomActions.h" #include "OldKingdomActions.h"
#include "OldKingdomStrategy.h" #include "OldKingdomStrategy.h"
bool AttackNadoxGuardianAction::Execute(Event event) bool AttackNadoxGuardianAction::Execute(Event event)
{ {
Unit* target = AI_VALUE2(Unit*, "find target", "ahn'kahar guardian"); Unit* target = AI_VALUE2(Unit*, "find target", "ahn'kahar guardian");

View File

@ -1,7 +1,6 @@
#include "OldKingdomStrategy.h" #include "OldKingdomStrategy.h"
#include "OldKingdomMultipliers.h" #include "OldKingdomMultipliers.h"
void WotlkDungeonOKStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonOKStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Elder Nadox // Elder Nadox

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonOKStrategy : public Strategy class WotlkDungeonOKStrategy : public Strategy
{ {
public: public:

View File

@ -3,7 +3,6 @@
#include "AiObject.h" #include "AiObject.h"
#include "AiObjectContext.h" #include "AiObjectContext.h"
bool NadoxGuardianTrigger::IsActive() bool NadoxGuardianTrigger::IsActive()
{ {
if (botAI->IsHeal(bot)) { return false; } if (botAI->IsHeal(bot)) { return false; }

View File

@ -136,7 +136,6 @@ bool IckAndKrickAction::PoisonNova(bool poisonNova, Unit* boss)
return false; return false;
} }
bool IckAndKrickAction::ExplosiveBarrage(bool explosiveBarrage, Unit* boss) bool IckAndKrickAction::ExplosiveBarrage(bool explosiveBarrage, Unit* boss)
{ {
std::vector<Unit*> orbs; std::vector<Unit*> orbs;

View File

@ -5,8 +5,6 @@
#include "MovementActions.h" #include "MovementActions.h"
#include "PitOfSaronTriggers.h" #include "PitOfSaronTriggers.h"
float IckAndKrickMultiplier::GetValue(Action* action) float IckAndKrickMultiplier::GetValue(Action* action)
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "ick"); Unit* boss = AI_VALUE2(Unit*, "find target", "ick");

View File

@ -20,5 +20,4 @@ public:
float GetValue(Action* action) override; float GetValue(Action* action) override;
}; };
#endif #endif

View File

@ -9,7 +9,6 @@
#include "GenericActions.h" #include "GenericActions.h"
#include <fstream> #include <fstream>
bool ToCLanceAction::Execute(Event event) bool ToCLanceAction::Execute(Event event)
{ {
// If already has lance equipped, do nothing // If already has lance equipped, do nothing

View File

@ -1,7 +1,6 @@
#include "TrialOfTheChampionStrategy.h" #include "TrialOfTheChampionStrategy.h"
#include "TrialOfTheChampionMultipliers.h" #include "TrialOfTheChampionMultipliers.h"
void WotlkDungeonToCStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonToCStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
triggers.push_back(new TriggerNode("toc lance", triggers.push_back(new TriggerNode("toc lance",

View File

@ -3,7 +3,6 @@
#include "AiObject.h" #include "AiObject.h"
#include "AiObjectContext.h" #include "AiObjectContext.h"
bool ToCLanceTrigger::IsActive() bool ToCLanceTrigger::IsActive()
{ {
if (bot->GetVehicle()) if (bot->GetVehicle())
@ -82,4 +81,3 @@ bool ToCEadricTrigger::IsActive()
return true; return true;
} }

View File

@ -16,20 +16,16 @@ enum TocC_IDs
//Eadric //Eadric
SPELL_RADIANCE = 66935, SPELL_RADIANCE = 66935,
// Objects // Objects
OBJECT_LANCE_RACK = 196398, OBJECT_LANCE_RACK = 196398,
// Items // Items
ITEM_LANCE = 46106, ITEM_LANCE = 46106,
// Vehicles // Vehicles
NPC_ARGENT_WARHORSE = 35644, NPC_ARGENT_WARHORSE = 35644,
NPC_ARGENT_BATTLEWORG = 36558, NPC_ARGENT_BATTLEWORG = 36558,
// Horde Champions // Horde Champions
NPC_MOKRA = 35572, NPC_MOKRA = 35572,
NPC_ERESSEA = 35569, NPC_ERESSEA = 35569,
@ -37,7 +33,6 @@ enum TocC_IDs
NPC_ZULTORE = 35570, NPC_ZULTORE = 35570,
NPC_VISCERI = 35617, NPC_VISCERI = 35617,
// Alliance Champions // Alliance Champions
NPC_JACOB = 34705, NPC_JACOB = 34705,
NPC_AMBROSE = 34702, NPC_AMBROSE = 34702,
@ -45,7 +40,6 @@ enum TocC_IDs
NPC_JAELYNE = 34657, NPC_JAELYNE = 34657,
NPC_LANA = 34703, NPC_LANA = 34703,
// Grand Champion Minions // Grand Champion Minions
NPC_IRONFORGE_MINION = 35329, NPC_IRONFORGE_MINION = 35329,
NPC_STORMWIND_MINION = 35328, NPC_STORMWIND_MINION = 35328,
@ -58,7 +52,6 @@ enum TocC_IDs
NPC_SENJIN_MINION = 35323, NPC_SENJIN_MINION = 35323,
NPC_UNDERCITY_MINION = 35327, NPC_UNDERCITY_MINION = 35327,
// Rest of the bosses and npcs // Rest of the bosses and npcs
NPC_EADRIC = 35119, NPC_EADRIC = 35119,
NPC_EADRIC_H = 35518, NPC_EADRIC_H = 35518,

View File

@ -1,7 +1,6 @@
#include "UtgardeKeepStrategy.h" #include "UtgardeKeepStrategy.h"
#include "UtgardeKeepMultipliers.h" #include "UtgardeKeepMultipliers.h"
void WotlkDungeonUKStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonUKStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Prince Keleseth // Prince Keleseth

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonUKStrategy : public Strategy class WotlkDungeonUKStrategy : public Strategy
{ {
public: public:

View File

@ -1,7 +1,6 @@
#include "UtgardePinnacleStrategy.h" #include "UtgardePinnacleStrategy.h"
#include "UtgardePinnacleMultipliers.h" #include "UtgardePinnacleMultipliers.h"
void WotlkDungeonUPStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonUPStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Svala Sorrowgrave // Svala Sorrowgrave

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonUPStrategy : public Strategy class WotlkDungeonUPStrategy : public Strategy
{ {
public: public:

View File

@ -2,7 +2,6 @@
#include "VioletHoldActions.h" #include "VioletHoldActions.h"
#include "VioletHoldStrategy.h" #include "VioletHoldStrategy.h"
bool AttackErekemAction::Execute(Event event) bool AttackErekemAction::Execute(Event event)
{ {
// Focus boss first, adds after // Focus boss first, adds after

View File

@ -1,7 +1,6 @@
#include "VioletHoldStrategy.h" #include "VioletHoldStrategy.h"
#include "VioletHoldMultipliers.h" #include "VioletHoldMultipliers.h"
void WotlkDungeonVHStrategy::InitTriggers(std::vector<TriggerNode*> &triggers) void WotlkDungeonVHStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{ {
// Erekem // Erekem

View File

@ -5,7 +5,6 @@
#include "AiObjectContext.h" #include "AiObjectContext.h"
#include "Strategy.h" #include "Strategy.h"
class WotlkDungeonVHStrategy : public Strategy class WotlkDungeonVHStrategy : public Strategy
{ {
public: public:

View File

@ -3,7 +3,6 @@
#include "AiObject.h" #include "AiObject.h"
#include "AiObjectContext.h" #include "AiObjectContext.h"
bool ErekemTargetTrigger::IsActive() bool ErekemTargetTrigger::IsActive()
{ {
Unit* boss = AI_VALUE2(Unit*, "find target", "erekem"); Unit* boss = AI_VALUE2(Unit*, "find target", "erekem");

View File

@ -21,7 +21,6 @@ public:
uint32 GetType() const override { return CombatStrategy::GetType() | STRATEGY_TYPE_RANGED | STRATEGY_TYPE_DPS; } uint32 GetType() const override { return CombatStrategy::GetType() | STRATEGY_TYPE_RANGED | STRATEGY_TYPE_DPS; }
}; };
class AoEHunterStrategy : public CombatStrategy class AoEHunterStrategy : public CombatStrategy
{ {
public: public:
@ -58,5 +57,4 @@ public:
std::string const getName() override { return "trap weave"; } std::string const getName() override { return "trap weave"; }
}; };
#endif #endif

View File

@ -250,7 +250,6 @@ bool CastBlessingOfWisdomOnPartyAction::Execute(Event event)
return botAI->CastSpell(castName, target); return botAI->CastSpell(castName, target);
} }
Value<Unit*>* CastBlessingOfSanctuaryOnPartyAction::GetTargetValue() Value<Unit*>* CastBlessingOfSanctuaryOnPartyAction::GetTargetValue()
{ {
return context->GetValue<Unit*>( return context->GetValue<Unit*>(
@ -488,7 +487,6 @@ Unit* CastRighteousDefenseAction::GetTarget()
return current_target->GetVictim(); return current_target->GetVictim();
} }
bool CastDivineSacrificeAction::isUseful() bool CastDivineSacrificeAction::isUseful()
{ {
return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() && return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() &&

Some files were not shown because too many files have changed in this diff Show More