📄 gcupdateinfo.h
字号:
//--------------------------------------------------------------------------------// // Filename : GCUpdateInfo.h // Written By : Reiot// Description : // //--------------------------------------------------------------------------------#ifndef __GC_UPDATE_INFO_H__#define __GC_UPDATE_INFO_H__// include files#include "Packet.h"#include "PacketFactory.h"#include "GameTime.h"#include "PCSlayerInfo2.h"#include "PCVampireInfo2.h"#include "InventoryInfo.h"#include "GearInfo.h"#include "ExtraInfo.h"#include "EffectInfo.h"#include "Assert.h"#include "RideMotorcycleInfo.h"#include "NPCInfo.h"#define FLAG_PREMIUM_ZONE 0x10 // premium栏肺 汲沥等 粮捞促.#define FLAG_PREMIUM_PLAY 0x01 // premium play甫 窍绰 吝牢啊?//--------------------------------------------------------------------------------//// class GCUpdateInfo;//// 努扼捞攫飘啊 霸烙 辑滚俊 立加秦辑 CGConnect 菩哦阑 焊郴搁, 霸烙 辑滚绰 农府贸客// 家蜡 酒捞袍阑 肺爹秦辑 粮俊 甸绢哎 霖厚甫 窍霸 等促. 弊促澜 PC客 酒捞袍 沥焊,// 弊府绊 粮 沥焊甫 GCUpdateInfo俊 淬酒辑 努扼捞攫飘肺 傈价窍霸 等促.////--------------------------------------------------------------------------------class GCUpdateInfo : public Packet {public : // constructor GCUpdateInfo() throw(); // destructor ~GCUpdateInfo() throw(); // 涝仿胶飘覆(滚欺)栏肺何磐 单捞鸥甫 佬绢辑 菩哦阑 檬扁拳茄促. 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_GC_UPDATE_INFO; } // get packet's body size PacketSize_t getPacketSize() const throw() { // [PCType][PCInfo] // [GameTime][Weather][WeatherLevel][DarkLevel][LightLevel] // [#NPCTypes][NPCType1]...[NPCTypeN] // [#MonsterTypes][MonsterType1]...[MonsterTypeM] PacketSize_t size = 0; WORD MotorcycleSize = 0; if(m_hasMotorcycle) { MotorcycleSize = m_pRideMotorcycleInfo->getSize(); } size += szBYTE; size += m_pPCInfo->getSize(); size += m_pInventoryInfo->getSize(); size += m_pGearInfo->getSize(); size += m_pExtraInfo->getSize(); size += szBYTE; size += MotorcycleSize; size += m_pEffectInfo->getSize(); size += szZoneID; size += szCoord; size += szCoord; size += m_GameTime.getSize(); size += szWeather; size += szWeatherLevel; size += szDarkLevel; size += szLightLevel; size += szBYTE; size += szNPCType* m_nNPCs; size += szBYTE; size += szMonsterType* m_nMonsters; size += szBYTE; list<NPCInfo*>::const_iterator itr = m_NPCInfos.begin(); for(; itr != m_NPCInfos.end(); itr++) { NPCInfo* pInfo = *itr; size += pInfo->getSize(); } // 辑滚 惑怕 size += szBYTE; // 橇府固决 size += szBYTE; return size; } // get packet name string getPacketName() const throw() { return "GCUpdateInfo"; } // get packet's debug string string toString() const throw();//--------------------------------------------------// methods//--------------------------------------------------public : // get/set PC info PCInfo* getPCInfo() const throw() { return m_pPCInfo; } void setPCInfo(PCInfo* pPCInfo) throw(Error) { m_pPCInfo = pPCInfo; } // get/set Inventory Info InventoryInfo* getInventoryInfo() const throw() { return m_pInventoryInfo; } void setInventoryInfo(InventoryInfo* pInventoryInfo) throw(Error) { m_pInventoryInfo = pInventoryInfo; } // get/set Gear Info GearInfo* getGearInfo() const throw() { return m_pGearInfo; } void setGearInfo(GearInfo* pGearInfo) throw(Error) { m_pGearInfo = pGearInfo; } // get/set ExtraInfo ExtraInfo* getExtraInfo() const throw() { return m_pExtraInfo; } void setExtraInfo(ExtraInfo* pExtraInfo) throw(Error) { m_pExtraInfo = pExtraInfo; } // get/set EffectInfo EffectInfo* getEffectInfo() const throw() { return m_pEffectInfo; } void setEffectInfo(EffectInfo* pEffectInfo) throw(Error) { m_pEffectInfo = pEffectInfo; } // get/set hasMotorcycle bool hasMotorcycle() const throw() { return m_hasMotorcycle; } // get/set RideMotorcycleInfo RideMotorcycleInfo* getRideMotorcycleInfo() const throw() { return m_pRideMotorcycleInfo; } void setRideMotorcycleInfo(RideMotorcycleInfo* pRideMotorcycleInfo) throw() { m_pRideMotorcycleInfo = pRideMotorcycleInfo; m_hasMotorcycle = true; } // get/set ZoneID ZoneID_t getZoneID() const throw() { return m_ZoneID; } void setZoneID(const ZoneID_t & zoneID) throw() { m_ZoneID = zoneID; } // get / set ZoneX Coord_t getZoneX() const throw() { return m_ZoneX; } void setZoneX(Coord_t ZoneX) { m_ZoneX = ZoneX; } // get / set ZoneY Coord_t getZoneY() const throw() { return m_ZoneY; } void setZoneY(Coord_t ZoneY) { m_ZoneY = ZoneY; } // get/set GameTime GameTime getGameTime() const throw() { return m_GameTime; } void setGameTime(const GameTime & gameTime) throw() { m_GameTime = gameTime; } // get/set weather Weather getWeather() const throw() { return m_Weather; } void setWeather(Weather weather) throw() { m_Weather = weather; } // get/set weather level WeatherLevel_t getWeatherLevel() const throw() { return m_WeatherLevel; } void setWeatherLevel(WeatherLevel_t weatherLevel) throw() { m_WeatherLevel = weatherLevel; } // get/set darklevel DarkLevel_t getDarkLevel() const throw() { return m_DarkLevel; } void setDarkLevel(DarkLevel_t darkLevel) throw() { m_DarkLevel = darkLevel; } // get/set lightlevel LightLevel_t getLightLevel() const throw() { return m_LightLevel; } void setLightLevel(LightLevel_t lightLevel) throw() { m_LightLevel = lightLevel; } // get/set # of NPC uint getNPCCount() const throw() { return m_nNPCs; } void setNPCCount(uint n) throw(Error) { Assert(n <= maxNPCPerZone); m_nNPCs = n; } // get/set NPC type NPCType_t getNPCType(uint n) const throw() { Assert(n < maxNPCPerZone); return m_NPCTypes[n]; } void setNPCType(uint n, NPCType_t npcType) throw() { Assert(n < maxNPCPerZone); m_NPCTypes[n] = npcType; } // get/set # of monster uint getMonsterCount() const throw() { return m_nMonsters; } void setMonsterCount(uint n) throw(Error) { Assert(n <= maxMonsterPerZone); m_nMonsters = n; } // get/set Monster type MonsterType_t getMonsterType(uint n) const throw() { Assert(n < maxMonsterPerZone); return m_MonsterTypes[n]; } void setMonsterType(uint n, MonsterType_t npcType) throw() { Assert(n < maxMonsterPerZone); m_MonsterTypes[n] = npcType; } // get/set npc info void addNPCInfo(NPCInfo* pInfo) { m_NPCInfos.push_back(pInfo);} NPCInfo* popNPCInfo(void) { if (m_NPCInfos.empty()) return NULL; NPCInfo* pInfo = m_NPCInfos.front(); m_NPCInfos.pop_front(); return pInfo; } // get/set ServerStat void setServerStat( BYTE ServerStat ) throw() { m_ServerStat = ServerStat; } BYTE getServerStat() const throw() { return m_ServerStat; } // premium play 包访 void setPremiumZone() { m_fPremium |= FLAG_PREMIUM_ZONE; } void setPremiumPlay() { m_fPremium |= FLAG_PREMIUM_PLAY; } BYTE isPremiumZone() const { return m_fPremium & FLAG_PREMIUM_ZONE; } BYTE isPremiumPlay() const { return m_fPremium & FLAG_PREMIUM_PLAY; }//--------------------------------------------------// data members//--------------------------------------------------private : //-------------------------------------------------------------------------------- // PC Information //-------------------------------------------------------------------------------- // PCSlayerInfo2 肚绰 PCVampireInfo2 甫 荤侩茄促. PCInfo* m_pPCInfo; //-------------------------------------------------------------------------------- // Inventory Information //-------------------------------------------------------------------------------- InventoryInfo* m_pInventoryInfo; //-------------------------------------------------------------------------------- // Gear Information //-------------------------------------------------------------------------------- GearInfo* m_pGearInfo; //-------------------------------------------------------------------------------- // Extra Information //-------------------------------------------------------------------------------- ExtraInfo* m_pExtraInfo; //-------------------------------------------------------------------------------- // Extra Information //-------------------------------------------------------------------------------- EffectInfo* m_pEffectInfo; //-------------------------------------------------------------------------------- // 葛配荤捞努捞 乐唱 绝唱. //-------------------------------------------------------------------------------- bool m_hasMotorcycle; //-------------------------------------------------------------------------------- // Motorcycle Information //-------------------------------------------------------------------------------- RideMotorcycleInfo* m_pRideMotorcycleInfo; // inventory // quick item slot // gear // 历澄(PDA) // 荐青 涅胶飘 沥焊 // 傍瘤荤亲, 捞亥飘 沥焊 // 儒褥.. 娟甸篮 贸澜 PDS甫 挠 锭 促款罐阑鳖唱.. - -; //-------------------------------------------------------------------------------- // Zone Information //-------------------------------------------------------------------------------- // 粮 酒捞叼 ZoneID_t m_ZoneID; // 唱鸥朝 谅钎狼 措碍狼 困摹 Coord_t m_ZoneX; Coord_t m_ZoneY; // Game Time GameTime m_GameTime; // Weather(朝揪 沥焊) Weather m_Weather; WeatherLevel_t m_WeatherLevel; // Dark/Light DarkLevel_t m_DarkLevel; LightLevel_t m_LightLevel; // 粮俊 免泅窍绰 NPC 胶橇扼捞飘 鸥涝狼 俺荐, 胶橇扼捞飘 鸥涝 硅凯 BYTE m_nNPCs; NPCType_t m_NPCTypes[ maxNPCPerZone ]; // 粮俊 免泅窍绰 阁胶磐 胶橇扼捞飘 鸥涝狼 俺荐, 胶橇扼捞飘 鸥涝 硅凯 BYTE m_nMonsters; MonsterType_t m_MonsterTypes[ maxMonsterPerZone ]; // 泅犁 粮俊 粮犁窍绰 NPC甸俊 措茄 沥焊 list<NPCInfo*> m_NPCInfos; // 辑滚 惑怕 BYTE m_ServerStat; // 橇府固决 包访 BYTE m_fPremium;};//--------------------------------------------------------------------------------//// class GCUpdateInfoFactory;//// Factory for GCUpdateInfo////--------------------------------------------------------------------------------class GCUpdateInfoFactory : public PacketFactory {public : // create packet Packet* createPacket() throw() { return new GCUpdateInfo(); } // get packet name string getPacketName() const throw() { return "GCUpdateInfo"; } // get packet id PacketID_t getPacketID() const throw() { return Packet::PACKET_GC_UPDATE_INFO; } // get packet's max body size // *OPTIMIZATION HINT* // const static GCUpdateInfoPacketMaxSize 甫 沥狼, 府畔窍扼. PacketSize_t getPacketMaxSize() const throw() { PacketSize_t size = 0; size += szBYTE; size += PCSlayerInfo2::getMaxSize(); size += InventoryInfo::getMaxSize(); size += GearInfo::getMaxSize(); size += ExtraInfo::getMaxSize(); size += EffectInfo::getMaxSize(); size += szBYTE; size += RideMotorcycleInfo::getMaxSize(); size += szZoneID; size += szCoord; size += szCoord; size += GameTime::getMaxSize(); size += szWeather; size += szWeatherLevel; size += szDarkLevel; size += szLightLevel; size += szBYTE; size += szNPCType* maxNPCPerZone; size += szBYTE; size += szMonsterType* maxMonsterPerZone; size += szBYTE; size += NPCInfo::getMaxSize()* 255; // 辑滚 惑怕 size += szBYTE; // 橇府固决 size += szBYTE; return size; }};//--------------------------------------------------------------------------------//// class GCUpdateInfoHandler;////--------------------------------------------------------------------------------class GCUpdateInfoHandler {public : // execute packet's handler static void execute(GCUpdateInfo* pPacket, Player* pPlayer) throw(ProtocolException, Error);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -