2017-04-16 07:00:25 +00:00
|
|
|
//
|
|
|
|
// Created by koncord on 16.04.17.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef OPENMW_PROCESSORPLAYERSPELLBOOK_HPP
|
|
|
|
#define OPENMW_PROCESSORPLAYERSPELLBOOK_HPP
|
|
|
|
|
|
|
|
|
2017-06-06 16:06:10 +00:00
|
|
|
#include "../PlayerProcessor.hpp"
|
2017-04-16 07:00:25 +00:00
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
{
|
|
|
|
class ProcessorPlayerSpellbook : public PlayerProcessor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ProcessorPlayerSpellbook()
|
|
|
|
{
|
|
|
|
BPP_INIT(ID_PLAYER_SPELLBOOK)
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
|
|
|
{
|
|
|
|
if (!isLocal()) return;
|
|
|
|
|
|
|
|
if (isRequest())
|
|
|
|
static_cast<LocalPlayer*>(player)->sendSpellbook();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LocalPlayer &localPlayer = static_cast<LocalPlayer&>(*player);
|
|
|
|
|
|
|
|
int spellbookAction = localPlayer.spellbookChanges.action;
|
|
|
|
|
|
|
|
if (spellbookAction == SpellbookChanges::ADD)
|
|
|
|
localPlayer.addSpells();
|
|
|
|
else if (spellbookAction == SpellbookChanges::REMOVE)
|
|
|
|
localPlayer.removeSpells();
|
|
|
|
else // SpellbookChanges::SET
|
|
|
|
localPlayer.setSpellbook();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //OPENMW_PROCESSORPLAYERSPELLBOOK_HPP
|