*Set seer back when it is removed to prevent crash.
--HG-- branch : trunk
This commit is contained in:
@@ -1442,8 +1442,8 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
|
|||||||
_player->SetSeer(_player);
|
_player->SetSeer(_player);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetFarSightGUID(), _player->GetGUIDLow());
|
sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
|
||||||
if(WorldObject *target = _player->GetFarsightTarget())
|
if(WorldObject *target = _player->GetViewpoint())
|
||||||
_player->SetSeer(target);
|
_player->SetSeer(target);
|
||||||
else
|
else
|
||||||
sLog.outError("Player %s requests non-existing seer", _player->GetName());
|
sLog.outError("Player %s requests non-existing seer", _player->GetName());
|
||||||
|
|||||||
+14
-22
@@ -20191,46 +20191,31 @@ void Player::HandleFallUnderMap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void Player::SetViewport(uint64 guid, bool moveable)
|
|
||||||
{
|
|
||||||
WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, 8+1);
|
|
||||||
data.appendPackGUID(guid); // Packed guid of object to set client's view to
|
|
||||||
data << (moveable ? uint8(0x01) : uint8(0x00)); // 0 - can't move; 1 - can move
|
|
||||||
m_session->SendPacket(&data);
|
|
||||||
sLog.outDetail("Viewport for "I64FMT" (%s) changed to "I64FMT, GetGUID(), GetName(), guid);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
WorldObject* Player::GetFarsightTarget() const
|
|
||||||
{
|
|
||||||
// Players can have in farsight field another player's guid, a creature's guid, or a dynamic object's guid
|
|
||||||
if(uint64 guid = GetFarSightGUID())
|
|
||||||
return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_SEER);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::StopCastingBindSight()
|
void Player::StopCastingBindSight()
|
||||||
{
|
{
|
||||||
if (WorldObject* target = GetFarsightTarget())
|
if(WorldObject* target = GetViewpoint())
|
||||||
{
|
{
|
||||||
if (target->isType(TYPEMASK_UNIT))
|
if(target->isType(TYPEMASK_UNIT))
|
||||||
((Unit*)target)->RemoveAuraTypeByCaster(SPELL_AURA_BIND_SIGHT, GetGUID());
|
((Unit*)target)->RemoveAuraTypeByCaster(SPELL_AURA_BIND_SIGHT, GetGUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::CreateSeer(WorldObject* target)
|
void Player::CreateViewpoint(WorldObject* target)
|
||||||
{
|
{
|
||||||
if(!target || target == this) // remove seer
|
if(!target || target == this) // remove seer
|
||||||
{
|
{
|
||||||
sLog.outDebug("Player::CreateSeer: Player %s remove seer", GetName());
|
sLog.outDebug("Player::CreateViewpoint: Player %s remove seer", GetName());
|
||||||
SetUInt64Value(PLAYER_FARSIGHT, 0);
|
SetUInt64Value(PLAYER_FARSIGHT, 0);
|
||||||
//WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
|
//WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
|
||||||
//GetSession()->SendPacket(&data);
|
//GetSession()->SendPacket(&data);
|
||||||
if(m_seer != this && m_seer->isType(TYPEMASK_UNIT))
|
if(m_seer != this && m_seer->isType(TYPEMASK_UNIT))
|
||||||
((Unit*)m_seer)->RemovePlayerFromVision(this);
|
((Unit*)m_seer)->RemovePlayerFromVision(this);
|
||||||
|
//must immediately set seer back otherwise may crash
|
||||||
|
m_seer = this;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outDebug("Player::CreateSeer: Player %s create seer %u (TypeId: %u).", GetName(), target->GetEntry(), target->GetTypeId());
|
sLog.outDebug("Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName(), target->GetEntry(), target->GetTypeId());
|
||||||
StopCastingBindSight();
|
StopCastingBindSight();
|
||||||
SetUInt64Value(PLAYER_FARSIGHT, target->GetGUID());
|
SetUInt64Value(PLAYER_FARSIGHT, target->GetGUID());
|
||||||
if(target->isType(TYPEMASK_UNIT))
|
if(target->isType(TYPEMASK_UNIT))
|
||||||
@@ -20238,6 +20223,13 @@ void Player::CreateSeer(WorldObject* target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WorldObject* Player::GetViewpoint() const
|
||||||
|
{
|
||||||
|
if(uint64 guid = GetUInt64Value(PLAYER_FARSIGHT))
|
||||||
|
return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_SEER);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bool Player::CanUseBattleGroundObject()
|
bool Player::CanUseBattleGroundObject()
|
||||||
{
|
{
|
||||||
return ( //InBattleGround() && // in battleground - not need, check in other cases
|
return ( //InBattleGround() && // in battleground - not need, check in other cases
|
||||||
|
|||||||
+3
-7
@@ -2057,16 +2057,12 @@ class TRINITY_DLL_SPEC Player : public Unit
|
|||||||
void EnterVehicle(Vehicle *vehicle);
|
void EnterVehicle(Vehicle *vehicle);
|
||||||
void ExitVehicle(Vehicle *vehicle);
|
void ExitVehicle(Vehicle *vehicle);
|
||||||
|
|
||||||
void SetMover(Unit* target) { CreateSeer(target); m_mover = target; }
|
void SetMover(Unit* target) { CreateViewpoint(target); m_mover = target; }
|
||||||
void CreateSeer(WorldObject *target);
|
|
||||||
void SetSeer(WorldObject *target) { m_seer = target; }
|
void SetSeer(WorldObject *target) { m_seer = target; }
|
||||||
|
void CreateViewpoint(WorldObject *target);
|
||||||
|
WorldObject* GetViewpoint() const;
|
||||||
void StopCastingCharm() { Uncharm(); }
|
void StopCastingCharm() { Uncharm(); }
|
||||||
void StopCastingBindSight();
|
void StopCastingBindSight();
|
||||||
uint64 GetFarSightGUID() const { return GetUInt64Value(PLAYER_FARSIGHT); }
|
|
||||||
WorldObject* GetFarsightTarget() const;
|
|
||||||
// Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode
|
|
||||||
void SetFarsightVision(bool apply) { m_farsightVision = apply; }
|
|
||||||
bool HasFarsightVision() const { return m_farsightVision; }
|
|
||||||
|
|
||||||
// Transports
|
// Transports
|
||||||
Transport * GetTransport() const { return m_transport; }
|
Transport * GetTransport() const { return m_transport; }
|
||||||
|
|||||||
@@ -2001,7 +2001,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||||||
if( m_target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->Effect[0]==72 )
|
if( m_target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->Effect[0]==72 )
|
||||||
{
|
{
|
||||||
// spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425
|
// spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425
|
||||||
((Player*)m_target)->CreateSeer(NULL);
|
((Player*)m_target)->CreateViewpoint(NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2949,7 +2949,7 @@ void Aura::HandleBindSight(bool apply, bool Real)
|
|||||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((Player*)caster)->CreateSeer(apply ? m_target : NULL);
|
((Player*)caster)->CreateViewpoint(apply ? m_target : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aura::HandleFarSight(bool apply, bool Real)
|
void Aura::HandleFarSight(bool apply, bool Real)
|
||||||
|
|||||||
@@ -3657,7 +3657,7 @@ void Spell::EffectAddFarsight(uint32 i)
|
|||||||
dynObj->GetMap()->Add(dynObj); //grid will also be loaded
|
dynObj->GetMap()->Add(dynObj); //grid will also be loaded
|
||||||
|
|
||||||
// Need to update visibility of object for client to accept farsight guid
|
// Need to update visibility of object for client to accept farsight guid
|
||||||
((Player*)m_caster)->CreateSeer(dynObj);
|
((Player*)m_caster)->CreateViewpoint(dynObj);
|
||||||
//((Player*)m_caster)->UpdateVisibilityOf(dynObj);
|
//((Player*)m_caster)->UpdateVisibilityOf(dynObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user