OpenFusion/src/PlayerManager.hpp

76 lines
2.7 KiB
C++
Raw Normal View History

#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>
struct WarpLocation;
2020-08-18 20:42:30 +00:00
struct PlayerView {
2020-11-16 14:59:53 +00:00
ChunkPos chunkPos;
2020-09-17 22:45:43 +00:00
std::vector<Chunk*> currentChunks;
Player *plr;
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);
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);
void updatePlayerPosition(CNSocket* sock, int X, int Y, int Z, int angle);
2020-10-12 16:55:41 +00:00
void updatePlayerChunk(CNSocket* sock, int X, int Y, uint64_t instanceID);
2020-09-17 22:45:43 +00:00
2020-10-12 16:55:41 +00:00
void sendPlayerTo(CNSocket* sock, int X, int Y, int Z, uint64_t 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);
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);
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);
void revivePlayer(CNSocket* sock, CNPacketData* data);
void exitGame(CNSocket* sock, CNPacketData* data);
void setSpecialSwitchPlayer(CNSocket* sock, CNPacketData* data);
void setGMSpecialSwitchPlayer(CNSocket* sock, CNPacketData* data);
void changePlayerGuide(CNSocket *sock, CNPacketData *data);
void enterPlayerVehicle(CNSocket* sock, CNPacketData* data);
void exitPlayerVehicle(CNSocket* sock, CNPacketData* data);
Player *getPlayer(CNSocket* key);
std::string getPlayerName(Player *plr, bool id=true);
WarpLocation getRespawnPoint(Player *plr);
bool isAccountInUse(int accountId);
void exitDuplicate(int accountId);
void setSpecialState(CNSocket* sock, CNPacketData* data);
Player *getPlayerFromID(int32_t iID);
CNSocket *getSockFromID(int32_t iID);
2020-08-18 20:42:30 +00:00
}