diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/MiscHandler.cpp | 8 | ||||
-rw-r--r-- | src/game/Player.cpp | 31 | ||||
-rw-r--r-- | src/game/Player.h | 6 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 9 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 2 |
5 files changed, 22 insertions, 34 deletions
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index c406694cf11..9cfbcdf091d 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -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); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d3af537026f..0e4c90aa50c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -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() diff --git a/src/game/Player.h b/src/game/Player.h index c0d2483e1ef..dd64ce5c7d0 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -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; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 20878e0679a..cab3c84abe2 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -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) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 2298376d766..16a2efef8b3 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -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); } |