1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-09 20:27:45 +00:00
sapphire/src/world/Session.h

83 lines
1.5 KiB
C
Raw Normal View History

2017-08-08 13:53:47 +02:00
#ifndef _SESSION_H_
#define _SESSION_H_
2018-10-25 12:44:51 +11:00
#include <memory>
2017-08-08 13:53:47 +02:00
#include "ForwardsZone.h"
2017-08-08 13:53:47 +02:00
namespace Sapphire::World
{
class Session : public std::enable_shared_from_this< Session >
{
public:
Session( uint32_t entityId );
~Session() = default;
void setZoneConnection( Network::GameConnectionPtr zoneCon );
void setChatConnection( Network::GameConnectionPtr chatCon );
Network::GameConnectionPtr getZoneConnection() const;
Network::GameConnectionPtr getChatConnection() const;
int64_t getLastDataTime() const;
int64_t getLastSqlTime() const;
2017-08-08 13:53:47 +02:00
void updateLastDataTime();
2017-08-08 13:53:47 +02:00
void updateLastSqlTime();
void startReplay( const std::string& folderpath );
2017-08-08 13:53:47 +02:00
void stopReplay();
2017-08-08 13:53:47 +02:00
void processReplay();
2017-08-08 13:53:47 +02:00
void sendReplayInfo();
2018-01-08 21:42:44 +01:00
void close();
2017-08-08 13:53:47 +02:00
uint32_t getId() const;
2017-08-08 13:53:47 +02:00
bool loadPlayer();
2017-08-08 13:53:47 +02:00
void update();
2017-08-08 13:53:47 +02:00
bool isValid() const;
Entity::PlayerPtr getPlayer() const;
2017-08-08 13:53:47 +02:00
/*! set timestamp for last received ping */
void setLastPing( uint32_t lastPing );
/*! get timestamp of last received ping */
uint32_t getLastPing() const;
private:
uint32_t m_entityId;
2017-08-08 13:53:47 +02:00
Entity::PlayerPtr m_pPlayer;
2017-08-08 13:53:47 +02:00
uint32_t m_lastDataTime;
2017-08-08 13:53:47 +02:00
uint32_t m_lastSqlTime;
uint32_t m_lastPing;
bool m_isValid;
bool m_isReplaying;
std::vector< std::tuple< uint64_t, std::string > > m_replayCache;
2018-01-08 21:42:44 +01:00
Network::GameConnectionPtr m_pZoneConnection;
Network::GameConnectionPtr m_pChatConnection;
2017-08-08 13:53:47 +02:00
};
2017-08-08 13:53:47 +02:00
}
#endif