Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
139
Server/RylServerProject/RylServerLibrary/Community/BanList.h
Normal file
139
Server/RylServerProject/RylServerLibrary/Community/BanList.h
Normal file
@@ -0,0 +1,139 @@
|
||||
#ifndef _BAN_LIST_H_
|
||||
#define _BAN_LIST_H_
|
||||
|
||||
#include <Network/Packet/PacketStruct/FriendPacket.h>
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
class CXRefBans
|
||||
{
|
||||
public:
|
||||
|
||||
static CXRefBans& GetInstance();
|
||||
|
||||
typedef std::multimap<unsigned long, unsigned long> XRefTable;
|
||||
|
||||
CXRefBans() { }
|
||||
~CXRefBans() { }
|
||||
|
||||
// FnProcess<73><73> bool operator() (CXRefFriends::XRefTable::value_type&) <20>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ü(Ŭ<><C5AC><EFBFBD><EFBFBD>)<29>̴<EFBFBD>.
|
||||
template<typename FnProcess>
|
||||
void Process(unsigned long dwFriendID, FnProcess fnProcess)
|
||||
{
|
||||
// dwFriendID<49><44> ģ<><C4A3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> CID<49><44> <20><><EFBFBD>ؼ<EFBFBD> <20>۾<EFBFBD><DBBE>Ѵ<EFBFBD>.
|
||||
std::pair<XRefTable::iterator, XRefTable::iterator> result =
|
||||
m_XRefTable.equal_range(dwFriendID);
|
||||
|
||||
std::for_each(result.first, result.second, fnProcess);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
XRefTable::iterator Add(unsigned long dwOwnerID, unsigned long dwFriendID)
|
||||
{ return m_XRefTable.insert(std::make_pair(dwFriendID, dwOwnerID)); }
|
||||
|
||||
void Remove(XRefTable::iterator erasePos) { m_XRefTable.erase(erasePos); }
|
||||
|
||||
XRefTable m_XRefTable;
|
||||
|
||||
// Add, Remove Method<6F><64> <20><><EFBFBD>߱<EFBFBD> <20><><EFBFBD>ؼ<EFBFBD> friend<6E><64> <20><><EFBFBD><EFBFBD>.
|
||||
friend class CBanList;
|
||||
};
|
||||
|
||||
class CBanList
|
||||
{
|
||||
public:
|
||||
|
||||
class Rebind
|
||||
{
|
||||
private:
|
||||
|
||||
CXRefBans::XRefTable::iterator m_XRefItr;
|
||||
BanInfo m_banInfo;
|
||||
|
||||
Rebind() : m_XRefItr() {}
|
||||
Rebind(const CXRefBans::XRefTable::iterator& XRefItr, const BanInfo& banInfo)
|
||||
: m_XRefItr(XRefItr), m_banInfo(banInfo) { }
|
||||
|
||||
public:
|
||||
|
||||
inline unsigned long GetCID() { return m_banInfo.m_dwCID; }
|
||||
inline const char* GetCharacterName() { return m_banInfo.m_szName; }
|
||||
|
||||
inline bool IsBan(const char* szName) { return 0 == strncmp(szName, m_banInfo.m_szName, FriendInfo::MAX_NAME); }
|
||||
|
||||
inline void UpdateLevel(char cLevel) { m_banInfo.m_cLevel = cLevel; }
|
||||
inline void UpdateGID(unsigned long dwGID) { m_banInfo.m_dwGID = dwGID; }
|
||||
inline void UpdateServerID(unsigned long dwServerID) { m_banInfo.m_dwServerID = dwServerID; }
|
||||
inline void UpdateClass(unsigned short wClass) { m_banInfo.m_wClass = wClass; }
|
||||
|
||||
inline char GetLevel() { return m_banInfo.m_cLevel; }
|
||||
inline unsigned long GetGID() { return m_banInfo.m_dwGID; }
|
||||
inline unsigned short GetClass() { return m_banInfo.m_wClass; }
|
||||
inline unsigned long GetServerID() { return m_banInfo.m_dwServerID; }
|
||||
|
||||
inline void InitializeBanInfo(unsigned long dwServerID, unsigned long dwGID, unsigned short wClass, char cLevel)
|
||||
{
|
||||
m_banInfo.m_dwServerID = dwServerID;
|
||||
m_banInfo.m_dwGID = (m_banInfo.m_dwGID!=dwGID) ? dwGID : m_banInfo.m_dwGID;
|
||||
m_banInfo.m_cLevel = (m_banInfo.m_cLevel!=cLevel) ? cLevel : m_banInfo.m_cLevel;
|
||||
m_banInfo.m_wClass = (m_banInfo.m_wClass!=wClass) ? wClass : m_banInfo.m_wClass;
|
||||
}
|
||||
|
||||
friend class CBanList;
|
||||
|
||||
friend inline static bool operator < (unsigned long dwCID, const Rebind& rhs) { return dwCID < rhs.m_banInfo.m_dwCID; }
|
||||
friend inline static bool operator < (const Rebind& lhs, unsigned long dwCID) { return lhs.m_banInfo.m_dwCID < dwCID; }
|
||||
friend inline static bool operator < (const Rebind& lhs, const Rebind& rhs) { return lhs.m_banInfo.m_dwCID < rhs.m_banInfo.m_dwCID; }
|
||||
};
|
||||
|
||||
enum { MAX_BAN_NUM = 100 };
|
||||
|
||||
CBanList(unsigned long dwOwnerCID, CXRefBans* lpXRefTable = NULL);
|
||||
~CBanList();
|
||||
|
||||
void Clear();
|
||||
|
||||
bool Add(unsigned long dwBanCID, const char* szCharacterName, unsigned long dwGID, unsigned short wClass, char cLevel, unsigned long dwServerID);
|
||||
bool Remove(unsigned long dwBanCID);
|
||||
bool IsBan(unsigned long dwBanCID, const char* szCharacterName);
|
||||
|
||||
// <20≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD> <20>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD> CID<49><44> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>. 0<≯<EFBFBD> BanList<73><74> <20><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
|
||||
unsigned long GetBanCID(const char* szCharacterName);
|
||||
const char* GetBanName(unsigned long dwCID);
|
||||
|
||||
CBanList::Rebind* GetBan(const char* szFriendName);
|
||||
CBanList::Rebind* GetBan(unsigned long dwBanCID);
|
||||
|
||||
void GetCIDList(unsigned long* dwCID_In);
|
||||
|
||||
bool SerializeIn(const char* szBuffer_In, unsigned long dwBufferSize_In);
|
||||
bool SerializeOut(char* szBuffer_Out, unsigned long& dwBufferSize_InOut) const;
|
||||
|
||||
bool SerializeOut(char* szBuffer_Out, char* szInfoBuffer_Out, unsigned long& dwBufferSize_InOut, unsigned long& dwInfoBufferSize_InOut) const;
|
||||
bool SerializeIn(const char* szBuffer_In, const char* szInfo_In, unsigned long dwBufferSize_In, unsigned long dwInfoBufferSize_In);
|
||||
|
||||
unsigned long GetBanNum() const { return static_cast<unsigned long>(m_banList.size()); }
|
||||
|
||||
// FnProcess<73><73> bool operator() (const BanInfo&) <20>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ü(Ŭ<><C5AC><EFBFBD><EFBFBD>)<29>̴<EFBFBD>.
|
||||
template<typename FnProcess>
|
||||
void Process(FnProcess fnProcess)
|
||||
{
|
||||
std::for_each(m_banList.begin(), m_banList.end(), fnProcess);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct Flags;
|
||||
typedef std::vector<Rebind> BanList;
|
||||
|
||||
BanList m_banList;
|
||||
CXRefBans* m_lpXRefTable;
|
||||
unsigned long m_dwOwnerCID;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user