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

📄 mapgroup.h

📁 魔域源代码需要的可以学习一下真么这么麻烦啊
💻 H
📖 第 1 页 / 共 2 页
字号:
// UserManager.h: interface for the CMapGroup class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAPGROUP_H__70A5EB1D_66D5_4DF0_BE98_F7E3498FFC72__INCLUDED_)
#define AFX_MAPGROUP_H__70A5EB1D_66D5_4DF0_BE98_F7E3498FFC72__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#pragma	warning(disable:4786)
#include "define.h"
#include "RoleManager.h"
#include "UserManager.h"
#include "MapManager.h"
#include "NpcManager.h"
#include "SynManager.h"
#include "LeaveWord.h"
#include "autoptr.h"
#include "GameAction.h"
#include "EventPack.h"

#include "DropRuleMap.h"	//add by zlong 2003-11-15
#include "MercenaryTask.h"
#include "Announce.h"

#include <vector>
using namespace std;


//////////////////////////////////////////////////////////////////////
class IIntraMsg
{
public:
//	virtual ~IIntraMsg() {}

	virtual bool	SendClientMsg		(SOCKET_ID idSocket, CNetMsg* pMsg)					PURE_VIRTUAL_FUNCTION_0
	virtual bool	SendNpcMsg			(OBJID idNpc, CNetMsg* pMsg)						PURE_VIRTUAL_FUNCTION_0
	virtual bool	SendBroadcastMsg	(CNetMsg* pNetMsg)									PURE_VIRTUAL_FUNCTION_0
	virtual bool	TransmitMsg			(CNetMsg* pNetMsg, SOCKET_ID idSocket, OBJID idNpc)									PURE_VIRTUAL_FUNCTION_0
	virtual bool	TransmitWorldMsg	(CNetMsg* pNetMsg)									PURE_VIRTUAL_FUNCTION_0
	virtual bool	TransmitWorldMsg	(CNetMsg* pNetMsg, LPCTSTR szName)					PURE_VIRTUAL_FUNCTION_0
	virtual bool	TransmitWorldMsg	(CNetMsg* pNetMsg, OBJID idUser)					PURE_VIRTUAL_FUNCTION_0
	virtual bool	TransmitWorldMsg	(SOCKET_ID idSocket,CNetMsg* pMsg)					PURE_VIRTUAL_FUNCTION_0
	virtual bool	SetNpcProcessID		(OBJID idNpc, bool bAddNew)							PURE_VIRTUAL_FUNCTION_0
	virtual bool	SendSocketUserInfo	(PROCESS_ID idProcess, SOCKET_ID idSocket, UserInfoStruct* pInfo)		PURE_VIRTUAL_FUNCTION_0
	virtual bool	SendObjInfo			(PROCESS_ID idProcess, OBJID idUser, INFO_ID nInfoMsgID, void* pInfo, int nSize)		PURE_VIRTUAL_FUNCTION_0
	virtual bool	ChangeMapGroup		(PROCESS_ID idProcess, OBJID idUser, OBJID idMap, int nPosX, int nPosY)		PURE_VIRTUAL_FUNCTION_0
	virtual bool	PrintText			(LPCTSTR szText)									PURE_VIRTUAL_FUNCTION_0
	virtual bool	CloseSocket			(SOCKET_ID idSocket)								PURE_VIRTUAL_FUNCTION_0
	virtual bool	CloseMapGroup		(SOCKET_ID idGmSocket)								PURE_VIRTUAL_FUNCTION_0
	virtual bool	ChangeTeam			(int nAction, OBJID idTeam, OBJID idUser, int nData=0)			PURE_VIRTUAL_FUNCTION_0
	virtual void	RemoteCall			(REMOTE_CALL0* pInfo,bool bSendToLocal=false)								PURE_VIRTUAL_FUNCTION
	virtual void	LevelUp				(OBJID idUser, int nLevel)							PURE_VIRTUAL_FUNCTION
	virtual void	QueryFee			(OBJID idAccount)									PURE_VIRTUAL_FUNCTION
	virtual void	ModifyNpc			(OBJID idNpc, LPCTSTR szField, LPCTSTR szData)		PURE_VIRTUAL_FUNCTION
	virtual void	DelTransNpc			(OBJID idMaster, bool bBroadcast=true)				PURE_VIRTUAL_FUNCTION
	virtual void	ChangeCode			(SOCKET_ID idSocket, DWORD dwCode)					PURE_VIRTUAL_FUNCTION
	virtual void	SendRpc				(const CEventPack& pPack)							PURE_VIRTUAL_FUNCTION
};

