mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-06 04:23:47 +00:00
fix(Core\OpCode): HandleFarSightOpcode (#9965)
* Change TO ThreadUNSAFE This will process the far sight packet as a is not thread-safe - process it in World::UpdateSessions() compared to the former packet is thread-safe - process it in Map::Update(). This matches up with tc in everything we have with the HandleFarSightOpcode. * Further Adjustments * Move to Debug Loggin TC has it as move to Debug Logging. Stating its a weird opcode handling issue which is not really known why.
This commit is contained in:
@@ -12385,13 +12385,6 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
// target must be in world
|
||||
if (!target->IsInWorld())
|
||||
return;
|
||||
|
||||
if (!IsInWorld() || IsDuringRemoveFromWorld())
|
||||
return;
|
||||
|
||||
LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId());
|
||||
|
||||
if (!AddGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
|
||||
@@ -12405,6 +12398,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
|
||||
|
||||
if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
|
||||
((Unit*)target)->AddPlayerToVision(this);
|
||||
SetSeer(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -12413,15 +12407,18 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
|
||||
|
||||
LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s remove seer", GetName().c_str());
|
||||
|
||||
if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
|
||||
((Unit*)target)->RemovePlayerFromVision(this);
|
||||
|
||||
if (!RemoveGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
|
||||
{
|
||||
LOG_FATAL("entities.player", "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
|
||||
static_cast<Unit*>(target)->RemovePlayerFromVision(this);
|
||||
|
||||
// must immediately set seer back otherwise may crash
|
||||
SetSeer(this);
|
||||
|
||||
//WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
|
||||
//GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user