[10462] Implement spell 6495

Also implement proper work CMSG_FAR_SIGHT.
This packet control switch view point from far sight object to caster
and back wihtout modify far sight object seelction.
This commit is contained in:
VladimirMangos 2010-09-10 05:20:10 +04:00
parent 1341345216
commit aa90aa8fdf
5 changed files with 51 additions and 22 deletions

View file

@ -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()

View file

@ -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<class T>
void UpdateVisibilityOf(T * obj, UpdateData &d, std::set<WorldObject*>& vis);

View file

@ -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;
}
}

View file

@ -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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10461"
#define REVISION_NR "10462"
#endif // __REVISION_NR_H__