Rename ID_GAME_UPDATE_BASESTATS into ID_GAME_DYNAMICSTATS_CURRENT

pull/76/head
David Cernat 8 years ago
parent 295f486a97
commit ce4b326b02

@ -259,14 +259,14 @@ void Networking::Update(RakNet::Packet *packet)
#endif #endif
myPacket->Send(player, true); myPacket->Send(player, true);
controller->GetPacket(ID_GAME_UPDATE_BASESTATS)->RequestData(player->GetAttack()->target); controller->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->RequestData(player->GetAttack()->target);
} }
break; break;
} }
case ID_GAME_UPDATE_BASESTATS: case ID_GAME_DYNAMICSTATS_CURRENT:
{ {
DEBUG_PRINTF("ID_GAME_UPDATE_BASESTATS\n"); DEBUG_PRINTF("ID_GAME_DYNAMICSTATS_CURRENT\n");
myPacket->Read(player); myPacket->Read(player);
myPacket->Send(player, true); myPacket->Send(player, true);
break; break;
@ -277,7 +277,6 @@ void Networking::Update(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_DIE from %s", LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_DIE from %s",
player->Npc()->mName.c_str()); player->Npc()->mName.c_str());
//packetMainStats.Read(player);
player->CreatureStats()->mDead = true; player->CreatureStats()->mDead = true;
myPacket->Send(player, true); myPacket->Send(player, true);
@ -294,7 +293,6 @@ void Networking::Update(RakNet::Packet *packet)
myPacket->Send(player, true); myPacket->Send(player, true);
controller->GetPacket(ID_GAME_UPDATE_POS)->RequestData(player->guid); controller->GetPacket(ID_GAME_UPDATE_POS)->RequestData(player->guid);
controller->GetPacket(ID_GAME_CELL)->RequestData(player->guid); controller->GetPacket(ID_GAME_CELL)->RequestData(player->guid);
//packetMainStats.RequestData(player->guid);
Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->GetID()); Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->GetID());
@ -364,7 +362,7 @@ void Networking::Update(RakNet::Packet *packet)
void Networking::NewPlayer(RakNet::RakNetGUID guid) void Networking::NewPlayer(RakNet::RakNetGUID guid)
{ {
controller->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid); controller->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid);
controller->GetPacket(ID_GAME_UPDATE_BASESTATS)->RequestData(guid); controller->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->RequestData(guid);
controller->GetPacket(ID_GAME_UPDATE_POS)->RequestData(guid); controller->GetPacket(ID_GAME_UPDATE_POS)->RequestData(guid);
controller->GetPacket(ID_GAME_CELL)->RequestData(guid); controller->GetPacket(ID_GAME_CELL)->RequestData(guid);
controller->GetPacket(ID_GAME_UPDATE_EQUIPED)->RequestData(guid); controller->GetPacket(ID_GAME_UPDATE_EQUIPED)->RequestData(guid);
@ -374,7 +372,7 @@ void Networking::NewPlayer(RakNet::RakNetGUID guid)
if (pl->first == guid) continue; if (pl->first == guid) continue;
controller->GetPacket(ID_GAME_BASE_INFO)->Send(pl->second, guid); controller->GetPacket(ID_GAME_BASE_INFO)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(pl->second, guid); controller->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_ATTRIBUTE)->Send(pl->second, guid); controller->GetPacket(ID_GAME_ATTRIBUTE)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_SKILL)->Send(pl->second, guid); controller->GetPacket(ID_GAME_SKILL)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_UPDATE_POS)->Send(pl->second, guid); controller->GetPacket(ID_GAME_UPDATE_POS)->Send(pl->second, guid);

@ -16,8 +16,8 @@ void ItemFunctions::AddItem(unsigned short pid, const char* itemName, unsigned s
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(player, false); mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(player, true);*/ mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, true);*/
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub"); LOG_MESSAGE(Log::LOG_WARN, "%s", "stub");
} }

