[11457] Use ObjectGuid way work with PLAYER_DUEL_ARBITER.

This commit is contained in:
VladimirMangos 2011-05-09 20:28:20 +04:00
parent 7318bb0864
commit 1d781cd431
3 changed files with 17 additions and 22 deletions

View file

@ -1765,11 +1765,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// We have to perform this check before the teleport, otherwise the
// ObjectAccessor won't find the flag.
if (duel && GetMapId() != mapid)
{
GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER));
if (obj)
if (GameObject* obj = GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER)))
DuelComplete(DUEL_FLED);
}
// reset movement flags at teleport, because player will continue move with these flags after teleport
m_movementInfo.SetMovementFlags(MOVEFLAG_NONE);
@ -6894,17 +6891,16 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
//If players are too far way of duel flag... then player loose the duel
void Player::CheckDuelDistance(time_t currTime)
{
if(!duel)
if (!duel)
return;
uint64 duelFlagGUID = GetUInt64Value(PLAYER_DUEL_ARBITER);
GameObject* obj = GetMap()->GetGameObject(duelFlagGUID);
GameObject* obj = GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER));
if(!obj)
return;
if(duel->outOfBound == 0)
if (duel->outOfBound == 0)
{
if(!IsWithinDistInMap(obj, 50))
if (!IsWithinDistInMap(obj, 50))
{
duel->outOfBound = currTime;
@ -6914,14 +6910,14 @@ void Player::CheckDuelDistance(time_t currTime)
}
else
{
if(IsWithinDistInMap(obj, 40))
if (IsWithinDistInMap(obj, 40))
{
duel->outOfBound = 0;
WorldPacket data(SMSG_DUEL_INBOUNDS, 0);
GetSession()->SendPacket(&data);
}
else if(currTime >= (duel->outOfBound+10))
else if (currTime >= (duel->outOfBound+10))
{
DuelComplete(DUEL_FLED);
}
@ -6956,9 +6952,8 @@ void Player::DuelComplete(DuelCompleteType type)
}
//Remove Duel Flag object
GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER));
if(obj)
duel->initiator->RemoveGameObject(obj,true);
if (GameObject* obj = GetMap()->GetGameObject(GetGuidValue(PLAYER_DUEL_ARBITER)))
duel->initiator->RemoveGameObject(obj, true);
/* remove auras */
std::vector<uint32> auras2remove;
@ -6979,7 +6974,7 @@ void Player::DuelComplete(DuelCompleteType type)
if (!i->second->IsPositive() && i->second->GetCasterGuid() == duel->opponent->GetObjectGuid() && i->second->GetAuraApplyTime() >= duel->startTime)
auras2remove.push_back(i->second->GetId());
}
for(size_t i=0; i<auras2remove.size(); ++i)
for (size_t i=0; i<auras2remove.size(); ++i)
RemoveAurasDueToSpell(auras2remove[i]);
// cleanup combo points
@ -6994,9 +6989,9 @@ void Player::DuelComplete(DuelCompleteType type)
duel->opponent->ClearComboPoints();
//cleanups
SetUInt64Value(PLAYER_DUEL_ARBITER, 0);
SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid());
SetUInt32Value(PLAYER_DUEL_TEAM, 0);
duel->opponent->SetUInt64Value(PLAYER_DUEL_ARBITER, 0);
duel->opponent->SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid());
duel->opponent->SetUInt32Value(PLAYER_DUEL_TEAM, 0);
delete duel->opponent->duel;
@ -15670,7 +15665,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
ClearInCombat();
// make sure the unit is considered not in duel for proper loading
SetUInt64Value(PLAYER_DUEL_ARBITER, 0);
SetGuidValue(PLAYER_DUEL_ARBITER, ObjectGuid());
SetUInt32Value(PLAYER_DUEL_TEAM, 0);
// reset stats before loading any modifiers
@ -15682,7 +15677,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
// rest bonus can only be calculated after InitStatsForLevel()
m_rest_bonus = fields[21].GetFloat();
if(time_diff > 0)
if (time_diff > 0)
{
//speed collect rest bonus in offline, in logout, far from tavern, city (section/in hour)
float bubble0 = 0.031f;

View file

@ -7765,8 +7765,8 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx)
duel2->startTimer = 0;
target->duel = duel2;
caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
caster->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetObjectGuid());
target->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetObjectGuid());
}
void Spell::EffectStuck(SpellEffectIndex /*eff_idx*/)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11456"
#define REVISION_NR "11457"
#endif // __REVISION_NR_H__