📄 packetutil.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : PacketUtil.cpp// Written by : excel96// Description : // 磊林 焊郴绊, 父甸扁啊 汗棱茄 菩哦篮 父靛绰 镑阑 咯扁 窍唱肺 烹老窃栏肺结// 蜡瘤焊荐啊 浆况柳促.//////////////////////////////////////////////////////////////////////////////#include "PacketUtil.h"#include "Properties.h"#include "GamePlayer.h"#include "Slayer.h"#include "Vampire.h"#include "Ousters.h"#include "Monster.h"#include "NPC.h"#include "Zone.h"#include "ZoneGroup.h"#include "ZoneGroupManager.h"#include "ZonePlayerManager.h"#include "TimeManager.h"#include "WeatherManager.h"#include "ItemInfo.h"#include "Inventory.h"#include "ItemInfoManager.h"#include "Effect.h"#include "EventSystemMessage.h"#include "ZoneUtil.h"#include "WarScheduler.h"#include "PlayerCreature.h"#include "ItemNameInfo.h"#include "Item.h"#include "AR.h"#include "SR.h"#include "SG.h"#include "SMG.h"#include "Belt.h"#include "OustersArmsband.h"#include "Mine.h"#include "PetItem.h"#include "Corpse.h"#include "SlayerCorpse.h"#include "VampireCorpse.h"#include "OustersCorpse.h"#include "MonsterCorpse.h"#include "PCSlayerInfo2.h"#include "PCVampireInfo2.h"#include "RideMotorcycleInfo.h"#include "NPCInfo.h"#include "SubItemInfo.h"#include "CastleInfoManager.h"#include "PKZoneInfoManager.h"#include "Gpackets/GCUpdateInfo.h"#include "Gpackets/GCAddSlayer.h"#include "Gpackets/GCAddVampire.h"#include "Gpackets/GCAddOusters.h"#include "Gpackets/GCAddMonster.h"#include "Gpackets/GCAddNPC.h"#include "Gpackets/GCAddNewItemToZone.h"#include "Gpackets/GCDropItemToZone.h"#include "Gpackets/GCAddSlayerCorpse.h"#include "Gpackets/GCAddVampireCorpse.h"#include "Gpackets/GCAddMonsterCorpse.h"#include "Gpackets/GCAddOustersCorpse.h"#include "Gpackets/GCOtherModifyInfo.h"#include "Gpackets/GCSystemMessage.h"#include "Gpackets/GCCreateItem.h"#include "Gpackets/GCAddEffect.h"#include "Gpackets/GCWarScheduleList.h"#include "Gpackets/GCMiniGameScores.h"#include "Gpackets/GCPetStashList.h"//#include "Gpackets/GCItemNameInfoList.h"#include "Assert.h"#include "LogClient.h"#include "DB.h"#include <list>#include <stdio.h>//////////////////////////////////////////////////////////////////////////////// void makeGCUpdateInfo()//// 器呕捞唱, 磷绢辑 甘 荤捞甫 捞悼且 锭 静绰, GCUpdateInfo 沥焊甫 备己茄促.//////////////////////////////////////////////////////////////////////////////void makeGCUpdateInfo(GCUpdateInfo* pUpdateInfo, Creature* pCreature) throw(){ __BEGIN_TRY //////////////////////////////////////////////////////////// // 粮 困摹 沥焊 备己 //////////////////////////////////////////////////////////// Zone* pZone = pCreature->getZone(); Assert(pZone!=NULL); ZoneCoord_t x = pCreature->getX(); ZoneCoord_t y = pCreature->getY(); ZoneGroup* pZoneGroup = pZone->getZoneGroup(); Assert(pZoneGroup != NULL); pUpdateInfo->setZoneID(pZone->getZoneID()); pUpdateInfo->setGameTime(g_pTimeManager->getGameTime()); pUpdateInfo->setZoneX(x); pUpdateInfo->setZoneY(y); //////////////////////////////////////////////////////////// // 牢亥配府 棺 扁绢 沥焊 备己 //////////////////////////////////////////////////////////// if (pCreature->isSlayer()) { Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature); Assert(pSlayer != NULL); pUpdateInfo->setPCInfo(pSlayer->getSlayerInfo2()); // Inventory, Gear 沥焊 备己 pUpdateInfo->setInventoryInfo(pSlayer->getInventoryInfo()); pUpdateInfo->setGearInfo(pSlayer->getGearInfo()); pUpdateInfo->setExtraInfo(pSlayer->getExtraInfo()); if (pSlayer->hasRideMotorcycle()) pUpdateInfo->setRideMotorcycleInfo(pSlayer->getRideMotorcycleInfo()); } else if ( pCreature->isVampire() ) { Vampire* pVampire = dynamic_cast<Vampire*>(pCreature); Assert(pVampire != NULL); pUpdateInfo->setPCInfo(pVampire->getVampireInfo2()); // Inventory, Gear 沥焊 备己 pUpdateInfo->setInventoryInfo(pVampire->getInventoryInfo()); pUpdateInfo->setGearInfo(pVampire->getGearInfo()); pUpdateInfo->setExtraInfo(pVampire->getExtraInfo()); } else if ( pCreature->isOusters() ) { Ousters* pOusters = dynamic_cast<Ousters*>(pCreature); Assert(pOusters != NULL); pUpdateInfo->setPCInfo( pOusters->getOustersInfo2() ); // Inventory, Gear 沥焊 备己 pUpdateInfo->setInventoryInfo( pOusters->getInventoryInfo() ); pUpdateInfo->setGearInfo( pOusters->getGearInfo() ); pUpdateInfo->setExtraInfo( pOusters->getExtraInfo() ); } //////////////////////////////////////////////////////////// // 捞棋飘 牢器 备己 //////////////////////////////////////////////////////////// pUpdateInfo->setEffectInfo(pCreature->getEffectInfo()); //////////////////////////////////////////////////////////// // 矫具 沥焊 备己 //////////////////////////////////////////////////////////// if (pZone->getZoneType()==ZONE_CASTLE ) { pUpdateInfo->setDarkLevel(pZone->getDarkLevel()); pUpdateInfo->setLightLevel(pZone->getLightLevel()); } else if ( g_pPKZoneInfoManager->isPKZone( pZone->getZoneID() ) ) { pUpdateInfo->setLightLevel(14); pUpdateInfo->setDarkLevel(0); } else if (pCreature->isSlayer()) { if (pCreature->isFlag(Effect::EFFECT_CLASS_LIGHTNESS)) { pUpdateInfo->setLightLevel(15); pUpdateInfo->setDarkLevel(1); } else if (pCreature->isFlag(Effect::EFFECT_CLASS_YELLOW_POISON_TO_CREATURE)) { pUpdateInfo->setDarkLevel(15); pUpdateInfo->setLightLevel(1); } else { pUpdateInfo->setDarkLevel(pZone->getDarkLevel()); pUpdateInfo->setLightLevel(pZone->getLightLevel()); } } else if ( pCreature->isVampire() ) { pUpdateInfo->setDarkLevel(max(0, DARK_MAX - pZone->getDarkLevel())); pUpdateInfo->setLightLevel(min(13, LIGHT_MAX - pZone->getLightLevel())); } else if ( pCreature->isOusters() ) { if (pCreature->isFlag(Effect::EFFECT_CLASS_YELLOW_POISON_TO_CREATURE)) { pUpdateInfo->setDarkLevel(15); pUpdateInfo->setLightLevel(1); } // else if (pCreature->isFlag(Effect::EFFECT_CLASS_BLOOD_DRAIN)) // { // pUpdateInfo->setDarkLevel(15); // pUpdateInfo->setLightLevel(3); // } else { pUpdateInfo->setDarkLevel( 13 ); pUpdateInfo->setLightLevel( 6 ); } } //////////////////////////////////////////////////////////// // 朝揪 沥焊 备己 //////////////////////////////////////////////////////////// pUpdateInfo->setWeather(pZone->getWeatherManager()->getCurrentWeather()); pUpdateInfo->setWeatherLevel(pZone->getWeatherManager()->getWeatherLevel()); //////////////////////////////////////////////////////////// // NPC 胶橇扼捞飘 沥焊 备己 //////////////////////////////////////////////////////////// pUpdateInfo->setNPCCount(pZone->getNPCCount()); for (uint i = 0 ; i < pZone->getNPCCount() ; i ++) pUpdateInfo->setNPCType(i , pZone->getNPCType(i)); //////////////////////////////////////////////////////////// // 阁胶磐 胶橇扼捞飘 沥焊 备己 //////////////////////////////////////////////////////////// // 付胶磐 饭绢俊辑 家券登绰 阁胶磐甫 固府 肺爹茄促. if (pZone->isMasterLair()) { // 荤角篮 SpriteType捞促. -_-; by sigi. 2002.10.8 const int num = 25; const MonsterType_t mtypes[num] = { 27, // 喉矾靛况废 40, // 榜饭赣 41, // 歹萍胶飘扼捞歹 47, // 墨坷胶啊叼攫 48, // 龋喉 57, // 溅档快喇 61, // 困档快令 62, // 俊胶飘肺捞歹 64, // 葛单扼胶 68, // 候曝 70, // 促农胶农府赣 71, // 墨坷胶唱捞飘 72, // 农覆郊浇肺磐 73, // 肺靛促农聪胶 74, // 府欺 75, // 秋啊叼攫 76, // 秋困磊靛 88, // 促农啊叼攫 89, // 肺靛墨坷胶 90, // 墨坷胶弊府靛 91, // 秋巧靛 92, // 促农庆捞令 101, // 带匡橇酒农 102, // 肛赴阁 103 // 箕刚坷橇 //27, 48, 40, 41, 57, //61, 62, 64, 68, 71, //73, 76, 89, 90, 91, //92,103,102, 101 }; pUpdateInfo->setMonsterCount( num ); for (int i = 0 ; i < num; i ++) pUpdateInfo->setMonsterType(i , mtypes[i]); } else { pUpdateInfo->setMonsterCount(pZone->getMonsterCount()); for (uint i = 0 ; i < pZone->getMonsterCount() ; i ++) pUpdateInfo->setMonsterType(i , pZone->getMonsterType(i)); } //////////////////////////////////////////////////////////// // NPC 谅钎 沥焊 备己 //////////////////////////////////////////////////////////// list<NPCInfo*>* pNPCInfos = pZone->getNPCInfos(); list<NPCInfo*>::const_iterator itr = pNPCInfos->begin(); for (; itr != pNPCInfos->end(); itr++) { NPCInfo* pInfo = *itr; pUpdateInfo->addNPCInfo(pInfo); } //////////////////////////////////////////////////////////// // 辑滚狼 惑怕 沥焊 //////////////////////////////////////////////////////////// ServerGroupID_t ZoneGroupCount = g_pZoneGroupManager->size(); UserNum_t ZoneUserNum = 0; for( int i = 1; i < ZoneGroupCount+1; i++ ) { ZoneGroup* pZoneGroup; try { pZoneGroup = g_pZoneGroupManager->getZoneGroup(i); } catch (NoSuchElementException&) { throw Error("Critical Error : ZoneInfoManager俊 秦寸 粮弊缝捞 粮犁窍瘤 臼嚼聪促."); } ZonePlayerManager* pZonePlayerManager = pZoneGroup->getZonePlayerManager(); ZoneUserNum += pZonePlayerManager->size(); } int UserModify = 0; //ServerGroupID_t CurrentServerGroupID = g_pConfig->getPropertyInt( "ServerID" ); /* if( CurrentServerGroupID == 0 || CurrentServerGroupID == 1 || CurrentServerGroupID == 2 || CurrentServerGroupID == 7 ) { UserModify = 400; } */ UserModify = 1000; if (ZoneUserNum < 100 + UserModify ) { pUpdateInfo->setServerStat( SERVER_FREE ); } else if (ZoneUserNum < 250 + UserModify ) { pUpdateInfo->setServerStat( SERVER_NORMAL ); } else if (ZoneUserNum < 400 + UserModify ) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -