[General] Extract BaseEvent & BasePlayer from packets to functions

Move Send and Read functions to BasePacket
0.6.1
Koncord 8 years ago
parent 6076346df4
commit 690211ad99

@ -67,7 +67,9 @@ void Cell::sendToLoaded(mwmp::WorldPacket *worldPacket, mwmp::BaseEvent *baseEve
for (auto pl : plList)
{
if (pl->guid == baseEvent->guid) continue;
worldPacket->Send(baseEvent, pl->guid);
worldPacket->setEvent(baseEvent);
worldPacket->setGUID(pl->guid);
worldPacket->Send();
}
}

@ -76,8 +76,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (packet->data[0] == ID_HANDSHAKE)
{
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
if (player->isHandshaked())
{
@ -115,7 +115,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (!result)
{
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(Players::getPlayer(packet->guid), false);
playerController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(Players::getPlayer(packet->guid));
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(false);
Players::deletePlayer(packet->guid);
return;
}
@ -124,8 +125,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_BASEINFO about %s", player->npc.mName.c_str());
myPacket->Read(player);
myPacket->Send(player, true);
myPacket->setPlayer(player);
myPacket->Read();
myPacket->Send(true);
}
if (player->getLoadState() == Player::NOTLOADED)
@ -154,7 +156,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (!player->creatureStats.mDead)
{
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
//myPacket->Send(player, true); //send to other clients
player->sendToLoaded(myPacket);
@ -169,7 +172,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (!player->creatureStats.mDead)
{
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
LOG_APPEND(Log::LOG_INFO, "- Moved to %s", player->cell.getDescription().c_str());
@ -184,25 +188,40 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
LOG_APPEND(Log::LOG_INFO, "- Started information exchange with %s", other->npc.mName.c_str());
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(other, pl->guid);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(other, pl->guid);
playerController->GetPacket(ID_PLAYER_POS)->Send(other, pl->guid);
playerController->GetPacket(ID_PLAYER_SKILL)->Send(other, pl->guid);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(other, pl->guid);
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->Send(other, pl->guid);
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(pl, other->guid);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(pl, other->guid);
playerController->GetPacket(ID_PLAYER_SKILL)->Send(pl, other->guid);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(pl, other->guid);
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->Send(pl, other->guid);
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(other);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(other);
playerController->GetPacket(ID_PLAYER_POS)->setPlayer(other);
playerController->GetPacket(ID_PLAYER_SKILL)->setPlayer(other);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(other);
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->setPlayer(other);
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(pl->guid);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(pl->guid);
playerController->GetPacket(ID_PLAYER_POS)->Send(pl->guid);
playerController->GetPacket(ID_PLAYER_SKILL)->Send(pl->guid);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(pl->guid);
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->Send(pl->guid);
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(pl);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl);
playerController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl);
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->setPlayer(pl);
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(other->guid);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(other->guid);
playerController->GetPacket(ID_PLAYER_SKILL)->Send(other->guid);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(other->guid);
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->Send(other->guid);
LOG_APPEND(Log::LOG_INFO, "- Finished information exchange with %s", other->npc.mName.c_str());
}
});
playerController->GetPacket(ID_PLAYER_POS)->Send(player);
myPacket->Send(player, true); //send to other clients
playerController->GetPacket(ID_PLAYER_POS)->setPlayer(player);
playerController->GetPacket(ID_PLAYER_POS)->Send();
myPacket->setPlayer(player);
myPacket->Send(true); //send to other clients
Script::Call<Script::CallbackIdentity("OnPlayerCellChange")>(player->getId());
@ -217,7 +236,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_CELL_STATE from %s", player->npc.mName.c_str());
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
CellController::get()->update(player);
@ -230,7 +250,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (!player->creatureStats.mDead)
{
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
//myPacket->Send(player, true);
player->sendToLoaded(myPacket);
@ -245,7 +266,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (!player->creatureStats.mDead)
{
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
//myPacket->Send(player, true);
player->sendToLoaded(myPacket);
@ -259,7 +281,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (!player->creatureStats.mDead)
{
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
//myPacket->Send(player, true);
Script::Call<Script::CallbackIdentity("OnPlayerLevelChange")>(player->getId());
@ -271,7 +294,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
DEBUG_PRINTF("ID_PLAYER_EQUIPMENT\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
//myPacket->Send(player, true);
player->sendToLoaded(myPacket);
@ -284,7 +308,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
case ID_PLAYER_INVENTORY:
{
DEBUG_PRINTF("ID_PLAYER_INVENTORY\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
Script::Call<Script::CallbackIdentity("OnPlayerInventoryChange")>(player->getId());
@ -294,7 +320,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
case ID_PLAYER_SPELLBOOK:
{
DEBUG_PRINTF("ID_PLAYER_SPELLBOOK\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
Script::Call<Script::CallbackIdentity("OnPlayerSpellbookChange")>(player->getId());
@ -304,7 +332,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
case ID_PLAYER_JOURNAL:
{
DEBUG_PRINTF("ID_PLAYER_JOURNAL\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
Script::Call<Script::CallbackIdentity("OnPlayerJournalChange")>(player->getId());
@ -317,7 +347,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (!player->creatureStats.mDead)
{
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
Player *target = Players::getPlayer(player->attack.target);
@ -347,7 +379,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
case ID_PLAYER_DYNAMICSTATS:
{
DEBUG_PRINTF("ID_PLAYER_DYNAMICSTATS\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
//myPacket->Send(player, true);
player->sendToLoaded(myPacket);
@ -376,7 +410,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
player->resetLastAttacker();
player->creatureStats.mDead = true;
myPacket->Send(player, true);
myPacket->setPlayer(player);
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnPlayerDeath")>(player->getId(), reason, killer->getId());
@ -388,7 +424,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_RESURRECT from %s", player->npc.mName.c_str());
player->creatureStats.mDead = false;
myPacket->Send(player, true);
myPacket->setPlayer(player);
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->getId());
@ -398,7 +436,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
case ID_PLAYER_DRAWSTATE:
{
DEBUG_PRINTF("ID_PLAYER_DRAWSTATE\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
//myPacket->Send(player, true);
player->sendToLoaded(myPacket);
@ -409,7 +449,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
case ID_CHAT_MESSAGE:
{
DEBUG_PRINTF("ID_CHAT_MESSAGE\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
Script::CallBackReturn<Script::CallbackIdentity("OnPlayerSendMessage")> result = true;
Script::Call<Script::CallbackIdentity("OnPlayerSendMessage")>(result, player->getId(), player->chatMessage.c_str());
@ -417,15 +459,19 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
player->chatMessage = player->npc.mName + " (" + std::to_string(player->getId()) + "): "
+ player->chatMessage + "\n";
myPacket->Send(player, false);
myPacket->Send(player, true);
myPacket->setPlayer(player);
myPacket->Send(false);
myPacket->Send(true);
}
break;
}
case ID_PLAYER_CHARGEN:
{
DEBUG_PRINTF("ID_PLAYER_CHARGEN\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
if (player->charGenStage.current == player->charGenStage.end && player->charGenStage.current != 0)
Script::Call<Script::CallbackIdentity("OnPlayerEndCharGen")>(player->getId());
@ -435,7 +481,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
case ID_GUI_MESSAGEBOX:
{
DEBUG_PRINTF("ID_GUI_MESSAGEBOX\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
Script::Call<Script::CallbackIdentity("OnGUIAction")>(player->getId(), (int)player->guiMessageBox.id,
player->guiMessageBox.data.c_str());
@ -445,7 +493,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
case ID_PLAYER_CHARCLASS:
{
DEBUG_PRINTF("ID_PLAYER_CHARCLASS\n");
myPacket->Read(player);
myPacket->setPlayer(player);
myPacket->Read();
break;
}
@ -476,8 +526,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_PLACE from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnObjectPlace")>(player->getId(), baseEvent.cell.getDescription().c_str());
@ -488,8 +539,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_DELETE from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnObjectDelete")>(player->getId(), baseEvent.cell.getDescription().c_str());
@ -500,8 +552,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_SCALE from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnObjectScale")>(player->getId(), baseEvent.cell.getDescription().c_str());
@ -512,8 +565,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_LOCK from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnObjectLock")>(player->getId(), baseEvent.cell.getDescription().c_str());
@ -524,8 +578,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_UNLOCK from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnObjectUnlock")>(player->getId(), baseEvent.cell.getDescription().c_str());
@ -536,8 +591,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_MOVE from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -546,8 +602,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ROTATE from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -556,8 +613,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -566,8 +624,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_STATE from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnDoorState")>(player->getId(), baseEvent.cell.getDescription().c_str());
@ -578,7 +637,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->setEvent(&baseEvent);
myPacket->Read();
LOG_APPEND(Log::LOG_WARN, "- action: %i", baseEvent.action);
@ -588,7 +648,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
if (baseEvent.action == BaseEvent::SET && baseEvent.objectChanges.count > 1)
CellController::get()->getCell(&baseEvent.cell)->sendToLoaded(myPacket, &baseEvent);
else
myPacket->Send(&baseEvent, true);
myPacket->Send(true);
Script::Call<Script::CallbackIdentity("OnContainer")>(player->getId(), baseEvent.cell.getDescription().c_str());
@ -601,8 +661,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_SHORT from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -611,8 +672,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_FLOAT from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -621,8 +683,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_MEMBER_SHORT from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -631,8 +694,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_GLOBAL_SHORT from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -641,8 +705,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_MUSIC_PLAY from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -651,8 +716,9 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_VIDEO_PLAY from %s", player->npc.mName.c_str());
myPacket->Read(&baseEvent);
myPacket->Send(&baseEvent, true);
myPacket->setEvent(&baseEvent);
myPacket->Read();
myPacket->Send(true);
break;
}
@ -679,7 +745,9 @@ void Networking::update(RakNet::Packet *packet)
playerController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid);
Players::newPlayer(packet->guid);
player = Players::getPlayer(packet->guid);
playerController->GetPacket(ID_USER_MYID)->Send(player, false);
playerController->GetPacket(ID_USER_MYID)->setPlayer(player);
playerController->GetPacket(ID_USER_MYID)->Send(false);
return;
}
else if (playerController->ContainsPacket(packet->data[0]))
@ -720,13 +788,21 @@ void Networking::newPlayer(RakNet::RakNetGUID guid)
// If we are iterating over a player who has inputted their name, proceed
else if (pl->second->getLoadState() == Player::POSTLOADED)
{
playerController->GetPacket(ID_PLAYER_BASEINFO)->Send(pl->second, guid);
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(pl->second, guid);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(pl->second, guid);
playerController->GetPacket(ID_PLAYER_SKILL)->Send(pl->second, guid);
playerController->GetPacket(ID_PLAYER_POS)->Send(pl->second, guid);
playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(pl->second, guid);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(pl->second, guid);
playerController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(pl->second);
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(pl->second);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl->second);
playerController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl->second);
playerController->GetPacket(ID_PLAYER_POS)->setPlayer(pl->second);
playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(pl->second);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl->second);
playerController->GetPacket(ID_PLAYER_BASEINFO)->Send(guid);
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(guid);
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(guid);
playerController->GetPacket(ID_PLAYER_SKILL)->Send(guid);
playerController->GetPacket(ID_PLAYER_POS)->Send(guid);
playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(guid);
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(guid);
}
}
@ -740,7 +816,9 @@ void Networking::disconnectPlayer(RakNet::RakNetGUID guid)
if (!player)
return;
Script::Call<Script::CallbackIdentity("OnPlayerDisconnect")>(player->getId());
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(player, true);
playerController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(player);
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(true);
Players::deletePlayer(guid);
}

@ -158,7 +158,8 @@ void Player::sendToLoaded(mwmp::PlayerPacket *myPacket)
for (auto pl : plList)
{
if (pl == this) continue;
myPacket->Send(this, pl->guid);
myPacket->setPlayer(this);
myPacket->Send();
}
}

@ -110,5 +110,6 @@ void CellFunctions::SendCell(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(false);
}

@ -15,7 +15,8 @@ void CharClassFunctions::SendClass(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARCLASS)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARCLASS)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARCLASS)->Send(false);
}
void CharClassFunctions::SetDefaultClass(unsigned short pid, const char *id) noexcept

@ -15,9 +15,11 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "System: %s", message);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(false);
if (broadcast)
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(true);
}
void ScriptFunctions::CleanChat(unsigned short pid)

@ -18,7 +18,8 @@ void GUIFunctions::_MessageBox(unsigned short pid, int id, const char *label) no
player->guiMessageBox.label = label;
player->guiMessageBox.type = Player::GUIMessageBox::MessageBox;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
}
void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept
@ -31,7 +32,8 @@ void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *labe
player->guiMessageBox.buttons = buttons;
player->guiMessageBox.type = Player::GUIMessageBox::CustomMessageBox;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
}
void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) noexcept
@ -43,7 +45,8 @@ void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) no
player->guiMessageBox.label = label;
player->guiMessageBox.type = Player::GUIMessageBox::InputDialog;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
}
void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const char *items)
@ -56,7 +59,8 @@ void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const
player->guiMessageBox.data = items;
player->guiMessageBox.type = Player::GUIMessageBox::ListBox;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
}
void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept
@ -76,5 +80,6 @@ void GUIFunctions::SetConsoleAllow(unsigned short pid, bool state)
player->consoleAllowed = state;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CONSOLE)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CONSOLE)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CONSOLE)->Send(false);
}

