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

📄 gameplayer.h

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 H
字号:
//////////////////////////////////////////////////////////////////////////////// Filename    : GamePlayer.h // Written by  : reiot@ewestsoft.com// Description : 霸烙 辑滚侩 敲饭捞绢 努贰胶//////////////////////////////////////////////////////////////////////////////#ifndef __GAME_PLAYER_H__#define __GAME_PLAYER_H__#include "Types.h"#include "Exception.h"#include "Player.h"#include "SocketEncryptOutputStream.h"#include "SocketEncryptInputStream.h"#include "Mutex.h"#include <deque>#include "Packet.h"#include "Timeval.h"#include "PlayerStatus.h"#include "EventManager.h"#include "skill/Skill.h"#include "PaySystem.h"#include "billing/BillingPlayerInfo.h"#include "chinabilling/CBillingPlayerInfo.h"#include "Gpackets/GCReconnectLogin.h"#include <bitset>//////////////////////////////////////////////////////////////////////////////// class GamePlayer//// 霸烙 辑滚侩 敲饭捞绢 努贰胶//// Player 努贰胶甫 惑加罐酒辑, 霸烙 辑滚俊辑父 荤侩登绰 Mutex 棺 // Creature 包访 单捞磐 棺 皋筋靛, PreviousPacket 包访 单捞磐 棺// 皋家靛甸阑 眠啊沁促.//// 漂洒 processOutput() 棺 sendPacket()篮 Race Condition 捞 惯积瞪 荐// 乐栏骨肺, Mutex 肺 焊龋登绢具 茄促.(MODE-IV狼 版快捞哥, MODE-I, II// 狼 版快俊绰 processInput(), processCommand() 葛滴 Mutex 肺 焊龋秦具// 茄促.)//////////////////////////////////////////////////////////////////////////////class Creature;class GamePlayer : public Player, public PaySystem, public BillingPlayerInfo, public CBillingPlayerInfo{public:	// 历厘秦 初阑 捞傈 菩哦狼 俺荐	const static BYTE nPacketHistorySize = 10;public:	GamePlayer (Socket * pSocket) throw ( Error );	~GamePlayer() throw(Error);public:	// read socket's receive buffer and fill input buffer	// virtual void processInput() throw(IOException, Error);		// parse packet and execute handler for the packet	virtual void processCommand(bool Option = true) throw(IOException, Error);		// flush output buffer to socket's send buffer	virtual void processOutput() throw(IOException, Error);		// send packet to player's output buffer	virtual void sendPacket(Packet* packet) throw(ProtocolException, Error);	// disconnect	// 沥侥 肺弊酒眶狼 版快 disconnect(LOGOUT)	virtual void disconnect(bool bDisconnected = DISCONNECTED) throw (InvalidProtocolException, Error);		// get debug string	virtual string toString() const throw(Error);	// 胶乔靛 眉农	virtual bool verifySpeed(Packet* pPacket) throw(Error);		// get creature pointer 	Creature* getCreature() throw() { return m_pCreature; }	const Creature* getCreature() const throw() { return m_pCreature; }	// set creature pointer	void setCreature(Creature* pCreature) throw() { m_pCreature = pCreature; }	// return recent N-th packet	// 弥辟 傈价等 N 锅掳 菩哦阑 府畔茄促.	Packet* getOldPacket(uint prev = 0) throw(OutOfBoundException, NoSuchElementException);	// return recent packet which has packetID	// 漂沥 ID甫 啊柳 菩哦 吝 啊厘 弥辟狼 菩哦阑 府畔茄促.	Packet* getOldPacket(PacketID_t packetID) throw(NoSuchElementException);	// get player's status	PlayerStatus getPlayerStatus() const throw() { return m_PlayerStatus; }	// set player's status	void setPlayerStatus(PlayerStatus playerStatus) throw() { m_PlayerStatus = playerStatus; }	//	void addEvent(Event* pEvent) throw(Error);	Event* getEvent(Event::EventClass EClass) throw(Error);	void deleteEvent(Event::EventClass EClass) throw(Error);	// 菩澄萍 Status 包访 窃荐    //Set Flag	void setPenaltyFlag(PenaltyType PenaltyFlag) throw() { m_PenaltyFlag.set(PenaltyFlag); }		// remove Flag	void removePenaltyFlag(PenaltyType PenaltyFlag) throw() { m_PenaltyFlag.reset(PenaltyFlag); }		// Is Flag?	bool isPenaltyFlag(PenaltyType PenaltyFlag) throw() { return m_PenaltyFlag.test(PenaltyFlag); }public:	uint getSpecialEventCount(void) const { return m_SpecialEventCount; }	void setSpecialEventCount(uint count) { m_SpecialEventCount = count; }	void loadSpecialEventCount(void) throw();	void saveSpecialEventCount(void) throw();	public :	// '捞固 立加 吝'牢 版快. 碍力 辆丰甫 困秦辑. by sigi.	bool isKickForLogin() const throw()						{ return m_bKickForLogin; }	void setKickForLogin(bool bKickForLogin=true) throw() 	{ m_bKickForLogin = bKickForLogin; }	const string& 	getKickRequestHost() const throw()		{ return m_KickRequestHost; }	uint  			getKickRequestPort() const throw()		{ return m_KickRequestPort; }	void			setKickRequestHost(const string& host) throw()	{ m_KickRequestHost = host; }	void			setKickRequestPort(uint port) throw()			{ m_KickRequestPort = port; }public :	// 铝. 	void	setReconnectPacket(GCReconnectLogin* pPacket) throw() 	{ SAFE_DELETE(m_pReconnectPacket); m_pReconnectPacket = pPacket; }	GCReconnectLogin* getReconnectPacket() const throw()			{ return m_pReconnectPacket; }	// by sigi. 2002.10.23	bool isFreePass() const { return m_bFreePass; }	void setFreePass(bool bFreePass=true) { m_bFreePass = bFreePass; }public :	void lock() throw(Error) { m_Mutex.lock(); }    void unlock() throw(Error) { m_Mutex.unlock(); }public :	void    setBillingSession() throw (Error)	{ BillingPlayerInfo::setBillingSession(this); }	bool    sendBillingLogin() throw (Error);	void	sendCBillingPayInfo() throw ( Error );	// 菩哦 鞠龋拳 包访	// by sigi. 2002.11.27	void	setEncryptCode() throw (Error);public :	void kickPlayer( uint nSeconds, uint KickMessageType ) throw (Error);	//////////////////////////////////////////////////	// PaySystem 包访	//////////////////////////////////////////////////public:	bool	loginPayPlay( PayType payType,						const string& PayPlayDate, int PayPlayHours, uint payPlayFlag,						const string& ip, const string& playerID )				throw (Error);	bool	loginPayPlay( const string& ip, const string& playerID )				throw (Error);	bool	updatePayPlayTime( const string& playerID,							const VSDateTime& currentDateTime,							const Timeval& currentTime )				throw (ProtocolException, Error );	void	logoutPayPlay( const string& playerID, bool bClear=false, bool bDecreaseTime=true )				throw (Error);	bool	isPayPlaying() const;	bool	isMetroFreePlayer() const { return m_bMetroFreePlayer; }	void	setMetroFreePlayer( bool bMetroFreePlayer = true ) { m_bMetroFreePlayer = bMetroFreePlayer; }	int getItemRatioBonusPoint(void) const { return m_ItemRatioBonusPoint; }	void setItemRatioBonusPoint(int point) { m_ItemRatioBonusPoint = point; }	bool	startPacketLog( uint sec );private:	void setPCRoomLottoStartTime();	void checkPCRoomLotto( const Timeval& currentTime );	void savePCRoomLottoTime();	void giveLotto();private:	// creature	Creature* m_pCreature;	// previous packet queue	deque<Packet *> m_PacketHistory;	// player status	PlayerStatus m_PlayerStatus;	// Panelty status	bitset<PENALTY_TYPE_MAX> m_PenaltyFlag;	// expire time	Timeval m_ExpireTime;	BYTE m_VerifyCount;	// 矫埃 八刘 鸥烙.	Timeval m_SpeedVerify;	Timeval m_MoveSpeedVerify;	Timeval m_AttackSpeedVerify;	Timeval m_SkillSpeedVerify[SKILL_MAX];	// mutex	mutable Mutex m_Mutex;	EventManager m_EventManager;	// 胶其既 捞亥飘 包访 墨款磐	// 秦榜 腹捞 凛扁唱, 构 弊繁 辆幅狼 捞亥飘俊 荤侩瞪 荐 乐绰 墨款磐	uint m_SpecialEventCount;	// '捞固 立加 吝'俊辑 碍力 辆丰 矫虐绰 版快	bool	m_bKickForLogin;	string  m_KickRequestHost;	uint    m_KickRequestPort;	// GameServer --> LoginServer肺 哎锭 荤侩茄促. 栏庆庆. by sigi. 2002.6.19	GCReconnectLogin*	m_pReconnectPacket;	bool m_bFreePass;	// 呼傅 矫胶袍俊 楷搬窍瘤 臼绊 蜡丰 敲饭捞 窍扁	bool m_bMetroFreePlayer;	// 阿 荤侩磊喊 酒捞袍 裙垫 焊呈胶 犬伏 	int m_ItemRatioBonusPoint;	Timeval			m_PCRoomLottoStartTime;		// PC 规 汗鼻 拌魂侩. 利侩矫累 矫埃	uint			m_PCRoomLottoSumTime;		// PC 规 汗鼻 拌魂侩. 穿利矫埃. logoutPayPlay矫 历厘侩	string			m_PacketLogFileName;	bool			m_bPacketLog;	Timeval			m_PacketLogEndTime;};////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////class isSamePlayer {public:	isSamePlayer(GamePlayer* pGamePlayer) : m_pGamePlayer(pGamePlayer) {}	bool operator()(GamePlayer* pGamePlayer) throw()	{		return pGamePlayer->getID() == m_pGamePlayer->getID();	}private:	// Creature Pointer	GamePlayer* m_pGamePlayer;};////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////class isSamePlayerbyID{public:	isSamePlayerbyID(const string & ID) : m_ID(ID) {}	bool operator()(GamePlayer* pGamePlayer) throw()	{		return pGamePlayer->getID() == m_ID;	}private:	// Creature ID	string m_ID;};#endif

⌨️ 快捷键说明

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