[Server] Add previous state to ON_PLAYER_SKILL

That is array of struct with next content: {base, current, mod, damage, progress}
sol2-server-rewrite
Koncord 7 years ago
parent 017956366f
commit 4aff1f1833

@ -24,7 +24,7 @@ namespace mwmp
"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)
std::copy(std::begin(player->creatureStats.mAttributes),

@ -11,10 +11,26 @@ namespace mwmp
{
class ProcessorPlayerSkill final: public PlayerProcessor
{
using OldSState = ESM::StatState<int>;
public:
ProcessorPlayerSkill()
{
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
@ -22,11 +38,12 @@ namespace mwmp
if (!player->creatureStats.mDead)
{
//myPacket->Send(player, true);
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_PLAYER_SKILL, true>(&oldValues, player.get());
player->sendToLoaded(packet);
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_PLAYER_SKILL>(player.get());
}
}
private:
std::array<OldSState, ESM::Skill::Length> oldValues;
};
}

Loading…
Cancel
Save