1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 06:23:52 +00:00
openmw-tes3mp/apps/openmw/mwmp/processors/player/ProcessorPlayerSpellbook.hpp
David Cernat 134dd06d48 [Client] Only add valid inventory & equipment items to LocalPlayer
Also add related debug information.
2017-08-31 08:35:46 +03:00

46 lines
1.3 KiB
C++

//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERSPELLBOOK_HPP
#define OPENMW_PROCESSORPLAYERSPELLBOOK_HPP
#include "../PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerSpellbook : public PlayerProcessor
{
public:
ProcessorPlayerSpellbook()
{
BPP_INIT(ID_PLAYER_SPELLBOOK)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (!isLocal()) return;
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_SPELLBOOK about LocalPlayer from server");
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