@ -145,8 +145,9 @@ void ItemFunctions::SendEquipment(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(true);
}
void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept
@ -155,7 +156,8 @@ void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept
GET_PLAYER(pid, player, );
std::swap(player->inventoryChanges, player->inventoryChangesBuffer);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_INVENTORY)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_INVENTORY)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_INVENTORY)->Send(false);
player->inventoryChanges = std::move(player->inventoryChangesBuffer);
player->inventoryChangesBuffer.items.clear();
}

@ -109,5 +109,6 @@ void PositionFunctions::SendPos(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_POS)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_POS)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_POS)->Send(false);
}

@ -73,7 +73,8 @@ void QuestFunctions::SendJournalChanges(unsigned short pid) noexcept
GET_PLAYER(pid, player, );
std::swap(player->journalChanges, player->journalChangesBuffer);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_JOURNAL)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_JOURNAL)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_JOURNAL)->Send(false);
player->journalChanges = std::move(player->journalChangesBuffer);
player->journalChangesBuffer.journalItems.clear();
}

@ -72,7 +72,8 @@ void SpellFunctions::SendSpellbookChanges(unsigned short pid) noexcept
GET_PLAYER(pid, player, );
std::swap(player->spellbookChanges, player->spellbookChangesBuffer);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SPELLBOOK)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SPELLBOOK)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SPELLBOOK)->Send(false);
player->spellbookChanges = std::move(player->spellbookChangesBuffer);
player->spellbookChangesBuffer.spells.clear();
}

