⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 packethandler.h

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 H
字号:
#ifndef _PACKETHANDLER_H_
#define _PACKETHANDLER_H_

#include <Singleton.h>
#include <FunctionMap.h>

struct MSG_BASE;
class GameDBProxySession;
class AccountDBProxySession;
class GameServerSession;
class BattleServerSession;
class FieldServerSession;
class AgentServerSession;
class WorldServerSession;
class OpServerSession;
class GuildServerSession;

class PacketHandler : public util::Singleton<PacketHandler>
{
	typedef VOID (*fnHandler_DM)( GameDBProxySession *pGameDBProxySession, MSG_BASE *pMsg, WORD wSize );
	typedef VOID (*fnHandler_MX)( AccountDBProxySession *pAccountDBProxySession, MSG_BASE *pMsg, WORD wSize );
	typedef VOID (*fnHandler_GM)( GameServerSession *pGameServerSession, MSG_BASE *pMsg, WORD wSize );
	typedef VOID (*fnHandler_BM)( BattleServerSession *pBattleServerSession, MSG_BASE *pMsg, WORD wSize );
	typedef VOID (*fnHandler_FM)( FieldServerSession *pFieldServerSession, MSG_BASE *pMsg, WORD wSize );
	typedef VOID (*fnHandler_AM)( AgentServerSession *pAgentServerSession, MSG_BASE *pMsg, WORD wSize );
	typedef VOID (*fnHandler_MW)( WorldServerSession *pWorldServerSession, MSG_BASE *pMsg, WORD wSize );
	typedef VOID (*fnHandler_MO)( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize );
	typedef VOID (*fnHandler_MZ)( GuildServerSession *pGuildServerSession, MSG_BASE *pMsg, WORD wSize );

public:
	PacketHandler();
	~PacketHandler();

	BOOL			RegisterHandler_DM();
	BOOL			RegisterHandler_MX();
	BOOL			RegisterHandler_GM();
	BOOL			RegisterHandler_BM();
	BOOL			RegisterHandler_FM();
	BOOL			RegisterHandler_AM();
	BOOL			RegisterHandler_MW();
	BOOL			RegisterHandler_MO();
	BOOL			RegisterHandler_MZ();

	BOOL			ParsePacket_DM( GameDBProxySession *pGameDBProxySession, MSG_BASE *pMsg, WORD wSize );
	BOOL			ParsePacket_MX( AccountDBProxySession *pAccountDBProxySession, MSG_BASE *pMsg, WORD wSize );
	BOOL			ParsePacket_GM( GameServerSession *pGameServerSession, MSG_BASE *pMsg, WORD wSize );
	BOOL			ParsePacket_BM( BattleServerSession *pBattleServerSession, MSG_BASE *pMsg, WORD wSize );
	BOOL			ParsePacket_FM( FieldServerSession *pFieldServerSession, MSG_BASE *pMsg, WORD wSize );
	BOOL			ParsePacket_AM( AgentServerSession *pAgentServerSession, MSG_BASE *pMsg, WORD wSize );
	BOOL			ParsePacket_MW( WorldServerSession *pWorldServerSession, MSG_BASE *pMsg, WORD wSize );
	BOOL			ParsePacket_MO( OpServerSession *pOpServerSession, MSG_BASE *pMsg, WORD wSize );
	BOOL			ParsePacket_MZ( GuildServerSession *pGuildServerSession, MSG_BASE *pMsg, WORD wSize );

private:
	BOOL			AddHandler_DM( BYTE category, BYTE protocol, PacketHandler::fnHandler_DM fnHandler );
	BOOL			AddHandler_MX( BYTE category, BYTE protocol, PacketHandler::fnHandler_MX fnHandler );
	BOOL			AddHandler_GM( BYTE category, BYTE protocol, PacketHandler::fnHandler_GM fnHandler );
	BOOL			AddHandler_BM( BYTE category, BYTE protocol, PacketHandler::fnHandler_BM fnHandler );
	BOOL			AddHandler_FM( BYTE category, BYTE protocol, PacketHandler::fnHandler_FM fnHandler );
	BOOL			AddHandler_AM( BYTE category, BYTE protocol, PacketHandler::fnHandler_AM fnHandler );
	BOOL			AddHandler_MW( BYTE category, BYTE protocol, PacketHandler::fnHandler_MW fnHandler );
	BOOL			AddHandler_MO( BYTE category, BYTE protocol, PacketHandler::fnHandler_MO fnHandler );
	BOOL			AddHandler_MZ( BYTE category, BYTE protocol, PacketHandler::fnHandler_MZ fnHandler );

	struct FUNC_DM : public util::BASE_FUNC
	{
		fnHandler_DM	m_fnHandler;
	};
	struct FUNC_MX : public util::BASE_FUNC
	{
		fnHandler_MX	m_fnHandler;
	};
	struct FUNC_GM : public util::BASE_FUNC
	{
		fnHandler_GM	m_fnHandler;
	};
	struct FUNC_BM : public util::BASE_FUNC
	{
		fnHandler_BM	m_fnHandler;
	};
	struct FUNC_FM : public util::BASE_FUNC
	{
		fnHandler_FM	m_fnHandler;
	};
	struct FUNC_AM : public util::BASE_FUNC
	{
		fnHandler_AM	m_fnHandler;
	};
	struct FUNC_MW : public util::BASE_FUNC
	{
		fnHandler_MW	m_fnHandler;
	};
	struct FUNC_MO : public util::BASE_FUNC
	{
		fnHandler_MO	m_fnHandler;
	};
	struct FUNC_MZ : public util::BASE_FUNC
	{
		fnHandler_MZ	m_fnHandler;
	};

	util::FunctionMap		*m_pFuncMap_DM;
	util::FunctionMap		*m_pFuncMap_MX;
	util::FunctionMap		*m_pFuncMap_GM;
	util::FunctionMap		*m_pFuncMap_BM;
	util::FunctionMap		*m_pFuncMap_FM;
	util::FunctionMap		*m_pFuncMap_AM;
	util::FunctionMap		*m_pFuncMap_MW;
	util::FunctionMap		*m_pFuncMap_MO;
	util::FunctionMap		*m_pFuncMap_MZ;
};

#endif // _PACKETHANDLER_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -