aboutsummaryrefslogtreecommitdiff
path: root/src/game/MiscHandler.cpp
diff options
context:
space:
mode:
authorgvcoman <none@none>2008-11-14 20:40:35 -0600
committergvcoman <none@none>2008-11-14 20:40:35 -0600
commit5deef1bb59ba53570d481a97e5c1df39ef316f37 (patch)
tree334e913e1247419d2ad485f1681e859aa8875044 /src/game/MiscHandler.cpp
parent3085e66b966fec0012decf2543c7e32064b47102 (diff)
[svn] * Reimplemented packet/update forwarding in more generic way
* Implemented far sight spells (Far Sight, Eagle Eye, etc) at unlimited range and properly forward packets * Implemented bind vision spells (Mind Vision, etc) to forward packets at unlimited distance * Implemented Sentry Totem (both vision switching/forwarding and alerting) * Other misc possession fixes * Added .bindsight and .unbindsight commands Please test out the above spells (including Mind Control) and report any issues on the forums. --HG-- branch : trunk
Diffstat (limited to 'src/game/MiscHandler.cpp')
-rw-r--r--src/game/MiscHandler.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 4c1129e6a98..c4c6d4fc110 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1391,21 +1391,33 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
sLog.outDebug("WORLD: CMSG_FAR_SIGHT");
//recv_data.hexlike();
- uint8 unk;
- recv_data >> unk;
+ uint8 apply;
+ recv_data >> apply;
+
+ CellPair pair;
- switch(unk)
+ switch(apply)
{
case 0:
- //WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0)
- //SendPacket(&data);
- //_player->SetUInt64Value(PLAYER_FARSIGHT, 0);
- sLog.outDebug("Removed FarSight from player %u", _player->GetGUIDLow());
+ _player->SetFarsightVision(false);
+ pair = Trinity::ComputeCellPair(_player->GetPositionX(), _player->GetPositionY());
+ sLog.outDebug("Player %u set vision to himself", _player->GetGUIDLow());
break;
case 1:
- sLog.outDebug("Added FarSight " I64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
+ _player->SetFarsightVision(true);
+ if (WorldObject* obj = _player->GetFarsightTarget())
+ pair = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
+ else
+ return;
+ sLog.outDebug("Player %u set vision to farsight target " I64FMTD ".", _player->GetGUIDLow(), _player->GetUInt64Value(PLAYER_FARSIGHT));
break;
+ default:
+ sLog.outDebug("Unhandled mode in CMSG_FAR_SIGHT: %u", apply);
+ return;
}
+ // Update visibility after vision change
+ Cell cell(pair);
+ GetPlayer()->GetMap()->UpdateObjectsVisibilityFor(_player, cell, pair);
}
void WorldSession::HandleChooseTitleOpcode( WorldPacket & recv_data )