@ -451,7 +451,8 @@ void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noe
player->charGenStage.current = start;
player->charGenStage.end = end;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARGEN)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARGEN)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARGEN)->Send(false);
}
void StatsFunctions::Resurrect(unsigned short pid)
@ -466,16 +467,19 @@ void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(true);
}
void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(true);
}
void StatsFunctions::SendAttributes(unsigned short pid) noexcept
@ -483,8 +487,9 @@ void StatsFunctions::SendAttributes(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(true);
}
void StatsFunctions::SendSkills(unsigned short pid) noexcept
@ -492,8 +497,9 @@ void StatsFunctions::SendSkills(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player,);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->Send(false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->Send(true);
}
void StatsFunctions::SendLevel(unsigned short pid) noexcept
@ -501,6 +507,7 @@ void StatsFunctions::SendLevel(unsigned short pid) noexcept
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(player, true);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(true);
}

@ -262,37 +262,44 @@ void WorldFunctions::AddContainerItem() noexcept
void WorldFunctions::SendObjectDelete() noexcept
{
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(&scriptEvent, scriptEvent.guid);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->setEvent(&scriptEvent);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(scriptEvent.guid);
}
void WorldFunctions::SendObjectPlace() noexcept
{
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(&scriptEvent, scriptEvent.guid);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->setEvent(&scriptEvent);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(scriptEvent.guid);
}
void WorldFunctions::SendObjectScale() noexcept
{
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(&scriptEvent, scriptEvent.guid);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->setEvent(&scriptEvent);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(scriptEvent.guid);
}
void WorldFunctions::SendObjectLock() noexcept
{
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(&scriptEvent, scriptEvent.guid);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->setEvent(&scriptEvent);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(scriptEvent.guid);
}
void WorldFunctions::SendObjectUnlock() noexcept
{
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(&scriptEvent, scriptEvent.guid);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->setEvent(&scriptEvent);
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(scriptEvent.guid);
}
void WorldFunctions::SendDoorState() noexcept
{
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(&scriptEvent, scriptEvent.guid);
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->setEvent(&scriptEvent);
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(scriptEvent.guid);
}
void WorldFunctions::SendContainer() noexcept
{
mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(&scriptEvent, scriptEvent.guid);
mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->setEvent(&scriptEvent);
mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(scriptEvent.guid);
}
void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
@ -304,7 +311,8 @@ void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
player->month = -1;
player->day = -1;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false);
}
void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
@ -316,7 +324,8 @@ void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
player->month = month;
player->day = -1;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false);
}
@ -329,5 +338,6 @@ void WorldFunctions::SetDay(unsigned short pid, int day) noexcept
player->month = -1;
player->day = day;
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false);
}

@ -126,7 +126,8 @@ namespace MWGui
worldObject.containerChanges.items.push_back(containerItem);
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s\n- item: %s, %i",
worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str(),
@ -187,7 +188,8 @@ namespace MWGui
worldObject.containerChanges.items.push_back(containerItem);
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s\n- item: %s, %i",
worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str(),
@ -330,7 +332,8 @@ namespace MWGui
worldObject.refNumIndex = mPtr.getCellRef().getRefNum().mIndex;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str());

@ -93,7 +93,8 @@ namespace MWGui
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i",
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.count);

@ -652,7 +652,8 @@ namespace MWGui
worldObject.refNumIndex = object.getCellRef().getRefNum().mIndex;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send();
mwmp::Main::get().getLocalPlayer()->sendInventory();
/*
End of tes3mp addition

@ -70,8 +70,9 @@ namespace MWMechanics
worldObject.refId = lock.getCellRef().getRefId();
worldObject.refNumIndex = lock.getCellRef().getRefNum().mIndex;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send();
/*
End of tes3mp addition
*/

@ -134,7 +134,8 @@ namespace mwmp
localPlayer->chatMessage = str;
networking->getPlayerPacket(ID_CHAT_MESSAGE)->Send(localPlayer);
networking->getPlayerPacket(ID_CHAT_MESSAGE)->setPlayer(localPlayer);
networking->getPlayerPacket(ID_CHAT_MESSAGE)->Send();
}
void GUIChat::clean()