@ -437,21 +437,29 @@ void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true); mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true);
} }
void StatsFunctions::SendAttributes(unsigned short pid) noexcept void StatsFunctions::SendDynamicStatsBase(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player,); GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_BASE)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_BASE)->Send(player, true);
}
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, false); void StatsFunctions::SendDynamicStatsCurrent(unsigned short pid) noexcept
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, true); {
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, true);
} }
void StatsFunctions::SendBaseStats(unsigned short pid) noexcept void StatsFunctions::SendAttributes(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player,); GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(player, true); mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, true);
} }
void StatsFunctions::SendSkills(unsigned short pid) noexcept void StatsFunctions::SendSkills(unsigned short pid) noexcept

@ -6,68 +6,70 @@
#define OPENMW_STATS_HPP #define OPENMW_STATS_HPP
#define STATSFUNCTIONS \ #define STATSFUNCTIONS \
{"GetName", StatsFunctions::GetName},\ {"GetName", StatsFunctions::GetName},\
{"SetName", StatsFunctions::SetName},\ {"SetName", StatsFunctions::SetName},\
\ \
{"GetRace", StatsFunctions::GetRace},\ {"GetRace", StatsFunctions::GetRace},\
{"SetRace", StatsFunctions::SetRace},\ {"SetRace", StatsFunctions::SetRace},\
\ \
{"GetHead", StatsFunctions::GetHead},\ {"GetHead", StatsFunctions::GetHead},\
{"SetHead", StatsFunctions::SetHead},\ {"SetHead", StatsFunctions::SetHead},\
\ \
{"GetHair", StatsFunctions::GetHairstyle},\ {"GetHair", StatsFunctions::GetHairstyle},\
{"SetHair", StatsFunctions::SetHairstyle},\ {"SetHair", StatsFunctions::SetHairstyle},\
\ \
{"GetIsMale", StatsFunctions::GetIsMale},\ {"GetIsMale", StatsFunctions::GetIsMale},\
{"SetIsMale", StatsFunctions::SetIsMale},\ {"SetIsMale", StatsFunctions::SetIsMale},\
\ \
{"GetLevel", StatsFunctions::GetLevel},\ {"GetLevel", StatsFunctions::GetLevel},\
{"SetLevel", StatsFunctions::SetLevel},\ {"SetLevel", StatsFunctions::SetLevel},\
\ \
{"GetBirthsign", StatsFunctions::GetBirthsign},\ {"GetBirthsign", StatsFunctions::GetBirthsign},\
{"SetBirthsign", StatsFunctions::SetBirthsign},\ {"SetBirthsign", StatsFunctions::SetBirthsign},\
\ \
{"GetAttributeCount", StatsFunctions::GetAttributeCount},\ {"GetAttributeCount", StatsFunctions::GetAttributeCount},\
{"GetSkillCount", StatsFunctions::GetSkillCount},\ {"GetSkillCount", StatsFunctions::GetSkillCount},\
{"GetAttributeId", StatsFunctions::GetAttributeId},\ {"GetAttributeId", StatsFunctions::GetAttributeId},\
{"GetSkillId", StatsFunctions::GetSkillId},\ {"GetSkillId", StatsFunctions::GetSkillId},\
{"GetAttributeName", StatsFunctions::GetAttributeName},\ {"GetAttributeName", StatsFunctions::GetAttributeName},\
{"GetSkillName", StatsFunctions::GetSkillName},\ {"GetSkillName", StatsFunctions::GetSkillName},\
\ \
{"GetAttributeBase", StatsFunctions::GetAttributeBase},\ {"GetAttributeBase", StatsFunctions::GetAttributeBase},\
{"SetAttributeBase", StatsFunctions::SetAttributeBase},\ {"SetAttributeBase", StatsFunctions::SetAttributeBase},\
{"GetAttributeCurrent", StatsFunctions::GetAttributeCurrent},\ {"GetAttributeCurrent", StatsFunctions::GetAttributeCurrent},\
{"SetAttributeCurrent", StatsFunctions::SetAttributeCurrent},\ {"SetAttributeCurrent", StatsFunctions::SetAttributeCurrent},\
{"GetSkillBase", StatsFunctions::GetSkillBase},\ {"GetSkillBase", StatsFunctions::GetSkillBase},\
{"SetSkillBase", StatsFunctions::SetSkillBase},\ {"SetSkillBase", StatsFunctions::SetSkillBase},\
{"GetSkillCurrent", StatsFunctions::GetSkillCurrent},\ {"GetSkillCurrent", StatsFunctions::GetSkillCurrent},\
{"SetSkillCurrent", StatsFunctions::SetSkillCurrent},\ {"SetSkillCurrent", StatsFunctions::SetSkillCurrent},\
\ \
{"GetHealthBase", StatsFunctions::GetHealthBase},\ {"GetHealthBase", StatsFunctions::GetHealthBase},\
{"SetHealthBase", StatsFunctions::SetHealthBase},\ {"SetHealthBase", StatsFunctions::SetHealthBase},\
{"GetHealthCurrent", StatsFunctions::GetHealthCurrent},\ {"GetHealthCurrent", StatsFunctions::GetHealthCurrent},\
{"SetHealthCurrent", StatsFunctions::SetHealthCurrent},\ {"SetHealthCurrent", StatsFunctions::SetHealthCurrent},\
\ \
{"GetMagickaBase", StatsFunctions::GetMagickaBase},\ {"GetMagickaBase", StatsFunctions::GetMagickaBase},\
{"SetMagickaBase", StatsFunctions::SetMagickaBase},\ {"SetMagickaBase", StatsFunctions::SetMagickaBase},\
{"GetMagickaCurrent", StatsFunctions::GetMagickaCurrent},\ {"GetMagickaCurrent", StatsFunctions::GetMagickaCurrent},\
{"SetMagickaCurrent", StatsFunctions::SetMagickaCurrent},\ {"SetMagickaCurrent", StatsFunctions::SetMagickaCurrent},\
\ \
{"SetFatigueBase", StatsFunctions::SetFatigueBase},\ {"SetFatigueBase", StatsFunctions::SetFatigueBase},\
{"GetFatigueBase", StatsFunctions::GetFatigueBase},\ {"GetFatigueBase", StatsFunctions::GetFatigueBase},\
{"SetFatigueCurrent", StatsFunctions::SetFatigueCurrent},\ {"SetFatigueCurrent", StatsFunctions::SetFatigueCurrent},\
{"GetFatigueCurrent", StatsFunctions::GetFatigueCurrent},\ {"GetFatigueCurrent", StatsFunctions::GetFatigueCurrent},\
\ \
{"GetSkillIncrease", StatsFunctions::GetSkillIncrease},\ {"GetSkillIncrease", StatsFunctions::GetSkillIncrease},\
{"SetSkillIncrease", StatsFunctions::SetSkillIncrease},\ {"SetSkillIncrease", StatsFunctions::SetSkillIncrease},\
\ \
{"SetCharGenStage", StatsFunctions::SetCharGenStage},\ {"SetCharGenStage", StatsFunctions::SetCharGenStage},\
{"Resurrect", StatsFunctions::Resurrect},\ {"Resurrect", StatsFunctions::Resurrect},\
{"SendBaseInfo", StatsFunctions::SendBaseInfo},\ {"SendBaseInfo", StatsFunctions::SendBaseInfo},\
{"SendAttributes", StatsFunctions::SendAttributes},\
{"SendBaseStats", StatsFunctions::SendBaseStats},\ {"SendDynamicStatsBase", StatsFunctions::SendDynamicStatsBase}, \
{"SendSkills", StatsFunctions::SendSkills},\ {"SendDynamicStatsCurrent", StatsFunctions::SendDynamicStatsCurrent}, \
{"SendLevel", StatsFunctions::SendLevel} {"SendAttributes", StatsFunctions::SendAttributes},\
{"SendSkills", StatsFunctions::SendSkills},\
{"SendLevel", StatsFunctions::SendLevel}
class StatsFunctions class StatsFunctions
{ {
@ -130,10 +132,11 @@ public:
static void Resurrect(unsigned short pid); static void Resurrect(unsigned short pid);
static void SetCharGenStage(unsigned short pid, int start, int end) noexcept; static void SetCharGenStage(unsigned short pid, int start, int end) noexcept;
static void SendBaseInfo(unsigned short pid) noexcept; static void SendBaseInfo(unsigned short pid) noexcept;
static void SendDynamicStatsBase(unsigned short pid) noexcept;
static void SendDynamicStatsCurrent(unsigned short pid) noexcept;
static void SendAttributes(unsigned short pid) noexcept; static void SendAttributes(unsigned short pid) noexcept;
static void SendBaseStats(unsigned short pid) noexcept;
static void SendSkills(unsigned short pid) noexcept; static void SendSkills(unsigned short pid) noexcept;
static void SendLevel(unsigned short pid) noexcept; static void SendLevel(unsigned short pid) noexcept;
}; };

