[Server] Add previous state to ON_RECORD_DYNAMIC

sol2-server-rewrite
Koncord 7 years ago
parent 4aff1f1833
commit 2ac01dc02a

@ -8,17 +8,36 @@ namespace mwmp
class ProcessorRecordDynamic final : public PlayerProcessor
{
public:
using OldDState = ESM::StatState<float>;
ProcessorRecordDynamic()
{
BPP_INIT(ID_RECORD_DYNAMIC)
Networking::get().getState().getState()->new_usertype<OldDState>("OldDState",
"base", &OldDState::mBase,
"current", &OldDState::mCurrent,
"mod", &OldDState::mMod,
"damage", &OldDState::mDamage,
"progress", &OldDState::mProgress);
}
void PreReading(PlayerPacket &packet, const std::shared_ptr<Player> &player) override
{
std::copy(std::begin(player->creatureStats.mDynamic),
std::end(player->creatureStats.mDynamic),
oldValues.begin()
);
}
void Do(PlayerPacket &packet, const std::shared_ptr<Player> &player) override
{
DEBUG_PRINTF(strPacketID.c_str());
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_RECORD_DYNAMIC>(player);
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_RECORD_DYNAMIC, true>(&oldValues, player);
}
private:
std::array<OldDState, 3> oldValues;
};
}

Loading…
Cancel
Save