2020-08-23 17:14:54 +00:00
|
|
|
#pragma once
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
#include "Player.hpp"
|
|
|
|
#include "CNProtocol.hpp"
|
|
|
|
#include "CNStructs.hpp"
|
|
|
|
#include "CNShardServer.hpp"
|
2020-09-17 22:45:43 +00:00
|
|
|
#include "ChunkManager.hpp"
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-09-17 22:45:43 +00:00
|
|
|
#include <utility>
|
2020-08-18 20:42:30 +00:00
|
|
|
#include <map>
|
|
|
|
#include <list>
|
|
|
|
|
2020-08-25 01:34:53 +00:00
|
|
|
struct WarpLocation;
|
|
|
|
|
2020-08-18 20:42:30 +00:00
|
|
|
struct PlayerView {
|
2020-10-01 01:44:37 +00:00
|
|
|
std::tuple<int, int, int> chunkPos;
|
2020-09-17 22:45:43 +00:00
|
|
|
std::vector<Chunk*> currentChunks;
|
2020-08-24 22:02:07 +00:00
|
|
|
Player *plr;
|
2020-09-16 15:45:53 +00:00
|
|
|
time_t lastHeartbeat;
|
2020-08-18 20:42:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
namespace PlayerManager {
|
|
|
|
extern std::map<CNSocket*, PlayerView> players;
|
|
|
|
void init();
|
|
|
|
|
|
|
|
void addPlayer(CNSocket* key, Player plr);
|
|
|
|
void removePlayer(CNSocket* key);
|
|
|
|
|
2020-10-15 02:36:38 +00:00
|
|
|
bool removePlayerFromChunks(std::vector<Chunk*> chunks, CNSocket* sock);
|
2020-09-17 22:45:43 +00:00
|
|
|
void addPlayerToChunks(std::vector<Chunk*> chunks, CNSocket* sock);
|
|
|
|
|
2020-08-18 20:42:30 +00:00
|
|
|
void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z);
|
2020-09-02 22:22:00 +00:00
|
|
|
void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z, int angle);
|
2020-10-02 20:17:24 +00:00
|
|
|
void updatePlayerChunk(CNSocket* sock, int X, int Y, int instanceID);
|
2020-09-17 22:45:43 +00:00
|
|
|
|
2020-10-03 15:21:36 +00:00
|
|
|
void sendPlayerTo(CNSocket* sock, int X, int Y, int Z, int I);
|
|
|
|
void sendPlayerTo(CNSocket* sock, int X, int Y, int Z);
|
|
|
|
|
2020-09-17 22:45:43 +00:00
|
|
|
void sendToViewable(CNSocket* sock, void* buf, uint32_t type, size_t size);
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
void enterPlayer(CNSocket* sock, CNPacketData* data);
|
|
|
|
void loadPlayer(CNSocket* sock, CNPacketData* data);
|
|
|
|
void movePlayer(CNSocket* sock, CNPacketData* data);
|
|
|
|
void stopPlayer(CNSocket* sock, CNPacketData* data);
|
|
|
|
void jumpPlayer(CNSocket* sock, CNPacketData* data);
|
2020-08-20 16:26:26 +00:00
|
|
|
void jumppadPlayer(CNSocket* sock, CNPacketData* data);
|
|
|
|
void launchPlayer(CNSocket* sock, CNPacketData* data);
|
|
|
|
void ziplinePlayer(CNSocket* sock, CNPacketData* data);
|
2020-08-18 20:42:30 +00:00
|
|
|
void movePlatformPlayer(CNSocket* sock, CNPacketData* data);
|
2020-09-23 04:08:51 +00:00
|
|
|
void moveSliderPlayer(CNSocket* sock, CNPacketData* data);
|
2020-08-20 16:26:26 +00:00
|
|
|
void moveSlopePlayer(CNSocket* sock, CNPacketData* data);
|
2020-08-18 20:42:30 +00:00
|
|
|
void gotoPlayer(CNSocket* sock, CNPacketData* data);
|
|
|
|
void setSpecialPlayer(CNSocket* sock, CNPacketData* data);
|
2020-08-19 01:34:39 +00:00
|
|
|
void heartbeatPlayer(CNSocket* sock, CNPacketData* data);
|
2020-08-24 21:04:56 +00:00
|
|
|
void revivePlayer(CNSocket* sock, CNPacketData* data);
|
2020-08-19 17:22:54 +00:00
|
|
|
void exitGame(CNSocket* sock, CNPacketData* data);
|
2020-08-24 21:04:56 +00:00
|
|
|
|
|
|
|
void setSpecialSwitchPlayer(CNSocket* sock, CNPacketData* data);
|
2020-09-22 15:30:49 +00:00
|
|
|
void setGMSpecialSwitchPlayer(CNSocket* sock, CNPacketData* data);
|
2020-08-28 19:42:00 +00:00
|
|
|
void changePlayerGuide(CNSocket *sock, CNPacketData *data);
|
2020-08-24 21:04:56 +00:00
|
|
|
|
|
|
|
void enterPlayerVehicle(CNSocket* sock, CNPacketData* data);
|
|
|
|
void exitPlayerVehicle(CNSocket* sock, CNPacketData* data);
|
2020-08-25 01:34:53 +00:00
|
|
|
|
|
|
|
Player *getPlayer(CNSocket* key);
|
|
|
|
WarpLocation getRespawnPoint(Player *plr);
|
2020-09-01 22:37:09 +00:00
|
|
|
|
|
|
|
bool isAccountInUse(int accountId);
|
|
|
|
void exitDuplicate(int accountId);
|
2020-09-22 15:30:49 +00:00
|
|
|
void setSpecialState(CNSocket* sock, CNPacketData* data);
|
2020-10-04 23:54:08 +00:00
|
|
|
Player *getPlayerFromID(int32_t iID);
|
|
|
|
CNSocket *getSockFromID(int32_t iID);
|
2020-08-18 20:42:30 +00:00
|
|
|
}
|