@ -855,7 +855,7 @@ namespace MWClass
if(ptr == MWMechanics::getPlayer()) if(ptr == MWMechanics::getPlayer())
{ {
mwmp::Main::get().getLocalPlayer()->updateBaseStats(true); mwmp::Main::get().getLocalPlayer()->updateDynamicStats(true);
mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after getting damage; mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after getting damage;
} }
} }

@ -49,7 +49,7 @@ void LocalPlayer::Update()
updateAttackState(); updateAttackState();
updateDeadState(); updateDeadState();
updateInventory(); updateInventory();
updateBaseStats(); updateDynamicStats();
updateClassStats(); updateClassStats();
} }
@ -58,7 +58,7 @@ MWWorld::Ptr LocalPlayer::GetPlayerPtr()
return MWBase::Environment::get().getWorld()->getPlayerPtr(); return MWBase::Environment::get().getWorld()->getPlayerPtr();
} }
void LocalPlayer::updateBaseStats(bool forceUpdate) void LocalPlayer::updateDynamicStats(bool forceUpdate)
{ {
MWWorld::Ptr player = GetPlayerPtr(); MWWorld::Ptr player = GetPlayerPtr();
@ -85,7 +85,7 @@ void LocalPlayer::updateBaseStats(bool forceUpdate)
timer = 0; timer = 0;
GetNetworking()->GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(this); GetNetworking()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(this);
} }
} }
@ -541,7 +541,7 @@ bool LocalPlayer::CharGenThread() // ToDo: need fix
if (CharGenStage()->end != 1) if (CharGenStage()->end != 1)
{ {
updateBaseStats(true); updateDynamicStats(true);
updateClassStats(true); updateClassStats(true);
SendClass(); SendClass();
GetNetworking()->GetPacket(ID_GAME_CHARGEN)->Send(this); GetNetworking()->GetPacket(ID_GAME_CHARGEN)->Send(this);

@ -20,7 +20,7 @@ namespace mwmp
void Update(); void Update();
void updateBaseStats(bool forceUpdate = false); void updateDynamicStats(bool forceUpdate = false);
void updatePosition(bool forceUpdate = false); void updatePosition(bool forceUpdate = false);
void updateInventory(bool forceUpdate = false); void updateInventory(bool forceUpdate = false);
void updateAttackState(bool forceUpdate = false); void updateAttackState(bool forceUpdate = false);

@ -194,7 +194,7 @@ void Main::UpdateWorld(float dt) const
mNetworking->GetPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer()); mNetworking->GetPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer());
mNetworking->GetPacket(ID_LOADED)->Send(getLocalPlayer()); mNetworking->GetPacket(ID_LOADED)->Send(getLocalPlayer());
mLocalPlayer->updateBaseStats(true); mLocalPlayer->updateDynamicStats(true);
get().getGUIController()->setChatVisible(true); get().getGUIController()->setChatVisible(true);
} }
else else