@ -159,7 +159,8 @@ void mwmp::GUIController::onInputBoxDone(MWGui::WindowBase *parWindow)
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "GUIController::OnInputBoxDone: %s.",mInputBox->getTextInput().c_str());
Main::get().getLocalPlayer()->guiMessageBox.data = mInputBox->getTextInput();
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->setPlayer(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send();
MWBase::Environment::get().getWindowManager()->removeDialog(mInputBox);
mInputBox = 0;
@ -201,7 +202,8 @@ void mwmp::GUIController::update(float dt)
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Pressed: %d", pressedButton);
calledMessageBox = false;
Main::get().getLocalPlayer()->guiMessageBox.data = MyGUI::utility::toString(pressedButton);
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->setPlayer(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send();
}
blockConsole();

@ -41,7 +41,8 @@ void GUIDialogList::mousePressed(MyGUI::Widget * /*widget*/)
size_t id = mListBox->getIndexSelected();
Main::get().getLocalPlayer()->guiMessageBox.data = MyGUI::utility::toString(id);
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->setPlayer(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Selected id: %d", id);
if(id == MyGUI::ITEM_NONE)

@ -108,7 +108,8 @@ bool LocalPlayer::charGenThread()
windowManager->pushGuiMode(MWGui::GM_Review);
break;
}
getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->Send();
charGenStage.current++;
return false;
@ -124,7 +125,8 @@ bool LocalPlayer::charGenThread()
birthsign = world->getPlayer().getBirthSign();
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_BASEINFO to server with my CharGen info");
getNetworking()->getPlayerPacket(ID_PLAYER_BASEINFO)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_BASEINFO)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_BASEINFO)->Send();
// Send stats packets if this is the 2nd round of CharGen that
// only happens for new characters
@ -136,7 +138,8 @@ bool LocalPlayer::charGenThread()
updateLevel(true);
sendClass();
sendSpellbook();
getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->Send();
}
sendCellStates();
@ -183,7 +186,8 @@ void LocalPlayer::updateDynamicStats(bool forceUpdate)
timer = 0;
getNetworking()->getPlayerPacket(ID_PLAYER_DYNAMICSTATS)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_DYNAMICSTATS)->Send();
}
}
}
@ -205,7 +209,8 @@ void LocalPlayer::updateAttributes(bool forceUpdate)
if (attributesChanged || forceUpdate)
{
getNetworking()->getPlayerPacket(ID_PLAYER_ATTRIBUTE)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_ATTRIBUTE)->Send();
}
}
@ -244,7 +249,8 @@ void LocalPlayer::updateSkills(bool forceUpdate)
if (skillsChanged || forceUpdate)
{
npcStats.mLevelProgress = ptrNpcStats.getLevelProgress();
getNetworking()->getPlayerPacket(ID_PLAYER_SKILL)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_SKILL)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_SKILL)->Send();
}
}
@ -256,7 +262,8 @@ void LocalPlayer::updateLevel(bool forceUpdate)
if (ptrNpcStats.getLevel() != creatureStats.mLevel || forceUpdate)
{
creatureStats.mLevel = ptrNpcStats.getLevel();
getNetworking()->getPlayerPacket(ID_PLAYER_LEVEL)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_LEVEL)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_LEVEL)->Send();
// Also update skills to refresh level progress and attribute bonuses
// for next level up
@ -296,7 +303,8 @@ void LocalPlayer::updatePosition(bool forceUpdate)
direction.pos[1] = move.mPosition[1];
direction.pos[2] = move.mPosition[2];
getNetworking()->getPlayerPacket(ID_PLAYER_POS)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_POS)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_POS)->Send();
}
else if (isJumping && world->isOnGround(player))
{
@ -308,7 +316,8 @@ void LocalPlayer::updatePosition(bool forceUpdate)
{
sentJumpEnd = true;
position = ptrPos;
getNetworking()->getPlayerPacket(ID_PLAYER_POS)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_POS)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_POS)->Send();
}
}
@ -354,7 +363,8 @@ void LocalPlayer::updateCell(bool forceUpdate)
// cell change events in server scripts will have the wrong player position
updatePosition(true);
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_CHANGE)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_CHANGE)->Send();
// Also force an update to skills (to send all progress to skill increases)
updateSkills(true);
@ -418,7 +428,8 @@ void LocalPlayer::updateEquipment(bool forceUpdate)
if (equipChanged)
{
getNetworking()->getPlayerPacket(ID_PLAYER_EQUIPMENT)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_EQUIPMENT)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_EQUIPMENT)->Send();
equipChanged = false;
}
}
@ -546,7 +557,8 @@ void LocalPlayer::updateDeadState(bool forceUpdate)
creatureStats.mDead = true;
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_DEATH to server about myself");
getNetworking()->getPlayerPacket(ID_PLAYER_DEATH)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_DEATH)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_DEATH)->Send();
isDead = true;
}
else if (ptrNpcStats->getHealth().getCurrent() > 0 && isDead)
@ -619,7 +631,8 @@ void LocalPlayer::updateDrawStateAndFlags(bool forceUpdate)
if (isJumping)
mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after jump;
getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_DRAWSTATE)->Send();
}
}
@ -956,7 +969,8 @@ void LocalPlayer::sendClass()
else
charClass.mId = cls->mId;
getNetworking()->getPlayerPacket(ID_PLAYER_CHARCLASS)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CHARCLASS)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CHARCLASS)->Send();
}
void LocalPlayer::sendInventory()
@ -981,7 +995,8 @@ void LocalPlayer::sendInventory()
inventoryChanges.count = (unsigned int) inventoryChanges.items.size();
inventoryChanges.action = InventoryChanges::SET;
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_INVENTORY)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_INVENTORY)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_INVENTORY)->Send();
}
void LocalPlayer::sendSpellbook()
@ -1003,12 +1018,14 @@ void LocalPlayer::sendSpellbook()
}
spellbookChanges.action = SpellbookChanges::SET;
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
}
void LocalPlayer::sendCellStates()
{
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_CELL_STATE)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_STATE)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_CELL_STATE)->Send();
}
@ -1024,7 +1041,8 @@ void LocalPlayer::sendSpellAddition(std::string id)
spellbookChanges.spells.push_back(spell);
spellbookChanges.action = SpellbookChanges::ADD;
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
}
void LocalPlayer::sendSpellRemoval(std::string id)
@ -1039,7 +1057,8 @@ void LocalPlayer::sendSpellRemoval(std::string id)
spellbookChanges.spells.push_back(spell);
spellbookChanges.action = SpellbookChanges::REMOVE;
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
}
void LocalPlayer::sendSpellAddition(const ESM::Spell &spell)
@ -1069,7 +1088,8 @@ void LocalPlayer::sendJournalEntry(const std::string& quest, int index, const MW
journalChanges.journalItems.push_back(journalItem);
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_JOURNAL)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_JOURNAL)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_JOURNAL)->Send();
}
void LocalPlayer::sendJournalIndex(const std::string& quest, int index)
@ -1083,7 +1103,8 @@ void LocalPlayer::sendJournalIndex(const std::string& quest, int index)
journalChanges.journalItems.push_back(journalItem);
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_JOURNAL)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_JOURNAL)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_JOURNAL)->Send();
}
void LocalPlayer::sendAttack(Attack::TYPE type)
@ -1092,7 +1113,9 @@ void LocalPlayer::sendAttack(Attack::TYPE type)
attack.type = type;
attack.pressed = false;
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Send();
}
void LocalPlayer::clearCellStates()
@ -1162,5 +1185,6 @@ void LocalPlayer::prepareAttack(Attack::TYPE type, bool state)
attack.target = RakNet::RakNetGUID();
attack.attacker = guid;
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Send(this);
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_ATTACK)->Send();
}

