mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
sync with azerothcore
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "LootObjectStack.h"
|
#include "LootObjectStack.h"
|
||||||
#include "LootMgr.h"
|
#include "LootMgr.h"
|
||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
|
#include "Unit.h"
|
||||||
|
|
||||||
#define MAX_LOOT_OBJECT_COUNT 10
|
#define MAX_LOOT_OBJECT_COUNT 10
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ void LootObject::Refresh(Player* bot, ObjectGuid lootGUID)
|
|||||||
|
|
||||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
||||||
Creature* creature = botAI->GetCreature(lootGUID);
|
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))
|
if (creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
|
||||||
guid = lootGUID;
|
guid = lootGUID;
|
||||||
@@ -176,7 +177,7 @@ WorldObject* LootObject::GetWorldObject(Player* bot)
|
|||||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
||||||
|
|
||||||
Creature* creature = botAI->GetCreature(guid);
|
Creature* creature = botAI->GetCreature(guid);
|
||||||
if (creature && creature->getDeathState() == CORPSE)
|
if (creature && creature->getDeathState() == DeathState::Corpse)
|
||||||
return creature;
|
return creature;
|
||||||
|
|
||||||
GameObject* go = botAI->GetGameObject(guid);
|
GameObject* go = botAI->GetGameObject(guid);
|
||||||
@@ -208,7 +209,7 @@ bool LootObject::IsLootPossible(Player* bot)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Creature* creature = botAI->GetCreature(guid);
|
Creature* creature = botAI->GetCreature(guid);
|
||||||
if (creature && creature->getDeathState() == CORPSE)
|
if (creature && creature->getDeathState() == DeathState::Corpse)
|
||||||
{
|
{
|
||||||
if (!bot->isAllowedToLoot(creature) && skillId != SKILL_SKINNING)
|
if (!bot->isAllowedToLoot(creature) && skillId != SKILL_SKINNING)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ class PlayerbotsServerScript : public ServerScript
|
|||||||
public:
|
public:
|
||||||
PlayerbotsServerScript() : ServerScript("PlayerbotsServerScript") { }
|
PlayerbotsServerScript() : ServerScript("PlayerbotsServerScript") { }
|
||||||
|
|
||||||
void OnPacketReceived(WorldSession* session, WorldPacket const& packet) override
|
void OnPacketReceived(WorldSession* session, WorldPacket& packet) override
|
||||||
{
|
{
|
||||||
if (Player* player = session->GetPlayer())
|
if (Player* player = session->GetPlayer())
|
||||||
if (PlayerbotMgr* playerbotMgr = GET_PLAYERBOT_MGR(player))
|
if (PlayerbotMgr* playerbotMgr = GET_PLAYERBOT_MGR(player))
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "Random.h"
|
#include "Random.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
#include "ChannelMgr.h"
|
#include "ChannelMgr.h"
|
||||||
|
#include "Unit.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@@ -2415,7 +2416,7 @@ ObjectGuid const RandomPlayerbotMgr::GetBattleMasterGUID(Player* bot, Battlegrou
|
|||||||
if (zone->team == 2 && bot->GetTeamId() == TEAM_HORDE)
|
if (zone->team == 2 && bot->GetTeamId() == TEAM_HORDE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Bm->getDeathState() == DEAD)
|
if (Bm->getDeathState() == DeathState::Dead)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float dist2 = sServerFacade->GetDistance2d(bot, data->posX, data->posY);
|
float dist2 = sServerFacade->GetDistance2d(bot, data->posX, data->posY);
|
||||||
|
|||||||
@@ -2915,7 +2915,7 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
{
|
{
|
||||||
if (Creature* pBalinda = bg->GetBGCreature(AV_NPC_A_CAPTAIN))
|
if (Creature* pBalinda = bg->GetBGCreature(AV_NPC_A_CAPTAIN))
|
||||||
{
|
{
|
||||||
if (pBalinda->getDeathState() != DEAD)
|
if (pBalinda->getDeathState() != DeathState::Dead)
|
||||||
{
|
{
|
||||||
uint32 attackCount = 0;
|
uint32 attackCount = 0;
|
||||||
attackCount += getDefendersCount(AV_STONEHEARTH_WAITING_HORDE, 10.0f, false);
|
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 (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;
|
BgObjective = mBossNeutral;
|
||||||
//std::ostringstream out;
|
//std::ostringstream out;
|
||||||
@@ -2984,7 +2984,7 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
|
|
||||||
if (Creature* mBossAlly = bg->GetBGCreature(AV_CPLACE_MINE_N_3))
|
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;
|
BgObjective = mBossAlly;
|
||||||
//std::ostringstream out;
|
//std::ostringstream out;
|
||||||
@@ -3075,7 +3075,7 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
{
|
{
|
||||||
if (Creature* mBossNeutral = bg->GetBGCreature(AV_CPLACE_MINE_S_3))
|
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;
|
BgObjective = mBossNeutral;
|
||||||
//std::ostringstream out;
|
//std::ostringstream out;
|
||||||
@@ -3086,7 +3086,7 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
|
|
||||||
if (Creature* mBossHorde = bg->GetBGCreature(AV_CPLACE_MINE_S_3))
|
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;
|
BgObjective = mBossHorde;
|
||||||
//std::ostringstream out;
|
//std::ostringstream out;
|
||||||
@@ -3320,9 +3320,9 @@ bool BGTactics::selectObjective(bool reset)
|
|||||||
|
|
||||||
for (auto const& objective : AB_AttackObjectives)
|
for (auto const& objective : AB_AttackObjectives)
|
||||||
{
|
{
|
||||||
if (arathiBasinBG->GetCapturePointInfo(objective)._ownerTeamId == BG_AB_NODE_STATE_NEUTRAL ||
|
if (arathiBasinBG->GetCapturePointInfo(objective)._state == BG_AB_NODE_STATE_NEUTRAL ||
|
||||||
((!defender || !objectives.size()) && arathiBasinBG->GetCapturePointInfo(objective)._ownerTeamId == BG_AB_NODE_STATE_ALLY_OCCUPIED) ||
|
((!defender || !objectives.size()) && arathiBasinBG->GetCapturePointInfo(objective)._state == BG_AB_NODE_STATE_ALLY_OCCUPIED) ||
|
||||||
((defender || !objectives.size()) && arathiBasinBG->GetCapturePointInfo(objective)._ownerTeamId == BG_AB_NODE_STATE_ALLY_CONTESTED))
|
((defender || !objectives.size()) && arathiBasinBG->GetCapturePointInfo(objective)._state == BG_AB_NODE_STATE_ALLY_CONTESTED))
|
||||||
{
|
{
|
||||||
if (GameObject* pGO = bg->GetBGObject(objective))
|
if (GameObject* pGO = bg->GetBGObject(objective))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class PlayerbotAI;
|
|||||||
|
|
||||||
struct ItemTemplate;
|
struct ItemTemplate;
|
||||||
|
|
||||||
enum RollVote : uint32;
|
enum RollVote : uint8;
|
||||||
|
|
||||||
class LootRollAction : public QueryItemUsageAction
|
class LootRollAction : public QueryItemUsageAction
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class FindDeadPlayer : public FindPlayerPredicate
|
|||||||
bool Check(Unit* unit) override
|
bool Check(Unit* unit) override
|
||||||
{
|
{
|
||||||
Player* player = unit->ToPlayer();
|
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:
|
private:
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ CreatureData const* BgMasterValue::NearestBm(bool allowDead)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Is the unit dead?
|
//Is the unit dead?
|
||||||
if (unit->getDeathState() == DEAD)
|
if (unit->getDeathState() == DeathState::Dead)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ bool IsDeadValue::Calculate()
|
|||||||
if (!target)
|
if (!target)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return target->getDeathState() != ALIVE;
|
return target->getDeathState() != DeathState::Alive;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PetIsDeadValue::Calculate()
|
bool PetIsDeadValue::Calculate()
|
||||||
@@ -51,7 +51,7 @@ bool PetIsDeadValue::Calculate()
|
|||||||
if (bot->GetPetGUID() && !bot->GetPet())
|
if (bot->GetPetGUID() && !bot->GetPet())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return bot->GetPet() && bot->GetPet()->getDeathState() != ALIVE;
|
return bot->GetPet() && bot->GetPet()->getDeathState() != DeathState::Alive;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PetIsHappyValue::Calculate()
|
bool PetIsHappyValue::Calculate()
|
||||||
|
|||||||
Reference in New Issue
Block a user