@ -336,11 +336,11 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
} }
break; break;
} }
case ID_GAME_UPDATE_BASESTATS: case ID_GAME_DYNAMICSTATS_CURRENT:
{ {
if (id == myid) if (id == myid)
{ {
getLocalPlayer()->updateBaseStats(true); getLocalPlayer()->updateDynamicStats(true);
myPacket->Send(getLocalPlayer(), serverAddr); myPacket->Send(getLocalPlayer(), serverAddr);
} }
else if (pl != 0) else if (pl != 0)
@ -393,8 +393,8 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
(*getLocalPlayer()->GetCell()) = *player.getCell()->getCell(); (*getLocalPlayer()->GetCell()) = *player.getCell()->getCell();
myPacket->Send(getLocalPlayer(), serverAddr); myPacket->Send(getLocalPlayer(), serverAddr);
getLocalPlayer()->updateBaseStats(true); getLocalPlayer()->updateDynamicStats(true);
controller.GetPacket(ID_GAME_UPDATE_BASESTATS)->Send(getLocalPlayer(), serverAddr); controller.GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(getLocalPlayer(), serverAddr);
} }
else if (pl != 0) else if (pl != 0)
{ {

@ -14,7 +14,8 @@
#include <components/openmw-mp/Packets/PacketBaseInfo.hpp> #include <components/openmw-mp/Packets/PacketBaseInfo.hpp>
#include <components/openmw-mp/Packets/PacketEquiped.hpp> #include <components/openmw-mp/Packets/PacketEquiped.hpp>
#include <components/openmw-mp/Packets/PacketAttack.hpp> #include <components/openmw-mp/Packets/PacketAttack.hpp>
#include <components/openmw-mp/Packets/PacketMainStats.hpp> #include <components/openmw-mp/Packets/PacketDynamicStatsBase.hpp>
#include <components/openmw-mp/Packets/PacketDynamicStatsCurrent.hpp>
#include <components/openmw-mp/Packets/PacketResurrect.hpp> #include <components/openmw-mp/Packets/PacketResurrect.hpp>
#include <components/openmw-mp/Packets/PacketDie.hpp> #include <components/openmw-mp/Packets/PacketDie.hpp>
#include <components/openmw-mp/Packets/PacketCell.hpp> #include <components/openmw-mp/Packets/PacketCell.hpp>

@ -149,9 +149,9 @@ add_component_dir (openmw-mp
Log Log
PacketsController PacketsController
Packets/BasePacket Packets/PacketBaseInfo Packets/PacketPosition Packets/PacketEquiped Packets/PacketAttack Packets/BasePacket Packets/PacketBaseInfo Packets/PacketPosition Packets/PacketEquiped Packets/PacketAttack
Packets/PacketMainStats Packets/PacketCell Packets/PacketDrawState Packets/PacketChatMessage Packets/PacketCharGen Packets/PacketDynamicStatsBase Packets/PacketDynamicStatsCurrent Packets/PacketCell Packets/PacketDrawState
Packets/PacketAttribute Packets/PacketSkill Packets/PacketLevel Packets/PacketHandshake Packets/PacketGUIBoxes Packets/PacketChatMessage Packets/PacketCharGen Packets/PacketAttribute Packets/PacketSkill Packets/PacketLevel
Packets/PacketClass Packets/PacketTime) Packets/PacketHandshake Packets/PacketGUIBoxes Packets/PacketClass Packets/PacketTime)
add_component_dir (fallback add_component_dir (fallback
fallback validate fallback validate

@ -12,7 +12,8 @@ enum GameMessages
ID_GAME_BASE_INFO = ID_USER_PACKET_ENUM+1, ID_GAME_BASE_INFO = ID_USER_PACKET_ENUM+1,
ID_GAME_CHARGEN, ID_GAME_CHARGEN,
ID_GAME_UPDATE_POS, ID_GAME_UPDATE_POS,
ID_GAME_UPDATE_BASESTATS, ID_GAME_DYNAMICSTATS_BASE,
ID_GAME_DYNAMICSTATS_CURRENT,
ID_GAME_ATTACK, ID_GAME_ATTACK,
ID_USER_MYID, ID_USER_MYID,
ID_GAME_UPDATE_EQUIPED, ID_GAME_UPDATE_EQUIPED,

@ -1,18 +1,18 @@
// //
// Created by koncord on 13.01.16. // Created by David Cernat on 28.09.16.
// //
#include "PacketMainStats.hpp" #include "PacketDynamicStatsBase.hpp"
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
using namespace mwmp; using namespace mwmp;
PacketMainStats::PacketMainStats(RakNet::RakPeerInterface *peer) : BasePacket(peer) PacketDynamicStatsBase::PacketDynamicStatsBase(RakNet::RakPeerInterface *peer) : BasePacket(peer)
{ {
packetID = ID_GAME_UPDATE_BASESTATS; packetID = ID_GAME_DYNAMICSTATS_BASE;
} }
void PacketMainStats::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) void PacketDynamicStatsBase::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
{ {
BasePacket::Packet(bs, player, send); BasePacket::Packet(bs, player, send);
RW(player->CreatureStats()->mDynamic[0], send); // health RW(player->CreatureStats()->mDynamic[0], send); // health

@ -0,0 +1,22 @@
//
// Created by David Cernat on 28.09.16.
//
#ifndef OPENMW_PACKAGEDYNAMICSTATSBASE_HPP
#define OPENMW_PACKAGEDYNAMICSTATSBASE_HPP
#include <components/openmw-mp/Packets/BasePacket.hpp>
namespace mwmp
{
class PacketDynamicStatsBase : public BasePacket
{
public:
PacketDynamicStatsBase(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
};
}
#endif //OPENMW_PACKAGEDYNAMICSTATSBASE_HPP

@ -0,0 +1,21 @@
//
// Created by David Cernat on 28.09.16.
//
#include "PacketDynamicStatsCurrent.hpp"
#include <components/openmw-mp/NetworkMessages.hpp>
using namespace mwmp;
PacketDynamicStatsCurrent::PacketDynamicStatsCurrent(RakNet::RakPeerInterface *peer) : BasePacket(peer)
{
packetID = ID_GAME_DYNAMICSTATS_CURRENT;
}
void PacketDynamicStatsCurrent::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
{
BasePacket::Packet(bs, player, send);
RW(player->CreatureStats()->mDynamic[0], send); // health
RW(player->CreatureStats()->mDynamic[1], send); // magic
RW(player->CreatureStats()->mDynamic[2], send); // fatigue
}

@ -0,0 +1,22 @@
//
// Created by David Cernat on 28.09.16.
//
#ifndef OPENMW_PACKAGEDYNAMICSTATSCURRENT_HPP
#define OPENMW_PACKAGEDYNAMICSTATSCURRENT_HPP
#include <components/openmw-mp/Packets/BasePacket.hpp>
namespace mwmp
{
class PacketDynamicStatsCurrent : public BasePacket
{
public:
PacketDynamicStatsCurrent(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
};
}
#endif //OPENMW_PACKAGEDYNAMICSTATSCURRENT_HPP

@ -1,22 +0,0 @@
//
// Created by koncord on 13.01.16.
//
#ifndef OPENMW_PACKAGEMAINSTATS_HPP
#define OPENMW_PACKAGEMAINSTATS_HPP
#include <components/openmw-mp/Packets/BasePacket.hpp>
namespace mwmp
{
class PacketMainStats : public BasePacket
{
public:
PacketMainStats(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
};
}
#endif //OPENMW_PACKAGEMAINSTATS_HPP

@ -11,7 +11,8 @@
#include "Packets/PacketBaseInfo.hpp" #include "Packets/PacketBaseInfo.hpp"
#include "components/openmw-mp/Packets/PacketEquiped.hpp" #include "components/openmw-mp/Packets/PacketEquiped.hpp"
#include "Packets/PacketAttack.hpp" #include "Packets/PacketAttack.hpp"
#include "Packets/PacketMainStats.hpp" #include "Packets/PacketDynamicStatsBase.hpp"
#include "Packets/PacketDynamicStatsCurrent.hpp"
#include "Packets/PacketResurrect.hpp" #include "Packets/PacketResurrect.hpp"
#include "Packets/PacketDie.hpp" #include "Packets/PacketDie.hpp"
#include "Packets/PacketCell.hpp" #include "Packets/PacketCell.hpp"
@ -46,7 +47,8 @@ mwmp::PacketsController::PacketsController(RakNet::RakPeerInterface *peer)
AddPacket<PacketEquiped>(&packets, peer); AddPacket<PacketEquiped>(&packets, peer);
AddPacket<PacketAttack>(&packets, peer); AddPacket<PacketAttack>(&packets, peer);
AddPacket<PacketMainStats>(&packets, peer); AddPacket<PacketDynamicStatsBase>(&packets, peer);
AddPacket<PacketDynamicStatsCurrent>(&packets, peer);
AddPacket<PacketResurrect>(&packets, peer); AddPacket<PacketResurrect>(&packets, peer);
AddPacket<PacketDie>(&packets, peer); AddPacket<PacketDie>(&packets, peer);

Loading…
Cancel
Save