*Fix a typo that makes players can see invisible units.
*Update farsight target code. Only change seer when receive client request. --HG-- branch : trunk
This commit is contained in:
@@ -1435,16 +1435,18 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
|
||||
uint8 apply;
|
||||
recv_data >> apply;
|
||||
|
||||
|
||||
switch(apply)
|
||||
{
|
||||
case 0:
|
||||
_player->SetSeer(_player);
|
||||
sLog.outDebug("Player %u set vision to self", _player->GetGUIDLow());
|
||||
_player->SetSeer(_player);
|
||||
break;
|
||||
case 1:
|
||||
_player->SetSeer(_player->GetFarsightTarget());
|
||||
sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetFarSightGUID(), _player->GetGUIDLow());
|
||||
if(WorldObject *target = _player->GetFarsightTarget())
|
||||
_player->SetSeer(target);
|
||||
else
|
||||
sLog.outError("Player %s requests non-existing seer", _player->GetName());
|
||||
break;
|
||||
default:
|
||||
sLog.outDebug("Unhandled mode in CMSG_FAR_SIGHT: %u", apply);
|
||||
|
||||
+11
-20
@@ -18566,7 +18566,7 @@ void Player::ReportedAfkBy(Player* reporter)
|
||||
bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
|
||||
{
|
||||
// Always can see self
|
||||
if (m_mover == this)
|
||||
if (m_mover == u)
|
||||
return true;
|
||||
|
||||
// phased visibility (both must phased in same way)
|
||||
@@ -20181,34 +20181,25 @@ void Player::StopCastingBindSight()
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetSeer(WorldObject* target)
|
||||
void Player::CreateSeer(WorldObject* target)
|
||||
{
|
||||
if(target == m_seer)
|
||||
return;
|
||||
|
||||
sLog.outDebug("Player::SetSeer: Player %s set object %u (TypeId: %u) as seer.", GetName(), target->GetEntry(), target->GetTypeId());
|
||||
|
||||
if(target == this)
|
||||
if(!target || target == this) // remove seer
|
||||
{
|
||||
if(GetFarSightGUID())
|
||||
{
|
||||
SetFarSightGUID(0);
|
||||
WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
if(m_seer->isType(TYPEMASK_UNIT))
|
||||
sLog.outDebug("Player::CreateSeer: Player %s remove seer", GetName());
|
||||
SetUInt64Value(PLAYER_FARSIGHT, 0);
|
||||
//WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
|
||||
//GetSession()->SendPacket(&data);
|
||||
if(m_seer != this && m_seer->isType(TYPEMASK_UNIT))
|
||||
((Unit*)m_seer)->RemovePlayerFromVision(this);
|
||||
}
|
||||
else if(target->isType(TYPEMASK_SEER))
|
||||
else
|
||||
{
|
||||
sLog.outDebug("Player::CreateSeer: Player %s create seer %u (TypeId: %u).", GetName(), target->GetEntry(), target->GetTypeId());
|
||||
StopCastingBindSight();
|
||||
SetFarSightGUID(target->GetGUID());
|
||||
|
||||
SetUInt64Value(PLAYER_FARSIGHT, target->GetGUID());
|
||||
if(target->isType(TYPEMASK_UNIT))
|
||||
((Unit*)target)->AddPlayerToVision(this);
|
||||
}
|
||||
m_seer = target;
|
||||
}
|
||||
|
||||
bool Player::CanUseBattleGroundObject()
|
||||
|
||||
+3
-3
@@ -2053,12 +2053,12 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
void EnterVehicle(Vehicle *vehicle);
|
||||
void ExitVehicle(Vehicle *vehicle);
|
||||
|
||||
void SetMover(Unit* target) { SetSeer(target); m_mover = target; }
|
||||
void SetSeer(WorldObject *target);
|
||||
void SetMover(Unit* target) { CreateSeer(target); m_mover = target; }
|
||||
void CreateSeer(WorldObject *target);
|
||||
void SetSeer(WorldObject *target) { m_seer = target; }
|
||||
void StopCastingCharm() { Uncharm(); }
|
||||
void StopCastingBindSight();
|
||||
uint64 GetFarSightGUID() const { return GetUInt64Value(PLAYER_FARSIGHT); }
|
||||
void SetFarSightGUID(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); }
|
||||
WorldObject* GetFarsightTarget() const;
|
||||
// Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode
|
||||
void SetFarsightVision(bool apply) { m_farsightVision = apply; }
|
||||
|
||||
@@ -1982,7 +1982,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
||||
if( m_target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->Effect[0]==72 )
|
||||
{
|
||||
// spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425
|
||||
((Player*)m_target)->SetSeer(m_target);
|
||||
((Player*)m_target)->CreateSeer(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2907,17 +2907,12 @@ void Aura::HandleBindSight(bool apply, bool Real)
|
||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)caster)->SetSeer(apply ? m_target : caster);
|
||||
((Player*)caster)->CreateSeer(apply ? m_target : NULL);
|
||||
}
|
||||
|
||||
void Aura::HandleFarSight(bool apply, bool Real)
|
||||
{
|
||||
//Handled by client
|
||||
/*Unit* caster = GetCaster();
|
||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)caster)->SetFarSightGUID(apply ? m_target->GetGUID() : 0);*/
|
||||
}
|
||||
|
||||
void Aura::HandleAuraTrackCreatures(bool apply, bool Real)
|
||||
|
||||
@@ -3704,7 +3704,7 @@ void Spell::EffectAddFarsight(uint32 i)
|
||||
dynObj->GetMap()->Add(dynObj); //grid will also be loaded
|
||||
|
||||
// Need to update visibility of object for client to accept farsight guid
|
||||
((Player*)m_caster)->SetSeer(dynObj);
|
||||
((Player*)m_caster)->CreateSeer(dynObj);
|
||||
//((Player*)m_caster)->UpdateVisibilityOf(dynObj);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user