|
|
|
@ -22,13 +22,30 @@ namespace mwmp
|
|
|
|
|
|
|
|
|
|
virtual void Do(ActorPacket &packet, ActorList &actorList)
|
|
|
|
|
{
|
|
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str());
|
|
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str());
|
|
|
|
|
|
|
|
|
|
// Never initialize LocalActors in a cell that is no longer loaded, if the server's packet arrived too late
|
|
|
|
|
if (mwmp::Main::get().getCellController()->isActiveWorldCell(actorList.cell))
|
|
|
|
|
{
|
|
|
|
|
Main::get().getCellController()->initializeLocalActors(actorList.cell);
|
|
|
|
|
Main::get().getCellController()->getCell(actorList.cell)->updateLocal(true);
|
|
|
|
|
if (isLocal())
|
|
|
|
|
{
|
|
|
|
|
LOG_APPEND(Log::LOG_INFO, "- The new authority is me");
|
|
|
|
|
Main::get().getCellController()->initializeLocalActors(actorList.cell);
|
|
|
|
|
Main::get().getCellController()->getCell(actorList.cell)->updateLocal(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BasePlayer *player = PlayerList::getPlayer(guid);
|
|
|
|
|
|
|
|
|
|
if (player != 0)
|
|
|
|
|
LOG_APPEND(Log::LOG_INFO, "- The new authority is %s", player->npc.mName.c_str());
|
|
|
|
|
|
|
|
|
|
Main::get().getCellController()->getCell(actorList.cell)->uninitializeLocalActors();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LOG_APPEND(Log::LOG_INFO, "- Ignoring it because that cell isn't loaded");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|