forked from teamnwah/openmw-tes3coop
[Server] Move all message handlers to PlayerProcessors
parent
020167df08
commit
e8a5fd1cd0
@ -0,0 +1,52 @@
|
||||
//
|
||||
// Created by koncord on 31.03.17.
|
||||
//
|
||||
|
||||
#include "init_processors.hpp"
|
||||
|
||||
#include "PlayerProcessor.hpp"
|
||||
#include "processors/ProcessorPlayerPos.hpp"
|
||||
#include "processors/ProcessorPlayerCellChange.hpp"
|
||||
#include "processors/ProcessorPlayerCellState.hpp"
|
||||
#include "processors/ProcessorPlayerAttribute.hpp"
|
||||
#include "processors/ProcessorPlayerSkill.hpp"
|
||||
#include "processors/ProcessorLevel.hpp"
|
||||
#include "processors/ProcessorPlayerEquipment.hpp"
|
||||
#include "processors/ProcessorPlayerInventory.hpp"
|
||||
#include "processors/ProcessorPlayerSpellbook.hpp"
|
||||
#include "processors/ProcessorPlayerJournal.hpp"
|
||||
#include "processors/ProcessorPlayerAttack.hpp"
|
||||
#include "processors/ProcessorPlayerDynamicStats.hpp"
|
||||
#include "processors/ProcessorPlayerDeath.hpp"
|
||||
#include "processors/ProcessorPlayerResurrect.hpp"
|
||||
#include "processors/ProcessorPlayerDrawState.hpp"
|
||||
#include "processors/ProcessorChatMsg.hpp"
|
||||
#include "processors/ProcessorPlayerCharGen.hpp"
|
||||
#include "processors/ProcessorGUIMessageBox.hpp"
|
||||
#include "processors/ProcessorPlayerCharClass.hpp"
|
||||
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
void init_processors()
|
||||
{
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerPos());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerCellChange());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerCellState());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerAttribute());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerSkill());
|
||||
PlayerProcessor::AddProcessor(new ProcessorLevel());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerEquipment());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerInventory());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerJournal());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerAttack());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerDynamicStats());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerDeath());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerResurrect());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerDrawState());
|
||||
PlayerProcessor::AddProcessor(new ProcessorChatMsg());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerCharGen());
|
||||
PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass());
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
//
|
||||
// Created by koncord on 31.03.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_INIT_PROCESSORS_HPP
|
||||
#define OPENMW_INIT_PROCESSORS_HPP
|
||||
|
||||
void init_processors();
|
||||
|
||||
|
||||
#endif //OPENMW_INIT_PROCESSORS_HPP
|
@ -0,0 +1,43 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERCHATMSG_HPP
|
||||
#define OPENMW_PROCESSORPLAYERCHATMSG_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorChatMsg : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorChatMsg()
|
||||
{
|
||||
BPP_INIT(ID_CHAT_MESSAGE)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
Script::CallBackReturn<Script::CallbackIdentity("OnPlayerSendMessage")> result = true;
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerSendMessage")>(result, player.getId(), player.chatMessage.c_str());
|
||||
|
||||
if (result)
|
||||
{
|
||||
player.chatMessage = player.npc.mName + " (" + std::to_string(player.getId()) + "): "
|
||||
+ player.chatMessage + "\n";
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Send(false);
|
||||
packet.Send(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERCHATMSG_HPP
|
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORGUIMESSAGEBOX_HPP
|
||||
#define OPENMW_PROCESSORGUIMESSAGEBOX_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorGUIMessageBox : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorGUIMessageBox()
|
||||
{
|
||||
BPP_INIT(ID_GUI_MESSAGEBOX)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnGUIAction")>(player.getId(), (int)player.guiMessageBox.id,
|
||||
player.guiMessageBox.data.c_str());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORGUIMESSAGEBOX_HPP
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORLEVEL_HPP
|
||||
#define OPENMW_PROCESSORLEVEL_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorLevel : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorLevel()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_LEVEL)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
if (!player.creatureStats.mDead)
|
||||
{
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
//packet.Send(&player, true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerLevelChange")>(player.getId());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORLEVEL_HPP
|
@ -0,0 +1,59 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERATTACK_HPP
|
||||
#define OPENMW_PROCESSORPLAYERATTACK_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerAttack : public PlayerProcessor
|
||||
{
|
||||
PlayerPacketController *playerController;
|
||||
public:
|
||||
ProcessorPlayerAttack()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_ATTACK)
|
||||
playerController = Networking::get().getPlayerController();
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
if (!player.creatureStats.mDead)
|
||||
{
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
Player *target = Players::getPlayer(player.attack.target);
|
||||
|
||||
if (target == nullptr)
|
||||
target = &player;
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Player: %s attacked %s state: %d", player.npc.mName.c_str(),
|
||||
target->npc.mName.c_str(), player.attack.pressed == 1);
|
||||
if (player.attack.pressed == 0)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "success: %d", player.attack.success == 1);
|
||||
if (player.attack.success == 1)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "damage: %d", player.attack.damage == 1);
|
||||
target->setLastAttackerId(player.getId());
|
||||
target->setLastAttackerTime(std::chrono::steady_clock::now());
|
||||
}
|
||||
}
|
||||
|
||||
//packet.Send(player, true);
|
||||
player.sendToLoaded(&packet);
|
||||
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->RequestData(player.attack.target);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERATTACK_HPP
|
@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERATTRIBUTE_HPP
|
||||
#define OPENMW_PROCESSORPLAYERATTRIBUTE_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerAttribute : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerAttribute()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_ATTRIBUTE)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
if (!player.creatureStats.mDead)
|
||||
{
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
//myPacket->Send(player, true);
|
||||
|
||||
player.sendToLoaded(&packet);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerAttributesChange")>(player.getId());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERATTRIBUTE_HPP
|
@ -0,0 +1,93 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERCELLCHANGE_HPP
|
||||
#define OPENMW_PROCESSORPLAYERCELLCHANGE_HPP
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
#include "../Networking.hpp"
|
||||
#include "../Script/Script.hpp"
|
||||
#include <components/openmw-mp/Controllers/PlayerPacketController.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerCellChange : public PlayerProcessor
|
||||
{
|
||||
PlayerPacketController *playerController;
|
||||
public:
|
||||
ProcessorPlayerCellChange()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_CELL_CHANGE)
|
||||
playerController = Networking::get().getPlayerController();
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_CELL_CHANGE from %s", player.npc.mName.c_str());
|
||||
|
||||
if (!player.creatureStats.mDead)
|
||||
{
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
LOG_APPEND(Log::LOG_INFO, "- Moved to %s", player.cell.getDescription().c_str());
|
||||
|
||||
player.forEachLoaded([this](Player *pl, Player *other) {
|
||||
|
||||
if (other == nullptr)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Tried to exchange information with nullptr!");
|
||||
LOG_APPEND(Log::LOG_INFO, "- Please report this to a developer");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Started information exchange with %s", other->npc.mName.c_str());
|
||||
|
||||
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(other);
|
||||
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(other);
|
||||
playerController->GetPacket(ID_PLAYER_POS)->setPlayer(other);
|
||||
playerController->GetPacket(ID_PLAYER_SKILL)->setPlayer(other);
|
||||
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(other);
|
||||
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->setPlayer(other);
|
||||
|
||||
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(pl->guid);
|
||||
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(pl->guid);
|
||||
playerController->GetPacket(ID_PLAYER_POS)->Send(pl->guid);
|
||||
playerController->GetPacket(ID_PLAYER_SKILL)->Send(pl->guid);
|
||||
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(pl->guid);
|
||||
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->Send(pl->guid);
|
||||
|
||||
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(pl);
|
||||
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl);
|
||||
playerController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl);
|
||||
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl);
|
||||
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->setPlayer(pl);
|
||||
|
||||
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(other->guid);
|
||||
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(other->guid);
|
||||
playerController->GetPacket(ID_PLAYER_SKILL)->Send(other->guid);
|
||||
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(other->guid);
|
||||
playerController->GetPacket(ID_PLAYER_DRAWSTATE)->Send(other->guid);
|
||||
|
||||
LOG_APPEND(Log::LOG_INFO, "- Finished information exchange with %s", other->npc.mName.c_str());
|
||||
}
|
||||
});
|
||||
|
||||
playerController->GetPacket(ID_PLAYER_POS)->setPlayer(&player);
|
||||
playerController->GetPacket(ID_PLAYER_POS)->Send();
|
||||
packet.setPlayer(&player);
|
||||
packet.Send(true); //send to other clients
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerCellChange")>(player.getId());
|
||||
|
||||
LOG_APPEND(Log::LOG_INFO, "- Finished processing ID_PLAYER_CELL_CHANGE", player.cell.getDescription().c_str());
|
||||
}
|
||||
else
|
||||
LOG_APPEND(Log::LOG_INFO, "- Ignored because %s is dead", player.npc.mName.c_str());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERCELLCHANGE_HPP
|
@ -0,0 +1,41 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERCELLSTATE_HPP
|
||||
#define OPENMW_PROCESSORPLAYERCELLSTATE_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
#include "../Networking.hpp"
|
||||
#include "../Script/Script.hpp"
|
||||
#include <components/openmw-mp/Controllers/PlayerPacketController.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerCellState : public PlayerProcessor
|
||||
{
|
||||
PlayerPacketController *playerController;
|
||||
public:
|
||||
ProcessorPlayerCellState()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_CELL_STATE)
|
||||
playerController = Networking::get().getPlayerController();
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID, player.npc.mName.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
CellController::get()->update(&player);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerCellState")>(player.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERCELLSTATE_HPP
|
@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERCHARCLASS_HPP
|
||||
#define OPENMW_PROCESSORPLAYERCHARCLASS_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerCharClass : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerCharClass()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_CHARCLASS)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERCHARCLASS_HPP
|
@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERCHARGEN_HPP
|
||||
#define OPENMW_PROCESSORPLAYERCHARGEN_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerCharGen : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerCharGen()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_CHARGEN)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
if (player.charGenStage.current == player.charGenStage.end && player.charGenStage.current != 0)
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerEndCharGen")>(player.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERCHARGEN_HPP
|
@ -0,0 +1,52 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERDEATH_HPP
|
||||
#define OPENMW_PROCESSORPLAYERDEATH_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
#include <chrono>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerDeath : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerDeath()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_DEATH)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
|
||||
|
||||
Player *killer = Players::getPlayer(player.getLastAttackerId());
|
||||
|
||||
short reason = 0; // unknown;
|
||||
double secondsSinceLastAttacker = std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||
std::chrono::steady_clock::now() - player.getLastAttackerTime()).count();
|
||||
|
||||
if (!killer)
|
||||
killer = &player;
|
||||
|
||||
if (secondsSinceLastAttacker < 3.0f)
|
||||
reason = 1; // killed
|
||||
else
|
||||
reason = 2; //suicide
|
||||
|
||||
player.resetLastAttacker();
|
||||
|
||||
player.creatureStats.mDead = true;
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Send(true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerDeath")>(player.getId(), reason, killer->getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERDEATH_HPP
|
@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERDRAWSTATE_HPP
|
||||
#define OPENMW_PROCESSORPLAYERDRAWSTATE_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerDrawState : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerDrawState()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_DRAWSTATE)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
//packet.Send(&player, true);
|
||||
|
||||
player.sendToLoaded(&packet);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERDRAWSTATE_HPP
|
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERDYNAMICSTATS_HPP
|
||||
#define OPENMW_PROCESSORPLAYERDYNAMICSTATS_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerDynamicStats : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerDynamicStats()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_DYNAMICSTATS)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
player.sendToLoaded(&packet);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERDYNAMICSTATS_HPP
|
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYEREQUIPMENT_HPP
|
||||
#define OPENMW_PROCESSORPLAYEREQUIPMENT_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerEquipment : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerEquipment()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_EQUIPMENT)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
//myPacket->Send(player, true);
|
||||
|
||||
player.sendToLoaded(&packet);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerEquipmentChange")>(player.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYEREQUIPMENT_HPP
|
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERINVENTORY_HPP
|
||||
#define OPENMW_PROCESSORPLAYERINVENTORY_HPP
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerInventory : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerInventory()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_INVENTORY)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerInventoryChange")>(player.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERINVENTORY_HPP
|
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERJOURNAL_HPP
|
||||
#define OPENMW_PROCESSORPLAYERJOURNAL_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerJournal : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerJournal()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_JOURNAL)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerJournalChange")>(player.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERJOURNAL_HPP
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by koncord on 31.03.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERPOS_HPP
|
||||
#define OPENMW_PROCESSORPLAYERPOS_HPP
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerPos : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerPos()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_POS)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
//DEBUG_PRINTF(strPacketID);
|
||||
if (!player.creatureStats.mDead)
|
||||
{
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
//myPacket.Send(player, true); //send to other clients
|
||||
|
||||
player.sendToLoaded(&packet);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERPOS_HPP
|
@ -0,0 +1,37 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERRESURRECT_HPP
|
||||
#define OPENMW_PROCESSORPLAYERRESURRECT_HPP
|
||||
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerResurrect : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerResurrect()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_RESURRECT)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
|
||||
|
||||
player.creatureStats.mDead = false;
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Send(true);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERRESURRECT_HPP
|
@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by koncord on 01.04.17.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_PROCESSORPLAYERSKILL_HPP
|
||||
#define OPENMW_PROCESSORPLAYERSKILL_HPP
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerSkill : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerSkill()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_SKILL)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
if (!player.creatureStats.mDead)
|
||||
{
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
//myPacket->Send(player, true);
|
||||
player.sendToLoaded(&packet);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerSkillsChange")>(player.getId());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERSKILL_HPP
|
@ -0,0 +1,33 @@
|
||||
//
|
||||
// Created by koncord on 01.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)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
||||
packet.setPlayer(&player);
|
||||
packet.Read();
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerSpellbookChange")>(player.getId());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERSPELLBOOK_HPP
|
Loading…
Reference in New Issue