@ -200,8 +200,10 @@ void Main::updateWorld(float dt) const
init = false;
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_BASEINFO to server");
mNetworking->getPlayerPacket(ID_PLAYER_BASEINFO)->Send(getLocalPlayer());
mNetworking->getPlayerPacket(ID_LOADED)->Send(getLocalPlayer());
mNetworking->getPlayerPacket(ID_PLAYER_BASEINFO)->setPlayer(getLocalPlayer());
mNetworking->getPlayerPacket(ID_LOADED)->setPlayer(getLocalPlayer());
mNetworking->getPlayerPacket(ID_PLAYER_BASEINFO)->Send();
mNetworking->getPlayerPacket(ID_LOADED)->Send();
mLocalPlayer->updateDynamicStats(true);
get().getGUIController()->setChatVisible(true);
}

@ -196,7 +196,9 @@ void Networking::preInit(std::vector<std::string> &content, Files::Collections &
PacketPreInit packetPreInit(peer);
RakNet::BitStream bs;
RakNet::RakNetGUID guid;
packetPreInit.Packet(&bs, guid, true, checksums);
packetPreInit.setGUID(guid);
packetPreInit.Packet(&bs, true, checksums);
bool done = false;
PacketPreInit::PluginContainer checksumsResponse;
@ -248,7 +250,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
case ID_HANDSHAKE:
{
myPacket->Send(getLocalPlayer(), serverAddr);
myPacket->setPlayer(getLocalPlayer());
myPacket->Send(serverAddr);
break;
}
case ID_PLAYER_BASEINFO:
@ -262,11 +265,14 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (packet->length == myPacket->headerSize())
{
LOG_APPEND(Log::LOG_INFO, "- Requesting info");
myPacket->Send(getLocalPlayer(), serverAddr);
myPacket->setPlayer(getLocalPlayer());
myPacket->Send(serverAddr);
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
LOG_APPEND(Log::LOG_INFO, "- Updating LocalPlayer");
getLocalPlayer()->updateChar();
}
@ -281,7 +287,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
pl = Players::newPlayer(guid);
}
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
Players::createPlayer(guid);
}
break;
@ -293,7 +300,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
if (packet->length != myPacket->headerSize())
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_PLAYER_POS changed by server");
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setPosition();
}
else
@ -301,7 +310,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
pl->updateMarker();
}
break;
@ -331,13 +341,15 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setEquipment();
}
}
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
pl->updateEquipment();
}
break;
@ -352,7 +364,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
int inventoryAction = getLocalPlayer()->inventoryChanges.action;
if (inventoryAction == InventoryChanges::ADD)
@ -381,7 +394,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
int spellbookAction = getLocalPlayer()->spellbookChanges.action;
if (spellbookAction == SpellbookChanges::ADD)
@ -410,7 +424,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->addJournalItems();
}
}
@ -420,7 +435,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
//cout << "Player: " << pl->Npc()->mName << " pressed: " << (pl->getAttack()->pressed == 1) << endl;
if (pl->attack.pressed == 0)
@ -488,13 +504,15 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setDynamicStats();
}
}
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
MWWorld::Ptr ptrPlayer = pl->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
@ -520,7 +538,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
MWMechanics::DynamicStat<float> health = player.getClass().getCreatureStats(player).getHealth();
health.setCurrent(0);
player.getClass().getCreatureStats(player).setHealth(health);
myPacket->Send(getLocalPlayer(), serverAddr);
myPacket->setPlayer(getLocalPlayer());
myPacket->Send(serverAddr);
}
else if (pl != 0)
{
@ -550,10 +569,12 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
// still have it readied but be unable to use it unless we clear it here
player.getClass().getNpcStats(player).setDrawState(MWMechanics::DrawState_Nothing);
myPacket->Send(getLocalPlayer(), serverAddr);
myPacket->setPlayer(getLocalPlayer());
myPacket->Send(serverAddr);
getLocalPlayer()->updateDynamicStats(true);
playerController.GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(getLocalPlayer(), serverAddr);
playerController.GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(getLocalPlayer());
playerController.GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(serverAddr);
}
else if (pl != 0)
{
@ -580,13 +601,15 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
getLocalPlayer()->updateCell(true);
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setCell();
}
}
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
pl->updateCell();
}
break;
@ -607,7 +630,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
getLocalPlayer()->updateDrawStateAndFlags(true);
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
pl->updateDrawState();
}
break;
@ -617,12 +641,14 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
std::string message;
if (guid == myGuid)
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
message = getLocalPlayer()->chatMessage;
}
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
message = pl->chatMessage;
}
Main::get().getGUIController()->printChatMessage(message);
@ -633,7 +659,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
if (guid == myGuid)
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
}
break;
}
@ -647,13 +674,15 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setAttributes();
}
}
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
MWWorld::Ptr ptrPlayer = pl->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
@ -677,13 +706,15 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setSkills();
}
}
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
MWWorld::Ptr ptrPlayer = pl->getPtr();
MWMechanics::NpcStats *ptrNpcStats = &ptrPlayer.getClass().getNpcStats(ptrPlayer);
@ -707,13 +738,15 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setLevel();
}
}
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
MWWorld::Ptr ptrPlayer = pl->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
@ -726,7 +759,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
if (guid == myGuid)
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GUI_MESSAGEBOX, Type %d, MSG %s", getLocalPlayer()->guiMessageBox.type,
getLocalPlayer()->guiMessageBox.label.c_str());
@ -752,7 +786,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
getLocalPlayer()->sendClass();
else
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setClass();
}
}
@ -762,7 +797,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
{
if (guid == myGuid)
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
MWBase::World *world = MWBase::Environment::get().getWorld();
if (getLocalPlayer()->hour != -1)
world->setHour(getLocalPlayer()->hour);
@ -775,7 +811,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
case ID_GAME_CONSOLE:
{
myPacket->Packet(&bsIn, getLocalPlayer(), false);
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
break;
}
default:
@ -796,7 +833,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
WorldPacket *myPacket = worldController.GetPacket(packet->data[0]);
myPacket->Packet(&bsIn, &worldEvent, false);
myPacket->setEvent(&worldEvent);
myPacket->Packet(&bsIn, false);
switch (packet->data[0])
{

@ -74,7 +74,8 @@ void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
worldEvent->addObject(worldObject);
}
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send();
}
void WorldEvent::editContainers(MWWorld::CellStore* cellStore)

@ -81,7 +81,8 @@ namespace MWScript
worldObject.animMode = mode;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send();
}
/*
End of tes3mp addition

@ -212,7 +212,8 @@ namespace MWScript
worldObject.shortVal = value;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i",
worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str(),
@ -257,7 +258,8 @@ namespace MWScript
worldObject.floatVal = value;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f",
worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str(),
@ -324,7 +326,8 @@ namespace MWScript
worldObject.shortVal = value;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT\n- varName: %s\n- shortVal: %i",
worldObject.varName.c_str(), worldObject.shortVal);
@ -669,7 +672,8 @@ namespace MWScript
worldObject.shortVal = value;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT\n- cellRef: %s\n- index: %i\n- shortVal: %i",
worldObject.refId.c_str(), worldObject.index, worldObject.shortVal);

@ -102,7 +102,8 @@ namespace MWScript
worldObject.allowSkipping = allowSkipping;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send();
/*
End of tes3mp addition
*/
@ -220,7 +221,8 @@ namespace MWScript
worldObject.lockLevel = lockLevel;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send();
/*
End of tes3mp addition
*/
@ -265,7 +267,8 @@ namespace MWScript
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send();
/*
End of tes3mp addition
*/
@ -744,7 +747,8 @@ namespace MWScript
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send();
/*
End of tes3mp addition
*/

@ -82,7 +82,8 @@ namespace MWScript
worldObject.filename = sound;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->Send();
/*
End of tes3mp addition
*/

@ -61,7 +61,8 @@ namespace MWScript
worldObject.scale = scale;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send();
/*
End of tes3mp addition
*/
@ -578,7 +579,8 @@ namespace MWScript
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i",
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.count);

@ -42,7 +42,8 @@ namespace MWWorld
worldObject.refNumIndex = getTarget().getCellRef().getRefNum().mIndex;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s",
worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str());

@ -2332,7 +2332,8 @@ namespace MWWorld
worldObject.doorState = state;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Door activation 1\n- cellRef: %s, %i\n- cell: %s\n- state: %s",
worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str(),
@ -2361,7 +2362,8 @@ namespace MWWorld
worldObject.doorState = state;
worldEvent->addObject(worldObject);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->Send(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->setEvent(worldEvent);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Door activation 2\n- cellRef: %s, %i\n- cell: %s\n- state: %s",
worldObject.refId.c_str(), worldObject.refNumIndex, worldEvent->cell.getDescription().c_str(),

@ -18,7 +18,7 @@ BasePacket::~BasePacket()
}
void BasePacket::Packet(RakNet::BitStream *bs, RakNet::RakNetGUID &guid, bool send)
void BasePacket::Packet(RakNet::BitStream *bs, bool send)
{
this->bs = bs;
@ -54,3 +54,32 @@ void BasePacket::RequestData(RakNet::RakNetGUID guid)
bsSend->Write(guid);
peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, guid, false);
}
void BasePacket::Send(RakNet::AddressOrGUID destination)
{
bsSend->ResetWritePointer();
Packet(bsSend, true);
peer->Send(bsSend, priority, reliability, 0, destination, false);
}
void BasePacket::Send(bool toOther)
{
bsSend->ResetWritePointer();
Packet(bsSend, true);
peer->Send(bsSend, priority, reliability, 0, guid, toOther);
}
void BasePacket::Read()
{
Packet(bsRead, false);
}
void BasePacket::setGUID(RakNet::RakNetGUID guid)
{
this->guid = guid;
}
RakNet::RakNetGUID BasePacket::getGUID()
{
return guid;
}

@ -14,9 +14,15 @@ namespace mwmp
public:
BasePacket(RakNet::RakPeerInterface *peer);
~BasePacket();
virtual ~BasePacket();
virtual void Packet(RakNet::BitStream *bs, RakNet::RakNetGUID &guid, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
virtual void Send(bool toOtherPlayers = true);
virtual void Send(RakNet::AddressOrGUID destination);
virtual void Read();
void setGUID(RakNet::RakNetGUID guid);
RakNet::RakNetGUID getGUID();
void SetReadStream(RakNet::BitStream *bitStream);
void SetSendStream(RakNet::BitStream *bitStream);
@ -88,6 +94,7 @@ namespace mwmp
PacketPriority priority;
RakNet::BitStream *bsRead, *bsSend, *bs;
RakNet::RakPeerInterface *peer;
RakNet::RakNetGUID guid;
};
}

@ -11,9 +11,9 @@ mwmp::PacketPreInit::PacketPreInit(RakNet::RakPeerInterface *peer) : BasePacket(
packetID = ID_GAME_PREINIT;
}
void mwmp::PacketPreInit::Packet(RakNet::BitStream *bs, RakNet::RakNetGUID &guid, bool send, PluginContainer &checksums)
void mwmp::PacketPreInit::Packet(RakNet::BitStream *bs, bool send, PluginContainer &checksums)
{
BasePacket::Packet(bs, guid, send);
BasePacket::Packet(bs, send);
unsigned int size = checksums.size();
RW(size, send);

@ -19,7 +19,7 @@ namespace mwmp
PacketPreInit(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, RakNet::RakNetGUID &guid, bool send, PluginContainer &checksums);
virtual void Packet(RakNet::BitStream *bs, bool send, PluginContainer &checksums);
};
}

@ -10,9 +10,9 @@ mwmp::PacketChatMessage::PacketChatMessage(RakNet::RakPeerInterface *peer) : Pla
packetID = ID_CHAT_MESSAGE;
}
void mwmp::PacketChatMessage::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
void mwmp::PacketChatMessage::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->chatMessage, send);
}

@ -14,7 +14,7 @@ namespace mwmp
public:
PacketChatMessage(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -17,9 +17,9 @@ namespace mwmp
{
packetID = ID_GAME_CONSOLE;
}
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->consoleAllowed, send);
}
};

@ -12,9 +12,9 @@ PacketGUIBoxes::PacketGUIBoxes(RakNet::RakPeerInterface *peer) : PlayerPacket(pe
packetID = ID_GUI_MESSAGEBOX;
}
void PacketGUIBoxes::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketGUIBoxes::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->guiMessageBox.id, send);
RW(player->guiMessageBox.type, send);

@ -15,7 +15,7 @@ namespace mwmp
public:
PacketGUIBoxes(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -12,9 +12,9 @@ PacketHandshake::PacketHandshake(RakNet::RakPeerInterface *peer) : PlayerPacket(
packetID = ID_HANDSHAKE;
}
void PacketHandshake::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketHandshake::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->npc.mName, send);
RW(player->passw, send);
}

@ -14,7 +14,7 @@ namespace mwmp
public:
PacketHandshake(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -12,9 +12,9 @@ PacketPlayerActiveSkills::PacketPlayerActiveSkills(RakNet::RakPeerInterface *pee
packetID = ID_PLAYER_ACTIVESKILLS;
}
void PacketPlayerActiveSkills::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
void PacketPlayerActiveSkills::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
unsigned long spells = 0;

@ -14,7 +14,7 @@ namespace mwmp
public:
PacketPlayerActiveSkills(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -12,9 +12,9 @@ PacketPlayerAttack::PacketPlayerAttack(RakNet::RakPeerInterface *peer) : PlayerP
packetID = ID_PLAYER_ATTACK;
}
void PacketPlayerAttack::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
void PacketPlayerAttack::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->attack.attacker, send);
RW(player->attack.target, send);

@ -15,7 +15,7 @@ namespace mwmp
public:
PacketPlayerAttack(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -12,9 +12,9 @@ PacketPlayerAttribute::PacketPlayerAttribute(RakNet::RakPeerInterface *peer) : P
packetID = ID_PLAYER_ATTRIBUTE;
}
void PacketPlayerAttribute::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerAttribute::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
for (int i = 0; i < AttributeCount; ++i)
RW(player->creatureStats.mAttributes[i], send);

@ -15,7 +15,7 @@ namespace mwmp
const static int AttributeCount = 8;
PacketPlayerAttribute(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -12,9 +12,9 @@ PacketPlayerBaseInfo::PacketPlayerBaseInfo(RakNet::RakPeerInterface *peer) : Pla
packetID = ID_PLAYER_BASEINFO;
}
void PacketPlayerBaseInfo::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerBaseInfo::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->npc.mName, send);
RW(player->npc.mModel, send);

@ -14,7 +14,7 @@ namespace mwmp
public:
PacketPlayerBaseInfo(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -13,9 +13,9 @@ mwmp::PacketPlayerCellChange::PacketPlayerCellChange(RakNet::RakPeerInterface *p
reliability = RELIABLE_ORDERED;
}
void mwmp::PacketPlayerCellChange::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
void mwmp::PacketPlayerCellChange::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->cell.mData.mFlags, send);
RW(player->cell.mData.mX, send);

@ -15,7 +15,7 @@ namespace mwmp
public:
PacketPlayerCellChange(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -9,9 +9,9 @@ mwmp::PacketPlayerCellState::PacketPlayerCellState(RakNet::RakPeerInterface *pee
reliability = RELIABLE_ORDERED;
}
void mwmp::PacketPlayerCellState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
void mwmp::PacketPlayerCellState::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
if (!send)
player->cellStateChanges.cellStates.clear();

@ -11,7 +11,7 @@ namespace mwmp
public:
PacketPlayerCellState(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -10,9 +10,9 @@ mwmp::PacketPlayerCharGen::PacketPlayerCharGen(RakNet::RakPeerInterface *peer) :
packetID = ID_PLAYER_CHARGEN;
}
void mwmp::PacketPlayerCharGen::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
void mwmp::PacketPlayerCharGen::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->charGenStage, send);

@ -15,7 +15,7 @@ namespace mwmp
public:
PacketPlayerCharGen(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -10,9 +10,9 @@ mwmp::PacketPlayerClass::PacketPlayerClass(RakNet::RakPeerInterface *peer) : Pla
packetID = ID_PLAYER_CHARCLASS;
}
void mwmp::PacketPlayerClass::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
void mwmp::PacketPlayerClass::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->charClass.mId, send);
if (player->charClass.mId.empty()) // custom class

@ -15,7 +15,7 @@ namespace mwmp
public:
PacketPlayerClass(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -18,9 +18,9 @@ namespace mwmp
{
packetID = ID_PLAYER_DEATH;
}
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->creatureStats.mDead, send);
}
};

@ -10,9 +10,9 @@ mwmp::PacketPlayerDrawState::PacketPlayerDrawState(RakNet::RakPeerInterface *pee
packetID = ID_PLAYER_DRAWSTATE;
}
void mwmp::PacketPlayerDrawState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
void mwmp::PacketPlayerDrawState::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->movementFlags, send);
RW(player->drawState, send);

@ -15,7 +15,7 @@ namespace mwmp
public:
PacketPlayerDrawState(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -12,9 +12,9 @@ PacketPlayerDynamicStats::PacketPlayerDynamicStats(RakNet::RakPeerInterface *pee
packetID = ID_PLAYER_DYNAMICSTATS;
}
void PacketPlayerDynamicStats::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerDynamicStats::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->creatureStats.mDynamic[0], send); // health
RW(player->creatureStats.mDynamic[1], send); // magic
RW(player->creatureStats.mDynamic[2], send); // fatigue

@ -15,7 +15,7 @@ namespace mwmp
public:
PacketPlayerDynamicStats(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -12,9 +12,9 @@ PacketPlayerEquipment::PacketPlayerEquipment(RakNet::RakPeerInterface *peer) : P
packetID = ID_PLAYER_EQUIPMENT;
}
void PacketPlayerEquipment::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerEquipment::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
for (int i = 0; i < 19; i++)
{

@ -14,7 +14,7 @@ namespace mwmp
public:
PacketPlayerEquipment(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -13,9 +13,9 @@ PacketPlayerInventory::PacketPlayerInventory(RakNet::RakPeerInterface *peer) : P
packetID = ID_PLAYER_INVENTORY;
}
void PacketPlayerInventory::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerInventory::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->inventoryChanges.action, send);

@ -14,7 +14,7 @@ namespace mwmp
public:
PacketPlayerInventory(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -9,9 +9,9 @@ PacketPlayerJournal::PacketPlayerJournal(RakNet::RakPeerInterface *peer) : Playe
packetID = ID_PLAYER_JOURNAL;
}
void PacketPlayerJournal::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerJournal::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
if (!send)
player->journalChanges.journalItems.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketPlayerJournal(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketPlayerLevel::PacketPlayerLevel(RakNet::RakPeerInterface *peer) : PlayerPac
packetID = ID_PLAYER_LEVEL;
}
void PacketPlayerLevel::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerLevel::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->creatureStats.mLevel, send);
}

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketPlayerLevel(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -15,9 +15,9 @@ PacketPlayerPosition::PacketPlayerPosition(RakNet::RakPeerInterface *peer) : Pla
//reliability = UNRELIABLE_SEQUENCED;
}
void PacketPlayerPosition::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerPosition::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->position, send);
RW(player->direction, send);

@ -14,7 +14,7 @@ namespace mwmp
public:
PacketPlayerPosition(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -18,9 +18,9 @@ namespace mwmp
{
packetID = ID_PLAYER_RESURRECT;
}
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->creatureStats.mDead, send);
}
};

@ -14,9 +14,9 @@ PacketPlayerSkill::PacketPlayerSkill(RakNet::RakPeerInterface *peer) : PlayerPac
packetID = ID_PLAYER_SKILL;
}
void PacketPlayerSkill::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerSkill::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
for (int i = 0; i < SkillCount; ++i)
RW(player->npcStats.mSkills[i], send);

@ -17,7 +17,7 @@ namespace mwmp
const static int AttributeCount = 8;
PacketPlayerSkill(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -9,9 +9,9 @@ PacketPlayerSpellbook::PacketPlayerSpellbook(RakNet::RakPeerInterface *peer) : P
packetID = ID_PLAYER_SPELLBOOK;
}
void PacketPlayerSpellbook::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketPlayerSpellbook::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->spellbookChanges.action, send);

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketPlayerSpellbook(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -12,9 +12,9 @@ PacketTime::PacketTime(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
packetID = ID_GAME_TIME;
}
void PacketTime::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
void PacketTime::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, player, send);
PlayerPacket::Packet(bs, send);
RW(player->month, send);
RW(player->day, send);

@ -15,7 +15,7 @@ namespace mwmp
public:
PacketTime(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -5,12 +5,6 @@
using namespace mwmp;
void PlayerPacket::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
{
BasePacket::Packet(bs, player->guid, send);
this->player = player;
}
PlayerPacket::PlayerPacket(RakNet::RakPeerInterface *peer) : BasePacket(peer)
{
packetID = 0;
@ -24,21 +18,13 @@ PlayerPacket::~PlayerPacket()
}
void PlayerPacket::Send(BasePlayer *player, RakNet::AddressOrGUID destination)
void PlayerPacket::setPlayer(BasePlayer *player)
{
bsSend->ResetWritePointer();
Packet(bsSend, player, true);
peer->Send(bsSend, priority, reliability, 0, destination, false);
}
void PlayerPacket::Send(BasePlayer *player, bool toOther)
{
bsSend->ResetWritePointer();
Packet(bsSend, player, true);
peer->Send(bsSend, priority, reliability, 0, player->guid, toOther);
this->player = player;
guid = player->guid;
}
void PlayerPacket::Read(BasePlayer *player)
BasePlayer *PlayerPacket::getPlayer()
{
Packet(bsRead, player, false);
return player;
}

@ -19,11 +19,8 @@ namespace mwmp
~PlayerPacket();
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
virtual void Send(BasePlayer *player, bool toOtherPlayers = true);
virtual void Send(BasePlayer *player, RakNet::AddressOrGUID destination);
virtual void Read(BasePlayer *player);
void setPlayer(BasePlayer *player);
BasePlayer *getPlayer();
protected:
BasePlayer *player;

@ -8,9 +8,9 @@ PacketContainer::PacketContainer(RakNet::RakPeerInterface *peer) : WorldPacket(p
packetID = ID_CONTAINER;
}
void PacketContainer::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketContainer::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
RW(event->action, send);

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketContainer(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketDoorState::PacketDoorState(RakNet::RakPeerInterface *peer) : WorldPacket(p
packetID = ID_DOOR_STATE;
}
void PacketDoorState::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketDoorState::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
if (!send)
event->objectChanges.objects.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketDoorState(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketMusicPlay::PacketMusicPlay(RakNet::RakPeerInterface *peer) : WorldPacket(p
packetID = ID_MUSIC_PLAY;
}
void PacketMusicPlay::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketMusicPlay::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
if (!send)
event->objectChanges.objects.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketMusicPlay(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketObjectAnimPlay::PacketObjectAnimPlay(RakNet::RakPeerInterface *peer) : Wor
packetID = ID_OBJECT_ANIM_PLAY;
}
void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
if (!send)
event->objectChanges.objects.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketObjectAnimPlay(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketObjectDelete::PacketObjectDelete(RakNet::RakPeerInterface *peer) : WorldPa
packetID = ID_OBJECT_DELETE;
}
void PacketObjectDelete::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketObjectDelete::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
if (!send)
event->objectChanges.objects.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketObjectDelete(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketObjectLock::PacketObjectLock(RakNet::RakPeerInterface *peer) : WorldPacket
packetID = ID_OBJECT_LOCK;
}
void PacketObjectLock::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketObjectLock::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
if (!send)
event->objectChanges.objects.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketObjectLock(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketObjectMove::PacketObjectMove(RakNet::RakPeerInterface *peer) : WorldPacket
packetID = ID_OBJECT_MOVE;
}
void PacketObjectMove::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketObjectMove::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
if (!send)
event->objectChanges.objects.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketObjectMove(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketObjectPlace::PacketObjectPlace(RakNet::RakPeerInterface *peer) : WorldPack
packetID = ID_OBJECT_PLACE;
}
void PacketObjectPlace::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketObjectPlace::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
if (!send)
event->objectChanges.objects.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketObjectPlace(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

@ -8,9 +8,9 @@ PacketObjectRotate::PacketObjectRotate(RakNet::RakPeerInterface *peer) : WorldPa
packetID = ID_OBJECT_ROTATE;
}
void PacketObjectRotate::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
void PacketObjectRotate::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, event, send);
WorldPacket::Packet(bs, send);
if (!send)
event->objectChanges.objects.clear();

@ -10,7 +10,7 @@ namespace mwmp
public:
PacketObjectRotate(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save