// // Created by koncord on 01.04.17. // #ifndef OPENMW_PROCESSORPLAYERATTRIBUTE_HPP #define OPENMW_PROCESSORPLAYERATTRIBUTE_HPP #include "../PlayerProcessor.hpp" namespace mwmp { class ProcessorPlayerAttribute final: public PlayerProcessor { public: using OldAState = ESM::StatState; ProcessorPlayerAttribute() { BPP_INIT(ID_PLAYER_ATTRIBUTE) Networking::get().getState().getState()->new_usertype("OldAState", "base", &OldAState::mBase, "current", &OldAState::mCurrent, "mod", &OldAState::mMod, "damage", &OldAState::mDamage); } void PreReading(PlayerPacket &packet, const std::shared_ptr &player) override { if (!player->creatureStats.mDead) std::copy(std::begin(player->creatureStats.mAttributes), std::end(player->creatureStats.mAttributes), oldValues.begin() ); } void Do(PlayerPacket &packet, const std::shared_ptr &player) override { if (!player->creatureStats.mDead) { //myPacket->Send(player, true); Networking::get().getState().getEventCtrl().Call(&oldValues, player.get()); player->sendToLoaded(packet); } } private: std::array oldValues; }; } #endif //OPENMW_PROCESSORPLAYERATTRIBUTE_HPP