⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vampire.cpp

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 CPP
📖 第 1 页 / 共 5 页
字号:
//////////////////////////////////////////////////////////////////////////////// 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 + -