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

76 lines
1.2 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 {
2017-08-08 13:53:47 +02:00
class Session :
2018-10-25 12:44:51 +11:00
public std::enable_shared_from_this< Session >
{
public:
Session( uint32_t sessionId );
~Session();
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
private:
uint32_t m_sessionId;
2017-08-08 13:53:47 +02:00
Entity::PlayerPtr m_pPlayer;
2017-08-08 13:53:47 +02:00
int64_t m_lastDataTime;
2017-08-08 13:53:47 +02:00
int64_t m_lastSqlTime;
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