[Server] Move packet.Read() to parent

0.6.1
Koncord 8 years ago
parent 4daf471874
commit 47924f5bb0

@ -32,6 +32,9 @@ bool PlayerProcessor::Process(RakNet::Packet &packet) noexcept
PlayerPacket *myPacket = Networking::get().getPlayerController()->GetPacket(packet.data[0]);
myPacket->setPlayer(player);
if(!processor.second->dontRead)
myPacket->Read();
processor.second->Do(*myPacket, *player);
return true;
}

@ -41,6 +41,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet) noexcept
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s from %s", processor.second->strPacketID.c_str(),
player->npc.mName.c_str());
myPacket->setEvent(&baseEvent);
if(!processor.second->dontRead)
myPacket->Read();
processor.second->Do(*myPacket, *player, baseEvent);
return true;

@ -22,7 +22,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
Script::CallBackReturn<Script::CallbackIdentity("OnPlayerSendMessage")> result = true;
Script::Call<Script::CallbackIdentity("OnPlayerSendMessage")>(result, player.getId(), player.chatMessage.c_str());

@ -22,8 +22,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
Script::Call<Script::CallbackIdentity("OnGUIAction")>(player.getId(), (int)player.guiMessageBox.id,
player.guiMessageBox.data.c_str());
}

@ -22,9 +22,6 @@ namespace mwmp
{
if (!player.creatureStats.mDead)
{
packet.Read();
//packet.Send(&player, true);
Script::Call<Script::CallbackIdentity("OnPlayerLevelChange")>(player.getId());
}
}

@ -26,8 +26,6 @@ namespace mwmp
if (!player.creatureStats.mDead)
{
packet.Read();
Player *target = Players::getPlayer(player.attack.target);
if (target == nullptr)

@ -22,7 +22,6 @@ namespace mwmp
{
if (!player.creatureStats.mDead)
{
packet.Read();
//myPacket->Send(player, true);
player.sendToLoaded(&packet);

@ -28,8 +28,6 @@ namespace mwmp
if (!player.creatureStats.mDead)
{
packet.Read();
LOG_APPEND(Log::LOG_INFO, "- Moved to %s", player.cell.getDescription().c_str());
player.forEachLoaded([this](Player *pl, Player *other) {

@ -27,8 +27,6 @@ namespace mwmp
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID, player.npc.mName.c_str());
packet.Read();
CellController::get()->update(&player);
Script::Call<Script::CallbackIdentity("OnPlayerCellState")>(player.getId());

@ -21,8 +21,6 @@ namespace mwmp
void Do(PlayerPacket &packet, Player &player) override
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
}
};
}

@ -22,8 +22,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
if (player.charGenStage.current == player.charGenStage.end && player.charGenStage.current != 0)
Script::Call<Script::CallbackIdentity("OnPlayerEndCharGen")>(player.getId());
}

@ -17,6 +17,7 @@ namespace mwmp
ProcessorPlayerDeath()
{
BPP_INIT(ID_PLAYER_DEATH)
dontRead = true;
}
void Do(PlayerPacket &packet, Player &player) override

@ -22,9 +22,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
//packet.Send(&player, true);
player.sendToLoaded(&packet);
}
};

@ -22,8 +22,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
player.sendToLoaded(&packet);
}
};

@ -22,9 +22,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
//myPacket->Send(player, true);
player.sendToLoaded(&packet);
Script::Call<Script::CallbackIdentity("OnPlayerEquipmentChange")>(player.getId());

@ -21,8 +21,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
Script::Call<Script::CallbackIdentity("OnPlayerInventoryChange")>(player.getId());
}
};

@ -22,8 +22,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
Script::Call<Script::CallbackIdentity("OnPlayerJournalChange")>(player.getId());
}
};

@ -22,9 +22,6 @@ namespace mwmp
//DEBUG_PRINTF(strPacketID);
if (!player.creatureStats.mDead)
{
packet.Read();
//myPacket.Send(player, true); //send to other clients
player.sendToLoaded(&packet);
}
}

@ -16,6 +16,7 @@ namespace mwmp
ProcessorPlayerResurrect()
{
BPP_INIT(ID_PLAYER_RESURRECT)
dontRead = true;
}
void Do(PlayerPacket &packet, Player &player) override

@ -21,7 +21,6 @@ namespace mwmp
{
if (!player.creatureStats.mDead)
{
packet.Read();
//myPacket->Send(player, true);
player.sendToLoaded(&packet);

@ -21,8 +21,6 @@ namespace mwmp
{
DEBUG_PRINTF(strPacketID.c_str());
packet.Read();
Script::Call<Script::CallbackIdentity("OnPlayerSpellbookChange")>(player.getId());
}
};

Loading…
Cancel
Save