📄 slayer.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : Slayer.cpp// Written By : Elca// Description ://////////////////////////////////////////////////////////////////////////////#include "DB.h"#include "Slayer.h"#include "Player.h"#include "LogClient.h"#include "EffectManager.h"#include <algo.h>#include <algorithm>#include <stdlib.h>#include <stdio.h>#include "SkillInfo.h"#include "ItemInfoManager.h"#include "ParkingCenter.h"#include "SkillHandlerManager.h"#include "SkillDomainInfoManager.h"#include "ResurrectLocationManager.h"#include "WarSystem.h"#include "GamePlayer.h"#include "PKZoneInfoManager.h"#include "CastleInfoManager.h"#include "CastleSkillInfo.h"#include "OptionInfo.h"#include "EffectLoaderManager.h"#include "AbilityBalance.h"#include "Stash.h"#include "TradeManager.h"#include "CreatureUtil.h"#include "FlagSet.h"//#include "AttrBalanceInfo.h"#include "Party.h"#include "Shape.h"#include "VariableManager.h"#include "ItemUtil.h"#include "PacketUtil.h"//#include "RankEXPInfo.h"#include "item/Motorcycle.h"#include "item/AR.h"#include "item/SR.h"#include "item/SG.h"#include "item/SMG.h"#include "item/Belt.h"#include "item/Skull.h"#include "skill/CastleSkillSlot.h"#include "skill/EffectBless.h"#include "skill/EffectDancingSword.h"#include "skill/EffectGhostBlade.h"#include "skill/EffectChargingPower.h"#include "skill/EffectPotentialExplosion.h"#include "skill/EffectParalyze.h"#include "skill/EffectDoom.h"#include "skill/EffectProtectionFromPoison.h"#include "skill/EffectProtectionFromCurse.h"#include "skill/EffectProtectionFromAcid.h"#include "EffectGrandMasterSlayer.h"#include "Gpackets/GCAddEffect.h"#include "Gpackets/GCRemoveEffect.h"#include "Gpackets/GCModifyInformation.h"#include "Gpackets/GCChangeShape.h"#include "Gpackets/GCTakeOff.h"#include "Gpackets/GCSkillInfo.h"#include "Gpackets/GCRealWearingInfo.h"#include "Gpackets/GCStatusCurrentHP.h"#include "Gpackets/GCTradeFinish.h"#include "Gpackets/GCOtherModifyInfo.h"#include "Gpackets/GCPetStashList.h"#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include "Rpackets/RCSay.h"#include "LoginServerManager.h"#include "Properties.h"//#include "RankEXPInfo.h"#include "RaceWarLimiter.h"#include "TimeLimitItemManager.h"#include "RankExpTable.h"#include "SlayerAttrExpTable.h"#include "ExpFwd.h"#include "skill/SkillUtil.h"#include "SystemAvailabilitiesManager.h"#include "types/ServerType.h"#include "MonsterInfo.h"const Color_t UNIQUE_COLOR = 0xFFFF;const Color_t UNIQUE_OPTION = 0xFFFF;const Color_t QUEST_COLOR = 0xFFFE;const Color_t QUEST_OPTION = 0xFFFE;const Attr_t MAX_SLAYER_ATTR = 290;const Attr_t MAX_SLAYER_SUM = 435;const Attr_t MAX_SLAYER_ATTR_OLD = 200;const Attr_t MAX_SLAYER_SUM_OLD = 300;Slayer::Slayer () throw () : PlayerCreature(0,NULL){ __BEGIN_TRY m_CClass = CREATURE_CLASS_SLAYER; m_Mutex.setName("Slayer"); // AttackMelee 鞍篮 扁夯 扁贱阑 笼绢持绢霖促. for (int i=0; i<SKILL_DOUBLE_IMPACT; i++) { SkillSlot* pSkillSlot = new SkillSlot; //pSkillSlot = new SkillSlot; // 2002.1.16 by sigi pSkillSlot->setName(m_Name); pSkillSlot->setSkillType(i); pSkillSlot->setInterval(5); pSkillSlot->setExpLevel(1); pSkillSlot->setExp(1); pSkillSlot->setRunTime(); addSkill(pSkillSlot); } for (int i = 0; i < WEAR_MAX; i++) m_pWearItem[i] = NULL; // Motorcycle阑 Null 肺 父电促. m_pMotorcycle = NULL; for (int i = 0; i < MAX_PHONE_SLOT; i++) { m_PhoneSlot[i] = 0; } // 侵 虐甫 檬扁拳 茄促.// for (int i = 0; i < 4; i++) // {// m_HotKey[i] = 0;// } // MP 府哩 矫埃 檬扁拳 getCurrentTime(m_MPRegenTime); // 版氰摹 技捞宏 墨款飘甫 檬扁拳茄促. m_DomainExpSaveCount = 0; m_AttrExpSaveCount = 0; m_SkillExpSaveCount = 0; m_FameSaveCount = 0; m_AlignmentSaveCount = 0;// m_RankExpSaveCount = 0; m_Gold = 0;// m_pRank = NULL; __END_CATCH}Slayer::~Slayer() throw (Error){ __BEGIN_TRY try { if (m_pMotorcycle != NULL) { //getOffMotorcycle(); // 捞芭 IncomingPlayerManager俊辑 秦滚府搁 巩力啊 等促.. // 弊贰辑.. 弊成 坷配官捞甫 绝局滚府档废 窍磊. 2002.7.15 by sigi if (g_pParkingCenter->hasMotorcycleBox(m_pMotorcycle->getItemID())) { g_pParkingCenter->deleteMotorcycleBox(m_pMotorcycle->getItemID()); } m_pMotorcycle = NULL; } // 汗厘 沥焊甫 积己秦敌促. by sigi. 2002.6.18 DWORD flag; Color_t color[PCSlayerInfo::SLAYER_COLOR_MAX]; getShapeInfo (flag, color); char pField[128]; sprintf(pField, "Shape=%ld, HelmetColor=%d, JacketColor=%d, PantsColor=%d, WeaponColor=%d, ShieldColor=%d", flag, color[PCSlayerInfo::SLAYER_COLOR_HELMET], color[PCSlayerInfo::SLAYER_COLOR_JACKET], color[PCSlayerInfo::SLAYER_COLOR_PANTS], color[PCSlayerInfo::SLAYER_COLOR_WEAPON], color[PCSlayerInfo::SLAYER_COLOR_SHIELD]); //cout << "SAVE = " << pField << endl; tinysave(pField); // 冻绢柳 酒捞袍狼 郴备己苞 版氰摹, 己氢 殿阑 历厘茄促. saveGears(); saveExps(); saveSkills(); // 涝绊 乐绰 酒捞袍阑 皋葛府俊辑 昏力茄促. destroyGears(); // 努贰胶啊 昏力瞪 版快, 秦寸窍绰 背券 沥焊甫 昏力秦具 窃篮 拱沸, // 背券 惑措俊霸档 捞 荤角阑 舅妨拎具 茄促. TradeManager* pTradeManager = m_pZone->getTradeManager(); TradeInfo* pInfo = pTradeManager->getTradeInfo(getName()); if (pInfo != NULL) { // 背券 沥焊甫 昏力 pTradeManager->cancelTrade(this); } // 臂肺国 颇萍俊辑 昏力茄促. // 老馆利牢 肺弊酒眶狼 版快俊绰 // CGLogoutHandler俊辑 Zone::deleteCreature() 窃荐甫 何福霸 登绊, // 厚沥惑利牢 版快扼绊 秦档, // GamePlayer::disconnect()俊辑 Zone::deleteCreature() 窃荐甫 何福霸 登骨肺, // 肺拿 颇萍 棺 颇萍 檬措, 飘饭捞靛 沥焊甫 捌沥且 鞘夸绰 绝促. deleteAllPartyInfo(this); // 扁贱甸阑 昏力 hash_map<SkillType_t, SkillSlot*>::iterator itr = m_SkillSlot.begin(); for (; itr != m_SkillSlot.end(); itr++) { SkillSlot* pSkillSlot = itr->second; SAFE_DELETE(pSkillSlot); } m_SkillSlot.clear();// SAFE_DELETE( m_pRank ); } catch (Throwable& t) { filelog("slayerDestructor.txt", "%s", t.toString().c_str()); throw; } catch (exception& e) { filelog("slayerDestructor.txt", "Unknown std::exception"); throw; } catch (...) { filelog("slayerDestructor.txt", "Unknown ... exception"); throw; } m_bDeriveDestructed = true; __END_CATCH}// Zone俊 辆加等 ObjectRegistry甫 荤侩秦辑, Slayer 客 家蜡酒捞袍甸狼// ObjectID甫 且寸罐绰促.void Slayer::registerObject () throw (Error){ __BEGIN_TRY Assert(getZone() != NULL); // zone 狼 object registery 俊 立辟茄促. ObjectRegistry & OR = getZone()->getObjectRegistry(); __ENTER_CRITICAL_SECTION(OR) // 葛电 酒捞袍俊 OID 啊 官差骨肺 矫埃力茄 酒捞袍 概聪历俊辑 OID 甘阑 瘤况拎具 茄促. if (m_pTimeLimitItemManager != NULL) m_pTimeLimitItemManager->clear(); // 快急 浇饭捞绢狼 OID甫 殿废罐绰促. OR.registerObject_NOLOCKED(this); // 牢亥配府狼 酒捞袍甸狼 OID甫 殿废罐绰促. registerInventory(OR); // Goods Inventory狼 酒捞袍甸狼 OID甫 殿废罐绰促. registerGoodsInventory(OR); // 厘馒窍绊 乐绰 酒捞袍甸狼 OID甫 殿废罐绰促. for (int i = 0; i < WEAR_MAX; i++) { Item* pItem = m_pWearItem[i]; if (pItem != NULL) { bool bCheck = true; // 剧颊 公扁老 版快, WEAR_LEFTHAND 俊辑 殿废沁栏骨肺, // 肚 殿废且 鞘夸绰 绝促. if (i == WEAR_RIGHTHAND && isTwohandWeapon(pItem)) bCheck = false; if (bCheck) registerItem(pItem, OR); } } // 付快胶俊 甸绊 乐绰 酒捞袍狼 OID甫 殿废 罐绰促. Item* pSlotItem = m_pExtraInventorySlot->getItem(); if (pSlotItem != NULL) registerItem(pSlotItem, OR); // 坷配官捞狼 OID甫 殿废 罐绰促. if (m_pMotorcycle != NULL) OR.registerObject_NOLOCKED(m_pMotorcycle); m_Garbage.registerObject(OR); for ( int i=0; i<MAX_PET_STASH; ++i ) { Item* pItem = getPetStashItem(i); if ( pItem != NULL ) registerItem( pItem, OR ); } __LEAVE_CRITICAL_SECTION(OR) m_SlayerInfo.setObjectID(m_ObjectID); __END_CATCH}// Zone俊 辆加等 ObjectRegistry甫 荤侩秦辑, Slayer 客 家蜡酒捞袍甸狼// ObjectID甫 且寸罐绰促. 檬扁俊 ItemTrace 甫 困秦 蝶肺 画void Slayer::registerInitObject () throw (Error){ __BEGIN_TRY Assert(getZone() != NULL); // zone 狼 object registery 俊 立辟茄促. ObjectRegistry & OR = getZone()->getObjectRegistry(); __ENTER_CRITICAL_SECTION(OR) // 葛电 酒捞袍俊 OID 啊 官差骨肺 矫埃力茄 酒捞袍 概聪历俊辑 OID 甘阑 瘤况拎具 茄促. if (m_pTimeLimitItemManager != NULL) m_pTimeLimitItemManager->clear(); // 快急 浇饭捞绢狼 OID甫 殿废罐绰促. OR.registerObject_NOLOCKED(this); // 牢亥配府狼 酒捞袍甸狼 OID甫 殿废罐绰促. registerInitInventory(OR); // Goods Inventory狼 酒捞袍甸狼 OID甫 殿废罐绰促. registerGoodsInventory(OR); // 厘馒窍绊 乐绰 酒捞袍甸狼 OID甫 殿废罐绰促. for (int i = 0; i < WEAR_MAX; i++) { Item* pItem = m_pWearItem[i]; if (pItem != NULL) { // ItemTrace 甫 巢辨 巴牢瘤 搬沥 pItem->setTraceItem( bTraceLog( pItem ) ); bool bCheck = true; // 剧颊 公扁老 版快, WEAR_LEFTHAND 俊辑 殿废沁栏骨肺, // 肚 殿废且 鞘夸绰 绝促. if (i == WEAR_RIGHTHAND && isTwohandWeapon(pItem)) bCheck = false; if (bCheck) registerItem(pItem, OR); } } // 付快胶俊 甸绊 乐绰 酒捞袍狼 OID甫 殿废 罐绰促. Item* pSlotItem = m_pExtraInventorySlot->getItem(); if (pSlotItem != NULL) { // ItemTrace 甫 巢辨 巴牢瘤 搬沥 pSlotItem->setTraceItem( bTraceLog( pSlotItem ) ); registerItem(pSlotItem, OR); } // 坷配官捞狼 OID甫 殿废 罐绰促. if (m_pMotorcycle != NULL) OR.registerObject_NOLOCKED(m_pMotorcycle); m_Garbage.registerObject(OR); __LEAVE_CRITICAL_SECTION(OR) m_SlayerInfo.setObjectID(m_ObjectID); __END_CATCH}// 矫埃力茄 酒捞袍阑 眉农茄促.// 葛电 酒捞袍捞 捞固 register 登绢乐绢具 茄促.void Slayer::checkItemTimeLimit() throw (Error){ __BEGIN_TRY // 牢亥配府俊辑 茫绰促. { list<Item*> ItemList; int height = m_pInventory->getHeight(); int width = m_pInventory->getWidth(); for (int j=0; j<height; j++) { for (int i=0; i<width; i++) { Item* pItem = m_pInventory->getItem(i, j); if (pItem != NULL) { // 眉农等 酒捞袍狼 府胶飘俊辑 泅犁 酒捞袍阑 茫绰促. list<Item*>::iterator itr = find(ItemList.begin(), ItemList.end(), pItem); if (itr == ItemList.end()) { i += pItem->getVolumeWidth() - 1; if ( wasteIfTimeLimitExpired( pItem ) ) { m_pInventory->deleteItem( pItem->getObjectID() ); SAFE_DELETE( pItem ); } else { // 府胶飘俊 酒捞袍捞 绝栏搁 // 鞍篮 酒捞袍阑 滴锅 眉农窍瘤 臼扁 困秦辑 // 府胶飘俊促啊 酒捞袍阑 笼绢持绰促. ItemList.push_back(pItem); } } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -