From 04d45b9dbb6a3a49f2dac382a72bd3552272668e Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 5 Feb 2017 09:01:33 +0200 Subject: [PATCH] [General] Rename packets to show they are for players only, not NPCs --- apps/openmw-mp/Networking.cpp | 70 +++++++++---------- apps/openmw-mp/Script/Functions/CharClass.cpp | 2 +- apps/openmw-mp/Script/Functions/Items.cpp | 18 ++--- apps/openmw-mp/Script/Functions/Positions.cpp | 2 +- apps/openmw-mp/Script/Functions/Quests.cpp | 2 +- apps/openmw-mp/Script/Functions/Spells.cpp | 2 +- apps/openmw-mp/Script/Functions/Stats.cpp | 14 ++-- apps/openmw/mwmp/DedicatedPlayer.cpp | 2 +- apps/openmw/mwmp/LocalPlayer.cpp | 70 +++++++++---------- apps/openmw/mwmp/Main.cpp | 4 +- apps/openmw/mwmp/Networking.cpp | 30 ++++---- components/CMakeLists.txt | 18 ++--- components/openmw-mp/Base/BasePlayer.hpp | 4 +- .../Controllers/PlayerPacketController.cpp | 52 +++++++------- components/openmw-mp/NetworkMessages.hpp | 26 +++---- .../Packets/Player/PacketActiveSkills.hpp | 21 ------ .../Packets/Player/PacketBaseInfo.hpp | 21 ------ .../Packets/Player/PacketCharGen.cpp | 19 ----- .../Packets/Player/PacketDrawState.cpp | 20 ------ .../Packets/Player/PacketDrawState.hpp | 23 ------ .../Packets/Player/PacketInventory.hpp | 22 ------ .../Packets/Player/PacketJournal.hpp | 18 ----- .../openmw-mp/Packets/Player/PacketLevel.cpp | 20 ------ .../openmw-mp/Packets/Player/PacketLevel.hpp | 21 ------ ...kills.cpp => PacketPlayerActiveSkills.cpp} | 8 +-- .../Player/PacketPlayerActiveSkills.hpp | 21 ++++++ ...acketAttack.cpp => PacketPlayerAttack.cpp} | 8 +-- ...acketAttack.hpp => PacketPlayerAttack.hpp} | 10 +-- ...tBaseInfo.cpp => PacketPlayerBaseInfo.cpp} | 8 +-- ...Equipment.hpp => PacketPlayerBaseInfo.hpp} | 10 +-- .../Packets/Player/PacketPlayerCharGen.cpp | 19 +++++ ...ketCharGen.hpp => PacketPlayerCharGen.hpp} | 10 +-- ...{PacketClass.cpp => PacketPlayerClass.cpp} | 8 +-- ...{PacketClass.hpp => PacketPlayerClass.hpp} | 10 +-- .../Packets/Player/PacketPlayerDrawState.cpp | 20 ++++++ .../Packets/Player/PacketPlayerDrawState.hpp | 23 ++++++ ...Stats.cpp => PacketPlayerDynamicStats.cpp} | 8 +-- ...Stats.hpp => PacketPlayerDynamicStats.hpp} | 10 +-- ...quipment.cpp => PacketPlayerEquipment.cpp} | 10 +-- .../Packets/Player/PacketPlayerEquipment.hpp | 21 ++++++ ...nventory.cpp => PacketPlayerInventory.cpp} | 12 ++-- .../Packets/Player/PacketPlayerInventory.hpp | 22 ++++++ ...ketJournal.cpp => PacketPlayerJournal.cpp} | 8 +-- .../Packets/Player/PacketPlayerJournal.hpp | 18 +++++ .../Packets/Player/PacketPlayerLevel.cpp | 16 +++++ .../Packets/Player/PacketPlayerLevel.hpp | 17 +++++ ...tPosition.cpp => PacketPlayerPosition.cpp} | 8 +-- ...tPosition.hpp => PacketPlayerPosition.hpp} | 10 +-- ...pellbook.cpp => PacketPlayerSpellbook.cpp} | 8 +-- .../Packets/Player/PacketPlayerSpellbook.hpp | 18 +++++ .../Packets/Player/PacketSpellbook.hpp | 18 ----- 51 files changed, 427 insertions(+), 433 deletions(-) delete mode 100644 components/openmw-mp/Packets/Player/PacketActiveSkills.hpp delete mode 100644 components/openmw-mp/Packets/Player/PacketBaseInfo.hpp delete mode 100644 components/openmw-mp/Packets/Player/PacketCharGen.cpp delete mode 100644 components/openmw-mp/Packets/Player/PacketDrawState.cpp delete mode 100644 components/openmw-mp/Packets/Player/PacketDrawState.hpp delete mode 100644 components/openmw-mp/Packets/Player/PacketInventory.hpp delete mode 100644 components/openmw-mp/Packets/Player/PacketJournal.hpp delete mode 100644 components/openmw-mp/Packets/Player/PacketLevel.cpp delete mode 100644 components/openmw-mp/Packets/Player/PacketLevel.hpp rename components/openmw-mp/Packets/Player/{PacketActiveSkills.cpp => PacketPlayerActiveSkills.cpp} (83%) create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerActiveSkills.hpp rename components/openmw-mp/Packets/Player/{PacketAttack.cpp => PacketPlayerAttack.cpp} (67%) rename components/openmw-mp/Packets/Player/{PacketAttack.hpp => PacketPlayerAttack.hpp} (51%) rename components/openmw-mp/Packets/Player/{PacketBaseInfo.cpp => PacketPlayerBaseInfo.cpp} (61%) rename components/openmw-mp/Packets/Player/{PacketEquipment.hpp => PacketPlayerBaseInfo.hpp} (50%) create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerCharGen.cpp rename components/openmw-mp/Packets/Player/{PacketCharGen.hpp => PacketPlayerCharGen.hpp} (50%) rename components/openmw-mp/Packets/Player/{PacketClass.cpp => PacketPlayerClass.cpp} (59%) rename components/openmw-mp/Packets/Player/{PacketClass.hpp => PacketPlayerClass.hpp} (51%) create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerDrawState.cpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerDrawState.hpp rename components/openmw-mp/Packets/Player/{PacketDynamicStats.cpp => PacketPlayerDynamicStats.cpp} (55%) rename components/openmw-mp/Packets/Player/{PacketDynamicStats.hpp => PacketPlayerDynamicStats.hpp} (50%) rename components/openmw-mp/Packets/Player/{PacketEquipment.cpp => PacketPlayerEquipment.cpp} (50%) create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerEquipment.hpp rename components/openmw-mp/Packets/Player/{PacketInventory.cpp => PacketPlayerInventory.cpp} (72%) create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerInventory.hpp rename components/openmw-mp/Packets/Player/{PacketJournal.cpp => PacketPlayerJournal.cpp} (82%) create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerJournal.hpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerLevel.cpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerLevel.hpp rename components/openmw-mp/Packets/Player/{PacketPosition.cpp => PacketPlayerPosition.cpp} (57%) rename components/openmw-mp/Packets/Player/{PacketPosition.hpp => PacketPlayerPosition.hpp} (50%) rename components/openmw-mp/Packets/Player/{PacketSpellbook.cpp => PacketPlayerSpellbook.cpp} (75%) create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerSpellbook.hpp delete mode 100644 components/openmw-mp/Packets/Player/PacketSpellbook.hpp diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index c463b554b..b98501165 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -108,9 +108,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) return; } } - else if (packet->data[0] == ID_GAME_BASE_INFO) + else if (packet->data[0] == ID_PLAYER_BASEINFO) { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_BASE_INFO about %s", + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_BASEINFO about %s", player->npc.mName.c_str()); myPacket->Read(player); @@ -128,9 +128,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) switch (packet->data[0]) { - case ID_GAME_BASE_INFO: + case ID_PLAYER_BASEINFO: { - /*LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_BASE_INFO about %s", + /*LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_BASEINFO about %s", player->npc.mName.c_str()); myPacket->Read(player); @@ -138,9 +138,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_POS: + case ID_PLAYER_POS: { - //DEBUG_PRINTF("ID_GAME_POS \n"); + //DEBUG_PRINTF("ID_PLAYER_POS \n"); if (!player->creatureStats.mDead) { @@ -210,7 +210,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_LEVEL: + case ID_PLAYER_LEVEL: { if (!player->creatureStats.mDead) @@ -223,9 +223,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_EQUIPMENT: + case ID_PLAYER_EQUIPMENT: { - DEBUG_PRINTF("ID_GAME_EQUIPMENT\n"); + DEBUG_PRINTF("ID_PLAYER_EQUIPMENT\n"); myPacket->Read(player); myPacket->Send(player, true); @@ -235,9 +235,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_INVENTORY: + case ID_PLAYER_INVENTORY: { - DEBUG_PRINTF("ID_GAME_INVENTORY\n"); + DEBUG_PRINTF("ID_PLAYER_INVENTORY\n"); myPacket->Read(player); Script::Call(player->getId()); @@ -245,9 +245,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_SPELLBOOK: + case ID_PLAYER_SPELLBOOK: { - DEBUG_PRINTF("ID_GAME_SPELLBOOK\n"); + DEBUG_PRINTF("ID_PLAYER_SPELLBOOK\n"); myPacket->Read(player); Script::Call(player->getId(), player->spellbookChanges.action); @@ -255,9 +255,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_JOURNAL: + case ID_PLAYER_JOURNAL: { - DEBUG_PRINTF("ID_GAME_JOURNAL\n"); + DEBUG_PRINTF("ID_PLAYER_JOURNAL\n"); myPacket->Read(player); Script::Call(player->getId()); @@ -265,9 +265,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_ATTACK: + case ID_PLAYER_ATTACK: { - DEBUG_PRINTF("ID_GAME_ATTACK\n"); + DEBUG_PRINTF("ID_PLAYER_ATTACK\n"); if (!player->creatureStats.mDead) { @@ -292,14 +292,14 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } myPacket->Send(player, true); - playerController->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(player->attack.target); + playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->RequestData(player->attack.target); } break; } - case ID_GAME_DYNAMICSTATS: + case ID_PLAYER_DYNAMICSTATS: { - DEBUG_PRINTF("ID_GAME_DYNAMICSTATS\n"); + DEBUG_PRINTF("ID_PLAYER_DYNAMICSTATS\n"); myPacket->Read(player); myPacket->Send(player, true); break; @@ -340,7 +340,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) //packetResurrect.Read(player); player->creatureStats.mDead = false; myPacket->Send(player, true); - playerController->GetPacket(ID_GAME_POS)->RequestData(player->guid); + playerController->GetPacket(ID_PLAYER_POS)->RequestData(player->guid); playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->RequestData(player->guid); Script::Call(player->getId()); @@ -348,9 +348,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_DRAWSTATE: + case ID_PLAYER_DRAWSTATE: { - DEBUG_PRINTF("ID_GAME_DRAWSTATE\n"); + DEBUG_PRINTF("ID_PLAYER_DRAWSTATE\n"); myPacket->Read(player); myPacket->Send(player, true); break; @@ -372,9 +372,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_CHARGEN: + case ID_PLAYER_CHARGEN: { - DEBUG_PRINTF("ID_GAME_CHARGEN\n"); + DEBUG_PRINTF("ID_PLAYER_CHARGEN\n"); myPacket->Read(player); if (player->charGenStage.current == player->charGenStage.end && player->charGenStage.current != 0) @@ -395,9 +395,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_CHARCLASS: + case ID_PLAYER_CHARCLASS: { - DEBUG_PRINTF("ID_GAME_CHARCLASS\n"); + DEBUG_PRINTF("ID_PLAYER_CHARCLASS\n"); myPacket->Read(player); break; } @@ -689,11 +689,11 @@ void Networking::update(RakNet::Packet *packet) void Networking::newPlayer(RakNet::RakNetGUID guid) { - playerController->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid); - playerController->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(guid); - playerController->GetPacket(ID_GAME_POS)->RequestData(guid); + playerController->GetPacket(ID_PLAYER_BASEINFO)->RequestData(guid); + playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->RequestData(guid); + playerController->GetPacket(ID_PLAYER_POS)->RequestData(guid); playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->RequestData(guid); - playerController->GetPacket(ID_GAME_EQUIPMENT)->RequestData(guid); + playerController->GetPacket(ID_PLAYER_EQUIPMENT)->RequestData(guid); LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Sending info about other players to %lu", guid.g); @@ -712,13 +712,13 @@ 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_GAME_BASE_INFO)->Send(pl->second, guid); - playerController->GetPacket(ID_GAME_DYNAMICSTATS)->Send(pl->second, guid); + 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_GAME_POS)->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_GAME_EQUIPMENT)->Send(pl->second, guid); + playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(pl->second, guid); } } diff --git a/apps/openmw-mp/Script/Functions/CharClass.cpp b/apps/openmw-mp/Script/Functions/CharClass.cpp index 7449c6b62..85bd3d092 100644 --- a/apps/openmw-mp/Script/Functions/CharClass.cpp +++ b/apps/openmw-mp/Script/Functions/CharClass.cpp @@ -15,7 +15,7 @@ void CharClassFunctions::SendClass(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player,); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CHARCLASS)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARCLASS)->Send(player, false); } void CharClassFunctions::SetDefaultClass(unsigned short pid, const char *id) noexcept diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index 3b20bdc6f..0812e35ba 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -29,7 +29,7 @@ void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const cha Player *player; GET_PLAYER(pid, player,); - player->equipedItems[slot].refid = itemId; + player->equipedItems[slot].refId = itemId; player->equipedItems[slot].count = count; player->equipedItems[slot].health = health; } @@ -48,7 +48,7 @@ void ItemFunctions::AddItem(unsigned short pid, const char* itemId, unsigned int GET_PLAYER(pid, player, ); Item item; - item.refid = itemId; + item.refId = itemId; item.count = count; item.health = health; @@ -62,7 +62,7 @@ void ItemFunctions::RemoveItem(unsigned short pid, const char* itemId, unsigned GET_PLAYER(pid, player, ); Item item; - item.refid = itemId; + item.refId = itemId; item.count = count; player->inventoryChangesBuffer.items.push_back(item); @@ -84,7 +84,7 @@ bool ItemFunctions::HasItemEquipped(unsigned short pid, const char* itemId) GET_PLAYER(pid, player, false); for (int slot = 0; slot < MWWorld::InventoryStore::Slots; slot++) - if (Misc::StringUtils::ciEqual(player->equipedItems[slot].refid, itemId)) + if (Misc::StringUtils::ciEqual(player->equipedItems[slot].refId, itemId)) return true; return false; } @@ -94,7 +94,7 @@ const char *ItemFunctions::GetEquipmentItemId(unsigned short pid, unsigned short Player *player; GET_PLAYER(pid, player, 0); - return player->equipedItems[slot].refid.c_str(); + return player->equipedItems[slot].refId.c_str(); } int ItemFunctions::GetEquipmentItemCount(unsigned short pid, unsigned short slot) noexcept @@ -121,7 +121,7 @@ const char *ItemFunctions::GetInventoryItemId(unsigned short pid, unsigned int i if (i >= player->inventoryChanges.count) return "invalid"; - return player->inventoryChanges.items.at(i).refid.c_str(); + return player->inventoryChanges.items.at(i).refId.c_str(); } int ItemFunctions::GetInventoryItemCount(unsigned short pid, unsigned int i) noexcept @@ -145,8 +145,8 @@ void ItemFunctions::SendEquipment(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, true); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(player, true); } void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept @@ -155,7 +155,7 @@ void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept GET_PLAYER(pid, player, ); std::swap(player->inventoryChanges, player->inventoryChangesBuffer); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_INVENTORY)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_INVENTORY)->Send(player, false); player->inventoryChanges = std::move(player->inventoryChangesBuffer); player->inventoryChangesBuffer.items.clear(); } diff --git a/apps/openmw-mp/Script/Functions/Positions.cpp b/apps/openmw-mp/Script/Functions/Positions.cpp index eb14451fd..7c25b52e3 100644 --- a/apps/openmw-mp/Script/Functions/Positions.cpp +++ b/apps/openmw-mp/Script/Functions/Positions.cpp @@ -109,5 +109,5 @@ void PositionFunctions::SendPos(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_POS)->Send(player, false); } diff --git a/apps/openmw-mp/Script/Functions/Quests.cpp b/apps/openmw-mp/Script/Functions/Quests.cpp index 18e829b12..d3a527873 100644 --- a/apps/openmw-mp/Script/Functions/Quests.cpp +++ b/apps/openmw-mp/Script/Functions/Quests.cpp @@ -73,7 +73,7 @@ void QuestFunctions::SendJournalChanges(unsigned short pid) noexcept GET_PLAYER(pid, player, ); std::swap(player->journalChanges, player->journalChangesBuffer); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_JOURNAL)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_JOURNAL)->Send(player, false); player->journalChanges = std::move(player->journalChangesBuffer); player->journalChangesBuffer.journalItems.clear(); } diff --git a/apps/openmw-mp/Script/Functions/Spells.cpp b/apps/openmw-mp/Script/Functions/Spells.cpp index 06289ab5d..6cacdbd85 100644 --- a/apps/openmw-mp/Script/Functions/Spells.cpp +++ b/apps/openmw-mp/Script/Functions/Spells.cpp @@ -64,7 +64,7 @@ void SpellFunctions::SendSpellbookChanges(unsigned short pid) noexcept GET_PLAYER(pid, player, ); std::swap(player->spellbookChanges, player->spellbookChangesBuffer); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_SPELLBOOK)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SPELLBOOK)->Send(player, false); player->spellbookChanges = std::move(player->spellbookChangesBuffer); player->spellbookChangesBuffer.spells.clear(); } diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 36702e0c3..525e0276c 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -453,7 +453,7 @@ 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_GAME_CHARGEN)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARGEN)->Send(player, false); } void StatsFunctions::Resurrect(unsigned short pid) @@ -468,16 +468,16 @@ void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player,); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(player, true); } void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, true); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(player, true); } void StatsFunctions::SendAttributes(unsigned short pid) noexcept @@ -503,6 +503,6 @@ void StatsFunctions::SendLevel(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_LEVEL)->Send(player, false); - mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_LEVEL)->Send(player, true); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(player, false); + mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(player, true); } diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 1697cc6c3..3418b6530 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -294,7 +294,7 @@ void DedicatedPlayer::updateEquipment() { MWWorld::ContainerStoreIterator it = invStore.getSlot(slot); - const string &dedicItem = equipedItems[slot].refid; + const string &dedicItem = equipedItems[slot].refId; std::string item = ""; bool equal = false; if (it != invStore.end()) diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 8e7fc2350..a520d967a 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -108,7 +108,7 @@ bool LocalPlayer::charGenThread() windowManager->pushGuiMode(MWGui::GM_Review); break; } - getNetworking()->getPlayerPacket(ID_GAME_CHARGEN)->Send(this); + getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->Send(this); charGenStage.current++; return false; @@ -123,8 +123,8 @@ bool LocalPlayer::charGenThread() npc = *player.get()->mBase; birthsign = world->getPlayer().getBirthSign(); - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_GAME_BASE_INFO to server with my CharGen info"); - getNetworking()->getPlayerPacket(ID_GAME_BASE_INFO)->Send(this); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_BASEINFO to server with my CharGen info"); + getNetworking()->getPlayerPacket(ID_PLAYER_BASEINFO)->Send(this); // Send stats packets if this is the 2nd round of CharGen that // only happens for new characters @@ -136,7 +136,7 @@ bool LocalPlayer::charGenThread() updateLevel(true); sendClass(); sendSpellbook(); - getNetworking()->getPlayerPacket(ID_GAME_CHARGEN)->Send(this); + getNetworking()->getPlayerPacket(ID_PLAYER_CHARGEN)->Send(this); } sendCellStates(); @@ -183,7 +183,7 @@ void LocalPlayer::updateDynamicStats(bool forceUpdate) timer = 0; - getNetworking()->getPlayerPacket(ID_GAME_DYNAMICSTATS)->Send(this); + getNetworking()->getPlayerPacket(ID_PLAYER_DYNAMICSTATS)->Send(this); } } } @@ -256,7 +256,7 @@ void LocalPlayer::updateLevel(bool forceUpdate) if (ptrNpcStats.getLevel() != creatureStats.mLevel || forceUpdate) { creatureStats.mLevel = ptrNpcStats.getLevel(); - getNetworking()->getPlayerPacket(ID_GAME_LEVEL)->Send(this); + getNetworking()->getPlayerPacket(ID_PLAYER_LEVEL)->Send(this); // Also update skills to refresh level progress and attribute bonuses // for next level up @@ -296,7 +296,7 @@ void LocalPlayer::updatePosition(bool forceUpdate) direction.pos[1] = move.mPosition[1]; direction.pos[2] = move.mPosition[2]; - getNetworking()->getPlayerPacket(ID_GAME_POS)->Send(this); + getNetworking()->getPlayerPacket(ID_PLAYER_POS)->Send(this); } else if (isJumping && world->isOnGround(player)) { @@ -308,7 +308,7 @@ void LocalPlayer::updatePosition(bool forceUpdate) { sentJumpEnd = true; position = ptrPos; - getNetworking()->getPlayerPacket(ID_GAME_POS)->Send(this); + getNetworking()->getPlayerPacket(ID_PLAYER_POS)->Send(this); } } @@ -395,11 +395,11 @@ void LocalPlayer::updateEquipment(bool forceUpdate) for (int slot = 0; slot < MWWorld::InventoryStore::Slots; slot++) { MWWorld::ContainerStoreIterator it = invStore.getSlot(slot); - if (it != invStore.end() && !::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), equipedItems[slot].refid)) + if (it != invStore.end() && !::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), equipedItems[slot].refId)) { equipChanged = true; - equipedItems[slot].refid = it->getCellRef().getRefId(); + equipedItems[slot].refId = it->getCellRef().getRefId(); equipedItems[slot].health = it->getCellRef().getCharge(); if (slot == MWWorld::InventoryStore::Slot_CarriedRight) { @@ -411,10 +411,10 @@ void LocalPlayer::updateEquipment(bool forceUpdate) else equipedItems[slot].count = invStore.count(it->getCellRef().getRefId()); } - else if (it == invStore.end() && !equipedItems[slot].refid.empty()) + else if (it == invStore.end() && !equipedItems[slot].refId.empty()) { equipChanged = true; - equipedItems[slot].refid = ""; + equipedItems[slot].refId = ""; equipedItems[slot].count = 0; equipedItems[slot].health = 0; } @@ -424,7 +424,7 @@ void LocalPlayer::updateEquipment(bool forceUpdate) { RakNet::BitStream bs; bs.ResetWritePointer(); - getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_EQUIPMENT)->Packet(&bs, this, true); + getNetworking()->getPlayerPacket((RakNet::MessageID) ID_PLAYER_EQUIPMENT)->Packet(&bs, this, true); getNetworking()->sendData(&bs); equipChanged = false; } @@ -448,8 +448,8 @@ void LocalPlayer::updateInventory(bool forceUpdate) MWWorld::ContainerStoreIterator result(ptrInventory.begin()); for (; result != ptrInventory.end(); ++result) { - item.refid = result->getCellRef().getRefId(); - if (item.refid.find("$dynamic") != string::npos) // skip generated items (self enchanted for e.g.) + item.refId = result->getCellRef().getRefId(); + if (item.refId.find("$dynamic") != string::npos) // skip generated items (self enchanted for e.g.) continue; item.count = result->getRefData().getCount(); @@ -470,8 +470,8 @@ void LocalPlayer::updateInventory(bool forceUpdate) { for (MWWorld::ContainerStoreIterator iter(ptrInventory.begin()); iter != ptrInventory.end(); ++iter) { - item.refid = iter->getCellRef().getRefId(); - if (item.refid.find("$dynamic") != string::npos) // skip generated items (self enchanted for e.g.) + item.refId = iter->getCellRef().getRefId(); + if (item.refId.find("$dynamic") != string::npos) // skip generated items (self enchanted for e.g.) continue; item.count = iter->getRefData().getCount(); @@ -525,7 +525,7 @@ void LocalPlayer::updateAttackState(bool forceUpdate) attack.refid = spell; /*RakNet::BitStream bs; - getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true); + getNetworking()->getPlayerPacket((RakNet::MessageID) ID_PLAYER_ATTACK)->Packet(&bs, this, true); getNetworking()->SendData(&bs);*/ } else if (state == MWMechanics::DrawState_Weapon) @@ -623,7 +623,7 @@ void LocalPlayer::updateDrawStateAndFlags(bool forceUpdate) mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after jump; RakNet::BitStream bs; - getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_DRAWSTATE)->Packet(&bs, this, true); + getNetworking()->getPlayerPacket((RakNet::MessageID) ID_PLAYER_DRAWSTATE)->Packet(&bs, this, true); getNetworking()->sendData(&bs); //timer = 0; } @@ -637,7 +637,7 @@ void LocalPlayer::addItems() for (unsigned int i = 0; i < inventoryChanges.count; i++) { mwmp::Item item = inventoryChanges.items[i]; - MWWorld::Ptr itemPtr = *ptrStore.add(item.refid, item.count, ptrPlayer); + MWWorld::Ptr itemPtr = *ptrStore.add(item.refId, item.count, ptrPlayer); if (item.health != -1) itemPtr.getCellRef().setCharge(item.health); } @@ -689,7 +689,7 @@ void LocalPlayer::removeItems() for (unsigned int i = 0; i < inventoryChanges.count; i++) { mwmp::Item item = inventoryChanges.items[i]; - ptrStore.remove(item.refid, item.count, ptrPlayer); + ptrStore.remove(item.refId, item.count, ptrPlayer); } } @@ -866,19 +866,19 @@ void LocalPlayer::setEquipment() { mwmp::Item *currentItem = &equipedItems[slot]; - if (!currentItem->refid.empty()) + if (!currentItem->refId.empty()) { MWWorld::ContainerStoreIterator it = ptrInventory.begin(); for (; it != ptrInventory.end(); ++it) // find item in inventory { - if (::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), currentItem->refid)) + if (::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), currentItem->refId)) break; } if (it == ptrInventory.end()) // if not exists add item ptrInventory.equip( slot, ptrInventory.ContainerStore::add( - equipedItems[slot].refid.c_str(), + equipedItems[slot].refId.c_str(), equipedItems[slot].count, ptrPlayer), ptrPlayer); @@ -952,7 +952,7 @@ void LocalPlayer::sendClass() else charClass.mId = cls->mId; - getNetworking()->getPlayerPacket(ID_GAME_CHARCLASS)->Send(this); + getNetworking()->getPlayerPacket(ID_PLAYER_CHARCLASS)->Send(this); } void LocalPlayer::sendInventory() @@ -965,8 +965,8 @@ void LocalPlayer::sendInventory() for (MWWorld::ContainerStoreIterator iter(ptrInventory.begin()); iter != ptrInventory.end(); ++iter) { - item.refid = iter->getCellRef().getRefId(); - if (item.refid.find("$dynamic") != string::npos) // skip generated items (self enchanted for e.g.) + item.refId = iter->getCellRef().getRefId(); + if (item.refId.find("$dynamic") != string::npos) // skip generated items (self enchanted for e.g.) continue; item.count = iter->getRefData().getCount(); @@ -977,7 +977,7 @@ void LocalPlayer::sendInventory() inventoryChanges.count = (unsigned int) inventoryChanges.items.size(); inventoryChanges.action = InventoryChanges::SET; - Main::get().getNetworking()->getPlayerPacket(ID_GAME_INVENTORY)->Send(this); + Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_INVENTORY)->Send(this); } void LocalPlayer::sendSpellbook() @@ -999,7 +999,7 @@ void LocalPlayer::sendSpellbook() } spellbookChanges.action = SpellbookChanges::SET; - Main::get().getNetworking()->getPlayerPacket(ID_GAME_SPELLBOOK)->Send(this); + Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send(this); } void LocalPlayer::sendCellStates() @@ -1020,7 +1020,7 @@ void LocalPlayer::sendSpellAddition(std::string id) spellbookChanges.spells.push_back(spell); spellbookChanges.action = SpellbookChanges::ADD; - Main::get().getNetworking()->getPlayerPacket(ID_GAME_SPELLBOOK)->Send(this); + Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send(this); } void LocalPlayer::sendSpellRemoval(std::string id) @@ -1035,7 +1035,7 @@ void LocalPlayer::sendSpellRemoval(std::string id) spellbookChanges.spells.push_back(spell); spellbookChanges.action = SpellbookChanges::REMOVE; - Main::get().getNetworking()->getPlayerPacket(ID_GAME_SPELLBOOK)->Send(this); + Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send(this); } void LocalPlayer::sendSpellAddition(const ESM::Spell &spell) @@ -1063,7 +1063,7 @@ void LocalPlayer::sendJournalEntry(const std::string& quest, int index, const MW journalChanges.journalItems.push_back(journalItem); - Main::get().getNetworking()->getPlayerPacket(ID_GAME_JOURNAL)->Send(this); + Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_JOURNAL)->Send(this); } void LocalPlayer::sendJournalIndex(const std::string& quest, int index) @@ -1077,7 +1077,7 @@ void LocalPlayer::sendJournalIndex(const std::string& quest, int index) journalChanges.journalItems.push_back(journalItem); - Main::get().getNetworking()->getPlayerPacket(ID_GAME_JOURNAL)->Send(this); + Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_JOURNAL)->Send(this); } void LocalPlayer::sendAttack(Attack::TYPE type) @@ -1087,7 +1087,7 @@ void LocalPlayer::sendAttack(Attack::TYPE type) attack.type = type; attack.pressed = false; RakNet::BitStream bs; - getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true); + getNetworking()->getPlayerPacket((RakNet::MessageID) ID_PLAYER_ATTACK)->Packet(&bs, this, true); getNetworking()->sendData(&bs); } @@ -1146,6 +1146,6 @@ void LocalPlayer::prepareAttack(Attack::TYPE type, bool state) attack.attacker = guid; RakNet::BitStream bs; - getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true); + getNetworking()->getPlayerPacket((RakNet::MessageID) ID_PLAYER_ATTACK)->Packet(&bs, this, true); getNetworking()->sendData(&bs); } diff --git a/apps/openmw/mwmp/Main.cpp b/apps/openmw/mwmp/Main.cpp index b341b1430..cb9bd4563 100644 --- a/apps/openmw/mwmp/Main.cpp +++ b/apps/openmw/mwmp/Main.cpp @@ -188,9 +188,9 @@ void Main::updateWorld(float dt) const if (init) { init = false; - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_GAME_BASE_INFO to server"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_BASEINFO to server"); - mNetworking->getPlayerPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer()); + mNetworking->getPlayerPacket(ID_PLAYER_BASEINFO)->Send(getLocalPlayer()); mNetworking->getPlayerPacket(ID_LOADED)->Send(getLocalPlayer()); mLocalPlayer->updateDynamicStats(true); get().getGUIController()->setChatVisible(true); diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index 32325e58f..f3bc942ce 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -193,9 +193,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) myPacket->Send(getLocalPlayer(), serverAddr); break; } - case ID_GAME_BASE_INFO: + case ID_PLAYER_BASEINFO: { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_BASE_INFO from server"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_BASEINFO from server"); if (guid == myGuid) { @@ -228,13 +228,13 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_POS: + case ID_PLAYER_POS: { if (guid == myGuid) { if (packet->length != myPacket->headerSize()) { - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GAME_POS changed by server"); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_PLAYER_POS changed by server"); myPacket->Packet(&bsIn, getLocalPlayer(), false); getLocalPlayer()->setPosition(); } @@ -263,7 +263,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) Players::disconnectPlayer(guid); } - case ID_GAME_EQUIPMENT: + case ID_PLAYER_EQUIPMENT: { if (guid == myGuid) { @@ -284,7 +284,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_INVENTORY: + case ID_PLAYER_INVENTORY: { if (guid == myGuid) { @@ -313,7 +313,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_SPELLBOOK: + case ID_PLAYER_SPELLBOOK: { if (guid == myGuid) { @@ -342,7 +342,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_JOURNAL: + case ID_PLAYER_JOURNAL: { if (guid == myGuid) { @@ -358,7 +358,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_ATTACK: + case ID_PLAYER_ATTACK: { if (pl != 0) { @@ -425,7 +425,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_DYNAMICSTATS: + case ID_PLAYER_DYNAMICSTATS: { if (guid == myGuid) { @@ -492,7 +492,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) myPacket->Send(getLocalPlayer(), serverAddr); getLocalPlayer()->updateDynamicStats(true); - playerController.GetPacket(ID_GAME_DYNAMICSTATS)->Send(getLocalPlayer(), serverAddr); + playerController.GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(getLocalPlayer(), serverAddr); } else if (pl != 0) { @@ -538,7 +538,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_DRAWSTATE: + case ID_PLAYER_DRAWSTATE: { if (guid == myGuid) getLocalPlayer()->updateDrawStateAndFlags(true); @@ -566,7 +566,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) break; } - case ID_GAME_CHARGEN: + case ID_PLAYER_CHARGEN: { if (guid == myGuid) { @@ -634,7 +634,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_LEVEL: + case ID_PLAYER_LEVEL: { if (guid == myGuid) { @@ -682,7 +682,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) } break; } - case ID_GAME_CHARCLASS: + case ID_PLAYER_CHARCLASS: { if (guid == myGuid) { diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 98124b107..8fbdb72d3 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -152,14 +152,16 @@ add_component_dir (openmw-mp Controllers/PlayerPacketController Controllers/WorldPacketController Packets/BasePacket Packets/Player/PlayerPacket Packets/World/WorldPacket - Packets/Player/PacketBaseInfo Packets/Player/PacketPosition Packets/Player/PacketEquipment - Packets/Player/PacketAttack Packets/Player/PacketDynamicStats Packets/Player/PacketDrawState - Packets/Player/PacketChatMessage Packets/Player/PacketCharGen Packets/Player/PacketPlayerAttribute - Packets/Player/PacketPlayerSkill Packets/Player/PacketLevel Packets/Player/PacketHandshake - Packets/Player/PacketGUIBoxes Packets/Player/PacketClass Packets/Player/PacketTime - Packets/Player/PacketInventory Packets/Player/PacketSpellbook Packets/Player/PacketJournal - Packets/Player/PacketActiveSkills Packets/Player/PacketPlayerCellChange - Packets/Player/PacketPlayerCellState + Packets/Player/PacketHandshake Packets/Player/PacketChatMessage + + Packets/Player/PacketPlayerBaseInfo Packets/Player/PacketPlayerPosition Packets/Player/PacketPlayerEquipment + Packets/Player/PacketPlayerAttack Packets/Player/PacketPlayerDynamicStats Packets/Player/PacketPlayerDrawState + Packets/Player/PacketPlayerCharGen Packets/Player/PacketPlayerAttribute Packets/Player/PacketPlayerSkill + Packets/Player/PacketPlayerLevel Packets/Player/PacketPlayerClass Packets/Player/PacketPlayerInventory + Packets/Player/PacketPlayerSpellbook Packets/Player/PacketPlayerJournal Packets/Player/PacketPlayerActiveSkills + Packets/Player/PacketPlayerCellChange Packets/Player/PacketPlayerCellState + + Packets/Player/PacketGUIBoxes Packets/Player/PacketTime Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectScale Packets/World/PacketObjectHealth Packets/World/PacketObjectLock Packets/World/PacketObjectUnlock diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index e3c6db6b1..e47b1bf08 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -37,12 +37,12 @@ namespace mwmp struct Item { - std::string refid; + std::string refId; int count; int health; inline bool operator==(const Item& rhs) { - return refid == rhs.refid && count == rhs.count && health == rhs.health; + return refId == rhs.refId && count == rhs.count && health == rhs.health; } }; diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index db951cc14..6ad7a907a 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -2,33 +2,33 @@ #include #include -#include "../Packets/Player/PacketClass.hpp" -#include "../Packets/Player/PacketPosition.hpp" +#include "../Packets/Player/PacketPlayerClass.hpp" +#include "../Packets/Player/PacketPlayerPosition.hpp" #include "../Packets/Player/PacketPlayerCellChange.hpp" #include "../Packets/Player/PacketPlayerCellState.hpp" -#include "../Packets/Player/PacketBaseInfo.hpp" -#include "../Packets/Player/PacketEquipment.hpp" -#include "../Packets/Player/PacketAttack.hpp" -#include "../Packets/Player/PacketDynamicStats.hpp" +#include "../Packets/Player/PacketPlayerBaseInfo.hpp" +#include "../Packets/Player/PacketPlayerEquipment.hpp" +#include "../Packets/Player/PacketPlayerAttack.hpp" +#include "../Packets/Player/PacketPlayerDynamicStats.hpp" #include "../Packets/Player/PacketResurrect.hpp" #include "../Packets/Player/PacketDie.hpp" #include "../Packets/Player/PacketSendMyID.hpp" #include "../Packets/Player/PacketDisconnect.hpp" -#include "../Packets/Player/PacketDrawState.hpp" +#include "../Packets/Player/PacketPlayerDrawState.hpp" #include "../Packets/Player/PacketChatMessage.hpp" -#include "../Packets/Player/PacketCharGen.hpp" +#include "../Packets/Player/PacketPlayerCharGen.hpp" #include "../Packets/Player/PacketPlayerAttribute.hpp" #include "../Packets/Player/PacketPlayerSkill.hpp" -#include "../Packets/Player/PacketLevel.hpp" +#include "../Packets/Player/PacketPlayerLevel.hpp" #include "../Packets/Player/PacketHandshake.hpp" #include "../Packets/Player/PacketGUIBoxes.hpp" #include "../Packets/Player/PacketTime.hpp" #include "../Packets/Player/PacketLoaded.hpp" -#include "../Packets/Player/PacketInventory.hpp" -#include "../Packets/Player/PacketSpellbook.hpp" -#include "../Packets/Player/PacketJournal.hpp" +#include "../Packets/Player/PacketPlayerInventory.hpp" +#include "../Packets/Player/PacketPlayerSpellbook.hpp" +#include "../Packets/Player/PacketPlayerJournal.hpp" #include "../Packets/Player/PacketConsole.hpp" -#include "../Packets/Player/PacketActiveSkills.hpp" +#include "../Packets/Player/PacketPlayerActiveSkills.hpp" #include "PlayerPacketController.hpp" @@ -42,38 +42,38 @@ inline void AddPacket(mwmp::PlayerPacketController::packets_t *packets, RakNet:: mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer) { - AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); } diff --git a/components/openmw-mp/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index 143a550e7..85f8a1a46 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -10,31 +10,31 @@ enum GameMessages { ID_MASTER_QUERY = ID_USER_PACKET_ENUM+1, - ID_GAME_BASE_INFO, - ID_GAME_CHARGEN, - ID_GAME_POS, - ID_GAME_DYNAMICSTATS, - ID_GAME_ATTACK, + ID_PLAYER_BASEINFO, + ID_PLAYER_CHARGEN, + ID_PLAYER_POS, + ID_PLAYER_DYNAMICSTATS, + ID_PLAYER_ATTACK, ID_USER_MYID, - ID_GAME_EQUIPMENT, + ID_PLAYER_EQUIPMENT, ID_USER_DISCONNECTED, ID_GAME_DIE, ID_GAME_RESURRECT, ID_CHAT_MESSAGE, - ID_GAME_DRAWSTATE, + ID_PLAYER_DRAWSTATE, ID_PLAYER_ATTRIBUTE, ID_PLAYER_SKILL, - ID_GAME_LEVEL, - ID_GAME_CHARCLASS, + ID_PLAYER_LEVEL, + ID_PLAYER_CHARCLASS, ID_HANDSHAKE, ID_LOADED, ID_GUI_MESSAGEBOX, ID_GAME_TIME, - ID_GAME_INVENTORY, - ID_GAME_SPELLBOOK, - ID_GAME_JOURNAL, - ID_GAME_ACTIVESKILLS, + ID_PLAYER_INVENTORY, + ID_PLAYER_SPELLBOOK, + ID_PLAYER_JOURNAL, + ID_PLAYER_ACTIVESKILLS, ID_PLAYER_CELL_CHANGE, ID_PLAYER_CELL_STATE, diff --git a/components/openmw-mp/Packets/Player/PacketActiveSkills.hpp b/components/openmw-mp/Packets/Player/PacketActiveSkills.hpp deleted file mode 100644 index 33f826e98..000000000 --- a/components/openmw-mp/Packets/Player/PacketActiveSkills.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Created by koncord on 03.12.16. -// - -#ifndef OPENMW_PACKETACTIVESKILLS_HPP -#define OPENMW_PACKETACTIVESKILLS_HPP - -#include - -namespace mwmp -{ - class PacketActiveSkills : public PlayerPacket - { - public: - PacketActiveSkills(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); - }; -} - -#endif //OPENMW_PACKETACTIVESKILLS_HPP diff --git a/components/openmw-mp/Packets/Player/PacketBaseInfo.hpp b/components/openmw-mp/Packets/Player/PacketBaseInfo.hpp deleted file mode 100644 index 91a6bee0f..000000000 --- a/components/openmw-mp/Packets/Player/PacketBaseInfo.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Created by koncord on 07.01.16. -// - -#ifndef OPENMW_PACKETBASEINFO_HPP -#define OPENMW_PACKETBASEINFO_HPP - -#include - -namespace mwmp -{ - class PacketBaseInfo : public PlayerPacket - { - public: - PacketBaseInfo(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); - }; -} - -#endif //OPENMW_PACKETBASEINFO_HPP diff --git a/components/openmw-mp/Packets/Player/PacketCharGen.cpp b/components/openmw-mp/Packets/Player/PacketCharGen.cpp deleted file mode 100644 index cac1f28a9..000000000 --- a/components/openmw-mp/Packets/Player/PacketCharGen.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// -// Created by koncord on 08.03.16. -// - -#include -#include "PacketCharGen.hpp" - -mwmp::PacketCharGen::PacketCharGen(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) -{ - packetID = ID_GAME_CHARGEN; -} - -void mwmp::PacketCharGen::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) -{ - PlayerPacket::Packet(bs, player, send); - - RW(player->charGenStage, send); - -} diff --git a/components/openmw-mp/Packets/Player/PacketDrawState.cpp b/components/openmw-mp/Packets/Player/PacketDrawState.cpp deleted file mode 100644 index 30c314e07..000000000 --- a/components/openmw-mp/Packets/Player/PacketDrawState.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// Created by koncord on 15.01.16. -// - -#include -#include "PacketDrawState.hpp" - -mwmp::PacketDrawState::PacketDrawState(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) -{ - packetID = ID_GAME_DRAWSTATE; -} - -void mwmp::PacketDrawState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) -{ - PlayerPacket::Packet(bs, player, send); - - RW(player->movementFlags, send); - - RW(player->drawState, send); -} diff --git a/components/openmw-mp/Packets/Player/PacketDrawState.hpp b/components/openmw-mp/Packets/Player/PacketDrawState.hpp deleted file mode 100644 index 7aa20750c..000000000 --- a/components/openmw-mp/Packets/Player/PacketDrawState.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// -// Created by koncord on 15.01.16. -// - -#ifndef OPENMW_PACKETDRAWSTATE_HPP -#define OPENMW_PACKETDRAWSTATE_HPP - - -#include - -namespace mwmp -{ - class PacketDrawState : public PlayerPacket - { - public: - PacketDrawState(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); - }; -} - - -#endif //OPENMW_PACKETDRAWSTATE_HPP diff --git a/components/openmw-mp/Packets/Player/PacketInventory.hpp b/components/openmw-mp/Packets/Player/PacketInventory.hpp deleted file mode 100644 index 8601a8b63..000000000 --- a/components/openmw-mp/Packets/Player/PacketInventory.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// -// Created by koncord on 22.10.16. -// - -#ifndef OPENMW_PACKETINVENTORY_HPP -#define OPENMW_PACKETINVENTORY_HPP - -#include - -namespace mwmp -{ - class PacketInventory : public PlayerPacket - { - public: - PacketInventory(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); - }; -} - - -#endif //OPENMW_PACKETINVENTORY_HPP diff --git a/components/openmw-mp/Packets/Player/PacketJournal.hpp b/components/openmw-mp/Packets/Player/PacketJournal.hpp deleted file mode 100644 index 7a8214b3c..000000000 --- a/components/openmw-mp/Packets/Player/PacketJournal.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef OPENMW_PACKETJOURNAL_HPP -#define OPENMW_PACKETJOURNAL_HPP - -#include - -namespace mwmp -{ - class PacketJournal : public PlayerPacket - { - public: - PacketJournal(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); - }; -} - - -#endif //OPENMW_PACKETJOURNAL_HPP diff --git a/components/openmw-mp/Packets/Player/PacketLevel.cpp b/components/openmw-mp/Packets/Player/PacketLevel.cpp deleted file mode 100644 index 2be7855a8..000000000 --- a/components/openmw-mp/Packets/Player/PacketLevel.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// Created by David Cernat on 25.09.16. -// - -#include "PacketLevel.hpp" -#include - -using namespace mwmp; - -PacketLevel::PacketLevel(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) -{ - packetID = ID_GAME_LEVEL; -} - -void PacketLevel::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) -{ - PlayerPacket::Packet(bs, player, send); - - RW(player->creatureStats.mLevel, send); -} diff --git a/components/openmw-mp/Packets/Player/PacketLevel.hpp b/components/openmw-mp/Packets/Player/PacketLevel.hpp deleted file mode 100644 index 8537e954d..000000000 --- a/components/openmw-mp/Packets/Player/PacketLevel.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Created by David Cernat on 25.09.16. -// - -#ifndef OPENMW_PACKETLEVEL_HPP -#define OPENMW_PACKETLEVEL_HPP - -#include - -namespace mwmp -{ - class PacketLevel : public PlayerPacket - { - public: - PacketLevel(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); - }; -} - -#endif //OPENMW_PACKETLEVEL_HPP diff --git a/components/openmw-mp/Packets/Player/PacketActiveSkills.cpp b/components/openmw-mp/Packets/Player/PacketPlayerActiveSkills.cpp similarity index 83% rename from components/openmw-mp/Packets/Player/PacketActiveSkills.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerActiveSkills.cpp index e7555ceb7..0633534a0 100644 --- a/components/openmw-mp/Packets/Player/PacketActiveSkills.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerActiveSkills.cpp @@ -2,17 +2,17 @@ // Created by koncord on 03.12.16. // -#include "PacketActiveSkills.hpp" +#include "PacketPlayerActiveSkills.hpp" #include using namespace mwmp; -PacketActiveSkills::PacketActiveSkills(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerActiveSkills::PacketPlayerActiveSkills(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_ACTIVESKILLS; + packetID = ID_PLAYER_ACTIVESKILLS; } -void PacketActiveSkills::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) +void PacketPlayerActiveSkills::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); diff --git a/components/openmw-mp/Packets/Player/PacketPlayerActiveSkills.hpp b/components/openmw-mp/Packets/Player/PacketPlayerActiveSkills.hpp new file mode 100644 index 000000000..6b417633e --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerActiveSkills.hpp @@ -0,0 +1,21 @@ +// +// Created by koncord on 03.12.16. +// + +#ifndef OPENMW_PACKETPLAYERACTIVESKILLS_HPP +#define OPENMW_PACKETPLAYERACTIVESKILLS_HPP + +#include + +namespace mwmp +{ + class PacketPlayerActiveSkills : public PlayerPacket + { + public: + PacketPlayerActiveSkills(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); + }; +} + +#endif //OPENMW_PACKETPLAYERACTIVESKILLS_HPP diff --git a/components/openmw-mp/Packets/Player/PacketAttack.cpp b/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp similarity index 67% rename from components/openmw-mp/Packets/Player/PacketAttack.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp index bdad8f821..5ee41d65c 100644 --- a/components/openmw-mp/Packets/Player/PacketAttack.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp @@ -3,16 +3,16 @@ // #include -#include "PacketAttack.hpp" +#include "PacketPlayerAttack.hpp" using namespace mwmp; -PacketAttack::PacketAttack(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerAttack::PacketPlayerAttack(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_ATTACK; + packetID = ID_PLAYER_ATTACK; } -void PacketAttack::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) +void PacketPlayerAttack::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); diff --git a/components/openmw-mp/Packets/Player/PacketAttack.hpp b/components/openmw-mp/Packets/Player/PacketPlayerAttack.hpp similarity index 51% rename from components/openmw-mp/Packets/Player/PacketAttack.hpp rename to components/openmw-mp/Packets/Player/PacketPlayerAttack.hpp index 415d5f78a..8c79bd875 100644 --- a/components/openmw-mp/Packets/Player/PacketAttack.hpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerAttack.hpp @@ -2,21 +2,21 @@ // Created by koncord on 13.01.16. // -#ifndef OPENMW_PACKETATTACK_HPP -#define OPENMW_PACKETATTACK_HPP +#ifndef OPENMW_PACKETPLAYERATTACK_HPP +#define OPENMW_PACKETPLAYERATTACK_HPP #include namespace mwmp { - class PacketAttack : public PlayerPacket + class PacketPlayerAttack : public PlayerPacket { public: - PacketAttack(RakNet::RakPeerInterface *peer); + PacketPlayerAttack(RakNet::RakPeerInterface *peer); virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); }; } -#endif //OPENMW_PACKETATTACK_HPP +#endif //OPENMW_PACKETPLAYERATTACK_HPP diff --git a/components/openmw-mp/Packets/Player/PacketBaseInfo.cpp b/components/openmw-mp/Packets/Player/PacketPlayerBaseInfo.cpp similarity index 61% rename from components/openmw-mp/Packets/Player/PacketBaseInfo.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerBaseInfo.cpp index 8d0b12a4e..ee0e6d5f4 100644 --- a/components/openmw-mp/Packets/Player/PacketBaseInfo.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerBaseInfo.cpp @@ -2,17 +2,17 @@ // Created by koncord on 07.01.16. // -#include "PacketBaseInfo.hpp" +#include "PacketPlayerBaseInfo.hpp" #include using namespace mwmp; -PacketBaseInfo::PacketBaseInfo(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerBaseInfo::PacketPlayerBaseInfo(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_BASE_INFO; + packetID = ID_PLAYER_BASEINFO; } -void PacketBaseInfo::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) +void PacketPlayerBaseInfo::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); diff --git a/components/openmw-mp/Packets/Player/PacketEquipment.hpp b/components/openmw-mp/Packets/Player/PacketPlayerBaseInfo.hpp similarity index 50% rename from components/openmw-mp/Packets/Player/PacketEquipment.hpp rename to components/openmw-mp/Packets/Player/PacketPlayerBaseInfo.hpp index d0134a577..765607490 100644 --- a/components/openmw-mp/Packets/Player/PacketEquipment.hpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerBaseInfo.hpp @@ -2,20 +2,20 @@ // Created by koncord on 07.01.16. // -#ifndef OPENMW_PACKETEQUIPMENT_HPP -#define OPENMW_PACKETEQUIPMENT_HPP +#ifndef OPENMW_PACKETPLAYERBASEINFO_HPP +#define OPENMW_PACKETPLAYERBASEINFO_HPP #include namespace mwmp { - class PacketEquipment : public PlayerPacket + class PacketPlayerBaseInfo : public PlayerPacket { public: - PacketEquipment(RakNet::RakPeerInterface *peer); + PacketPlayerBaseInfo(RakNet::RakPeerInterface *peer); virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); }; } -#endif //OPENMW_PACKETEQUIPMENT_HPP +#endif //OPENMW_PACKETPLAYERBASEINFO_HPP diff --git a/components/openmw-mp/Packets/Player/PacketPlayerCharGen.cpp b/components/openmw-mp/Packets/Player/PacketPlayerCharGen.cpp new file mode 100644 index 000000000..ded6fac99 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerCharGen.cpp @@ -0,0 +1,19 @@ +// +// Created by koncord on 08.03.16. +// + +#include +#include "PacketPlayerCharGen.hpp" + +mwmp::PacketPlayerCharGen::PacketPlayerCharGen(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_CHARGEN; +} + +void mwmp::PacketPlayerCharGen::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) +{ + PlayerPacket::Packet(bs, player, send); + + RW(player->charGenStage, send); + +} diff --git a/components/openmw-mp/Packets/Player/PacketCharGen.hpp b/components/openmw-mp/Packets/Player/PacketPlayerCharGen.hpp similarity index 50% rename from components/openmw-mp/Packets/Player/PacketCharGen.hpp rename to components/openmw-mp/Packets/Player/PacketPlayerCharGen.hpp index 7df1e43ff..781f0b617 100644 --- a/components/openmw-mp/Packets/Player/PacketCharGen.hpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerCharGen.hpp @@ -2,18 +2,18 @@ // Created by koncord on 08.03.16. // -#ifndef OPENMW_PACKETCHARGEN_HPP -#define OPENMW_PACKETCHARGEN_HPP +#ifndef OPENMW_PACKETPLAYERCHARGEN_HPP +#define OPENMW_PACKETPLAYERCHARGEN_HPP #include namespace mwmp { - class PacketCharGen : public PlayerPacket + class PacketPlayerCharGen : public PlayerPacket { public: - PacketCharGen(RakNet::RakPeerInterface *peer); + PacketPlayerCharGen(RakNet::RakPeerInterface *peer); virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); }; @@ -21,4 +21,4 @@ namespace mwmp -#endif //OPENMW_PACKETCHARGEN_HPP +#endif //OPENMW_PACKETPLAYERCHARGEN_HPP diff --git a/components/openmw-mp/Packets/Player/PacketClass.cpp b/components/openmw-mp/Packets/Player/PacketPlayerClass.cpp similarity index 59% rename from components/openmw-mp/Packets/Player/PacketClass.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerClass.cpp index c1be651c1..f0872ec05 100644 --- a/components/openmw-mp/Packets/Player/PacketClass.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerClass.cpp @@ -3,14 +3,14 @@ // #include -#include "PacketClass.hpp" +#include "PacketPlayerClass.hpp" -mwmp::PacketClass::PacketClass(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +mwmp::PacketPlayerClass::PacketPlayerClass(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_CHARCLASS; + packetID = ID_PLAYER_CHARCLASS; } -void mwmp::PacketClass::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) +void mwmp::PacketPlayerClass::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); diff --git a/components/openmw-mp/Packets/Player/PacketClass.hpp b/components/openmw-mp/Packets/Player/PacketPlayerClass.hpp similarity index 51% rename from components/openmw-mp/Packets/Player/PacketClass.hpp rename to components/openmw-mp/Packets/Player/PacketPlayerClass.hpp index f8ce75dc5..c3161e034 100644 --- a/components/openmw-mp/Packets/Player/PacketClass.hpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerClass.hpp @@ -2,22 +2,22 @@ // Created by koncord on 29.08.16. // -#ifndef OPENMW_PACKETCLASS_HPP -#define OPENMW_PACKETCLASS_HPP +#ifndef OPENMW_PACKETPLAYERCLASS_HPP +#define OPENMW_PACKETPLAYERCLASS_HPP #include namespace mwmp { - class PacketClass : public PlayerPacket + class PacketPlayerClass : public PlayerPacket { public: - PacketClass(RakNet::RakPeerInterface *peer); + PacketPlayerClass(RakNet::RakPeerInterface *peer); virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); }; } -#endif //OPENMW_PACKETCLASS_HPP +#endif //OPENMW_PACKETPLAYERCLASS_HPP diff --git a/components/openmw-mp/Packets/Player/PacketPlayerDrawState.cpp b/components/openmw-mp/Packets/Player/PacketPlayerDrawState.cpp new file mode 100644 index 000000000..5bcfa1d45 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerDrawState.cpp @@ -0,0 +1,20 @@ +// +// Created by koncord on 15.01.16. +// + +#include +#include "PacketPlayerDrawState.hpp" + +mwmp::PacketPlayerDrawState::PacketPlayerDrawState(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_DRAWSTATE; +} + +void mwmp::PacketPlayerDrawState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send) +{ + PlayerPacket::Packet(bs, player, send); + + RW(player->movementFlags, send); + + RW(player->drawState, send); +} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerDrawState.hpp b/components/openmw-mp/Packets/Player/PacketPlayerDrawState.hpp new file mode 100644 index 000000000..50f51bbd5 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerDrawState.hpp @@ -0,0 +1,23 @@ +// +// Created by koncord on 15.01.16. +// + +#ifndef OPENMW_PACKETPLAYERDRAWSTATE_HPP +#define OPENMW_PACKETPLAYERDRAWSTATE_HPP + + +#include + +namespace mwmp +{ + class PacketPlayerDrawState : public PlayerPacket + { + public: + PacketPlayerDrawState(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); + }; +} + + +#endif //OPENMW_PACKETPLAYERDRAWSTATE_HPP diff --git a/components/openmw-mp/Packets/Player/PacketDynamicStats.cpp b/components/openmw-mp/Packets/Player/PacketPlayerDynamicStats.cpp similarity index 55% rename from components/openmw-mp/Packets/Player/PacketDynamicStats.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerDynamicStats.cpp index 24e7da2d4..4538897ae 100644 --- a/components/openmw-mp/Packets/Player/PacketDynamicStats.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerDynamicStats.cpp @@ -2,17 +2,17 @@ // Created by koncord on 13.01.16. // -#include "PacketDynamicStats.hpp" +#include "PacketPlayerDynamicStats.hpp" #include using namespace mwmp; -PacketDynamicStats::PacketDynamicStats(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerDynamicStats::PacketPlayerDynamicStats(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_DYNAMICSTATS; + packetID = ID_PLAYER_DYNAMICSTATS; } -void PacketDynamicStats::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) +void PacketPlayerDynamicStats::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); RW(player->creatureStats.mDynamic[0], send); // health diff --git a/components/openmw-mp/Packets/Player/PacketDynamicStats.hpp b/components/openmw-mp/Packets/Player/PacketPlayerDynamicStats.hpp similarity index 50% rename from components/openmw-mp/Packets/Player/PacketDynamicStats.hpp rename to components/openmw-mp/Packets/Player/PacketPlayerDynamicStats.hpp index 8c03445bc..dd511acab 100644 --- a/components/openmw-mp/Packets/Player/PacketDynamicStats.hpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerDynamicStats.hpp @@ -2,21 +2,21 @@ // Created by koncord on 13.01.16. // -#ifndef OPENMW_PACKAGEDYNAMICSTATS_HPP -#define OPENMW_PACKAGEDYNAMICSTATS_HPP +#ifndef OPENMW_PACKETDYNAMICSTATS_HPP +#define OPENMW_PACKETDYNAMICSTATS_HPP #include namespace mwmp { - class PacketDynamicStats : public PlayerPacket + class PacketPlayerDynamicStats : public PlayerPacket { public: - PacketDynamicStats(RakNet::RakPeerInterface *peer); + PacketPlayerDynamicStats(RakNet::RakPeerInterface *peer); virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); }; } -#endif //OPENMW_PACKAGEDYNAMICSTATS_HPP +#endif //OPENMW_PACKETDYNAMICSTATS_HPP diff --git a/components/openmw-mp/Packets/Player/PacketEquipment.cpp b/components/openmw-mp/Packets/Player/PacketPlayerEquipment.cpp similarity index 50% rename from components/openmw-mp/Packets/Player/PacketEquipment.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerEquipment.cpp index 709e6d448..cf4e7146c 100644 --- a/components/openmw-mp/Packets/Player/PacketEquipment.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerEquipment.cpp @@ -2,23 +2,23 @@ // Created by koncord on 07.01.16. // -#include "PacketEquipment.hpp" +#include "PacketPlayerEquipment.hpp" #include using namespace mwmp; -PacketEquipment::PacketEquipment(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerEquipment::PacketPlayerEquipment(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_EQUIPMENT; + packetID = ID_PLAYER_EQUIPMENT; } -void PacketEquipment::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) +void PacketPlayerEquipment::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); for (int i = 0; i < 19; i++) { - RW(player->equipedItems[i].refid, send); + RW(player->equipedItems[i].refId, send); RW(player->equipedItems[i].count, send); RW(player->equipedItems[i].health, send); } diff --git a/components/openmw-mp/Packets/Player/PacketPlayerEquipment.hpp b/components/openmw-mp/Packets/Player/PacketPlayerEquipment.hpp new file mode 100644 index 000000000..802b5851a --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerEquipment.hpp @@ -0,0 +1,21 @@ +// +// Created by koncord on 07.01.16. +// + +#ifndef OPENMW_PACKETPLAYEREQUIPMENT_HPP +#define OPENMW_PACKETPLAYEREQUIPMENT_HPP + +#include + +namespace mwmp +{ + class PacketPlayerEquipment : public PlayerPacket + { + public: + PacketPlayerEquipment(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); + }; +} + +#endif //OPENMW_PACKETPLAYEREQUIPMENT_HPP diff --git a/components/openmw-mp/Packets/Player/PacketInventory.cpp b/components/openmw-mp/Packets/Player/PacketPlayerInventory.cpp similarity index 72% rename from components/openmw-mp/Packets/Player/PacketInventory.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerInventory.cpp index d028c33b0..f6761c78c 100644 --- a/components/openmw-mp/Packets/Player/PacketInventory.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerInventory.cpp @@ -3,17 +3,17 @@ // #include -#include "PacketInventory.hpp" +#include "PacketPlayerInventory.hpp" using namespace std; using namespace mwmp; -PacketInventory::PacketInventory(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerInventory::PacketPlayerInventory(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_INVENTORY; + packetID = ID_PLAYER_INVENTORY; } -void PacketInventory::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) +void PacketPlayerInventory::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); @@ -33,13 +33,13 @@ void PacketInventory::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen if (send) { item = player->inventoryChanges.items[i]; - RW(item.refid, send); + RW(item.refId, send); RW(item.count, send); RW(item.health, send); } else { - RW(item.refid, send); + RW(item.refId, send); RW(item.count, send); RW(item.health, send); player->inventoryChanges.items.push_back(item); diff --git a/components/openmw-mp/Packets/Player/PacketPlayerInventory.hpp b/components/openmw-mp/Packets/Player/PacketPlayerInventory.hpp new file mode 100644 index 000000000..bc7375243 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerInventory.hpp @@ -0,0 +1,22 @@ +// +// Created by koncord on 22.10.16. +// + +#ifndef OPENMW_PACKETPLAYERINVENTORY_HPP +#define OPENMW_PACKETPLAYERINVENTORY_HPP + +#include + +namespace mwmp +{ + class PacketPlayerInventory : public PlayerPacket + { + public: + PacketPlayerInventory(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); + }; +} + + +#endif //OPENMW_PACKETPLAYERINVENTORY_HPP diff --git a/components/openmw-mp/Packets/Player/PacketJournal.cpp b/components/openmw-mp/Packets/Player/PacketPlayerJournal.cpp similarity index 82% rename from components/openmw-mp/Packets/Player/PacketJournal.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerJournal.cpp index 8d737839a..cc1393ad5 100644 --- a/components/openmw-mp/Packets/Player/PacketJournal.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerJournal.cpp @@ -1,15 +1,15 @@ #include -#include "PacketJournal.hpp" +#include "PacketPlayerJournal.hpp" using namespace std; using namespace mwmp; -PacketJournal::PacketJournal(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerJournal::PacketPlayerJournal(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_JOURNAL; + packetID = ID_PLAYER_JOURNAL; } -void PacketJournal::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) +void PacketPlayerJournal::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); diff --git a/components/openmw-mp/Packets/Player/PacketPlayerJournal.hpp b/components/openmw-mp/Packets/Player/PacketPlayerJournal.hpp new file mode 100644 index 000000000..d28014040 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerJournal.hpp @@ -0,0 +1,18 @@ +#ifndef OPENMW_PACKETPLAYERJOURNAL_HPP +#define OPENMW_PACKETPLAYERJOURNAL_HPP + +#include + +namespace mwmp +{ + class PacketPlayerJournal : public PlayerPacket + { + public: + PacketPlayerJournal(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); + }; +} + + +#endif //OPENMW_PACKETPLAYERJOURNAL_HPP diff --git a/components/openmw-mp/Packets/Player/PacketPlayerLevel.cpp b/components/openmw-mp/Packets/Player/PacketPlayerLevel.cpp new file mode 100644 index 000000000..e847f3436 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerLevel.cpp @@ -0,0 +1,16 @@ +#include "PacketPlayerLevel.hpp" +#include + +using namespace mwmp; + +PacketPlayerLevel::PacketPlayerLevel(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_LEVEL; +} + +void PacketPlayerLevel::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) +{ + PlayerPacket::Packet(bs, player, send); + + RW(player->creatureStats.mLevel, send); +} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerLevel.hpp b/components/openmw-mp/Packets/Player/PacketPlayerLevel.hpp new file mode 100644 index 000000000..2dc6758eb --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerLevel.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETPLAYERLEVEL_HPP +#define OPENMW_PACKETPLAYERLEVEL_HPP + +#include + +namespace mwmp +{ + class PacketPlayerLevel : public PlayerPacket + { + public: + PacketPlayerLevel(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); + }; +} + +#endif //OPENMW_PACKETPLAYERLEVEL_HPP diff --git a/components/openmw-mp/Packets/Player/PacketPosition.cpp b/components/openmw-mp/Packets/Player/PacketPlayerPosition.cpp similarity index 57% rename from components/openmw-mp/Packets/Player/PacketPosition.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerPosition.cpp index ddce99007..25f7290fa 100644 --- a/components/openmw-mp/Packets/Player/PacketPosition.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerPosition.cpp @@ -2,20 +2,20 @@ // Created by koncord on 05.01.16. // -#include "PacketPosition.hpp" +#include "PacketPlayerPosition.hpp" #include using namespace std; using namespace mwmp; -PacketPosition::PacketPosition(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerPosition::PacketPlayerPosition(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_POS; + packetID = ID_PLAYER_POS; priority = MEDIUM_PRIORITY; //reliability = UNRELIABLE_SEQUENCED; } -void PacketPosition::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) +void PacketPlayerPosition::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); diff --git a/components/openmw-mp/Packets/Player/PacketPosition.hpp b/components/openmw-mp/Packets/Player/PacketPlayerPosition.hpp similarity index 50% rename from components/openmw-mp/Packets/Player/PacketPosition.hpp rename to components/openmw-mp/Packets/Player/PacketPlayerPosition.hpp index 33c60a6a8..a69a4838e 100644 --- a/components/openmw-mp/Packets/Player/PacketPosition.hpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerPosition.hpp @@ -2,20 +2,20 @@ // Created by koncord on 05.01.16. // -#ifndef OPENMW_PACKETPOSITION_HPP -#define OPENMW_PACKETPOSITION_HPP +#ifndef OPENMW_PACKETPLAYERPOSITION_HPP +#define OPENMW_PACKETPLAYERPOSITION_HPP #include namespace mwmp { - class PacketPosition : public PlayerPacket + class PacketPlayerPosition : public PlayerPacket { public: - PacketPosition(RakNet::RakPeerInterface *peer); + PacketPlayerPosition(RakNet::RakPeerInterface *peer); virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); }; } -#endif //OPENMW_PACKETPOSITION_HPP +#endif //OPENMW_PACKETPLAYERPOSITION_HPP diff --git a/components/openmw-mp/Packets/Player/PacketSpellbook.cpp b/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.cpp similarity index 75% rename from components/openmw-mp/Packets/Player/PacketSpellbook.cpp rename to components/openmw-mp/Packets/Player/PacketPlayerSpellbook.cpp index 1b9094d77..65c0db41d 100644 --- a/components/openmw-mp/Packets/Player/PacketSpellbook.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.cpp @@ -1,15 +1,15 @@ #include -#include "PacketSpellbook.hpp" +#include "PacketPlayerSpellbook.hpp" using namespace std; using namespace mwmp; -PacketSpellbook::PacketSpellbook(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketPlayerSpellbook::PacketPlayerSpellbook(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_GAME_SPELLBOOK; + packetID = ID_PLAYER_SPELLBOOK; } -void PacketSpellbook::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) +void PacketPlayerSpellbook::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { PlayerPacket::Packet(bs, player, send); diff --git a/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.hpp b/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.hpp new file mode 100644 index 000000000..7365c88a6 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerSpellbook.hpp @@ -0,0 +1,18 @@ +#ifndef OPENMW_PACKETPLAYERSPELLBOOK_HPP +#define OPENMW_PACKETPLAYERSPELLBOOK_HPP + +#include + +namespace mwmp +{ + class PacketPlayerSpellbook : public PlayerPacket + { + public: + PacketPlayerSpellbook(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); + }; +} + + +#endif //OPENMW_PACKETPLAYERSPELLBOOK_HPP diff --git a/components/openmw-mp/Packets/Player/PacketSpellbook.hpp b/components/openmw-mp/Packets/Player/PacketSpellbook.hpp deleted file mode 100644 index 4caa51d5f..000000000 --- a/components/openmw-mp/Packets/Player/PacketSpellbook.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef OPENMW_PACKETSPELLBOOK_HPP -#define OPENMW_PACKETSPELLBOOK_HPP - -#include - -namespace mwmp -{ - class PacketSpellbook : public PlayerPacket - { - public: - PacketSpellbook(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); - }; -} - - -#endif //OPENMW_PACKETSPELLBOOK_HPP