mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +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);
|
||||
}
|
||||
|
||||
@@ -351,19 +351,6 @@ Unit::~Unit()
|
||||
ASSERT(!m_attacking);
|
||||
ASSERT(m_attackers.empty());
|
||||
|
||||
// pussywizard: clear m_sharedVision along with back references
|
||||
if (!m_sharedVision.empty())
|
||||
{
|
||||
LOG_INFO("misc", "Unit::~Unit (B1)");
|
||||
do
|
||||
{
|
||||
LOG_INFO("misc", "Unit::~Unit (B2)");
|
||||
Player* p = *(m_sharedVision.begin());
|
||||
p->m_isInSharedVisionOf.erase(this);
|
||||
m_sharedVision.erase(p);
|
||||
} while (!m_sharedVision.empty());
|
||||
}
|
||||
|
||||
ASSERT(m_Controlled.empty());
|
||||
ASSERT(m_appliedAuras.empty());
|
||||
ASSERT(m_ownedAuras.empty());
|
||||
@@ -10624,15 +10611,13 @@ void Unit::AddPlayerToVision(Player* player)
|
||||
setActive(true);
|
||||
SetWorldObject(true);
|
||||
}
|
||||
m_sharedVision.insert(player);
|
||||
player->m_isInSharedVisionOf.insert(this);
|
||||
m_sharedVision.push_back(player);
|
||||
}
|
||||
|
||||
// only called in Player::SetSeer
|
||||
void Unit::RemovePlayerFromVision(Player* player)
|
||||
{
|
||||
m_sharedVision.erase(player);
|
||||
player->m_isInSharedVisionOf.erase(this);
|
||||
m_sharedVision.remove(player);
|
||||
if (m_sharedVision.empty())
|
||||
{
|
||||
setActive(false);
|
||||
|
||||
@@ -1196,7 +1196,7 @@ struct UnitActionBarEntry
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<Player*> SharedVisionList;
|
||||
typedef std::list<Player*> SharedVisionList;
|
||||
|
||||
enum CharmType
|
||||
{
|
||||
|
||||
@@ -1224,7 +1224,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
|
||||
_player->SetSeer(target);
|
||||
else
|
||||
{
|
||||
LOG_ERROR("network.opcode", "Player %s requests non-existing seer %s", _player->GetName().c_str(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str());
|
||||
LOG_DEBUG("network.opcode", "Player %s requests non-existing seer %s", _player->GetName().c_str(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -762,7 +762,7 @@ void OpcodeTable::Initialize()
|
||||
/*0x277*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PLAY_MUSIC, STATUS_NEVER);
|
||||
/*0x278*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PLAY_OBJECT_SOUND, STATUS_NEVER);
|
||||
/*0x279*/ DEFINE_HANDLER(CMSG_REQUEST_PET_INFO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRequestPetInfoOpcode );
|
||||
/*0x27A*/ DEFINE_HANDLER(CMSG_FAR_SIGHT, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleFarSightOpcode );
|
||||
/*0x27A*/ DEFINE_HANDLER(CMSG_FAR_SIGHT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleFarSightOpcode );
|
||||
/*0x27B*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELLDISPELLOG, STATUS_NEVER);
|
||||
/*0x27C*/ DEFINE_SERVER_OPCODE_HANDLER(SMSG_DAMAGE_CALC_LOG, STATUS_NEVER);
|
||||
/*0x27D*/ DEFINE_HANDLER(CMSG_ENABLE_DAMAGE_LOG, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
|
||||
Reference in New Issue
Block a user