From 5e14f2f26d5b7cc989c02b185295c1f5cfb567dd Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Tue, 12 Dec 2023 21:02:23 +0800 Subject: [PATCH] sync with azerothcore --- src/LootObjectStack.cpp | 7 ++++--- src/Playerbots.cpp | 2 +- src/RandomPlayerbotMgr.cpp | 3 ++- src/strategy/actions/BattleGroundTactics.cpp | 16 ++++++++-------- src/strategy/actions/LootRollAction.h | 2 +- src/strategy/values/PartyMemberToResurrect.cpp | 2 +- src/strategy/values/PvpValues.cpp | 2 +- src/strategy/values/StatsValues.cpp | 4 ++-- 8 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/LootObjectStack.cpp b/src/LootObjectStack.cpp index d9121c53..8bba885c 100644 --- a/src/LootObjectStack.cpp +++ b/src/LootObjectStack.cpp @@ -5,6 +5,7 @@ #include "LootObjectStack.h" #include "LootMgr.h" #include "Playerbots.h" +#include "Unit.h" #define MAX_LOOT_OBJECT_COUNT 10 @@ -59,7 +60,7 @@ void LootObject::Refresh(Player* bot, ObjectGuid lootGUID) PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); Creature* creature = botAI->GetCreature(lootGUID); - if (creature && creature->getDeathState() == CORPSE) + if (creature && creature->getDeathState() == DeathState::Corpse) { if (creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) guid = lootGUID; @@ -176,7 +177,7 @@ WorldObject* LootObject::GetWorldObject(Player* bot) PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot); Creature* creature = botAI->GetCreature(guid); - if (creature && creature->getDeathState() == CORPSE) + if (creature && creature->getDeathState() == DeathState::Corpse) return creature; GameObject* go = botAI->GetGameObject(guid); @@ -208,7 +209,7 @@ bool LootObject::IsLootPossible(Player* bot) return false; Creature* creature = botAI->GetCreature(guid); - if (creature && creature->getDeathState() == CORPSE) + if (creature && creature->getDeathState() == DeathState::Corpse) { if (!bot->isAllowedToLoot(creature) && skillId != SKILL_SKINNING) return false; diff --git a/src/Playerbots.cpp b/src/Playerbots.cpp index d49d54b5..58aa4222 100644 --- a/src/Playerbots.cpp +++ b/src/Playerbots.cpp @@ -222,7 +222,7 @@ class PlayerbotsServerScript : public ServerScript public: PlayerbotsServerScript() : ServerScript("PlayerbotsServerScript") { } - void OnPacketReceived(WorldSession* session, WorldPacket const& packet) override + void OnPacketReceived(WorldSession* session, WorldPacket& packet) override { if (Player* player = session->GetPlayer()) if (PlayerbotMgr* playerbotMgr = GET_PLAYERBOT_MGR(player)) diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index a991ee8e..7df1a3e6 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -26,6 +26,7 @@ #include "Random.h" #include "ServerFacade.h" #include "ChannelMgr.h" +#include "Unit.h" #include "World.h" #include @@ -2415,7 +2416,7 @@ ObjectGuid const RandomPlayerbotMgr::GetBattleMasterGUID(Player* bot, Battlegrou if (zone->team == 2 && bot->GetTeamId() == TEAM_HORDE) continue; - if (Bm->getDeathState() == DEAD) + if (Bm->getDeathState() == DeathState::Dead) continue; float dist2 = sServerFacade->GetDistance2d(bot, data->posX, data->posY); diff --git a/src/strategy/actions/BattleGroundTactics.cpp b/src/strategy/actions/BattleGroundTactics.cpp index 57dc6813..3dabc821 100644 --- a/src/strategy/actions/BattleGroundTactics.cpp +++ b/src/strategy/actions/BattleGroundTactics.cpp @@ -2915,7 +2915,7 @@ bool BGTactics::selectObjective(bool reset) { if (Creature* pBalinda = bg->GetBGCreature(AV_NPC_A_CAPTAIN)) { - if (pBalinda->getDeathState() != DEAD) + if (pBalinda->getDeathState() != DeathState::Dead) { uint32 attackCount = 0; attackCount += getDefendersCount(AV_STONEHEARTH_WAITING_HORDE, 10.0f, false); @@ -2973,7 +2973,7 @@ bool BGTactics::selectObjective(bool reset) { if (Creature* mBossNeutral = bg->GetBGCreature(AV_CPLACE_MINE_N_3)) { - if (bot->IsWithinDist(mBossNeutral, 400.0f) && mBossNeutral->getDeathState() != DEAD && alterValleyBG->GetMineOwner(AV_NORTH_MINE) == TEAM_OTHER) + if (bot->IsWithinDist(mBossNeutral, 400.0f) && mBossNeutral->getDeathState() != DeathState::Dead && alterValleyBG->GetMineOwner(AV_NORTH_MINE) == TEAM_OTHER) { BgObjective = mBossNeutral; //std::ostringstream out; @@ -2984,7 +2984,7 @@ bool BGTactics::selectObjective(bool reset) if (Creature* mBossAlly = bg->GetBGCreature(AV_CPLACE_MINE_N_3)) { - if (!BgObjective && bot->IsWithinDist(mBossAlly, 400.0f) && mBossAlly->getDeathState() != DEAD && alterValleyBG->GetMineOwner(AV_NORTH_MINE) == TEAM_ALLIANCE) + if (!BgObjective && bot->IsWithinDist(mBossAlly, 400.0f) && mBossAlly->getDeathState() != DeathState::Dead && alterValleyBG->GetMineOwner(AV_NORTH_MINE) == TEAM_ALLIANCE) { BgObjective = mBossAlly; //std::ostringstream out; @@ -3075,7 +3075,7 @@ bool BGTactics::selectObjective(bool reset) { if (Creature* mBossNeutral = bg->GetBGCreature(AV_CPLACE_MINE_S_3)) { - if (bot->IsWithinDist(mBossNeutral, 400.0f) && mBossNeutral->getDeathState() != DEAD && alterValleyBG->GetMineOwner(AV_SOUTH_MINE) == TEAM_OTHER) + if (bot->IsWithinDist(mBossNeutral, 400.0f) && mBossNeutral->getDeathState() != DeathState::Dead && alterValleyBG->GetMineOwner(AV_SOUTH_MINE) == TEAM_OTHER) { BgObjective = mBossNeutral; //std::ostringstream out; @@ -3086,7 +3086,7 @@ bool BGTactics::selectObjective(bool reset) if (Creature* mBossHorde = bg->GetBGCreature(AV_CPLACE_MINE_S_3)) { - if (!BgObjective && bot->IsWithinDist(mBossHorde, 400.0f) && mBossHorde->getDeathState() != DEAD && alterValleyBG->GetMineOwner(AV_SOUTH_MINE) == TEAM_HORDE) + if (!BgObjective && bot->IsWithinDist(mBossHorde, 400.0f) && mBossHorde->getDeathState() != DeathState::Dead && alterValleyBG->GetMineOwner(AV_SOUTH_MINE) == TEAM_HORDE) { BgObjective = mBossHorde; //std::ostringstream out; @@ -3320,9 +3320,9 @@ bool BGTactics::selectObjective(bool reset) for (auto const& objective : AB_AttackObjectives) { - if (arathiBasinBG->GetCapturePointInfo(objective)._ownerTeamId == BG_AB_NODE_STATE_NEUTRAL || - ((!defender || !objectives.size()) && arathiBasinBG->GetCapturePointInfo(objective)._ownerTeamId == BG_AB_NODE_STATE_ALLY_OCCUPIED) || - ((defender || !objectives.size()) && arathiBasinBG->GetCapturePointInfo(objective)._ownerTeamId == BG_AB_NODE_STATE_ALLY_CONTESTED)) + if (arathiBasinBG->GetCapturePointInfo(objective)._state == BG_AB_NODE_STATE_NEUTRAL || + ((!defender || !objectives.size()) && arathiBasinBG->GetCapturePointInfo(objective)._state == BG_AB_NODE_STATE_ALLY_OCCUPIED) || + ((defender || !objectives.size()) && arathiBasinBG->GetCapturePointInfo(objective)._state == BG_AB_NODE_STATE_ALLY_CONTESTED)) { if (GameObject* pGO = bg->GetBGObject(objective)) { diff --git a/src/strategy/actions/LootRollAction.h b/src/strategy/actions/LootRollAction.h index 1651a372..af243e94 100644 --- a/src/strategy/actions/LootRollAction.h +++ b/src/strategy/actions/LootRollAction.h @@ -11,7 +11,7 @@ class PlayerbotAI; struct ItemTemplate; -enum RollVote : uint32; +enum RollVote : uint8; class LootRollAction : public QueryItemUsageAction { diff --git a/src/strategy/values/PartyMemberToResurrect.cpp b/src/strategy/values/PartyMemberToResurrect.cpp index 5a592087..3117d777 100644 --- a/src/strategy/values/PartyMemberToResurrect.cpp +++ b/src/strategy/values/PartyMemberToResurrect.cpp @@ -29,7 +29,7 @@ class FindDeadPlayer : public FindPlayerPredicate bool Check(Unit* unit) override { Player* player = unit->ToPlayer(); - return player && !player->isResurrectRequested() && player->getDeathState() == CORPSE && !value->IsTargetOfSpellCast(player, predicate); + return player && !player->isResurrectRequested() && player->getDeathState() == DeathState::Corpse && !value->IsTargetOfSpellCast(player, predicate); } private: diff --git a/src/strategy/values/PvpValues.cpp b/src/strategy/values/PvpValues.cpp index bb81d6d1..43911c66 100644 --- a/src/strategy/values/PvpValues.cpp +++ b/src/strategy/values/PvpValues.cpp @@ -151,7 +151,7 @@ CreatureData const* BgMasterValue::NearestBm(bool allowDead) continue; //Is the unit dead? - if (unit->getDeathState() == DEAD) + if (unit->getDeathState() == DeathState::Dead) continue; } diff --git a/src/strategy/values/StatsValues.cpp b/src/strategy/values/StatsValues.cpp index c3d96985..9ebc1468 100644 --- a/src/strategy/values/StatsValues.cpp +++ b/src/strategy/values/StatsValues.cpp @@ -33,7 +33,7 @@ bool IsDeadValue::Calculate() if (!target) return false; - return target->getDeathState() != ALIVE; + return target->getDeathState() != DeathState::Alive; } bool PetIsDeadValue::Calculate() @@ -51,7 +51,7 @@ bool PetIsDeadValue::Calculate() if (bot->GetPetGUID() && !bot->GetPet()) return true; - return bot->GetPet() && bot->GetPet()->getDeathState() != ALIVE; + return bot->GetPet() && bot->GetPet()->getDeathState() != DeathState::Alive; } bool PetIsHappyValue::Calculate()