OpenFusion/src/BuddyManager.hpp
Gent 803f1a246a Buddy code cleanup
- Get rid of buddyCnt, self-nullptr checks, and redundant playermap loops in chat handlers
- Add helper function to find available buddy slot
- Reorganize a bit
2020-11-08 00:08:43 -05:00

42 lines
1.1 KiB
C++

#pragma once
#include "Player.hpp"
#include "CNProtocol.hpp"
#include "CNStructs.hpp"
#include "CNShardServer.hpp"
#include <map>
#include <list>
namespace BuddyManager {
void init();
// Buddy requests
void requestBuddy(CNSocket* sock, CNPacketData* data);
void reqBuddyByName(CNSocket* sock, CNPacketData* data);
// Buddy accepting
void reqAcceptBuddy(CNSocket* sock, CNPacketData* data);
void reqFindNameBuddyAccept(CNSocket* sock, CNPacketData* data);
// Buddy Messaging
void reqBuddyFreechat(CNSocket* sock, CNPacketData* data);
void reqBuddyMenuchat(CNSocket* sock, CNPacketData* data);
// Getting buddy state
void reqPktGetBuddyState(CNSocket* sock, CNPacketData* data);
// Blocking/removing buddies
void reqBuddyBlock(CNSocket* sock, CNPacketData* data);
void reqBuddyDelete(CNSocket* sock, CNPacketData* data);
// Buddy warping
void reqBuddyWarp(CNSocket* sock, CNPacketData* data);
// helper methods
// Name checks
int getAvailableBuddySlot(Player* plr);
bool NameCheck(char16_t reqName[], char16_t resName[], int sizeOfReq, int sizeOfRes); // checks if the request and requested player's names match
}