2017-04-16 07:00:25 +00:00
|
|
|
#ifndef OPENMW_PROCESSORPLAYERBASEINFO_HPP
|
|
|
|
#define OPENMW_PROCESSORPLAYERBASEINFO_HPP
|
|
|
|
|
2017-06-06 16:06:10 +00:00
|
|
|
#include "../PlayerProcessor.hpp"
|
2017-04-16 07:00:25 +00:00
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
{
|
2019-10-24 19:16:17 +00:00
|
|
|
class ProcessorPlayerBaseInfo final: public PlayerProcessor
|
2017-04-16 07:00:25 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ProcessorPlayerBaseInfo()
|
|
|
|
{
|
|
|
|
BPP_INIT(ID_PLAYER_BASEINFO)
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
|
|
|
{
|
2019-08-19 18:39:33 +00:00
|
|
|
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received ID_PLAYER_BASEINFO from server");
|
2017-04-16 07:00:25 +00:00
|
|
|
|
2017-05-02 19:47:58 +00:00
|
|
|
if (isLocal())
|
2017-04-16 07:00:25 +00:00
|
|
|
{
|
2019-08-19 18:39:33 +00:00
|
|
|
LOG_APPEND(TimedLog::LOG_INFO, "- Packet was about LocalPlayer");
|
2017-04-16 07:00:25 +00:00
|
|
|
|
2017-05-02 19:47:58 +00:00
|
|
|
if (isRequest())
|
2017-04-16 07:00:25 +00:00
|
|
|
{
|
2019-08-19 18:39:33 +00:00
|
|
|
LOG_APPEND(TimedLog::LOG_INFO, "- Requesting info");
|
2017-04-16 07:00:25 +00:00
|
|
|
packet.Send(serverAddr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-19 18:39:33 +00:00
|
|
|
LOG_APPEND(TimedLog::LOG_INFO, "- Setting character for LocalPlayer");
|
2018-04-09 16:21:19 +00:00
|
|
|
static_cast<LocalPlayer*>(player)->setCharacter();
|
2017-04-16 07:00:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-19 18:39:33 +00:00
|
|
|
LOG_APPEND(TimedLog::LOG_INFO, "- Packet was about %s", player == 0 ? "new player" : player->npc.mName.c_str());
|
2017-04-16 07:00:25 +00:00
|
|
|
|
|
|
|
if (player == 0)
|
|
|
|
{
|
2019-08-19 18:39:33 +00:00
|
|
|
LOG_APPEND(TimedLog::LOG_INFO, "- Exchanging data with new player");
|
2017-04-18 04:17:58 +00:00
|
|
|
player = PlayerList::newPlayer(guid);
|
2017-04-16 07:00:25 +00:00
|
|
|
|
|
|
|
packet.setPlayer(player);
|
|
|
|
packet.Read();
|
|
|
|
}
|
|
|
|
|
2018-04-08 07:56:33 +00:00
|
|
|
static_cast<DedicatedPlayer*>(player)->setBaseInfo();
|
2017-04-16 07:00:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //OPENMW_PROCESSORPLAYERBASEINFO_HPP
|