mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:53:51 +00:00
[Server] Add previous state to ON_PLAYER_SKILL
That is array of struct with next content: {base, current, mod, damage, progress}
This commit is contained in:
parent
017956366f
commit
4aff1f1833
2 changed files with 20 additions and 3 deletions
|
@ -24,7 +24,7 @@ namespace mwmp
|
||||||
"damage", &OldAState::mDamage);
|
"damage", &OldAState::mDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreReading(PlayerPacket &packet, const std::shared_ptr<Player> &player)
|
void PreReading(PlayerPacket &packet, const std::shared_ptr<Player> &player) override
|
||||||
{
|
{
|
||||||
if (!player->creatureStats.mDead)
|
if (!player->creatureStats.mDead)
|
||||||
std::copy(std::begin(player->creatureStats.mAttributes),
|
std::copy(std::begin(player->creatureStats.mAttributes),
|
||||||
|
|
|
@ -11,10 +11,26 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
class ProcessorPlayerSkill final: public PlayerProcessor
|
class ProcessorPlayerSkill final: public PlayerProcessor
|
||||||
{
|
{
|
||||||
|
using OldSState = ESM::StatState<int>;
|
||||||
public:
|
public:
|
||||||
ProcessorPlayerSkill()
|
ProcessorPlayerSkill()
|
||||||
{
|
{
|
||||||
BPP_INIT(ID_PLAYER_SKILL)
|
BPP_INIT(ID_PLAYER_SKILL)
|
||||||
|
Networking::get().getState().getState()->new_usertype<OldSState>("OldSState",
|
||||||
|
"base", &OldSState::mBase,
|
||||||
|
"current", &OldSState::mCurrent,
|
||||||
|
"mod", &OldSState::mMod,
|
||||||
|
"damage", &OldSState::mDamage,
|
||||||
|
"progress", &OldSState::mProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PreReading(PlayerPacket &packet, const std::shared_ptr<Player> &player) override
|
||||||
|
{
|
||||||
|
if (!player->creatureStats.mDead)
|
||||||
|
std::copy(std::begin(player->npcStats.mSkills),
|
||||||
|
std::end(player->npcStats.mSkills),
|
||||||
|
oldValues.begin()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Do(PlayerPacket &packet, const std::shared_ptr<Player> &player) override
|
void Do(PlayerPacket &packet, const std::shared_ptr<Player> &player) override
|
||||||
|
@ -22,11 +38,12 @@ namespace mwmp
|
||||||
if (!player->creatureStats.mDead)
|
if (!player->creatureStats.mDead)
|
||||||
{
|
{
|
||||||
//myPacket->Send(player, true);
|
//myPacket->Send(player, true);
|
||||||
|
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_PLAYER_SKILL, true>(&oldValues, player.get());
|
||||||
player->sendToLoaded(packet);
|
player->sendToLoaded(packet);
|
||||||
|
|
||||||
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_PLAYER_SKILL>(player.get());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
std::array<OldSState, ESM::Skill::Length> oldValues;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue