Merge remote-tracking branch 'zero/develop21' into develop21

This commit is contained in:
Olion 2016-02-22 23:20:21 +02:00
commit c571e47a8a
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)
{
DEBUG_LOG("WORLD: Received opcode CMSG_AREATRIGGER");
uint32 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;
}
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
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;
}
@ -723,23 +721,23 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
const float delta = 5.0f;
// 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;
}
if (sScriptMgr.OnAreaTrigger(player, atEntry))
if (sScriptMgr.OnAreaTrigger(_player, atEntry))
{ return; }
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);
if (pQuest)
{
if (player->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE)
{ player->AreaExploredOrEventHappens(quest_id); }
if (_player->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE)
{ _player->AreaExploredOrEventHappens(quest_id); }
}
}
@ -747,19 +745,19 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
if (sObjectMgr.IsTavernAreaTrigger(Trigger_ID))
{
// set resting flag we are in the inn
if (player->GetRestType() != REST_TYPE_IN_CITY)
{ player->SetRestType(REST_TYPE_IN_TAVERN, Trigger_ID); }
if (_player->GetRestType() != REST_TYPE_IN_CITY)
{ _player->SetRestType(REST_TYPE_IN_TAVERN, Trigger_ID); }
return;
}
if (BattleGround* bg = player->GetBattleGround())
if (BattleGround* bg = _player->GetBattleGround())
{
bg->HandleAreaTrigger(player, Trigger_ID);
bg->HandleAreaTrigger(_player, Trigger_ID);
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; }
}
@ -773,10 +771,10 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
{ return; }
// 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;
if (Corpse* corpse = player->GetCorpse())
if (Corpse* corpse = _player->GetCorpse())
{ corpseMapId = corpse->GetMapId(); }
// 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
if (!instance_map)
{
player->GetSession()->SendAreaTriggerMessage("You can not enter %s while in a ghost mode",
targetMapEntry->name[player->GetSession()->GetSessionDbcLocale()]);
_player->GetSession()->SendAreaTriggerMessage("You can not enter %s while in a ghost mode",
targetMapEntry->name[_player->GetSession()->GetSessionDbcLocale()]);
return;
}
@ -813,20 +811,20 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
}
// now we can resurrect player, and then check teleport requirements
player->ResurrectPlayer(0.5f);
player->SpawnCorpseBones();
_player->ResurrectPlayer(0.5f);
_player->SpawnCorpseBones();
}
uint32 miscRequirement = 0;
AreaLockStatus lockStatus = player->GetAreaTriggerLockStatus(at, miscRequirement);
AreaLockStatus lockStatus = _player->GetAreaTriggerLockStatus(at, miscRequirement);
if (lockStatus != AREA_LOCKSTATUS_OK)
{
player->SendTransferAbortedByLockStatus(targetMapEntry, lockStatus, miscRequirement);
_player->SendTransferAbortedByLockStatus(targetMapEntry, lockStatus, miscRequirement);
return;
}
// 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)

View File

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

View File

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

View File

@ -28,13 +28,12 @@ bool ReachAreaTriggerAction::Execute(Event event)
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(out);
ai->TellMaster("I won't follow: I don't meet the conditions");
return false;
}
if (bot->GetMapId() != atEntry->mapid || bot->GetDistance(atEntry->x, atEntry->y, atEntry->z) > sPlayerbotAIConfig.sightDistance)
{
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);
SpellCastTargets targets;
targets.setUnitTarget(bot);
spell->prepare(&targets, false);
spell->prepare(&targets, NULL);
spell->cast(true);
return true;
}