Merge pull request #90 from H0zen/develop21

Fix playerbot module building
This commit is contained in:
MadMax 2016-02-22 18:27:43 +00:00
commit 5654238603
5 changed files with 34 additions and 37 deletions

View File

@ -698,24 +698,22 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
{ {
DEBUG_LOG("WORLD: Received opcode CMSG_AREATRIGGER");
uint32 Trigger_ID; uint32 Trigger_ID;
recv_data >> Trigger_ID; recv_data >> Trigger_ID;
DEBUG_LOG("Trigger ID: %u", Trigger_ID);
Player* player = GetPlayer();
if (player->IsTaxiFlying()) DEBUG_LOG("WORLD: Received opcode CMSG_AREATRIGGER");
DEBUG_LOG("Trigger ID: %u", Trigger_ID);
if (_player->IsTaxiFlying())
{ {
DEBUG_LOG("Player '%s' (GUID: %u) in flight, ignore Area Trigger ID: %u", player->GetName(), player->GetGUIDLow(), Trigger_ID); DEBUG_LOG("%s in flight, ignore Area Trigger ID: %u", _player->GetGuidStr().c_str(), Trigger_ID);
return; return;
} }
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry) if (!atEntry)
{ {
DEBUG_LOG("Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID: %u", player->GetName(), player->GetGUIDLow(), Trigger_ID); DEBUG_LOG("%s send unknown (by DBC) Area Trigger ID: %u", _player->GetGuidStr().c_str(), Trigger_ID);
return; return;
} }
@ -723,23 +721,23 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
const float delta = 5.0f; const float delta = 5.0f;
// check if player in the range of areatrigger // check if player in the range of areatrigger
if (!IsPointInAreaTriggerZone(atEntry, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), delta)) if (!IsPointInAreaTriggerZone(atEntry, _player->GetMapId(), _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), delta))
{ {
DEBUG_LOG("Player '%s' (GUID: %u) too far, ignore Area Trigger ID: %u", player->GetName(), player->GetGUIDLow(), Trigger_ID); DEBUG_LOG("%s too far, ignore Area Trigger ID: %u", _player->GetGuidStr().c_str(), Trigger_ID);
return; return;
} }
if (sScriptMgr.OnAreaTrigger(player, atEntry)) if (sScriptMgr.OnAreaTrigger(_player, atEntry))
{ return; } { return; }
uint32 quest_id = sObjectMgr.GetQuestForAreaTrigger(Trigger_ID); uint32 quest_id = sObjectMgr.GetQuestForAreaTrigger(Trigger_ID);
if (quest_id && player->IsAlive() && player->IsActiveQuest(quest_id)) if (quest_id && _player->IsAlive() && _player->IsActiveQuest(quest_id))
{ {
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id); Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
if (pQuest) if (pQuest)
{ {
if (player->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE) if (_player->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE)
{ player->AreaExploredOrEventHappens(quest_id); } { _player->AreaExploredOrEventHappens(quest_id); }
} }
} }
@ -747,19 +745,19 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
if (sObjectMgr.IsTavernAreaTrigger(Trigger_ID)) if (sObjectMgr.IsTavernAreaTrigger(Trigger_ID))
{ {
// set resting flag we are in the inn // set resting flag we are in the inn
if (player->GetRestType() != REST_TYPE_IN_CITY) if (_player->GetRestType() != REST_TYPE_IN_CITY)
{ player->SetRestType(REST_TYPE_IN_TAVERN, Trigger_ID); } { _player->SetRestType(REST_TYPE_IN_TAVERN, Trigger_ID); }
return; return;
} }
if (BattleGround* bg = player->GetBattleGround()) if (BattleGround* bg = _player->GetBattleGround())
{ {
bg->HandleAreaTrigger(player, Trigger_ID); bg->HandleAreaTrigger(_player, Trigger_ID);
return; return;
} }
else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(player->GetCachedZoneId())) else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(_player->GetCachedZoneId()))
{ {
if (outdoorPvP->HandleAreaTrigger(player, Trigger_ID)) if (outdoorPvP->HandleAreaTrigger(_player, Trigger_ID))
{ return; } { return; }
} }
@ -773,10 +771,10 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
{ return; } { return; }
// ghost resurrected at enter attempt to dungeon with corpse (including fail enter cases) // ghost resurrected at enter attempt to dungeon with corpse (including fail enter cases)
if (!player->IsAlive() && targetMapEntry->IsDungeon()) if (!_player->IsAlive() && targetMapEntry->IsDungeon())
{ {
int32 corpseMapId = 0; int32 corpseMapId = 0;
if (Corpse* corpse = player->GetCorpse()) if (Corpse* corpse = _player->GetCorpse())
{ corpseMapId = corpse->GetMapId(); } { corpseMapId = corpse->GetMapId(); }
// check back way from corpse to entrance // check back way from corpse to entrance
@ -795,8 +793,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
// corpse not in dungeon or some linked deep dungeons // corpse not in dungeon or some linked deep dungeons
if (!instance_map) if (!instance_map)
{ {
player->GetSession()->SendAreaTriggerMessage("You can not enter %s while in a ghost mode", _player->GetSession()->SendAreaTriggerMessage("You can not enter %s while in a ghost mode",
targetMapEntry->name[player->GetSession()->GetSessionDbcLocale()]); targetMapEntry->name[_player->GetSession()->GetSessionDbcLocale()]);
return; return;
} }
@ -813,20 +811,20 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
} }
// now we can resurrect player, and then check teleport requirements // now we can resurrect player, and then check teleport requirements
player->ResurrectPlayer(0.5f); _player->ResurrectPlayer(0.5f);
player->SpawnCorpseBones(); _player->SpawnCorpseBones();
} }
uint32 miscRequirement = 0; uint32 miscRequirement = 0;
AreaLockStatus lockStatus = player->GetAreaTriggerLockStatus(at, miscRequirement); AreaLockStatus lockStatus = _player->GetAreaTriggerLockStatus(at, miscRequirement);
if (lockStatus != AREA_LOCKSTATUS_OK) if (lockStatus != AREA_LOCKSTATUS_OK)
{ {
player->SendTransferAbortedByLockStatus(targetMapEntry, lockStatus, miscRequirement); _player->SendTransferAbortedByLockStatus(targetMapEntry, lockStatus, miscRequirement);
return; return;
} }
// teleport player // teleport player
player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT, true); _player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT, true);
} }
void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data) void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data)

