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"
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
struct PlayerView {
|
|
|
|
std::list<CNSocket*> viewable;
|
2020-08-20 21:43:48 +00:00
|
|
|
std::list<int32_t> viewableNPCs;
|
2020-08-24 22:02:07 +00:00
|
|
|
Player *plr;
|
2020-08-22 18:38:27 +00:00
|
|
|
uint64_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-08-24 22:02:07 +00:00
|
|
|
Player *getPlayer(CNSocket* key);
|
2020-08-18 20:42:30 +00:00
|
|
|
|
|
|
|
void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z);
|
2020-08-23 15:42:37 +00:00
|
|
|
std::list<CNSocket*> getNearbyPlayers(int X, int Y, int dist);
|
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-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);
|
|
|
|
|
|
|
|
void enterPlayerVehicle(CNSocket* sock, CNPacketData* data);
|
|
|
|
void exitPlayerVehicle(CNSocket* sock, CNPacketData* data);
|
2020-08-18 20:42:30 +00:00
|
|
|
}
|