?? vampire.cpp
字號:
//////////////////////////////////////////////////////////////////////////////// Filename : Vampire.cpp// Written By : Elca// Description : //////////////////////////////////////////////////////////////////////////////#include "Vampire.h"#include "Player.h"#include "OptionInfo.h"#include "SkillInfo.h"#include "ItemLoaderManager.h"#include "EffectLoaderManager.h"#include "SkillParentInfo.h"#include "DB.h"#include "ItemInfoManager.h"#include "AbilityBalance.h"#include "Stash.h"#include "TradeManager.h"#include "CreatureUtil.h"#include "FlagSet.h"#include "VampEXPInfo.h"#include "Party.h"#include "ItemUtil.h"#include "PacketUtil.h"#include "SkillUtil.h"#include "Shape.h"#include "GamePlayer.h"//#include "RankEXPInfo.h"#include "RankExpTable.h"#include "VariableManager.h"#include "WarSystem.h"#include "ResurrectLocationManager.h"#include "PKZoneInfoManager.h"#include "TimeLimitItemManager.h"#include "CastleSkillInfo.h"#include "PetInfo.h"#include <stdio.h>#include "item/AR.h"#include "item/SR.h"#include "item/SG.h"#include "item/SMG.h"#include "item/PetItem.h"#include "item/Belt.h"#include "item/Skull.h"#include "skill/VampireCastleSkillSlot.h"#include "skill/EffectBless.h"#include "skill/EffectParalyze.h"#include "skill/EffectDoom.h"#include "skill/EffectTransformToWolf.h"#include "skill/EffectTransformToBat.h"#include "EffectGrandMasterVampire.h"#include "RaceWarLimiter.h"#include "Gpackets/GCModifyInformation.h"#include "Gpackets/GCChangeShape.h"#include "Gpackets/GCSkillInfo.h"#include "Gpackets/GCRealWearingInfo.h"#include "Gpackets/GCStatusCurrentHP.h"#include "Gpackets/GCTakeOff.h"#include "Gpackets/GCOtherModifyInfo.h"#include "Gpackets/GCPetStashList.h"#include "MonsterInfo.h"#include "SystemAvailabilitiesManager.h"const Color_t UNIQUE_COLOR = 0xFFFF;const Color_t QUEST_COLOR = 0xFFFE;const Level_t MAX_VAMPIRE_LEVEL = 150;const Level_t MAX_VAMPIRE_LEVEL_OLD = 100;//////////////////////////////////////////////////////////////////////////////// incraseVampExp///////////////////////////////////////////////////////////////////////////////*void Vampire::increaseVampExp(Exp_t Point){ if (Point <= 0) return; Level_t curLevel = getLevel(); if (curLevel >= VAMPIRE_MAX_LEVEL) { // 飯駭 茄拌俊 檔崔秦檔 版氰摹綽 階霸 秦霖促. // by sigi. 2002.8.31 Exp_t NewExp = getExp() + Point; WORD ExpSaveCount = getExpSaveCount(); if (ExpSaveCount > VAMPIRE_EXP_SAVE_PERIOD) { char pField[80]; sprintf(pField, "Exp=%lu", NewExp); tinysave(pField); ExpSaveCount = 0; } else ExpSaveCount++; setExpSaveCount(ExpSaveCount); setExp( NewExp ); return; } Exp_t OldExp = getExp(); Exp_t OldGoalExp = getGoalExp(); Exp_t NewGoalExp = max(0, (int)(OldGoalExp - Point)); // 穿利 版氰摹俊綽 格釬 版氰摹啊 臨絹電 父怒 敲礬膠 竅咯具 茄促. Exp_t DiffGoalExp = max(0, (int)(OldGoalExp - NewGoalExp)); Exp_t NewExp = OldExp + DiffGoalExp; setExp(NewExp); setGoalExp(NewGoalExp); // 格釬 版氰摹啊 0 撈扼擱 飯駭 訣撈促. if (NewGoalExp == 0 && curLevel < VAMPIRE_MAX_LEVEL) { // 撈 竊薦 磊眉啊 load且錠父 利儈登綽芭扁 錠鞏俊.. // 鞘夸絕促. by sigi. 2002.8.31 // VAMPIRE_RECORD prev; // getVampireRecord(prev); curLevel++; setLevel(curLevel); // add bonus point Bonus_t bonus = getBonus(); if ((getSTR(ATTR_BASIC) + getDEX(ATTR_BASIC) + getINT(ATTR_BASIC) + getBonus() - 60) < ((getLevel() - 1) * 3)) { // 飯駭俊 惑包摹 臼絆, 公煉扒 3欄肺 函版登菌促. // 2001.12.12 辮己刮 bonus += 3; } setBonus(bonus); VampEXPInfo* pBeforeExpInfo = g_pVampEXPInfoManager->getVampEXPInfo(curLevel-1); VampEXPInfo* pNextExpInfo = g_pVampEXPInfoManager->getVampEXPInfo(curLevel); Exp_t NextGoalExp = pNextExpInfo->getGoalExp(); setGoalExp(NextGoalExp);// StringStream sav;// sav << "Level = " << (int)curLevel << "," << "Exp = " << (int)pBeforeExpInfo->getAccumExp() << "," << "GoalExp = " << (int)NextGoalExp << "," << "Bonus = " << (int)bonus;// pVampire->tinysave(sav.toString()); char pField[80]; sprintf(pField, "Level=%d, Exp=%lu, GoalExp=%lu, Bonus=%d", curLevel, pBeforeExpInfo->getAccumExp(), NextGoalExp, bonus); tinysave(pField); setExpSaveCount(0); } else { // 林扁利欄肺 歷厘茄促. WORD ExpSaveCount = getExpSaveCount(); if (ExpSaveCount > VAMPIRE_EXP_SAVE_PERIOD) { // by sigi. 2002.5.15 char pField[80]; sprintf(pField, "Exp=%lu, GoalExp=%lu", NewExp, NewGoalExp); tinysave(pField); ExpSaveCount = 0; } else ExpSaveCount++; setExpSaveCount(ExpSaveCount); }}*///////////////////////////////////////////////////////////////////////////////// increaseRankExp///////////////////////////////////////////////////////////////////////////////*void Vampire::increaseRankExp(RankExp_t Point){ if (Point <= 0) return; // PK糧 救俊輯綽 版氰摹甫 林瘤 臼綽促. if ( g_pPKZoneInfoManager->isPKZone( getZoneID() ) ) return; Rank_t curRank = getRank(); if (curRank >= VAMPIRE_MAX_RANK) { // 飯駭 茄拌俊 檔崔秦檔 版氰摹綽 階霸 秦霖促. // by sigi. 2002.8.31 Exp_t NewExp = getRankExp() + Point; WORD ExpSaveCount = getRankExpSaveCount(); if (ExpSaveCount > RANK_EXP_SAVE_PERIOD) { char pField[80]; sprintf(pField, "RankExp=%lu", NewExp); tinysave(pField); ExpSaveCount = 0; } else ExpSaveCount++; setRankExpSaveCount(ExpSaveCount); setRankExp( NewExp ); return; } Exp_t OldExp = getRankExp(); Exp_t OldGoalExp = getRankGoalExp(); Exp_t NewGoalExp = max(0, (int)(OldGoalExp - Point)); // 穿利 版氰摹俊綽 格釬 版氰摹啊 臨絹電 父怒 敲礬膠 竅咯具 茄促. Exp_t DiffGoalExp = max(0, (int)(OldGoalExp - NewGoalExp)); Exp_t NewExp = OldExp + DiffGoalExp; // 格釬 版氰摹啊 0 撈扼擱 飯駭 訣撈促. if (NewGoalExp == 0 && curRank < VAMPIRE_MAX_RANK) { VAMPIRE_RECORD prev; getVampireRecord(prev); curRank++; setRank(curRank); setRankExp(NewExp); setRankGoalExp(NewGoalExp); RankEXPInfo* pBeforeExpInfo = g_pRankEXPInfoManager[RANK_TYPE_VAMPIRE]->getRankEXPInfo(curRank-1); RankEXPInfo* pNextExpInfo = g_pRankEXPInfoManager[RANK_TYPE_VAMPIRE]->getRankEXPInfo(curRank); Exp_t NextGoalExp = pNextExpInfo->getGoalExp(); setRankGoalExp(NextGoalExp);// StringStream sav;// sav << "Rank = " << (int)curRank << "," << "Exp = " << (int)pBeforeExpInfo->getAccumExp() << "," << "GoalExp = " << (int)NextGoalExp << "," << "Bonus = " << (int)bonus;// tinysave(sav.toString()); char pField[80]; sprintf(pField, "Rank=%d, RankExp=%lu, RankGoalExp=%lu", curRank, pBeforeExpInfo->getAccumExp(), NextGoalExp); tinysave(pField); setRankExpSaveCount(0); sendModifyInfo(prev); if (m_pZone != NULL) { GCOtherModifyInfo gcOtherModifyInfo; gcOtherModifyInfo.setObjectID(getObjectID()); gcOtherModifyInfo.addShortData(MODIFY_RANK, curRank); m_pZone->broadcastPacket(m_X, m_Y, &gcOtherModifyInfo, this); } } else { setRankExp(NewExp); setRankGoalExp(NewGoalExp); // 林扁利欄肺 歷厘茄促. WORD rankExpSaveCount = getRankExpSaveCount(); if (rankExpSaveCount > RANK_EXP_SAVE_PERIOD) { char pField[80]; sprintf(pField, "RankExp=%lu, RankGoalExp=%lu", NewExp, NewGoalExp); tinysave(pField); rankExpSaveCount = 0; } else rankExpSaveCount++; setRankExpSaveCount(rankExpSaveCount); // 拌鞭 版氰摹甫 焊郴霖促. by sigi. 2002.9.13 GCModifyInformation gcModifyInformation; gcModifyInformation.addLongData(MODIFY_RANK_EXP, NewExp); m_pPlayer->sendPacket(&gcModifyInformation); }}*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Vampire::Vampire () throw () : PlayerCreature(0, NULL){ __BEGIN_TRY m_CClass = CREATURE_CLASS_VAMPIRE; m_Mutex.setName("Vampire"); // AttackMelee 鞍籃 扁夯 傍拜闌 籠絹持絹霖促. for (int i=0; i<SKILL_DOUBLE_IMPACT; i++) { VampireSkillSlot* pVampireSkillSlot = new VampireSkillSlot; //pVampireSkillSlot = new VampireSkillSlot; // 2002.1.16 by sigi pVampireSkillSlot->setName(m_Name); pVampireSkillSlot->setSkillType(i); pVampireSkillSlot->setInterval(5); pVampireSkillSlot->setRunTime(); addSkill(pVampireSkillSlot); } for (int i = 0; i < VAMPIRE_WEAR_MAX; i++) m_pWearItem[i] = NULL; // 侵 虐甫 檬扁拳 茄促.// for (int i = 0; i < 8; i++) // {// m_HotKey[i] = 0;// } m_SilverDamage = 0; m_ClanType = 0; // HP 府哩 矯埃 檬扁拳 getCurrentTime(m_HPRegenTime); // 版氰摹 技撈宏 墨款飄 檬扁拳// m_RankExpSaveCount = 0; m_ExpSaveCount = 0; m_FameSaveCount = 0; m_AlignmentSaveCount = 0; __END_CATCH}Vampire::~Vampire() throw (Error){ __BEGIN_TRY try { // 汗厘 瀝焊甫 積己秦敵促. by sigi. 2002.6.18 DWORD flag; Color_t color[PCVampireInfo::VAMPIRE_COLOR_MAX]; getShapeInfo (flag, color); char pField[128]; sprintf(pField, "Shape=%ld, CoatColor=%d", flag, color[PCVampireInfo::VAMPIRE_COLOR_COAT]); //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, VampireSkillSlot*>::iterator itr = m_SkillSlot.begin(); for (; itr != m_SkillSlot.end(); itr++) { VampireSkillSlot* pVampireSkillSlot = itr->second; SAFE_DELETE(pVampireSkillSlot); } } catch (Throwable& t) { filelog("vampireDestructor.txt", "%s", t.toString().c_str()); } catch (exception& e) { filelog("vampireDestructor.txt", "Unknown std::exception"); } catch (...) { filelog("vampireDestructor.txt", "Unknown ... exception"); } m_bDeriveDestructed = true; __END_CATCH}// registerObject// Zone俊 輛加等 ObjectRegistry甫 葷儈秦輯, Vampire 客 家蠟酒撈袍甸狼// ObjectID甫 且寸罐綽促.void Vampire::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 < VAMPIRE_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); m_Garbage.registerObject(OR); for ( int i=0; i<MAX_PET_STASH; ++i ) { Item* pItem = getPetStashItem(i); if ( pItem != NULL ) registerItem( pItem, OR ); }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -