openmw-tes3coop/apps/openmw/mwmp/processors/player/ProcessorPlayerBaseInfo.hpp

59 lines
1.6 KiB
C++
Raw Normal View History

2017-04-16 07:00:25 +00:00
//
// Created by koncord on 04.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERBASEINFO_HPP
#define OPENMW_PROCESSORPLAYERBASEINFO_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerBaseInfo : public PlayerProcessor
{
public:
ProcessorPlayerBaseInfo()
{
BPP_INIT(ID_PLAYER_BASEINFO)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_BASEINFO from server");
2017-05-02 19:47:58 +00:00
if (isLocal())
2017-04-16 07:00:25 +00:00
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about my id");
2017-05-02 19:47:58 +00:00
if (isRequest())
2017-04-16 07:00:25 +00:00
{
LOG_APPEND(Log::LOG_INFO, "- Requesting info");
packet.Send(serverAddr);
}
else
{
LOG_APPEND(Log::LOG_INFO, "- Updating LocalPlayer");
static_cast<LocalPlayer*>(player)->updateChar();
}
}
else
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", player == 0 ? "new player" : player->npc.mName.c_str());
if (player == 0)
{
LOG_APPEND(Log::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();
}
2017-04-18 04:17:58 +00:00
PlayerList::createPlayer(guid);
2017-04-16 07:00:25 +00:00
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERBASEINFO_HPP