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
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;
}
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->Send(player, true);
break;
@ -277,7 +277,6 @@ void Networking::Update(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_GAME_DIE from %s",
player->Npc()->mName.c_str());
//packetMainStats.Read(player);
player->CreatureStats()->mDead = true;
myPacket->Send(player, true);
@ -294,7 +293,6 @@ void Networking::Update(RakNet::Packet *packet)
myPacket->Send(player, true);
controller->GetPacket(ID_GAME_UPDATE_POS)->RequestData(player->guid);
controller->GetPacket(ID_GAME_CELL)->RequestData(player->guid);
//packetMainStats.RequestData(player->guid);
Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->GetID());
@ -364,7 +362,7 @@ void Networking::Update(RakNet::Packet *packet)
void Networking::NewPlayer(RakNet::RakNetGUID 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_CELL)->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;
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_SKILL)->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_UPDATE_BASESTATS)->Send(player, true);*/
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, true);*/
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);
}
void StatsFunctions::SendAttributes(unsigned short pid) noexcept
void StatsFunctions::SendDynamicStatsBase(unsigned short pid) noexcept
{
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);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, true);
void StatsFunctions::SendDynamicStatsCurrent(unsigned short pid) noexcept
{
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;
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

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

@ -855,7 +855,7 @@ namespace MWClass
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;
}
}

@ -49,7 +49,7 @@ void LocalPlayer::Update()
updateAttackState();
updateDeadState();
updateInventory();
updateBaseStats();
updateDynamicStats();
updateClassStats();
}
@ -58,7 +58,7 @@ MWWorld::Ptr LocalPlayer::GetPlayerPtr()
return MWBase::Environment::get().getWorld()->getPlayerPtr();
}
void LocalPlayer::updateBaseStats(bool forceUpdate)
void LocalPlayer::updateDynamicStats(bool forceUpdate)
{
MWWorld::Ptr player = GetPlayerPtr();
@ -85,7 +85,7 @@ void LocalPlayer::updateBaseStats(bool forceUpdate)
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)
{
updateBaseStats(true);
updateDynamicStats(true);
updateClassStats(true);
SendClass();
GetNetworking()->GetPacket(ID_GAME_CHARGEN)->Send(this);

@ -20,7 +20,7 @@ namespace mwmp
void Update();
void updateBaseStats(bool forceUpdate = false);
void updateDynamicStats(bool forceUpdate = false);
void updatePosition(bool forceUpdate = false);
void updateInventory(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_LOADED)->Send(getLocalPlayer());
mLocalPlayer->updateBaseStats(true);
mLocalPlayer->updateDynamicStats(true);
get().getGUIController()->setChatVisible(true);
}
else

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

@ -14,7 +14,8 @@
#include <components/openmw-mp/Packets/PacketBaseInfo.hpp>
#include <components/openmw-mp/Packets/PacketEquiped.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/PacketDie.hpp>
#include <components/openmw-mp/Packets/PacketCell.hpp>

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

@ -12,7 +12,8 @@ enum GameMessages
ID_GAME_BASE_INFO = ID_USER_PACKET_ENUM+1,
ID_GAME_CHARGEN,
ID_GAME_UPDATE_POS,
ID_GAME_UPDATE_BASESTATS,
ID_GAME_DYNAMICSTATS_BASE,
ID_GAME_DYNAMICSTATS_CURRENT,
ID_GAME_ATTACK,
ID_USER_MYID,
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>
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);
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 "components/openmw-mp/Packets/PacketEquiped.hpp"
#include "Packets/PacketAttack.hpp"
#include "Packets/PacketMainStats.hpp"
#include "Packets/PacketDynamicStatsBase.hpp"
#include "Packets/PacketDynamicStatsCurrent.hpp"
#include "Packets/PacketResurrect.hpp"
#include "Packets/PacketDie.hpp"
#include "Packets/PacketCell.hpp"
@ -46,7 +47,8 @@ mwmp::PacketsController::PacketsController(RakNet::RakPeerInterface *peer)
AddPacket<PacketEquiped>(&packets, peer);
AddPacket<PacketAttack>(&packets, peer);
AddPacket<PacketMainStats>(&packets, peer);
AddPacket<PacketDynamicStatsBase>(&packets, peer);
AddPacket<PacketDynamicStatsCurrent>(&packets, peer);
AddPacket<PacketResurrect>(&packets, peer);
AddPacket<PacketDie>(&packets, peer);

Loading…
Cancel
Save