You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw-mp/Player.hpp

80 lines
1.7 KiB
C++

//
// Created by koncord on 05.01.16.
//
#ifndef OPENMW_PLAYER_HPP
#define OPENMW_PLAYER_HPP
#include <map>
#include <string>
#include <chrono>
#include <RakNetTypes.h>
#include <components/esm/npcstats.hpp>
#include <components/esm/cellid.hpp>
#include <components/esm/loadnpc.hpp>
#include <components/esm/loadcell.hpp>
#include <components/openmw-mp/Log.hpp>
#include <components/openmw-mp/Base/BasePlayer.hpp>
struct Player;
typedef std::map<uint64_t, Player*> TPlayers;
typedef std::map<unsigned short, Player*> TSlots;
class Players
{
public:
static void NewPlayer(RakNet::RakNetGUID guid);
static void DeletePlayer(RakNet::RakNetGUID guid);
static Player *GetPlayer(RakNet::RakNetGUID guid);
static Player *GetPlayer(unsigned short id);
static TPlayers *GetPlayers();
private:
static TPlayers players;
static TSlots slots;
};
class Player : public mwmp::BasePlayer
{
unsigned short id;
public:
8 years ago
enum
{
NOTLOADED=0,
LOADED,
POSTLOADED
};
Player(RakNet::RakNetGUID guid);
unsigned short GetID();
void SetID(unsigned short id);
bool isHandshaked();
void Handshake();
8 years ago
void Loaded(int state);
int LoadedState();
void setLastAttackerId(unsigned short pid);
void resetLastAttacker();
unsigned short getLastAttackerId();
void setLastAttackerTime(std::chrono::steady_clock::time_point time);
std::chrono::steady_clock::time_point getLastAttackerTime();
virtual ~Player();
public:
mwmp::Inventory inventorySendBuffer;
private:
bool handshake;
8 years ago
int loaded;
unsigned short lastAttacker;
std::chrono::steady_clock::time_point lastAttackerTime;
};
#endif //OPENMW_PLAYER_HPP