//////////////////////////////////////////////////////////////////////
class IDataDefault
{
public:
	virtual IRecordset*		GetMagicData()												PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetUserWeaponSkill()										PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetGameItemData()											PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetUserData()												PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetGameMapData()											PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetSynData()												PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetSynAttrData()											PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetPetData()												PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetDynaNpc()												PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetDynaMap()												PURE_VIRTUAL_FUNCTION_0
	virtual IRecordset*		GetEudemonData()											PURE_VIRTUAL_FUNCTION_0
};

class ISynMessage
{
public:
	virtual bool	CreateSyndicate		(const CreateSyndicateInfo* pInfo)				PURE_VIRTUAL_FUNCTION_0
	virtual bool	DestroySyndicate	(OBJID idSyn, OBJID idTarget = ID_NONE)			PURE_VIRTUAL_FUNCTION_0
	virtual bool	CombineSyndicate	(OBJID idSyn, OBJID idTarget)					PURE_VIRTUAL_FUNCTION_0
	virtual bool	ChangeSyndicate		(const SynFuncInfo0* pFuncInfo)					PURE_VIRTUAL_FUNCTION_0
	virtual void	SetMapSynID			(OBJID idMap, OBJID idSyn)						PURE_VIRTUAL_FUNCTION
};

//////////////////////////////////////////////////////////////////////
class ISocket;
class IDatabase;
class IMessagePort;
class CMapGroup : IIntraMsg, IDataDefault, ISynMessage
{
public:
	CMapGroup();
	virtual ~CMapGroup() {}
	PROCESS_ID		GetID() { return m_idProcess; }
	int		GetMapGroup()	{ return m_idProcess-MSGPORT_MAPGROUP_FIRST; }

public: // create
	bool	Create(PROCESS_ID idProcess, ISocket* pSocket, IDatabase* pDb, IMessagePort* pMsgPort);
	void	Destroy();
	void	OnTimer(time_t tCurr);
	IUserManager*	CreateNewUserManager();
	IMapManager*	CreateNewMapManager();
	INpcManager*	CreateNewNpcManager();

private:// action
	CTimeOut	m_tmEvent;

	void	ProcessEvent	(void);

public: // interface
	IRoleManager*	GetRoleManager()	{ ASSERT(m_pRoleManager); return m_pRoleManager; }
	IUserManager*	GetUserManager()	{ ASSERT(m_pUserManager); return m_pUserManager; }
	IMapManager*	GetMapManager()		{ ASSERT(m_pMapManager); return m_pMapManager; }
	INpcManager*	GetNpcManager()		{ ASSERT(m_pNpcManager); return m_pNpcManager; }
	IDatabase*		GetDatabase()		{ ASSERT(m_pDb); return m_pDb; }
	CSynManager*	GetSynManager()		{ ASSERT(m_pSynManager); return m_pSynManager; }
	IIntraMsg*		QueryIntraMsg()		{ return (IIntraMsg*)this; }
	IDataDefault*	QueryDataDefault()	{ return (IDataDefault*)this; }
	ISynMessage*	QuerySynMessage()	{ return (ISynMessage*)this; }
	CLeaveWord*		GetLeaveWord()		{ ASSERT(m_pLeaveWord); return m_pLeaveWord; }
	CGameAction*	GetGameAction()		{ ASSERT(m_pGameAction); return m_pGameAction; }
	CMercenaryTask*	GetMercenaryTask()	{ ASSERT(m_pMercenaryTask); return m_pMercenaryTask; }
	IMessagePort*	QueryMsgPort()		{ CHECKF(m_pMsgPort); return m_pMsgPort; }
    CAnnounce*      GetAnnounce()          { CHECKF(m_pAnnounce);return m_pAnnounce;}

public: // const
	int				GetMapGroupAmount();

protected: // IIntraMsg

	virtual bool	SendClientMsg		(SOCKET_ID idSocket, CNetMsg* pMsg);			// to network
	virtual bool	SendNpcMsg			(OBJID idNpc, CNetMsg* pMsg);					// to network
	virtual bool	SendBroadcastMsg	(CNetMsg* pNetMsg);
	virtual bool	TransmitMsg			(CNetMsg* pNetMsg, SOCKET_ID idSocket, OBJID idNpc);		// 广播给其它地图组核心处理
	virtual bool	TransmitWorldMsg	(CNetMsg* pNetMsg);									// 广播给世界核心处理
	virtual bool	TransmitWorldMsg	(CNetMsg* pNetMsg, LPCTSTR szName);					// 通过世界核心转发给玩家
	virtual bool	TransmitWorldMsg	(CNetMsg* pNetMsg, OBJID idUser);					// 通过世界核心转发给玩家
	virtual bool	TransmitWorldMsg	(SOCKET_ID idSocket,CNetMsg* pMsg);

⌨️ 快捷键说明

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