|
|
@ -12,9 +12,26 @@ namespace mwmp
|
|
|
|
class ProcessorPlayerAttribute final: public PlayerProcessor
|
|
|
|
class ProcessorPlayerAttribute final: public PlayerProcessor
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
using OldAState = ESM::StatState<int>;
|
|
|
|
ProcessorPlayerAttribute()
|
|
|
|
ProcessorPlayerAttribute()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BPP_INIT(ID_PLAYER_ATTRIBUTE)
|
|
|
|
BPP_INIT(ID_PLAYER_ATTRIBUTE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Networking::get().getState().getState()->new_usertype<OldAState>("OldAState",
|
|
|
|
|
|
|
|
"base", &OldAState::mBase,
|
|
|
|
|
|
|
|
"current", &OldAState::mCurrent,
|
|
|
|
|
|
|
|
"mod", &OldAState::mMod,
|
|
|
|
|
|
|
|
"damage", &OldAState::mDamage);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PreReading(PlayerPacket &packet, const std::shared_ptr<Player> &player)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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> &player) override
|
|
|
|
void Do(PlayerPacket &packet, const std::shared_ptr<Player> &player) override
|
|
|
@ -22,12 +39,13 @@ 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_ATTRIBUTE, true>(&oldValues, player.get());
|
|
|
|
|
|
|
|
|
|
|
|
player->sendToLoaded(packet);
|
|
|
|
player->sendToLoaded(packet);
|
|
|
|
|
|
|
|
|
|
|
|
Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_PLAYER_ATTRIBUTE>(player.get());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
std::array<OldAState, ESM::Attribute::Length> oldValues;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|