Compare commits

..

No commits in common. "85c7009fe1af8815c203ed963f431b5a08930f86" and "80dbd22ba1f4122a1fbfda18d47ef7c6a5a6b3a0" have entirely different histories.

166 changed files with 719 additions and 2128 deletions

View File

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

2
code_format.sh Normal file → Executable file
View File

@ -15,4 +15,4 @@ for file in $cpp_files; do
$CLANG_FORMAT_PATH -i $file
done
echo "All .cpp or .h files have been formatted."
echo "All .cpp or .h files have been formatted."

View File

@ -413,12 +413,10 @@ 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))
@ -708,9 +706,7 @@ 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 (auto const& pair : toChannels)
for (const auto& 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, ItemTemplate const* proto)
bool BroadcastHelper::BroadcastLootingItem(PlayerbotAI* ai, Player* bot, const ItemTemplate *proto)
{
if (!sPlayerbotAIConfig->enableBroadcasts)
return false;
@ -410,6 +410,7 @@ 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 (auto const& entry : specTabNames)
for (const auto& 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 (auto const& guid : npcs)
for (const auto& guid : npcs)
{
Creature* c = botAI->GetCreature(guid);
if (!c)

View File

@ -329,11 +329,9 @@ 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;
@ -343,8 +341,7 @@ 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->IsCreature())
if (victim->GetTypeId() != TYPEID_UNIT)
return;
Creature* creature = reinterpret_cast<Creature*>(victim);

View File

@ -355,7 +355,7 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
}
// Update the bot's group status (moved to helper function)
UpdateAIGroupAndMaster();
UpdateAIGroupMembership();
// Update internal AI
UpdateAIInternal(elapsed, minimal);
@ -363,60 +363,47 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
}
// Helper function for UpdateAI to check group membership and handle removal if necessary
void PlayerbotAI::UpdateAIGroupAndMaster()
void PlayerbotAI::UpdateAIGroupMembership()
{
if (!bot)
if (!bot || !bot->GetGroup())
return;
Group* group = bot->GetGroup();
// If bot is not in group verify that for is RandomBot before clearing master and resetting.
if (!group)
if (!bot->InBattleground() && !bot->inRandomLfgDungeon() && !group->isLFGGroup())
{
if (master && sRandomPlayerbotMgr->IsRandomBot(bot))
Player* leader = group->GetLeader();
if (leader && leader != bot) // Ensure the leader is valid and not the bot itself
{
SetMaster(nullptr);
Reset(true);
ResetStrategies();
PlayerbotAI* leaderAI = GET_PLAYERBOT_AI(leader);
if (leaderAI && !leaderAI->IsRealPlayer())
{
LeaveOrDisbandGroup();
}
}
return;
}
if (bot->InBattleground() && bot->GetBattleground()->GetBgTypeID() != BATTLEGROUND_AV)
return;
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
if (!botAI)
return;
PlayerbotAI* masterBotAI = nullptr;
if (master)
masterBotAI = GET_PLAYERBOT_AI(master);
if (!master || (masterBotAI && !masterBotAI->IsRealPlayer()))
else if (group->isLFGGroup())
{
Player* newMaster = FindNewMaster();
if (newMaster)
bool hasRealPlayer = false;
// Iterate over all group members to check if at least one is a real player
for (GroupReference* ref = group->GetFirstMember(); ref; ref = ref->next())
{
master = newMaster;
botAI->SetMaster(newMaster);
botAI->ResetStrategies();
Player* member = ref->GetSource();
if (!member)
continue;
if (!bot->InBattleground())
{
botAI->ChangeStrategy("+follow", BOT_STATE_NON_COMBAT);
PlayerbotAI* memberAI = GET_PLAYERBOT_AI(member);
if (memberAI && !memberAI->IsRealPlayer())
continue;
if (botAI->GetMaster() == botAI->GetGroupMaster())
botAI->TellMaster("Hello, I follow you!");
else
botAI->TellMaster(!urand(0, 2) ? "Hello!" : "Hi!");
}
else
{
// we're in a battleground, stay with the pack and focus on objective
botAI->ChangeStrategy("-follow", BOT_STATE_NON_COMBAT);
}
hasRealPlayer = true;
break;
}
else if (!newMaster && !bot->InBattleground())
if (!hasRealPlayer)
{
LeaveOrDisbandGroup();
}
}
}
@ -805,6 +792,7 @@ void PlayerbotAI::LeaveOrDisbandGroup()
WorldPacket* packet = new WorldPacket(CMSG_GROUP_DISBAND);
bot->GetSession()->QueuePacket(packet);
ResetStrategies();
}
bool PlayerbotAI::IsAllowedCommand(std::string const text)
@ -1313,6 +1301,7 @@ void PlayerbotAI::DoNextAction(bool min)
return;
}
// Change engine if just died
bool isBotAlive = bot->IsAlive();
if (currentEngine != engines[BOT_STATE_DEAD] && !isBotAlive)
@ -1372,6 +1361,92 @@ void PlayerbotAI::DoNextAction(bool min)
Group* group = bot->GetGroup();
PlayerbotAI* masterBotAI = nullptr;
if (master)
masterBotAI = GET_PLAYERBOT_AI(master);
// Test BG master set
if ((!master || (masterBotAI && !masterBotAI->IsRealPlayer())) && group)
{
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
if (!botAI)
{
return;
}
// Ideally we want to have the leader as master.
Player* newMaster = botAI->GetGroupMaster();
Player* playerMaster = nullptr;
// Are there any non-bot players in the group?
if (!newMaster || GET_PLAYERBOT_AI(newMaster))
{
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
{
Player* member = gref->GetSource();
if (!member || member == bot || member == newMaster || !member->IsInWorld() ||
!member->IsInSameRaidWith(bot))
continue;
PlayerbotAI* memberBotAI = GET_PLAYERBOT_AI(member);
if (memberBotAI)
{
if (memberBotAI->IsRealPlayer() && !bot->InBattleground())
playerMaster = member;
continue;
}
// Same BG checks (optimize checking conditions here)
if (bot->InBattleground() && bot->GetBattleground() &&
bot->GetBattleground()->GetBgTypeID() == BATTLEGROUND_AV && !GET_PLAYERBOT_AI(member) &&
member->InBattleground() && bot->GetMapId() == member->GetMapId())
{
// Skip if same BG but same subgroup or lower level
if (!group->SameSubGroup(bot, member) || member->GetLevel() < bot->GetLevel())
continue;
// Follow real player only if higher honor points
uint32 honorpts = member->GetHonorPoints();
if (bot->GetHonorPoints() && honorpts < bot->GetHonorPoints())
continue;
playerMaster = member;
continue;
}
if (bot->InBattleground())
continue;
newMaster = member;
break;
}
}
if (!newMaster && playerMaster)
newMaster = playerMaster;
if (newMaster && (!master || master != newMaster) && bot != newMaster)
{
master = newMaster;
botAI->SetMaster(newMaster);
botAI->ResetStrategies();
if (!bot->InBattleground())
{
botAI->ChangeStrategy("+follow", BOT_STATE_NON_COMBAT);
if (botAI->GetMaster() == botAI->GetGroupMaster())
botAI->TellMaster("Hello, I follow you!");
else
botAI->TellMaster(!urand(0, 2) ? "Hello!" : "Hi!");
}
else
{
// we're in a battleground, stay with the pack and focus on objective
botAI->ChangeStrategy("-follow", BOT_STATE_NON_COMBAT);
}
}
}
if (master && master->IsInWorld())
{
@ -1442,25 +1517,23 @@ 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
case 565:
strategyName = "gruulslair"; // Gruul's Lair
break;
@ -3097,10 +3170,8 @@ 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);
// }
@ -3123,6 +3194,7 @@ 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);
@ -3305,8 +3377,7 @@ 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());
// }
@ -3351,8 +3422,7 @@ 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());
// }
@ -3421,8 +3491,7 @@ 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);
// }
@ -3433,8 +3502,7 @@ 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);
// }
@ -3501,8 +3569,7 @@ 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());
// }
@ -4066,50 +4133,6 @@ bool IsAlliance(uint8 race)
race == RACE_DRAENEI;
}
Player* PlayerbotAI::FindNewMaster()
{
// Ideally we want to have the leader as master.
Group* group = bot->GetGroup();
// Only allow real players as masters unless in battleground.
if (!group)
return nullptr;
Player* groupLeader = GetGroupMaster();
PlayerbotAI* leaderBotAI = GET_PLAYERBOT_AI(groupLeader);
if (!leaderBotAI || leaderBotAI->IsRealPlayer())
return groupLeader;
// Find the real player in group
for (GroupReference* gref = group->GetFirstMember(); gref; gref = gref->next())
{
Player* member = gref->GetSource();
if (!member || member == bot || !member->IsInWorld() ||
!member->IsInSameRaidWith(bot))
continue;
PlayerbotAI* memberBotAI = GET_PLAYERBOT_AI(member);
if ((!memberBotAI || memberBotAI->IsRealPlayer()) && !bot->InBattleground())
return member;
if (bot->InBattleground() && bot->GetBattleground() &&
bot->GetBattleground()->GetBgTypeID() == BATTLEGROUND_AV && !GET_PLAYERBOT_AI(member) &&
member->InBattleground() && bot->GetMapId() == member->GetMapId())
{
// Skip if same BG but same subgroup or lower level
if (!group->SameSubGroup(bot, member) || member->GetLevel() < bot->GetLevel())
continue;
// Follow real player only if higher honor points
uint32 honorpts = member->GetHonorPoints();
if (bot->GetHonorPoints() && honorpts < bot->GetHonorPoints())
continue;
return member;
}
}
return nullptr;
}
bool PlayerbotAI::HasRealPlayerMaster()
{
if (master)
@ -4733,6 +4756,7 @@ uint32 PlayerbotAI::GetEquipGearScore(Player* player)
sum += gearScore[i];
}
if (count)
{
uint32 res = uint32(sum / count);
@ -5269,7 +5293,7 @@ Item* PlayerbotAI::FindOpenableItem() const
return FindItemInInventory(
[this](ItemTemplate const* itemTemplate) -> bool
{
return itemTemplate->HasFlag(ITEM_FLAG_HAS_LOOT) &&
return (itemTemplate->Flags & ITEM_FLAG_HAS_LOOT) &&
(itemTemplate->LockID == 0 || !this->bot->GetItemByEntry(itemTemplate->ItemId)->IsLocked());
});
}
@ -5420,7 +5444,7 @@ Item* PlayerbotAI::FindOilFor(Item* weapon) const
if (prioritizedOils)
{
for (auto const& id : *prioritizedOils)
for (const auto& id : *prioritizedOils)
{
oil = FindConsumable(id);
if (oil)

View File

@ -529,7 +529,6 @@ 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; }
@ -612,7 +611,7 @@ private:
static void _fillGearScoreData(Player* player, Item* item, std::vector<uint32>* gearScore, uint32& twoHandScore,
bool mixed = false);
bool IsTellAllowed(PlayerbotSecurityLevel securityLevel = PLAYERBOT_SECURITY_ALLOW_ALL);
void UpdateAIGroupAndMaster();
void UpdateAIGroupMembership();
Item* FindItemInInventory(std::function<bool(ItemTemplate const*)> checkItem) const;
void HandleCommands();
void HandleCommand(uint32 type, const std::string& text, Player& fromPlayer, const uint32 lang = LANG_UNIVERSAL);

View File

@ -1736,8 +1736,7 @@ 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->HasFlag(ITEM_FLAG_DEPRECATED))
if (proto->Flags & ITEM_FLAG_DEPRECATED)
{
itemForTest.insert(proto->ItemId);
continue;
@ -1072,10 +1072,10 @@ void RandomItemMgr::BuildItemInfoCache()
// cacheInfo.team = TEAM_NEUTRAL;
// // check faction
// if (proto->HasFlag2(ITEM_FLAG2_FACTION_HORDE))
// if (proto->Flags2 & ITEM_FLAG2_FACTION_HORDE)
// cacheInfo.team = TEAM_HORDE;
// if (proto->HasFlag2(ITEM_FLAG2_FACTION_ALLIANCE))
// if (proto->Flags2 & 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->HasFlag(ITEM_FLAG_NO_DISENCHANT))
// if (proto->Flags & 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 (auto const& spellData : proto->Spells)
for (const auto& spellData : proto->Spells)
{
// no spell
if (!spellData.SpellId)
@ -2374,6 +2374,7 @@ 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 (auto const& [accountId, accountType] : currentAssignments)
for (const auto& [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 (auto const& [accountId, accountType] : currentAssignments)
for (const auto& [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 (auto const& charInfo : allCharacters)
for (const auto& 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 (auto const& charInfo : allianceChars)
for (const auto& charInfo : allianceChars)
{
if (!allowedAllianceCount)
break;
@ -845,7 +845,7 @@ uint32 RandomPlayerbotMgr::AddRandomBots()
}
// PHASE 2: Log-in Horde bots up to maxAllowedBotCount
for (auto const& charInfo : hordeChars)
for (const auto& 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 (auto const& charInfo : allianceChars)
for (const auto& charInfo : allianceChars)
{
if (!maxAllowedBotCount)
break;
@ -1248,7 +1248,7 @@ void RandomPlayerbotMgr::CheckBgQueue()
void RandomPlayerbotMgr::LogBattlegroundInfo()
{
for (auto const& queueTypePair : BattlegroundData)
for (const auto& queueTypePair : BattlegroundData)
{
uint8 queueType = queueTypePair.first;
@ -1256,7 +1256,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
if (uint8 type = BattlegroundMgr::BGArenaType(queueTypeId))
{
for (auto const& bracketIdPair : queueTypePair.second)
for (const auto& bracketIdPair : queueTypePair.second)
{
auto& bgInfo = bracketIdPair.second;
if (bgInfo.minLevel == 0)
@ -1306,7 +1306,7 @@ void RandomPlayerbotMgr::LogBattlegroundInfo()
break;
}
for (auto const& bracketIdPair : queueTypePair.second)
for (const auto& 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,6 +1704,7 @@ 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());
@ -2255,7 +2256,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)];
auto const& bankers = cityToBankers.at(selectedCity);
const auto& 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->IsPlayer())
if (target->GetTypeId() == TYPEID_PLAYER)
{
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,6 +2076,7 @@ void TravelMgr::LoadQuestTravelTable()
continue;
}
if (r.role == 0)
{
container->questGivers.push_back(loc);
@ -2590,7 +2591,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,6 +470,7 @@ bool TravelNode::cropUselessLinks()
for (auto& firstLink : getLinks())
{
TravelNode* firstNode = firstLink.first;
float firstLength = firstLink.second.getDistance();
for (auto& secondLink : getLinks())
@ -1301,7 +1302,7 @@ TravelNodeRoute TravelNodeMap::getRoute(TravelNode* start, TravelNode* goal, Pla
return TravelNodeRoute(path);
}
for (auto const& link : *currentNode->dataNode->getLinks()) // for each successor n' of n
for (const auto& link : *currentNode->dataNode->getLinks()) // for each successor n' of n
{
TravelNode* linkNode = link.first;
float linkCost = link.second->getCost(bot, currentNode->currentGold);
@ -1350,7 +1351,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.
@ -1901,7 +1902,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->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE))
if (proto->Flags & 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,8 +1600,7 @@ 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;
@ -1706,8 +1705,7 @@ 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()))
{
@ -1736,8 +1734,7 @@ void PlayerbotFactory::InitEquipment(bool incremental, bool second_chance)
continue;
}
if (bot->HasItemCount(itemId, count))
{
if (bot->HasItemCount(itemId, count)) {
continue;
}
@ -2774,8 +2771,7 @@ 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

@ -39,8 +39,6 @@
#include "raids/blackwinglair/RaidBwlTriggerContext.h"
#include "raids/karazhan/RaidKarazhanActionContext.h"
#include "raids/karazhan/RaidKarazhanTriggerContext.h"
#include "raids/magtheridon/RaidMagtheridonActionContext.h"
#include "raids/magtheridon/RaidMagtheridonTriggerContext.h"
#include "raids/gruulslair/RaidGruulsLairActionContext.h"
#include "raids/gruulslair/RaidGruulsLairTriggerContext.h"
#include "raids/naxxramas/RaidNaxxActionContext.h"
@ -115,7 +113,6 @@ void AiObjectContext::BuildSharedActionContexts(SharedNamedObjectContextList<Act
actionContexts.Add(new RaidMcActionContext());
actionContexts.Add(new RaidBwlActionContext());
actionContexts.Add(new RaidKarazhanActionContext());
actionContexts.Add(new RaidMagtheridonActionContext());
actionContexts.Add(new RaidGruulsLairActionContext());
actionContexts.Add(new RaidNaxxActionContext());
actionContexts.Add(new RaidOsActionContext());
@ -150,7 +147,6 @@ void AiObjectContext::BuildSharedTriggerContexts(SharedNamedObjectContextList<Tr
triggerContexts.Add(new RaidMcTriggerContext());
triggerContexts.Add(new RaidBwlTriggerContext());
triggerContexts.Add(new RaidKarazhanTriggerContext());
triggerContexts.Add(new RaidMagtheridonTriggerContext());
triggerContexts.Add(new RaidGruulsLairTriggerContext());
triggerContexts.Add(new RaidNaxxTriggerContext());
triggerContexts.Add(new RaidOsTriggerContext());

View File

@ -77,8 +77,7 @@ 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;
// }
// }
@ -403,6 +402,7 @@ 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 (auto const& iter : context->creators)
for (const auto& iter : context->creators)
creators[iter.first] = iter.second;
}
};
@ -294,7 +294,7 @@ public:
void Add(NamedObjectFactory<T>* context)
{
factories.push_back(context);
for (auto const& iter : context->creators)
for (const auto& iter : context->creators)
creators[iter.first] = iter.second;
}

View File

@ -161,21 +161,17 @@ 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,3 +176,4 @@ 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->HasNpcFlag(UNIT_NPC_FLAG_BANKER))
if (!npc || !npc->HasFlag(UNIT_NPC_FLAGS, 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;
auto const& attackObjectives =
const auto& attackObjectives =
(team == TEAM_HORDE) ? AV_AttackObjectives_Horde : AV_AttackObjectives_Alliance;
auto const& defendObjectives =
const auto& defendObjectives =
(team == TEAM_HORDE) ? AV_DefendObjectives_Horde : AV_DefendObjectives_Alliance;
uint32 destroyedNodes = 0;
for (auto const& [nodeId, _] : defendObjectives)
for (const auto& [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 (auto const& [nodeId, goId] : defendObjectives)
for (const auto& [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 (auto const& [nodeId, _] : attackObjectives)
for (const auto& [nodeId, _] : attackObjectives)
if (av->GetAVNodeInfo(nodeId).State == POINT_DESTROYED)
towersDown++;
@ -2053,7 +2053,7 @@ bool BGTactics::selectObjective(bool reset)
{
std::vector<GameObject*> candidates;
for (auto const& [nodeId, goId] : attackObjectives)
for (const auto& [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 (auto const& [nodeId, goId] : attackObjectives)
for (const auto& [nodeId, goId] : attackObjectives)
if (bg->GetBGObject(goId) == BgObjective)
linkedNodeId = nodeId;
if (!linkedNodeId)
{
for (auto const& [nodeId, goId] : defendObjectives)
for (const auto& [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 (auto const& [nodeId, _, areaTrigger] : EY_AttackObjectives)
for (const auto& [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 (auto const& [nodeId, _, __] : EY_AttackObjectives)
for (const auto& [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 (auto const& [nodeId, _, __] : EY_AttackObjectives)
for (const auto& [nodeId, _, __] : EY_AttackObjectives)
{
if (IsOwned(nodeId))
{
@ -2739,7 +2739,7 @@ bool BGTactics::selectObjective(bool reset)
float bestDist = FLT_MAX;
Optional<uint32> bestNode;
for (auto const& [nodeId, _, __] : EY_AttackObjectives)
for (const auto& [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++)
{
auto const& objective =
const auto& 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++)
{
auto const& objective =
const auto& 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 (auto const& pair : spells)
for (const auto& 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.
auto const& ids = pair.second;
const auto& 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,6 +120,7 @@ void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarge
}
}
//Continue current target. 90% chance
if (!foundTarget && urand(1, 100) > 10)
{
@ -672,7 +673,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,6 +58,7 @@ bool DropQuestAction::Execute(Event event)
return true;
}
bool CleanQuestLogAction::Execute(Event event)
{
Player* requester = event.getOwner() ? event.getOwner() : GetMaster();
@ -164,6 +165,7 @@ 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->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) ||
unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER)))
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) ||
unit->HasFlag(UNIT_NPC_FLAGS, 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->HasNpcFlag(UNIT_NPC_FLAG_TRAINER) ||
unit->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER)))
if (unit && (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) ||
unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)))
{
types.push_back(EMOTE_ONESHOT_SALUTE);
}

View File

@ -328,6 +328,7 @@ void EquipAction::EquipItem(Item* item)
botAI->TellMaster(out);
}
bool EquipUpgradesAction::Execute(Event event)
{
if (!sPlayerbotAIConfig->autoEquipUpgradeLoot && !sRandomPlayerbotMgr->IsRandomBot(bot))
@ -356,12 +357,9 @@ 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);
@ -390,12 +388,9 @@ 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,6 +29,7 @@ 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,8 +364,7 @@ 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

@ -11,11 +11,8 @@
bool LeaveGroupAction::Execute(Event event)
{
Player* player = event.getOwner();
if (player == botAI->GetMaster())
return Leave();
return false;
Player* master = event.getOwner();
return Leave(master);
}
bool PartyCommandAction::Execute(Event event)
@ -29,21 +26,13 @@ bool PartyCommandAction::Execute(Event event)
if (operation != PARTY_OP_LEAVE)
return false;
// Only leave if master has left the party, and randombot cannot set new master.
Player* master = GetMaster();
if (master && member == master->GetName())
{
if (sRandomPlayerbotMgr->IsRandomBot(bot))
{
Player* newMaster = botAI->FindNewMaster();
if (newMaster || bot->InBattleground())
{
botAI->SetMaster(newMaster);
return false;
}
}
return Leave();
}
return Leave(bot);
botAI->Reset();
return false;
}
@ -53,17 +42,17 @@ bool UninviteAction::Execute(Event event)
if (p.GetOpcode() == CMSG_GROUP_UNINVITE)
{
p.rpos(0);
std::string memberName;
p >> memberName;
std::string membername;
p >> membername;
// player not found
if (!normalizePlayerName(memberName))
if (!normalizePlayerName(membername))
{
return false;
}
if (bot->GetName() == memberName)
return Leave();
if (bot->GetName() == membername)
return Leave(bot);
}
if (p.GetOpcode() == CMSG_GROUP_UNINVITE_GUID)
@ -73,29 +62,50 @@ bool UninviteAction::Execute(Event event)
p >> guid;
if (bot->GetGUID() == guid)
return Leave();
return Leave(bot);
}
botAI->Reset();
return false;
}
bool LeaveGroupAction::Leave()
bool LeaveGroupAction::Leave(Player* player)
{
if (!botAI)
if (player &&
!botAI &&
!botAI->GetSecurity()->CheckLevelFor(PLAYERBOT_SECURITY_INVITE, false, player))
return false;
Player* master = botAI -> GetMaster();
if (master)
botAI->TellMaster("Goodbye!", PLAYERBOT_SECURITY_TALK);
bool aiMaster = GET_PLAYERBOT_AI(botAI->GetMaster()) != nullptr;
botAI->TellMaster("Goodbye!", PLAYERBOT_SECURITY_TALK);
bool randomBot = sRandomPlayerbotMgr->IsRandomBot(bot);
bool shouldStay = randomBot && bot->GetGroup() && player == bot;
if (!shouldStay)
{
botAI->LeaveOrDisbandGroup();
}
if (randomBot)
{
GET_PLAYERBOT_AI(bot)->SetMaster(nullptr);
}
if (!aiMaster)
botAI->ResetStrategies(!randomBot);
botAI->Reset();
botAI->LeaveOrDisbandGroup();
return true;
}
bool LeaveFarAwayAction::Execute(Event event)
{
// allow bot to leave party when they want
return Leave();
return Leave(botAI->GetGroupMaster());
}
bool LeaveFarAwayAction::isUseful()
@ -155,5 +165,7 @@ bool LeaveFarAwayAction::isUseful()
return true;
}
botAI->Reset();
return false;
}

View File

@ -18,7 +18,7 @@ public:
bool Execute(Event event) override;
virtual bool Leave();
virtual bool Leave(Player* player);
};
class PartyCommandAction : public LeaveGroupAction

View File

@ -16,6 +16,7 @@
using namespace lfg;
bool LfgJoinAction::Execute(Event event) { return JoinLFG(); }
uint32 LfgJoinAction::GetRoles()
@ -112,7 +113,7 @@ bool LfgJoinAction::JoinLFG()
dungeon->TypeID != LFG_TYPE_HEROIC && dungeon->TypeID != LFG_TYPE_RAID))
continue;
auto const& botLevel = bot->GetLevel();
const auto& 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) ||
@ -179,6 +180,7 @@ 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);
@ -265,6 +267,7 @@ bool LfgAcceptAction::Execute(Event event)
return false;
}
bool LfgLeaveAction::Execute(Event event)
{
// Don't leave if lfg strategy enabled

View File

@ -41,12 +41,9 @@ 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);
@ -123,6 +120,7 @@ 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,8 +530,7 @@ 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);
@ -877,8 +876,7 @@ 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;
@ -1011,8 +1009,7 @@ bool MovementAction::IsMovingAllowed()
return false;
}
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING))
// {
// if (bot->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) {
// return false;
// }
return bot->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLIGHT_MOTION_TYPE;
@ -1097,12 +1094,9 @@ 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)
@ -1111,7 +1105,7 @@ void MovementAction::UpdateMovementState()
// {
// if (Unit* pTarget = sServerFacade->GetChaseTarget(bot))
// {
// if (!bot->IsWithinMeleeRange(pTarget) && pTarget->IsCreature())
// if (!bot->IsWithinMeleeRange(pTarget) && pTarget->GetTypeId() == TYPEID_UNIT)
// {
// float angle = bot->GetAngle(pTarget);
// float distance = 5.0f;
@ -1727,8 +1721,7 @@ 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;
@ -1739,12 +1732,10 @@ 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;
// }
// }
@ -1753,12 +1744,10 @@ 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;
// }
// }
@ -1767,22 +1756,18 @@ 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;
@ -2833,7 +2818,7 @@ bool MoveAwayFromCreatureAction::Execute(Event event)
// Find all creatures with the specified Id
std::vector<Unit*> creatures;
for (auto const& guid : targets)
for (const auto& guid : targets)
{
Unit* unit = botAI->GetUnit(guid);
if (unit && (alive && unit->IsAlive()) && unit->GetEntry() == creatureId)

View File

@ -119,6 +119,7 @@ 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 (auto const& npc : npcs)
for (const auto& 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 (auto const& go : gos)
for (const auto& 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 (auto const& pair : botAI->GetCurrentQuestsRequiringItemId(itemId))
for (const auto& 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 (auto const& guid : npcs)
for (const auto& guid : npcs)
{
Unit* unit = botAI->GetUnit(guid);
if (unit && unit->IsFriendlyTo(bot) && unit->IsSpiritService())

View File

@ -12,7 +12,24 @@
#include "GridNotifiersImpl.h"
#include "Playerbots.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)
{

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->HasNpcFlag(UNIT_NPC_FLAG_SPIRITHEALER))
if (unit && unit->HasFlag(UNIT_NPC_FLAGS, 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,6 +50,7 @@ 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->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
if (unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER))
{
if (isRpgAction)
{

View File

@ -120,8 +120,7 @@ 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 (auto const& name : normalFamilies)
for (const auto& name : normalFamilies)
{
if (count++ != 0)
oss << ", ";
@ -93,7 +93,7 @@ bool TameAction::Execute(Event event)
oss << " | ";
oss << "Exotic: ";
count = 0;
for (auto const& name : exoticFamilies)
for (const auto& name : exoticFamilies)
{
if (count++ != 0)
oss << ", ";

View File

@ -18,3 +18,4 @@ 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 (auto const& prefix : sPlayerbotAIConfig->tradeActionExcludedPrefixes)
for (const auto& 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,7 +9,6 @@
#include "Event.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "NearestGameObjects.h"
#include "PlayerbotAIConfig.h"
#include "Playerbots.h"
#include "PositionValue.h"
@ -55,6 +54,24 @@ 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();
@ -117,7 +134,7 @@ bool SummonAction::SummonUsingNpcs(Player* summoner, Player* player)
for (Unit* unit : targets)
{
if (unit && unit->HasNpcFlag(UNIT_NPC_FLAG_INNKEEPER))
if (unit && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_INNKEEPER))
{
if (!player->HasItemCount(6948, 1, false))
{
@ -225,7 +242,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,3 +97,4 @@ std::vector<uint32> WorldBuffAction::NeedWorldBuffs(Unit* unit)
return retVec;
}

View File

@ -15,6 +15,7 @@ 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);
// SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
// const SpellInfo *spellInfo = sSpellMgr->GetSpellInfo(spellId);
bot->AddSpellCooldown(spellId, 0, 3 * 60 * 1000);
return true;
}
}

View File

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

View File

@ -35,6 +35,8 @@ Bronjahm, Devourer of Souls
*/
class DungeonStrategyContext : public NamedObjectContext<Strategy>
{
public:
@ -82,6 +84,8 @@ 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,4 +18,5 @@
#include "trialofthechampion/TrialOfTheChampionTriggerContext.h"
// #include "hallsofreflection/HallsOfReflectionTriggerContext.h"
#endif

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
#include "CullingOfStratholmeActions.h"
#include "CullingOfStratholmeStrategy.h"
bool ExplodeGhoulSpreadAction::Execute(Event event)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "salramm the fleshcrafter");
@ -31,7 +32,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;
// }
@ -44,7 +45,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,6 +1,7 @@
#include "CullingOfStratholmeStrategy.h"
#include "CullingOfStratholmeMultipliers.h"
void WotlkDungeonCoSStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
{
// Meathook

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,6 +5,7 @@
#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,6 +152,7 @@ bool LokenStackAction::Execute(Event event)
return false;
}
bool AvoidLightningNovaAction::Execute(Event event)
{
Unit* boss = AI_VALUE2(Unit*, "find target", "loken");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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