clcreatepc.h

来自「dk1游戏的原代码文件,完整.编译系统redhat7.3,mysql 3.23 」· C头文件 代码 · 共 210 行

H
210
字号
//----------------------------------------------------------------------// // Filename    : CLCreatePC.h // Written By  : Reiot// Description : // //----------------------------------------------------------------------#ifndef __CL_CREATE_PC_H__#define __CL_CREATE_PC_H__// include files#include "Packet.h"#include "PacketFactory.h"#include <bitset>//----------------------------------------------------------------------//// class CLCreatePC;//// 浇饭捞绢 某腐磐甫 货肺 父甸 版快, 捞 菩哦俊 沥焊甫 淬酒辑 辑滚肺 傈价茄促.////----------------------------------------------------------------------class CLCreatePC : public Packet {public:    enum {        SLAYER_BIT_SEX ,		SLAYER_BIT_HAIRSTYLE ,		SLAYER_BIT_HAIRSTYLE2 ,		SLAYER_BIT_MAX    };	enum {		SLAYER_COLOR_HAIR ,		SLAYER_COLOR_SKIN ,		SLAYER_COLOR_SHIRT ,		SLAYER_COLOR_SHIRT2 ,		SLAYER_COLOR_JEANS ,		SLAYER_COLOR_JEANS2 ,		SLAYER_COLOR_MAX	};public:	    // 涝仿胶飘覆(滚欺)栏肺何磐 单捞鸥甫 佬绢辑 菩哦阑 檬扁拳茄促.    void read(SocketInputStream & iStream) throw(ProtocolException, Error);		        // 免仿胶飘覆(滚欺)栏肺 菩哦狼 官捞呈府 捞固瘤甫 焊辰促.    void write(SocketOutputStream & oStream) const throw(ProtocolException, Error);	// execute packet's handler	void execute(Player* pPlayer) throw(ProtocolException, Error);	// get packet id	PacketID_t getPacketID() const throw() { return PACKET_CL_CREATE_PC; }		// get packet's body size	// *OPTIMIZATION HINT*	// const static CLCreatePCPacketSize 甫 沥狼, 府畔窍扼.	PacketSize_t getPacketSize() const throw() 	{ 		return szBYTE + m_Name.size() 	// 捞抚			+ szSlot					// 浇儿			+ szBYTE					// 浇饭捞绢 敲贰弊(3 bit)			+ szAttr* 3			+ szColor* SLAYER_COLOR_MAX ; // 祸彬 沥焊	}	// get packet's name	string getPacketName() const throw() { return "CLCreatePC"; }		// get packet's debug string	string toString() const throw();public:	// get/set name	string getName() const throw() { return m_Name; }	void setName(string name) throw() { m_Name = name; }	// get/set slot	Slot getSlot() const throw() { return m_Slot; }	void setSlot(Slot slot) throw() { m_Slot = slot; }	// get/set sex    Sex getSex() const throw() { return m_BitSet.test(SLAYER_BIT_SEX)?MALE:FEMALE; }    void setSex(Sex sex) throw() { m_BitSet.set(SLAYER_BIT_SEX,(sex==MALE?true:false)); }	// get/set hair style	HairStyle getHairStyle() const throw() { return HairStyle((m_BitSet.to_ulong() >> 1) & 3); }	void setHairStyle(HairStyle hairStyle) throw() { m_BitSet |= bitset<SLAYER_BIT_MAX>(hairStyle << 1); }	// get/set race. by sigi. 2002.10.31	//bool isSlayer() const throw() { return ((m_BitSet.to_ulong() >> 3) & 1)==0; }	//void setSlayer(bool bSlayer=true) throw() { m_BitSet |= bitset<SLAYER_BIT_MAX>((int)(bSlayer==false) << 3); }	// get/set hair color	Color_t getHairColor() const throw() { return m_Colors[ SLAYER_COLOR_HAIR ]; }	void setHairColor(Color_t hairColor) throw() { m_Colors[ SLAYER_COLOR_HAIR ] = hairColor; }	// get/set skin color	Color_t getSkinColor() const throw() { return m_Colors[ SLAYER_COLOR_SKIN ]; }	void setSkinColor(Color_t skinColor) throw() { m_Colors[ SLAYER_COLOR_SKIN ] = skinColor; }	// get/set shirt color	Color_t getShirtColor(ColorType colorType = MAIN_COLOR) const throw() { return m_Colors[ SLAYER_COLOR_SHIRT +(uint)colorType ]; }	void setShirtColor(Color_t shirtColor, ColorType colorType = MAIN_COLOR) throw() { m_Colors[ SLAYER_COLOR_SHIRT +(uint)colorType ] = shirtColor; }	// get/set jeans color	Color_t getJeansColor(ColorType colorType = MAIN_COLOR) const throw() { return m_Colors[ SLAYER_COLOR_JEANS +(uint)colorType ]; }	void setJeansColor(Color_t jeansColor, ColorType colorType = MAIN_COLOR) throw() { m_Colors[ SLAYER_COLOR_JEANS +(uint)colorType ] = jeansColor; }	// get/set STR	Attr_t getSTR() const throw() { return m_STR; }	void setSTR(Attr_t str) throw() { m_STR = str; }	// get/set DEX	Attr_t getDEX() const throw() { return m_DEX; }	void setDEX(Attr_t dex) throw() { m_DEX = dex; }	// get/set INT	Attr_t getINT() const throw() { return m_INT; }	void setINT(Attr_t inte) throw() { m_INT = inte; }	// get/set Race	Race_t getRace() const throw() { return m_Race; }	void setRace( Race_t race ) throw() { m_Race = race; }private :    // PC狼 捞抚    string m_Name;	// 浇儿	Slot m_Slot;	// 浇饭捞绢 敲贰弊 	bitset<SLAYER_BIT_MAX> m_BitSet; 	// 浇饭捞绢 祸彬 沥焊	Color_t m_Colors[SLAYER_COLOR_MAX ];	// STR, DEX, INTE	Attr_t m_STR;	Attr_t m_DEX;	Attr_t m_INT;	// 辆练	Race_t m_Race;};////////////////////////////////////////////////////////////////////////// class CLCreatePCFactory;//// Factory for CLCreatePC////////////////////////////////////////////////////////////////////////class CLCreatePCFactory : public PacketFactory {public:		// create packet	Packet* createPacket() throw() { return new CLCreatePC(); }	// get packet name	string getPacketName() const throw() { return "CLCreatePC"; }		// get packet id	PacketID_t getPacketID() const throw() { return Packet::PACKET_CL_CREATE_PC; }	// get packet's body size	// *OPTIMIZATION HINT*	// const static CLCreatePCPacketSize 甫 沥狼, 府畔窍扼.	PacketSize_t getPacketMaxSize() const throw()	{ 		return szBYTE + 20 								// 捞抚			+ szSlot									// 浇儿			+ szBYTE									// 浇饭捞绢 敲贰弊(3 bit)			+ szAttr* 3			+ szColor* CLCreatePC::SLAYER_COLOR_MAX 	// 祸彬 沥焊			+ szRace;									// 辆练	}};////////////////////////////////////////////////////////////////////////// class CLCreatePCHandler;////////////////////////////////////////////////////////////////////////class CLCreatePCHandler {public:	// execute packet's handler	static void execute(CLCreatePC* pPacket, Player* pPlayer) throw(ProtocolException, Error);};#endif

⌨️ 快捷键说明

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