*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;
|
uint8 apply;
|
||||||
recv_data >> apply;
|
recv_data >> apply;
|
||||||
|
|
||||||
|
|
||||||
switch(apply)
|
switch(apply)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
_player->SetSeer(_player);
|
|
||||||
sLog.outDebug("Player %u set vision to self", _player->GetGUIDLow());
|
sLog.outDebug("Player %u set vision to self", _player->GetGUIDLow());
|
||||||
|
_player->SetSeer(_player);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
_player->SetSeer(_player->GetFarsightTarget());
|
|
||||||
sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetFarSightGUID(), _player->GetGUIDLow());
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
sLog.outDebug("Unhandled mode in CMSG_FAR_SIGHT: %u", apply);
|
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
|
bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const
|
||||||
{
|
{
|
||||||
// Always can see self
|
// Always can see self
|
||||||
if (m_mover == this)
|
if (m_mover == u)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// phased visibility (both must phased in same way)
|
// 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)
|
if(!target || target == this) // remove seer
|
||||||
return;
|
|
||||||
|
|
||||||
sLog.outDebug("Player::SetSeer: Player %s set object %u (TypeId: %u) as seer.", GetName(), target->GetEntry(), target->GetTypeId());
|
|
||||||
|
|
||||||
if(target == this)
|
|
||||||
{
|
{
|
||||||
if(GetFarSightGUID())
|
sLog.outDebug("Player::CreateSeer: Player %s remove seer", GetName());
|
||||||
{
|
SetUInt64Value(PLAYER_FARSIGHT, 0);
|
||||||
SetFarSightGUID(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->isType(TYPEMASK_UNIT))
|
|
||||||
((Unit*)m_seer)->RemovePlayerFromVision(this);
|
((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();
|
StopCastingBindSight();
|
||||||
SetFarSightGUID(target->GetGUID());
|
SetUInt64Value(PLAYER_FARSIGHT, target->GetGUID());
|
||||||
|
|
||||||
if(target->isType(TYPEMASK_UNIT))
|
if(target->isType(TYPEMASK_UNIT))
|
||||||
((Unit*)target)->AddPlayerToVision(this);
|
((Unit*)target)->AddPlayerToVision(this);
|
||||||
}
|
}
|
||||||
m_seer = target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::CanUseBattleGroundObject()
|
bool Player::CanUseBattleGroundObject()
|
||||||
|
|||||||
+3
-3
@@ -2053,12 +2053,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) { SetSeer(target); m_mover = target; }
|
void SetMover(Unit* target) { CreateSeer(target); m_mover = target; }
|
||||||
void SetSeer(WorldObject *target);
|
void CreateSeer(WorldObject *target);
|
||||||
|
void SetSeer(WorldObject *target) { m_seer = target; }
|
||||||
void StopCastingCharm() { Uncharm(); }
|
void StopCastingCharm() { Uncharm(); }
|
||||||
void StopCastingBindSight();
|
void StopCastingBindSight();
|
||||||
uint64 GetFarSightGUID() const { return GetUInt64Value(PLAYER_FARSIGHT); }
|
uint64 GetFarSightGUID() const { return GetUInt64Value(PLAYER_FARSIGHT); }
|
||||||
void SetFarSightGUID(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); }
|
|
||||||
WorldObject* GetFarsightTarget() const;
|
WorldObject* GetFarsightTarget() const;
|
||||||
// Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode
|
// Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode
|
||||||
void SetFarsightVision(bool apply) { m_farsightVision = apply; }
|
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 )
|
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)->SetSeer(m_target);
|
((Player*)m_target)->CreateSeer(NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2907,17 +2907,12 @@ void Aura::HandleBindSight(bool apply, bool Real)
|
|||||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((Player*)caster)->SetSeer(apply ? m_target : caster);
|
((Player*)caster)->CreateSeer(apply ? m_target : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aura::HandleFarSight(bool apply, bool Real)
|
void Aura::HandleFarSight(bool apply, bool Real)
|
||||||
{
|
{
|
||||||
//Handled by client
|
//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)
|
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
|
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)->SetSeer(dynObj);
|
((Player*)m_caster)->CreateSeer(dynObj);
|
||||||
//((Player*)m_caster)->UpdateVisibilityOf(dynObj);
|
//((Player*)m_caster)->UpdateVisibilityOf(dynObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user