From 7b07d6651f5f35add7f746f9c522bc650ac3987d Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 25 Apr 2017 21:24:39 +0300 Subject: [PATCH] [General] Add and use PlayerBounty packet and matching script functions --- apps/openmw-mp/CMakeLists.txt | 16 ++++---- apps/openmw-mp/ProcessorInitializer.cpp | 2 + apps/openmw-mp/Script/Functions/Stats.cpp | 32 ++++++++++++++-- apps/openmw-mp/Script/Functions/Stats.hpp | 14 +++++-- apps/openmw-mp/Script/ScriptFunctions.hpp | 1 + .../player/ProcessorPlayerBounty.hpp | 24 ++++++++++++ apps/openmw/CMakeLists.txt | 10 ++--- apps/openmw/mwmp/LocalPlayer.cpp | 29 ++++++++++++-- apps/openmw/mwmp/LocalPlayer.hpp | 2 + apps/openmw/mwmp/ProcessorInitializer.cpp | 2 + .../player/ProcessorPlayerBounty.hpp | 38 +++++++++++++++++++ components/CMakeLists.txt | 6 +-- .../Controllers/PlayerPacketController.cpp | 2 + components/openmw-mp/NetworkMessages.hpp | 1 + .../Packets/Player/PacketPlayerBounty.cpp | 16 ++++++++ .../Packets/Player/PacketPlayerBounty.hpp | 17 +++++++++ 16 files changed, 187 insertions(+), 25 deletions(-) create mode 100644 apps/openmw-mp/processors/player/ProcessorPlayerBounty.hpp create mode 100644 apps/openmw/mwmp/processors/player/ProcessorPlayerBounty.hpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerBounty.cpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerBounty.hpp diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index 5de22de19..3968b1f37 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -113,14 +113,14 @@ source_group(tes3mp-server\\processors\\actor FILES ${PROCESSORS_ACTOR}) set(PROCESSORS_PLAYER processors/player/ProcessorChatMsg.hpp processors/player/ProcessorGUIMessageBox.hpp processors/player/ProcessorPlayerAnimFlags.hpp processors/player/ProcessorPlayerAttack.hpp - processors/player/ProcessorPlayerAttribute.hpp processors/player/ProcessorPlayerCellChange.hpp - processors/player/ProcessorPlayerCellState.hpp processors/player/ProcessorPlayerCharClass.hpp - processors/player/ProcessorPlayerCharGen.hpp processors/player/ProcessorPlayerDeath.hpp - processors/player/ProcessorPlayerEquipment.hpp processors/player/ProcessorPlayerInventory.hpp - processors/player/ProcessorPlayerJournal.hpp processors/player/ProcessorPlayerLevel.hpp - processors/player/ProcessorPlayerPos.hpp processors/player/ProcessorPlayerResurrect.hpp - processors/player/ProcessorPlayerSkill.hpp processors/player/ProcessorPlayerSpellbook.hpp - processors/player/ProcessorPlayerStatsDynamic.hpp + processors/player/ProcessorPlayerAttribute.hpp processors/player/ProcessorPlayerBounty.hpp + processors/player/ProcessorPlayerCellChange.hpp processors/player/ProcessorPlayerCellState.hpp + processors/player/ProcessorPlayerCharClass.hpp processors/player/ProcessorPlayerCharGen.hpp + processors/player/ProcessorPlayerDeath.hpp processors/player/ProcessorPlayerEquipment.hpp + processors/player/ProcessorPlayerInventory.hpp processors/player/ProcessorPlayerJournal.hpp + processors/player/ProcessorPlayerLevel.hpp processors/player/ProcessorPlayerPos.hpp + processors/player/ProcessorPlayerResurrect.hpp processors/player/ProcessorPlayerSkill.hpp + processors/player/ProcessorPlayerSpellbook.hpp processors/player/ProcessorPlayerStatsDynamic.hpp ) source_group(tes3mp-server\\processors\\player FILES ${PROCESSORS_PLAYER}) diff --git a/apps/openmw-mp/ProcessorInitializer.cpp b/apps/openmw-mp/ProcessorInitializer.cpp index e30f7d6e1..b48040bf1 100644 --- a/apps/openmw-mp/ProcessorInitializer.cpp +++ b/apps/openmw-mp/ProcessorInitializer.cpp @@ -11,6 +11,7 @@ #include "processors/player/ProcessorPlayerAttribute.hpp" #include "processors/player/ProcessorPlayerSkill.hpp" #include "processors/player/ProcessorPlayerLevel.hpp" +#include "processors/player/ProcessorPlayerBounty.hpp" #include "processors/player/ProcessorPlayerEquipment.hpp" #include "processors/player/ProcessorPlayerInventory.hpp" #include "processors/player/ProcessorPlayerSpellbook.hpp" @@ -64,6 +65,7 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorPlayerAttribute()); PlayerProcessor::AddProcessor(new ProcessorPlayerSkill()); PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); + PlayerProcessor::AddProcessor(new ProcessorPlayerBounty()); PlayerProcessor::AddProcessor(new ProcessorPlayerEquipment()); PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook()); diff --git a/apps/openmw-mp/Script/Functions/Stats.cpp b/apps/openmw-mp/Script/Functions/Stats.cpp index 43332b79e..38d0f555d 100644 --- a/apps/openmw-mp/Script/Functions/Stats.cpp +++ b/apps/openmw-mp/Script/Functions/Stats.cpp @@ -134,7 +134,7 @@ void StatsFunctions::SetIsMale(unsigned short pid, int value) noexcept int StatsFunctions::GetLevel(unsigned short pid) noexcept { Player *player; - GET_PLAYER(pid, player, 0.0f); + GET_PLAYER(pid, player, 0); return player->creatureStats.mLevel; } @@ -150,7 +150,7 @@ void StatsFunctions::SetLevel(unsigned short pid, int value) noexcept int StatsFunctions::GetLevelProgress(unsigned short pid) noexcept { Player *player; - GET_PLAYER(pid, player, 0.0f); + GET_PLAYER(pid, player, 0); return player->npcStats.mLevelProgress; } @@ -432,7 +432,7 @@ int StatsFunctions::GetSkillIncrease(unsigned short pid, unsigned int attribute) return player->npcStats.mSkillIncrease[attribute]; } -void StatsFunctions::SetSkillIncrease(unsigned short pid, unsigned int attribute, int value) noexcept // TODO: need packet for transmit it +void StatsFunctions::SetSkillIncrease(unsigned short pid, unsigned int attribute, int value) noexcept { Player *player; GET_PLAYER(pid, player,); @@ -443,6 +443,22 @@ void StatsFunctions::SetSkillIncrease(unsigned short pid, unsigned int attribute player->npcStats.mSkillIncrease[attribute] = value; } +int StatsFunctions::GetBounty(unsigned short pid) noexcept +{ + Player *player; + GET_PLAYER(pid, player, 0); + + return player->npcStats.mBounty; +} + +void StatsFunctions::SetBounty(unsigned short pid, int value) noexcept +{ + Player *player; + GET_PLAYER(pid, player, ); + + player->npcStats.mBounty = value; +} + void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noexcept { Player *player; @@ -511,3 +527,13 @@ void StatsFunctions::SendLevel(unsigned short pid) noexcept mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL)->Send(false); mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL)->Send(true); } + +void StatsFunctions::SendBounty(unsigned short pid) noexcept +{ + Player *player; + GET_PLAYER(pid, player, ); + + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BOUNTY)->setPlayer(player); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BOUNTY)->Send(false); + mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BOUNTY)->Send(true); +} diff --git a/apps/openmw-mp/Script/Functions/Stats.hpp b/apps/openmw-mp/Script/Functions/Stats.hpp index 421a36293..dd38002d8 100644 --- a/apps/openmw-mp/Script/Functions/Stats.hpp +++ b/apps/openmw-mp/Script/Functions/Stats.hpp @@ -58,14 +58,17 @@ {"GetMagickaCurrent", StatsFunctions::GetMagickaCurrent},\ {"SetMagickaCurrent", StatsFunctions::SetMagickaCurrent},\ \ - {"SetFatigueBase", StatsFunctions::SetFatigueBase},\ {"GetFatigueBase", StatsFunctions::GetFatigueBase},\ - {"SetFatigueCurrent", StatsFunctions::SetFatigueCurrent},\ + {"SetFatigueBase", StatsFunctions::SetFatigueBase},\ {"GetFatigueCurrent", StatsFunctions::GetFatigueCurrent},\ + {"SetFatigueCurrent", StatsFunctions::SetFatigueCurrent},\ \ {"GetSkillIncrease", StatsFunctions::GetSkillIncrease},\ {"SetSkillIncrease", StatsFunctions::SetSkillIncrease},\ \ + {"GetBounty", StatsFunctions::GetBounty},\ + {"SetBounty", StatsFunctions::SetBounty},\ + \ {"SetCharGenStage", StatsFunctions::SetCharGenStage},\ {"Resurrect", StatsFunctions::Resurrect},\ {"SendBaseInfo", StatsFunctions::SendBaseInfo},\ @@ -73,7 +76,8 @@ {"SendStatsDynamic", StatsFunctions::SendStatsDynamic},\ {"SendAttributes", StatsFunctions::SendAttributes},\ {"SendSkills", StatsFunctions::SendSkills},\ - {"SendLevel", StatsFunctions::SendLevel} + {"SendLevel", StatsFunctions::SendLevel},\ + {"SendBounty", StatsFunctions::SendBounty} class StatsFunctions { @@ -138,6 +142,9 @@ public: static int GetSkillIncrease(unsigned short pid, unsigned int pos) noexcept; static void SetSkillIncrease(unsigned short pid, unsigned int pos, int value) noexcept; + static int GetBounty(unsigned short pid) noexcept; + static void SetBounty(unsigned short pid, int value) noexcept; + static void Resurrect(unsigned short pid); static void SetCharGenStage(unsigned short pid, int start, int end) noexcept; static void SendBaseInfo(unsigned short pid) noexcept; @@ -146,6 +153,7 @@ public: static void SendAttributes(unsigned short pid) noexcept; static void SendSkills(unsigned short pid) noexcept; static void SendLevel(unsigned short pid) noexcept; + static void SendBounty(unsigned short pid) noexcept; }; #endif //OPENMW_STATAPI_HPP diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index be1b80bf5..afd40011b 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -119,6 +119,7 @@ public: {"OnPlayerAttributesChange", Function()}, {"OnPlayerSkillsChange", Function()}, {"OnPlayerLevelChange", Function()}, + {"OnPlayerBountyChange", Function()}, {"OnPlayerEquipmentChange", Function()}, {"OnPlayerInventoryChange", Function()}, {"OnPlayerSpellbookChange", Function()}, diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerBounty.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerBounty.hpp new file mode 100644 index 000000000..b36021644 --- /dev/null +++ b/apps/openmw-mp/processors/player/ProcessorPlayerBounty.hpp @@ -0,0 +1,24 @@ +#ifndef OPENMW_PROCESSORPLAYERBOUNTY_HPP +#define OPENMW_PROCESSORPLAYERBOUNTY_HPP + + +#include "apps/openmw-mp/PlayerProcessor.hpp" + +namespace mwmp +{ + class ProcessorPlayerBounty : public PlayerProcessor + { + public: + ProcessorPlayerBounty() + { + BPP_INIT(ID_PLAYER_BOUNTY) + } + + void Do(PlayerPacket &packet, Player &player) override + { + Script::Call(player.getId()); + } + }; +} + +#endif //OPENMW_PROCESSORPLAYERBOUNTY_HPP diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index b0452f5f8..d6149c6a2 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -106,11 +106,11 @@ add_openmw_dir (mwmp\\processors\\actor ProcessorActorAnimFlags ProcessorActorAn ) add_openmw_dir (mwmp\\processors\\player ProcessorChatMessage ProcessorGameConsole ProcessorGameTime ProcessorGUIMessageBox - ProcessorHandshake ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerCellChange - ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerAnimFlags - ProcessorPlayerStatsDynamic ProcessorPlayerEquipment ProcessorPlayerInventory ProcessorPlayerJournal - ProcessorPlayerLevel ProcessorPlayerPos ProcessorPlayerResurrect ProcessorPlayerSkill ProcessorPlayerSpellbook - ProcessorUserDisconnected ProcessorUserMyID + ProcessorHandshake ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBounty + ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath + ProcessorPlayerAnimFlags ProcessorPlayerStatsDynamic ProcessorPlayerEquipment ProcessorPlayerInventory + ProcessorPlayerJournal ProcessorPlayerLevel ProcessorPlayerPos ProcessorPlayerResurrect ProcessorPlayerSkill + ProcessorPlayerSpellbook ProcessorUserDisconnected ProcessorUserMyID ) add_openmw_dir (mwmp\\processors\\world BaseObjectProcessor ProcessorContainer ProcessorDoorState ProcessorMusicPlay diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index fe6ed77e7..4ca9ff937 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -79,6 +79,7 @@ void LocalPlayer::update() updateAttributes(); updateSkills(); updateLevel(); + updateBounty(); } void LocalPlayer::charGen(int stageFirst, int stageEnd) @@ -267,11 +268,11 @@ void LocalPlayer::updateSkills(bool forceUpdate) void LocalPlayer::updateLevel(bool forceUpdate) { MWWorld::Ptr player = getPlayerPtr(); - const MWMechanics::NpcStats &ptrNpcStats = player.getClass().getNpcStats(player); + const MWMechanics::CreatureStats &ptrCreatureStats = player.getClass().getCreatureStats(player); - if (ptrNpcStats.getLevel() != creatureStats.mLevel || forceUpdate) + if (ptrCreatureStats.getLevel() != creatureStats.mLevel || forceUpdate) { - creatureStats.mLevel = ptrNpcStats.getLevel(); + creatureStats.mLevel = ptrCreatureStats.getLevel(); getNetworking()->getPlayerPacket(ID_PLAYER_LEVEL)->setPlayer(this); getNetworking()->getPlayerPacket(ID_PLAYER_LEVEL)->Send(); @@ -281,6 +282,19 @@ void LocalPlayer::updateLevel(bool forceUpdate) } } +void LocalPlayer::updateBounty(bool forceUpdate) +{ + MWWorld::Ptr player = getPlayerPtr(); + const MWMechanics::NpcStats &ptrNpcStats = player.getClass().getNpcStats(player); + + if (ptrNpcStats.getBounty() != npcStats.mBounty || forceUpdate) + { + npcStats.mBounty = ptrNpcStats.getBounty(); + getNetworking()->getPlayerPacket(ID_PLAYER_BOUNTY)->setPlayer(this); + getNetworking()->getPlayerPacket(ID_PLAYER_BOUNTY)->Send(); + } +} + void LocalPlayer::updatePosition(bool forceUpdate) { MWBase::World *world = MWBase::Environment::get().getWorld(); @@ -742,6 +756,15 @@ void LocalPlayer::setLevel() ptrCreatureStats->setLevel(creatureStats.mLevel); } +void LocalPlayer::setBounty() +{ + MWBase::World *world = MWBase::Environment::get().getWorld(); + MWWorld::Ptr player = world->getPlayerPtr(); + + MWMechanics::NpcStats *ptrNpcStats = &player.getClass().getNpcStats(player); + ptrNpcStats->setBounty(npcStats.mBounty); +} + void LocalPlayer::setPosition() { MWBase::World *world = MWBase::Environment::get().getWorld(); diff --git a/apps/openmw/mwmp/LocalPlayer.hpp b/apps/openmw/mwmp/LocalPlayer.hpp index da5eb099d..cf4d27a60 100644 --- a/apps/openmw/mwmp/LocalPlayer.hpp +++ b/apps/openmw/mwmp/LocalPlayer.hpp @@ -29,6 +29,7 @@ namespace mwmp void updateAttributes(bool forceUpdate = false); void updateSkills(bool forceUpdate = false); void updateLevel(bool forceUpdate = false); + void updateBounty(bool forceUpdate = false); void updatePosition(bool forceUpdate = false); void updateCell(bool forceUpdate = false); void updateChar(); @@ -49,6 +50,7 @@ namespace mwmp void setAttributes(); void setSkills(); void setLevel(); + void setBounty(); void setPosition(); void setCell(); void setClass(); diff --git a/apps/openmw/mwmp/ProcessorInitializer.cpp b/apps/openmw/mwmp/ProcessorInitializer.cpp index 73977ba1f..be92abdab 100644 --- a/apps/openmw/mwmp/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/ProcessorInitializer.cpp @@ -11,6 +11,7 @@ #include "processors/player/ProcessorPlayerAttribute.hpp" #include "processors/player/ProcessorPlayerSkill.hpp" #include "processors/player/ProcessorPlayerLevel.hpp" +#include "processors/player/ProcessorPlayerBounty.hpp" #include "processors/player/ProcessorPlayerEquipment.hpp" #include "processors/player/ProcessorPlayerInventory.hpp" #include "processors/player/ProcessorPlayerSpellbook.hpp" @@ -68,6 +69,7 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorPlayerAttribute()); PlayerProcessor::AddProcessor(new ProcessorPlayerSkill()); PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); + PlayerProcessor::AddProcessor(new ProcessorPlayerBounty()); PlayerProcessor::AddProcessor(new ProcessorPlayerEquipment()); PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook()); diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerBounty.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerBounty.hpp new file mode 100644 index 000000000..d58a44ede --- /dev/null +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerBounty.hpp @@ -0,0 +1,38 @@ +#ifndef OPENMW_PROCESSORPLAYERBOUNTY_HPP +#define OPENMW_PROCESSORPLAYERBOUNTY_HPP + + +#include "apps/openmw/mwmp/PlayerProcessor.hpp" + +namespace mwmp +{ + class ProcessorPlayerBounty : public PlayerProcessor + { + public: + ProcessorPlayerBounty() + { + BPP_INIT(ID_PLAYER_BOUNTY) + } + + virtual void Do(PlayerPacket &packet, BasePlayer *player) + { + if (isLocal()) + { + if(isRequest()) + static_cast(player)->updateBounty(true); + else + static_cast(player)->setBounty(); + } + else if (player != 0) + { + MWWorld::Ptr ptrPlayer = static_cast(player)->getPtr(); + MWMechanics::NpcStats *ptrNpcStats = &ptrPlayer.getClass().getNpcStats(ptrPlayer); + + ptrNpcStats->setBounty(player->npcStats.mBounty); + } + } + }; +} + + +#endif //OPENMW_PROCESSORPLAYERBOUNTY_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index e48435fd2..dfec0ef22 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -177,9 +177,9 @@ add_component_dir (openmw-mp\\Packets\\Player PlayerPacket PacketHandshake PacketChatMessage PacketPlayerBaseInfo PacketPlayerPosition PacketPlayerEquipment PacketPlayerAttack PacketPlayerStatsDynamic PacketPlayerAnimFlags PacketPlayerCharGen PacketPlayerAttribute - PacketPlayerSkill PacketPlayerLevel PacketPlayerClass PacketPlayerInventory PacketPlayerSpellbook - PacketPlayerJournal PacketPlayerActiveSkills PacketPlayerCellChange PacketPlayerCellState PacketPlayerDeath - PacketPlayerResurrect PacketGUIBoxes PacketTime + PacketPlayerSkill PacketPlayerLevel PacketPlayerBounty PacketPlayerClass PacketPlayerInventory + PacketPlayerSpellbook PacketPlayerJournal PacketPlayerActiveSkills PacketPlayerCellChange PacketPlayerCellState + PacketPlayerDeath PacketPlayerResurrect PacketGUIBoxes PacketTime ) add_component_dir (openmw-mp\\Packets\\World diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index 4445387c3..0395b4263 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -20,6 +20,7 @@ #include "../Packets/Player/PacketPlayerAttribute.hpp" #include "../Packets/Player/PacketPlayerSkill.hpp" #include "../Packets/Player/PacketPlayerLevel.hpp" +#include "../Packets/Player/PacketPlayerBounty.hpp" #include "../Packets/Player/PacketHandshake.hpp" #include "../Packets/Player/PacketGUIBoxes.hpp" #include "../Packets/Player/PacketTime.hpp" @@ -63,6 +64,7 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p 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 286202028..51c5d9920 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -26,6 +26,7 @@ enum GameMessages ID_PLAYER_ATTRIBUTE, ID_PLAYER_SKILL, ID_PLAYER_LEVEL, + ID_PLAYER_BOUNTY, ID_PLAYER_CHARCLASS, ID_HANDSHAKE, ID_LOADED, diff --git a/components/openmw-mp/Packets/Player/PacketPlayerBounty.cpp b/components/openmw-mp/Packets/Player/PacketPlayerBounty.cpp new file mode 100644 index 000000000..a4fceb4bb --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerBounty.cpp @@ -0,0 +1,16 @@ +#include "PacketPlayerBounty.hpp" +#include + +using namespace mwmp; + +PacketPlayerBounty::PacketPlayerBounty(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_BOUNTY; +} + +void PacketPlayerBounty::Packet(RakNet::BitStream *bs, bool send) +{ + PlayerPacket::Packet(bs, send); + + RW(player->npcStats.mBounty, send); +} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerBounty.hpp b/components/openmw-mp/Packets/Player/PacketPlayerBounty.hpp new file mode 100644 index 000000000..5dd7b1a77 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerBounty.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETPLAYERBOUNTY_HPP +#define OPENMW_PACKETPLAYERBOUNTY_HPP + +#include + +namespace mwmp +{ + class PacketPlayerBounty : public PlayerPacket + { + public: + PacketPlayerBounty(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETPLAYERBOUNTY_HPP