diff --git a/src/game/Camera.cpp b/src/game/Camera.cpp index 6e0e8e163..120efbade 100644 --- a/src/game/Camera.cpp +++ b/src/game/Camera.cpp @@ -49,11 +49,10 @@ void Camera::UpdateForCurrentViewPoint() if (GridType* grid = m_source->GetViewPoint().m_grid) grid->AddWorldObject(this); - m_owner.SetUInt64Value(PLAYER_FARSIGHT, (m_source == &m_owner ? 0 : m_source->GetGUID())); UpdateVisibilityForOwner(); } -void Camera::SetView(WorldObject *obj) +void Camera::SetView(WorldObject *obj, bool update_far_sight_field /*= true*/) { MANGOS_ASSERT(obj); @@ -84,6 +83,9 @@ void Camera::SetView(WorldObject *obj) m_source->GetViewPoint().Attach(this); + if (update_far_sight_field) + m_owner.SetUInt64Value(PLAYER_FARSIGHT, (m_source == &m_owner ? 0 : m_source->GetGUID())); + UpdateForCurrentViewPoint(); } @@ -93,9 +95,9 @@ void Camera::Event_ViewPointVisibilityChanged() ResetView(); } -void Camera::ResetView() +void Camera::ResetView(bool update_far_sight_field /*= true*/) { - SetView(&m_owner); + SetView(&m_owner, update_far_sight_field); } void Camera::Event_AddedToWorld() diff --git a/src/game/Camera.h b/src/game/Camera.h index 4cacaa1ac..3a2cfaac7 100644 --- a/src/game/Camera.h +++ b/src/game/Camera.h @@ -43,10 +43,10 @@ class MANGOS_DLL_SPEC Camera // set camera's view to any worldobject // Note: this worldobject must be in same map, in same phase with camera's owner(player) // client supports only unit and dynamic objects as farsight objects - void SetView(WorldObject *obj); + void SetView(WorldObject *obj, bool update_far_sight_field = true); // set view to camera's owner - void ResetView(); + void ResetView(bool update_far_sight_field = true); template void UpdateVisibilityOf(T * obj, UpdateData &d, std::set& vis); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 6f7e3e51f..d752daa2b 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1287,19 +1287,22 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data ) DEBUG_LOG("WORLD: CMSG_FAR_SIGHT"); //recv_data.hexlike(); - uint8 unk; - recv_data >> unk; + uint8 op; + recv_data >> op; - switch(unk) + WorldObject* obj = _player->GetMap()->GetWorldObject(_player->GetFarSightGuid()); + if (!obj) + return; + + switch(op) { case 0: - //WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0) - //SendPacket(&data); - //_player->SetUInt64Value(PLAYER_FARSIGHT, 0); DEBUG_LOG("Removed FarSight from %s", _player->GetObjectGuid().GetString().c_str()); + _player->GetCamera().ResetView(false); break; case 1: DEBUG_LOG("Added FarSight %s to %s", _player->GetFarSightGuid().GetString().c_str(), _player->GetObjectGuid().GetString().c_str()); + _player->GetCamera().SetView(obj, false); break; } } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 92ea8a4dc..4ca3987f6 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2089,19 +2089,24 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } case SPELLFAMILY_SHAMAN: { - // Tidal Force - if (GetId() == 55198) + switch(GetId()) { - // apply max stack bufs - SpellEntry const* buffEntry = sSpellStore.LookupEntry(55166); - if (!buffEntry) - return; + case 55198: // Tidal Force + { + // apply max stack bufs + SpellEntry const* buffEntry = sSpellStore.LookupEntry(55166); + if (!buffEntry) + return; - for(uint32 k = 0; k < buffEntry->StackAmount; ++k) - target->CastSpell(target, buffEntry, true, NULL, this); + for(uint32 k = 0; k < buffEntry->StackAmount; ++k) + target->CastSpell(target, buffEntry, true, NULL, this); + + return; + } } + // Earth Shield - else if ((GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000))) + if ((GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000))) { // prevent double apply bonuses if (target->GetTypeId() != TYPEID_PLAYER || !((Player*)target)->GetSession()->PlayerLoading()) @@ -2621,7 +2626,26 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } break; case SPELLFAMILY_SHAMAN: + { + switch(GetId()) + { + case 6495: // Sentry Totem + { + if (target->GetTypeId() != TYPEID_PLAYER) + return; + + Totem* totem = target->GetTotem(TOTEM_SLOT_AIR); + + if (totem && apply) + ((Player*)target)->GetCamera().SetView(totem); + else + ((Player*)target)->GetCamera().ResetView(totem); + + return; + } + } break; + } } // pet auras diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1af37c7ee..ac1f7b37b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10461" + #define REVISION_NR "10462" #endif // __REVISION_NR_H__