sync with azerothcore

This commit is contained in:
Yunfan Li
2023-12-12 21:02:23 +08:00
parent 748801b10b
commit 5e14f2f26d
8 changed files with 20 additions and 18 deletions

View File

@@ -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;

View File

@@ -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))

View File

@@ -26,6 +26,7 @@
#include "Random.h"
#include "ServerFacade.h"
#include "ChannelMgr.h"
#include "Unit.h"
#include "World.h"
#include <cstdlib>
@@ -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);

View File

@@ -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))
{

View File

@@ -11,7 +11,7 @@ class PlayerbotAI;
struct ItemTemplate;
enum RollVote : uint32;
enum RollVote : uint8;
class LootRollAction : public QueryItemUsageAction
{

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -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()