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
149 changed files with 443 additions and 557 deletions

View File

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

View File

@@ -413,10 +413,12 @@ void AiFactory::AddDefaultCombatStrategies(Player* player, PlayerbotAI* const fa
break;
}
if (PlayerbotAI::IsTank(player, true)) {
if (PlayerbotAI::IsTank(player, true))
{
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);
}
if (PlayerbotAI::IsHeal(player, true))
@@ -706,7 +708,9 @@ void AiFactory::AddDefaultNonCombatStrategies(Player* player, PlayerbotAI* const
// {
// // nonCombatEngine->addStrategy("travel");
// nonCombatEngine->addStrategy("rpg");
// } else {
// }
// else
// {
// nonCombatEngine->addStrategy("move random");
// }

View File

@@ -70,7 +70,7 @@ bool BroadcastHelper::BroadcastToChannelWithGlobalChance(PlayerbotAI* ai, std::s
return false;
}
for (const auto& pair : toChannels)
for (auto const& pair : toChannels)
{
uint32 roll = urand(1, 100);
uint32 chance = pair.second;
@@ -166,7 +166,7 @@ bool BroadcastHelper::BroadcastToChannelWithGlobalChance(PlayerbotAI* ai, std::s
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)
return false;
@@ -410,7 +410,6 @@ bool BroadcastHelper::BroadcastQuestUpdateComplete(PlayerbotAI* ai, Player* bot,
placeholders["%my_race"] = ai->GetChatHelper()->FormatRace(bot->getRace());
placeholders["%my_level"] = std::to_string(bot->GetLevel());
return BroadcastToChannelWithGlobalChance(
ai,
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)
{
std::string msgLower = ToLower(message);
for (const auto& entry : specTabNames)
for (auto const& entry : specTabNames)
{
std::string prefix = "@" + entry.second;
if (msgLower.find(ToLower(prefix)) == 0)
@@ -555,7 +555,7 @@ public:
const float radius = 100.0f;
GuidVector npcs = botAI->GetAiObjectContext()->GetValue<GuidVector>("nearest npcs")->Get();
bool match = false;
for (const auto& guid : npcs)
for (auto const& guid : npcs)
{
Creature* c = botAI->GetCreature(guid);
if (!c)

View File

@@ -329,9 +329,11 @@ ItemWithRandomProperty ChatHelper::parseItemWithRandomProperty(std::string const
while (currentPos < text.length()) {
size_t nextColon = text.find(':', currentPos);
if (nextColon == std::string::npos) {
if (nextColon == std::string::npos)
{
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));
}
break;
@@ -341,7 +343,8 @@ ItemWithRandomProperty ChatHelper::parseItemWithRandomProperty(std::string const
currentPos = nextColon + 1;
}
if (params.size() >= 6) {
if (params.size() >= 6)
{
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)
{
ObjectGuid::LowType owner = player->GetGUID().GetCounter();
if (victim->GetTypeId() != TYPEID_UNIT)
if (victim->IsCreature())
return;
Creature* creature = reinterpret_cast<Creature*>(victim);

View File

@@ -1442,22 +1442,22 @@ void PlayerbotAI::ApplyInstanceStrategies(uint32 mapId, bool tellMaster)
switch (mapId)
{
case 249:
strategyName = "onyxia"; // Onyxia's Lair
strategyName = "onyxia"; // Onyxia's Lair
break;
case 409:
strategyName = "mc"; // Molten Core
strategyName = "mc"; // Molten Core
break;
case 469:
strategyName = "bwl"; // Blackwing Lair
strategyName = "bwl"; // Blackwing Lair
break;
case 509:
strategyName = "aq20"; // Ruins of Ahn'Qiraj
strategyName = "aq20"; // Ruins of Ahn'Qiraj
break;
case 532:
strategyName = "karazhan"; // Karazhan
break;
case 533:
strategyName = "naxx"; // Naxxramas
strategyName = "naxx"; // Naxxramas
break;
case 544:
strategyName = "magtheridon"; // Magtheridon's Lair
@@ -3097,8 +3097,10 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
SpellCastResult result = spell->CheckCast(true);
delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK)
// {
// LOG_DEBUG("playerbots", "CanCastSpell - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellid, bot->GetName(), result);
// }
@@ -3121,7 +3123,6 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
default:
if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
{
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) {
LOG_DEBUG("playerbots",
"CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, 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 (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// {
// LOG_DEBUG("playerbots", "Spell cast is flying - target name: {}, spellid: {}, bot name: {}}",
// target->GetName(), spellId, bot->GetName());
// }
@@ -3349,7 +3351,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
{
bot->GetTradeData()->SetSpell(spellId);
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: {}",
// target->GetName(), spellId, bot->GetName());
// }
@@ -3418,7 +3421,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
// spell->m_targets.SetUnitTarget(target);
// 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: {}",
// 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 (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// {
// LOG_DEBUG("playerbots", "Spell cast failed. - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellId, bot->GetName(), result);
// }
@@ -3496,7 +3501,8 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
// {
// spell->cancel();
// 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: {}",
// target->GetName(), spellId, bot->GetName());
// }
@@ -4727,7 +4733,6 @@ uint32 PlayerbotAI::GetEquipGearScore(Player* player)
sum += gearScore[i];
}
if (count)
{
uint32 res = uint32(sum / count);
@@ -5264,7 +5269,7 @@ Item* PlayerbotAI::FindOpenableItem() const
return FindItemInInventory(
[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());
});
}
@@ -5415,7 +5420,7 @@ Item* PlayerbotAI::FindOilFor(Item* weapon) const
if (prioritizedOils)
{
for (const auto& id : *prioritizedOils)
for (auto const& id : *prioritizedOils)
{
oil = FindConsumable(id);
if (oil)

View File

@@ -530,7 +530,7 @@ public:
Player* GetBot() { return bot; }
Player* GetMaster() { return master; }
Player* FindNewMaster();
// Checks if the bot is really a player. Players always have themselves as master.
bool IsRealPlayer() { return master ? (master == bot) : false; }
// Bot has a master that is a player.

View File

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

View File

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

View File

@@ -633,7 +633,7 @@ void RandomPlayerbotMgr::AssignAccountTypes()
uint32 existingRndBotAccounts = 0;
uint32 existingAddClassAccounts = 0;
for (const auto& [accountId, accountType] : currentAssignments)
for (auto const& [accountId, accountType] : currentAssignments)
{
if (accountType == 1) existingRndBotAccounts++;
else if (accountType == 2) existingAddClassAccounts++;
@@ -688,7 +688,7 @@ void RandomPlayerbotMgr::AssignAccountTypes()
}
// 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);
else if (accountType == 2) addClassTypeAccounts.push_back(accountId);
@@ -798,7 +798,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
std::vector<CharacterInfo> allianceChars;
std::vector<CharacterInfo> hordeChars;
for (const auto& charInfo : allCharacters)
for (auto const& charInfo : allCharacters)
{
if (IsAlliance(charInfo.rRace))
allianceChars.push_back(charInfo);
@@ -832,7 +832,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
};
// PHASE 1: Log-in Alliance bots up to allowedAllianceCount
for (const auto& charInfo : allianceChars)
for (auto const& charInfo : allianceChars)
{
if (!allowedAllianceCount)
break;
@@ -845,7 +845,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
}
// PHASE 2: Log-in Horde bots up to maxAllowedBotCount
for (const auto& charInfo : hordeChars)
for (auto const& charInfo : hordeChars)
{
if (!maxAllowedBotCount)
break;
@@ -855,7 +855,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
}
// PHASE 3: If maxAllowedBotCount wasn't reached, log-in more Alliance bots
for (const auto& charInfo : allianceChars)
for (auto const& charInfo : allianceChars)
{
if (!maxAllowedBotCount)
break;
@@ -1248,7 +1248,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
void RandomPlayerbotMgr::LogBattlegroundInfo()
{
for (const auto& queueTypePair : BattlegroundData)
for (auto const& queueTypePair : BattlegroundData)
{
uint8 queueType = queueTypePair.first;
@@ -1256,7 +1256,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
if (uint8 type = BattlegroundMgr::BGArenaType(queueTypeId))
{
for (const auto& bracketIdPair : queueTypePair.second)
for (auto const& bracketIdPair : queueTypePair.second)
{
auto& bgInfo = bracketIdPair.second;
if (bgInfo.minLevel == 0)
@@ -1306,7 +1306,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
break;
}
for (const auto& bracketIdPair : queueTypePair.second)
for (auto const& bracketIdPair : queueTypePair.second)
{
auto& bgInfo = bracketIdPair.second;
if (bgInfo.minLevel == 0)
@@ -1576,7 +1576,7 @@ bool RandomPlayerbotMgr::ProcessBot(Player* bot)
{
idleBot = true;
}
if (idleBot)
{
// randomize
@@ -1704,7 +1704,6 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
return;
}
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "RandomTeleportByLocations");
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
// then teleport to that banker
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)];
auto locIt = bankerEntryToLocation.find(selectedBankerEntry);
if (locIt != bankerEntryToLocation.end())

View File

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

View File

@@ -480,7 +480,7 @@ std::string const WorldPosition::getAreaName(bool fullName, bool zoneName)
std::set<Transport*> WorldPosition::getTransports(uint32 entry)
{
/*
if(!entry)
if (!entry)
return getMap()->m_transports;
else
{
@@ -488,7 +488,7 @@ std::set<Transport*> WorldPosition::getTransports(uint32 entry)
std::set<Transport*> transports;
/*
for (auto transport : getMap()->m_transports)
if(transport->GetEntry() == entry)
if (transport->GetEntry() == entry)
transports.insert(transport);
return transports;
@@ -1272,7 +1272,7 @@ std::string const RpgTravelDestination::getTitle()
{
std::ostringstream out;
if(entry > 0)
if (entry > 0)
out << "rpg npc ";
out << " " << ChatHelper::FormatWorldEntry(entry);
@@ -2076,7 +2076,6 @@ void TravelMgr::LoadQuestTravelTable()
continue;
}
if (r.role == 0)
{
container->questGivers.push_back(loc);
@@ -2591,7 +2590,7 @@ void TravelMgr::LoadQuestTravelTable()
//if (data->displayId == 3015)
// pos.setZ(pos.getZ() + 6.0f);
//else if(data->displayId == 3031)
//else if (data->displayId == 3031)
// pos.setZ(pos.getZ() - 17.0f);
if (prevNode)

View File

@@ -180,7 +180,7 @@ uint32 TravelNodePath::getPrice()
if (!taxiPath)
return 0;
return taxiPath->price;
}
@@ -470,7 +470,6 @@ bool TravelNode::cropUselessLinks()
for (auto& firstLink : getLinks())
{
TravelNode* firstNode = firstLink.first;
float firstLength = firstLink.second.getDistance();
for (auto& secondLink : getLinks())
@@ -1302,7 +1301,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Pla
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;
float linkCost = link.second->getCost(bot, currentNode->currentGold);
@@ -1351,7 +1350,7 @@ TravelNodeRoute TravelNodeMap::getRoute(WorldPosition startPos, WorldPosition en
std::vector<WorldPosition> newStartPath;
std::vector<TravelNode*> startNodes = m_nodes, endNodes = m_nodes;
if(!startNodes.size() || !endNodes.size())
if (!startNodes.size() || !endNodes.size())
return TravelNodeRoute();
// Partial sort to get the closest 5 nodes at the begin of the array.
@@ -1902,7 +1901,7 @@ void TravelNodeMap::generateTransportNodes()
// if (data->displayId == 3015)
// pos.setZ(pos.getZ() + 6.0f);
// else if(data->displayId == 3031)
// else if (data->displayId == 3031)
// pos.setZ(pos.getZ() - 17.0f);
if (prevNode)

View File

@@ -180,7 +180,7 @@ void PlayerbotFactory::Init()
continue;
}
if (proto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE)
if (proto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE))
{
continue;
}
@@ -1391,7 +1391,7 @@ bool PlayerbotFactory::CanEquipArmor(ItemTemplate const* proto)
// for (uint8 j = 0; j < MAX_ITEM_PROTO_STATS; ++j)
// {
// // for ItemStatValue != 0
// if(!proto->ItemStat[j].ItemStatValue)
// if (!proto->ItemStat[j].ItemStatValue)
// continue;
// AddItemStats(proto->ItemStat[j].ItemStatType, sp, ap, tank);
@@ -1600,7 +1600,8 @@ void Shuffle(std::vector<uint32>& items)
// bool noItem = false;
// uint32 quality = urand(ITEM_QUALITY_UNCOMMON, ITEM_QUALITY_EPIC);
// 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--;
// }
// // current item;
@@ -1705,7 +1706,8 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance)
if (incremental && !sPlayerbotAIConfig->incrementalGearInit)
return;
if (level < 5) {
if (level < 5)
{
// original items
if (CharStartOutfitEntry const* oEntry = GetCharStartOutfitEntry(bot->getRace(), bot->getClass(), bot->getGender()))
{
@@ -1734,7 +1736,8 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance)
continue;
}
if (bot->HasItemCount(itemId, count)) {
if (bot->HasItemCount(itemId, count))
{
continue;
}
@@ -2771,7 +2774,8 @@ void PlayerbotFactory::InitTalents(uint32 specNo)
void PlayerbotFactory::InitTalentsByTemplate(uint32 specTab)
{
// if (sPlayerbotAIConfig->parsedSpecLinkOrder[bot->getClass()][specNo][80].size() == 0) {
// if (sPlayerbotAIConfig->parsedSpecLinkOrder[bot->getClass()][specNo][80].size() == 0)
// {
// return;
// }
uint32 cls = bot->getClass();

View File

@@ -97,7 +97,7 @@ float StatsWeightCalculator::CalculateItem(uint32 itemId, int32 randomPropertyId
// Use player level as effective item level for heirlooms - Quality EPIC
// Else - Blend with item quality and level for normal items
if (proto->Quality == ITEM_QUALITY_HEIRLOOM)
weight_ *= PlayerbotFactory::CalcMixedGearScore(lvl, ITEM_QUALITY_EPIC);
weight_ *= PlayerbotFactory::CalcMixedGearScore(lvl, ITEM_QUALITY_EPIC);
else
weight_ *= PlayerbotFactory::CalcMixedGearScore(proto->ItemLevel, proto->Quality);

View File

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

View File

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

View File

@@ -161,17 +161,21 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
bot->Attack(target, shouldMelee);
/* 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;
// }
// if (Pet* pet = bot->GetPet())
// {
// if (with_pet) {
// if (with_pet)
// {
// pet->SetReactState(REACT_DEFENSIVE);
// pet->SetTarget(target->GetGUID());
// pet->GetCharmInfo()->SetIsCommandAttack(true);
// pet->AI()->AttackStart(target);
// } else {
// }
// else
// {
// pet->SetReactState(REACT_PASSIVE);
// pet->GetCharmInfo()->SetIsCommandFollow(true);
// pet->GetCharmInfo()->IsReturning();

View File

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

View File

@@ -17,7 +17,7 @@ bool BankAction::Execute(Event event)
for (GuidVector::iterator i = npcs.begin(); i != npcs.end(); 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;
return ExecuteBank(text, npc);

View File

@@ -1894,13 +1894,13 @@ bool BGTactics::selectObjective(bool reset)
bool isDefender = role < defendersProhab;
bool isAdvanced = !isDefender && role > 8;
const auto& attackObjectives =
auto const& attackObjectives =
(team == TEAM_HORDE) ? AV_AttackObjectives_Horde : AV_AttackObjectives_Alliance;
const auto& defendObjectives =
auto const& defendObjectives =
(team == TEAM_HORDE) ? AV_DefendObjectives_Horde : AV_DefendObjectives_Alliance;
uint32 destroyedNodes = 0;
for (const auto& [nodeId, _] : defendObjectives)
for (auto const& [nodeId, _] : defendObjectives)
if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED)
destroyedNodes++;
@@ -2000,7 +2000,7 @@ bool BGTactics::selectObjective(bool reset)
std::vector<GameObject*> contestedObjectives;
std::vector<GameObject*> availableObjectives;
for (const auto& [nodeId, goId] : defendObjectives)
for (auto const& [nodeId, goId] : defendObjectives)
{
const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId);
if (node.State == POINT_DESTROYED)
@@ -2026,7 +2026,7 @@ bool BGTactics::selectObjective(bool reset)
if (!BgObjective)
{
uint32 towersDown = 0;
for (const auto& [nodeId, _] : attackObjectives)
for (auto const& [nodeId, _] : attackObjectives)
if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED)
towersDown++;
@@ -2053,7 +2053,7 @@ bool BGTactics::selectObjective(bool reset)
{
std::vector<GameObject*> candidates;
for (const auto& [nodeId, goId] : attackObjectives)
for (auto const& [nodeId, goId] : attackObjectives)
{
const BG_AV_NodeInfo& node = av->GetAVNodeInfo(nodeId);
GameObject* go = bg->GetBGObject(goId);
@@ -2105,13 +2105,13 @@ bool BGTactics::selectObjective(bool reset)
Position objPos = BgObjective->GetPosition();
Optional<uint8> linkedNodeId;
for (const auto& [nodeId, goId] : attackObjectives)
for (auto const& [nodeId, goId] : attackObjectives)
if (bg->GetBGObject(goId) == BgObjective)
linkedNodeId = nodeId;
if (!linkedNodeId)
{
for (const auto& [nodeId, goId] : defendObjectives)
for (auto const& [nodeId, goId] : defendObjectives)
if (bg->GetBGObject(goId) == BgObjective)
linkedNodeId = nodeId;
}
@@ -2543,7 +2543,7 @@ bool BGTactics::selectObjective(bool reset)
float bestDist = FLT_MAX;
uint32 bestTrigger = 0;
for (const auto& [nodeId, _, areaTrigger] : EY_AttackObjectives)
for (auto const& [nodeId, _, areaTrigger] : EY_AttackObjectives)
{
if (!IsOwned(nodeId))
continue;
@@ -2610,7 +2610,7 @@ bool BGTactics::selectObjective(bool reset)
// --- PRIORITY 2: Nearby unowned contested node ---
if (!foundObjective)
{
for (const auto& [nodeId, _, __] : EY_AttackObjectives)
for (auto const& [nodeId, _, __] : EY_AttackObjectives)
{
if (IsOwned(nodeId))
continue;
@@ -2711,7 +2711,7 @@ bool BGTactics::selectObjective(bool reset)
if (!foundObjective && strategy == EY_STRATEGY_FLAG_FOCUS)
{
bool ownsAny = false;
for (const auto& [nodeId, _, __] : EY_AttackObjectives)
for (auto const& [nodeId, _, __] : EY_AttackObjectives)
{
if (IsOwned(nodeId))
{
@@ -2739,7 +2739,7 @@ bool BGTactics::selectObjective(bool reset)
float bestDist = FLT_MAX;
Optional<uint32> bestNode;
for (const auto& [nodeId, _, __] : EY_AttackObjectives)
for (auto const& [nodeId, _, __] : EY_AttackObjectives)
{
if (IsOwned(nodeId))
continue;
@@ -2974,7 +2974,7 @@ bool BGTactics::selectObjective(bool reset)
uint32 len = end(IC_AttackObjectives) - begin(IC_AttackObjectives);
for (uint32 i = 0; i < len; i++)
{
const auto& objective =
auto const& objective =
IC_AttackObjectives[(i + role) %
len]; // use role to determine which objective checked first
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);
for (uint32 i = 0; i < len; i++)
{
const auto& objective =
auto const& objective =
IC_AttackObjectives[(i + role) %
len]; // use role to determine which objective checked first
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
{
for (const auto& pair : spells)
for (auto const& pair : spells)
{
int32 currentSpeed = pair.first;
@@ -378,7 +378,7 @@ bool CheckMountStateAction::TryRandomMountFiltered(const std::map<int32, std::ve
continue;
// Pick a random mount from the candidate group.
const auto& ids = pair.second;
auto const& ids = pair.second;
if (!ids.empty())
{
// 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
if (!foundTarget && urand(1, 100) > 10)
{
@@ -673,7 +672,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
//271 south shore
//35 booty bay
//380 The Barrens The Crossroads
if(((ExploreTravelDestination * )activeTarget)->getAreaId() == 380)
if (((ExploreTravelDestination * )activeTarget)->getAreaId() == 380)
{
activePoints.push_back(activeTarget->getPoints(true)[0]);
}

View File

@@ -58,7 +58,6 @@ bool DropQuestAction::Execute(Event event)
return true;
}
bool CleanQuestLogAction::Execute(Event event)
{
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
@@ -165,7 +164,6 @@ bool CleanQuestLogAction::Execute(Event event)
return true;
}
void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isGreen, bool hasProgress, bool isComplete)
{
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_TALKQ);
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) ||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
if (unit && (unit->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) ||
unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER)))
{
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_QUESTION);
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) ||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
if (unit && (unit->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) ||
unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER)))
{
types.push_back(EMOTE_ONESHOT_SALUTE);
}

View File

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

View File

@@ -61,7 +61,7 @@ namespace ai::buff
return false;
if (SpellInfo const* info = sSpellMgr->GetSpellInfo(spellId))
{
{
for (int i = 0; i < MAX_SPELL_REAGENTS; ++i)
{
if (info->Reagent[i] > 0)

View File

@@ -29,7 +29,6 @@ namespace ai::buff
// Returns false if the spellId is invalid.
bool HasRequiredReagents(Player* bot, uint32 spellId);
// 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.
// 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()
{
// if (!CastSpellAction::isPossible()) {
// if (!CastSpellAction::isPossible())
// {
// botAI->TellMasterNoFacing("Impossible: " + spell);
// return false;
// }
@@ -364,7 +364,8 @@ bool UseTrinketAction::UseTrinket(Item* item)
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
{
const SpellEffectInfo& effectInfo = spellInfo->Effects[i];
if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA) {
if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA)
{
applyAura = true;
break;
}

View File

@@ -193,7 +193,7 @@ bool GuildManageNearbyAction::Execute(Event event)
if (guild->GetMemberSize() > 1000)
return false;
if ( (guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_INVITE) == 0)
if ((guild->GetRankRights(botMember->GetRankId()) & GR_RIGHT_INVITE) == 0)
continue;
if (player->GetGuildIdInvited())

View File

@@ -16,7 +16,6 @@
using namespace lfg;
bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
uint32 LfgJoinAction::GetRoles()
@@ -113,7 +112,7 @@ bool LfgJoinAction::JoinLFG()
dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID))
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*/
if (dungeon->MinLevel && (botLevel < dungeon->MinLevel || botLevel > dungeon->MaxLevel) ||
@@ -180,7 +179,6 @@ bool LfgRoleCheckAction::Execute(Event event)
// if (currentRoles == newRoles)
// return false;
WorldPacket* packet = new WorldPacket(CMSG_LFG_SET_ROLES);
*packet << (uint8)newRoles;
bot->GetSession()->QueuePacket(packet);
@@ -267,7 +265,6 @@ bool LfgAcceptAction::Execute(Event event)
return false;
}
bool LfgLeaveAction::Execute(Event event)
{
// Don't leave if lfg strategy enabled

View File

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

View File

@@ -248,7 +248,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
// bot->CastStop();
// botAI->InterruptSpell();
// }
MotionMaster& mm = *bot->GetMotionMaster();
// No ground pathfinding if the bot/master are flying => allow true 3D (Z) movement
auto isFlying = [](Unit* u){ return u && (u->HasUnitMovementFlag(MOVEMENTFLAG_FLYING) || u->IsInFlight()); };
@@ -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;
// }
// else {
// else
// {
// LOG_DEBUG("playerbots", "!entry");
// return bot->TeleportTo(movePosition.getMapId(), movePosition.getX(), movePosition.getY(),
// movePosition.getZ(), movePosition.getO(), 0);
@@ -876,7 +877,8 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance)
deltaAngle -= 2.0f * M_PI; // -PI..PI
// if target is moving forward and moving far away, predict the position
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);
tx += cos(target->GetOrientation()) * predictDis;
ty += sin(target->GetOrientation()) * predictDis;
@@ -1009,7 +1011,8 @@ bool MovementAction::IsMovingAllowed()
return false;
}
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) {
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
// {
// return false;
// }
return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE;
@@ -1094,9 +1097,12 @@ void MovementAction::UpdateMovementState()
wasMovementRestricted = isCurrentlyRestricted;
// Temporary speed increase in group
// if (botAI->HasRealPlayerMaster()) {
// if (botAI->HasRealPlayerMaster())
// {
// bot->SetSpeedRate(MOVE_RUN, 1.1f);
// } else {
// }
// else
// {
// bot->SetSpeedRate(MOVE_RUN, 1.0f);
// }
// check if target is not reachable (from Vmangos)
@@ -1105,7 +1111,7 @@ void MovementAction::UpdateMovementState()
// {
// 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 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
// normal_only, float step)
// {
// if (!generatePath) {
// if (!generatePath)
// {
// return z;
// }
// 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);
// PathGenerator gen(bot);
// 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();
// current_z = modified_z;
// if (abs(current_z - z) < 0.5f) {
// if (abs(current_z - z) < 0.5f)
// {
// 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);
// PathGenerator gen(bot);
// 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();
// current_z = modified_z;
// if (abs(current_z - z) < 0.5f) {
// if (abs(current_z - z) < 0.5f)
// {
// 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);
// PathGenerator gen(bot);
// 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();
// current_z = modified_z;
// if (abs(current_z - z) < 0.5f) {
// if (abs(current_z - z) < 0.5f)
// {
// return current_z;
// }
// }
// }
// if (current_z == INVALID_HEIGHT && normal_only) {
// if (current_z == INVALID_HEIGHT && normal_only)
// {
// return INVALID_HEIGHT;
// }
// if (current_z == INVALID_HEIGHT && !normal_only) {
// if (current_z == INVALID_HEIGHT && !normal_only)
// {
// return z;
// }
// return current_z;
@@ -2818,7 +2833,7 @@ bool MoveAwayFromCreatureAction::Execute(Event event)
// Find all creatures with the specified Id
std::vector<Unit*> creatures;
for (const auto& guid : targets)
for (auto const& guid : targets)
{
Unit* unit = botAI->GetUnit(guid);
if (unit && (alive && unit->IsAlive()) && unit->GetEntry() == creatureId)

View File

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

View File

@@ -47,16 +47,16 @@ bool DrinkAction::Execute(Event event)
return UseItemAction::Execute(event);
}
bool DrinkAction::isUseful()
{
return UseItemAction::isUseful() &&
bool DrinkAction::isUseful()
{
return UseItemAction::isUseful() &&
AI_VALUE2(bool, "has mana", "self target") &&
AI_VALUE2(uint8, "mana", "self target") < 100;
}
bool DrinkAction::isPossible()
{
return !bot->IsInCombat() &&
return !bot->IsInCombat() &&
!bot->IsMounted() &&
!botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form",
"aquatic form","flight form", "swift flight form", nullptr) &&
@@ -102,15 +102,15 @@ bool EatAction::Execute(Event event)
return UseItemAction::Execute(event);
}
bool EatAction::isUseful()
{
return UseItemAction::isUseful() &&
bool EatAction::isUseful()
{
return UseItemAction::isUseful() &&
AI_VALUE2(uint8, "health", "self target") < 100;
}
bool EatAction::isPossible()
{
return !bot->IsInCombat() &&
return !bot->IsInCombat() &&
!bot->IsMounted() &&
!botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form",
"aquatic form","flight form", "swift flight form", nullptr) &&

View File

@@ -48,7 +48,7 @@ bool QuestAction::Execute(Event event)
// Check the nearest NPCs
GuidVector npcs = AI_VALUE(GuidVector, "nearest npcs");
for (const auto& npc : npcs)
for (auto const& npc : npcs)
{
Unit* unit = botAI->GetUnit(npc);
if (unit && bot->GetDistance(unit) <= INTERACTION_DISTANCE)
@@ -59,7 +59,7 @@ bool QuestAction::Execute(Event event)
// Checks the 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);
if (gameobj && bot->GetDistance(gameobj) <= INTERACTION_DISTANCE)
@@ -359,7 +359,7 @@ bool QuestUpdateAddItemAction::Execute(Event event)
uint32 availableItemsCount = botAI->GetInventoryItemsCountWithId(itemId);
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);
uint32 requiredItemsCount = pair.second;

View File

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

View File

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

View File

@@ -12,24 +12,7 @@
#include "GridNotifiersImpl.h"
#include "Playerbots.h"
#include "ServerFacade.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;
};
#include "NearestGameObjects.h"
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++)
{
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(),
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<TriggerNode*> triggerNodes;
for (auto& strategy : botAI->GetAiObjectContext()->GetSupportedStrategies())
{
if (strategy.find("rpg") == std::string::npos)

View File

@@ -195,7 +195,7 @@ void ChatReplyAction::ChatReplyDo(Player* bot, uint32& type, uint32& guid1, uint
}
ChatChannelSource chatChannelSource = GET_PLAYERBOT_AI(bot)->GetChatChannelSource(bot, type, chanName);
if ( (msg.starts_with("LFG") || msg.starts_with("LFM")) && HandleLFGQuestsReply(bot, chatChannelSource, msg, name))
if ((msg.starts_with("LFG") || msg.starts_with("LFM")) && HandleLFGQuestsReply(bot, chatChannelSource, msg, name))
{
return;
}

View File

@@ -24,7 +24,7 @@ bool SetHomeAction::Execute(Event event)
}
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)
{

View File

@@ -120,7 +120,8 @@ void SuggestWhatToDoAction::grindMaterials()
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;
double multiplier = i->second;

View File

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

View File

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

View File

@@ -15,7 +15,7 @@ bool TradeAction::Execute(Event event)
std::string const text = event.getParam();
// 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)
return false;

View File

@@ -172,7 +172,7 @@ bool MaintenanceAction::Execute(Event event)
PlayerbotFactory factory(bot, bot->GetLevel());
if (!botAI->IsAlt())
{
{
factory.InitAttunementQuests();
factory.InitBags(false);
factory.InitAmmo();
@@ -194,7 +194,7 @@ bool MaintenanceAction::Execute(Event event)
if (bot->GetLevel() >= sPlayerbotAIConfig->minEnchantingBotLevel)
factory.ApplyEnchantAndGemsNew();
}
else
else
{
if (sPlayerbotAIConfig->altMaintenanceAttunementQs)
factory.InitAttunementQuests();

View File

@@ -9,6 +9,7 @@
#include "Event.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "NearestGameObjects.h"
#include "PlayerbotAIConfig.h"
#include "Playerbots.h"
#include "PositionValue.h"
@@ -54,24 +55,6 @@ bool UseMeetingStoneAction::Execute(Event event)
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)
{
Player* master = GetMaster();
@@ -134,7 +117,7 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
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))
{
@@ -242,7 +225,7 @@ bool SummonAction::Teleport(Player* summoner, Player* player)
}
}
if(summoner != player)
if (summoner != player)
botAI->TellError("Not enough place to summon");
return false;
}

View File

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

View File

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

View File

@@ -43,7 +43,7 @@ bool CastRaiseDeadAction::Execute(Event event)
return false;
}
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);
return true;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,6 @@
#include "CullingOfStratholmeActions.h"
#include "CullingOfStratholmeStrategy.h"
bool ExplodeGhoulSpreadAction::Execute(Event event)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "salramm the fleshcrafter");
@@ -32,7 +31,7 @@ bool EpochStackAction::isUseful()
// Hunter bots will try and melee in between ranged attacks, or just melee entirely at 5 as they are in range.
// 7.5 or 8.0 solves this for this boss.
// Unfortunately at this range the boss will charge. So I guess just don't stack as a hunter..
// if(bot->getClass() == CLASS_HUNTER)
// if (bot->getClass() == CLASS_HUNTER)
// {
// return AI_VALUE2(float, "distance", "current target") > 7.5f;
// }
@@ -45,7 +44,7 @@ bool EpochStackAction::Execute(Event event)
if (!boss) { return false; }
float maxMovement = 10.0f;
// if(bot->getClass() == CLASS_HUNTER)
// if (bot->getClass() == CLASS_HUNTER)
// {
// return Move(bot->GetAngle(boss), fmin(bot->GetExactDist2d(boss) - 6.5f, maxMovement));
// }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -126,7 +126,7 @@ bool LokenStackAction::isUseful()
// Minimum hunter range is 5, but values too close to this seem to cause issues..
// Hunter bots will try and melee in between ranged attacks, or just melee entirely at 5 as they are in range.
// 6.5 or 7.0 solves this for this boss.
if(bot->getClass() == CLASS_HUNTER)
if (bot->getClass() == CLASS_HUNTER)
{
return AI_VALUE2(float, "distance", "current target") > 6.5f;
}
@@ -141,7 +141,7 @@ bool LokenStackAction::Execute(Event event)
float maxMovement = 10.0f;
if (!boss->HasUnitState(UNIT_STATE_CASTING))
{
if(bot->getClass() == CLASS_HUNTER)
if (bot->getClass() == CLASS_HUNTER)
{
return Move(bot->GetAngle(boss), fmin(bot->GetExactDist2d(boss) - 6.5f, maxMovement));
}
@@ -152,7 +152,6 @@ bool LokenStackAction::Execute(Event event)
return false;
}
bool AvoidLightningNovaAction::Execute(Event event)
{
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.
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -40,7 +40,7 @@ float OccFlyingMultiplier::GetValue(Action* action)
float UromMultiplier::GetValue(Action* action)
{
if(GetPhaseByCurrentPosition(bot) < 3)
if (GetPhaseByCurrentPosition(bot) < 3)
{
Unit* target = action->GetTarget();
if (target && target->GetEntry() == NPC_MAGE_LORD_UROM)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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