View File

@ -45,7 +45,7 @@ void LootTargetList::shrink(time_t fromTime)
} }
LootObject::LootObject(Player* bot, ObjectGuid guid) LootObject::LootObject(Player* bot, ObjectGuid guid)
: guid(), skillId(SKILL_NONE), reqSkillValue(0), reqItem(NULL) : guid(), skillId(SKILL_NONE), reqSkillValue(0), reqItem(0)
{ {
Refresh(bot, guid); Refresh(bot, guid);
} }
@ -54,7 +54,7 @@ void LootObject::Refresh(Player* bot, ObjectGuid guid)
{ {
skillId = SKILL_NONE; skillId = SKILL_NONE;
reqSkillValue = 0; reqSkillValue = 0;
reqItem = NULL; reqItem = 0;
this->guid = ObjectGuid(); this->guid = ObjectGuid();
PlayerbotAI* ai = bot->GetPlayerbotAI(); PlayerbotAI* ai = bot->GetPlayerbotAI();

View File

@ -14,7 +14,7 @@ namespace ai
class FindItemVisitor : public IterateItemsVisitor { class FindItemVisitor : public IterateItemsVisitor {
public: public:
FindItemVisitor() : IterateItemsVisitor(), result(NULL) {} FindItemVisitor() : IterateItemsVisitor() {}
virtual bool Visit(Item* item) virtual bool Visit(Item* item)
{ {

View File

@ -28,13 +28,12 @@ bool ReachAreaTriggerAction::Execute(Event event)
return true; return true;
} }
if (at->requiredLevel > bot->getLevel()) if (at->condition && !sObjectMgr.IsPlayerMeetToCondition(at->condition, bot, bot->GetMap(), NULL, CONDITION_AREA_TRIGGER))
{ {
ostringstream out; out << "I won't follow: |h|cff00ff00" << (int)at->requiredLevel << "|h|cffffffff level is required"; ai->TellMaster("I won't follow: I don't meet the conditions");
ai->TellMaster(out);
return false; return false;
} }
if (bot->GetMapId() != atEntry->mapid || bot->GetDistance(atEntry->x, atEntry->y, atEntry->z) > sPlayerbotAIConfig.sightDistance) if (bot->GetMapId() != atEntry->mapid || bot->GetDistance(atEntry->x, atEntry->y, atEntry->z) > sPlayerbotAIConfig.sightDistance)
{ {
ai->TellMaster("I won't follow: too far away"); ai->TellMaster("I won't follow: too far away");

View File

@ -31,7 +31,7 @@ bool TeleportAction::Execute(Event event)
Spell *spell = new Spell(bot, pSpellInfo, false); Spell *spell = new Spell(bot, pSpellInfo, false);
SpellCastTargets targets; SpellCastTargets targets;
targets.setUnitTarget(bot); targets.setUnitTarget(bot);
spell->prepare(&targets, false); spell->prepare(&targets, NULL);
spell->cast(true); spell->cast(true);
return true; return true;
} }