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

📄 effectreloadtimer.cpp

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 CPP
字号:
//////////////////////////////////////////////////////////////////////////////// Filename    : EffectReloadTimer.cpp// Written by  : elca// Description : //////////////////////////////////////////////////////////////////////////////#include "EffectReloadTimer.h"#include "Creature.h"#include "Slayer.h"#include "Player.h"#include "Gpackets/GCReloadOK.h"#include "ItemInfoManager.h"#include "ItemUtil.h"#include "item/Magazine.h"#include "item/SG.h"#include "item/AR.h"#include "item/SMG.h"#include "item/SR.h"#include "item/Belt.h"#include <stdio.h>//////////////////////////////////////////////////////////////////////////////// Constructor//////////////////////////////////////////////////////////////////////////////EffectReloadTimer::EffectReloadTimer(Creature* pCreature)	throw(Error){	__BEGIN_TRY	setTarget(pCreature);	__END_CATCH}//////////////////////////////////////////////////////////////////////////////// EffectReloadTimer::affect()//////////////////////////////////////////////////////////////////////////////void EffectReloadTimer::affect(Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pObject)	throw(Error){	__BEGIN_TRY	__END_CATCH}//////////////////////////////////////////////////////////////////////////////// EffectReloadTimer::affect()//////////////////////////////////////////////////////////////////////////////void EffectReloadTimer::affect(Creature* pCreature)	throw(Error){	__BEGIN_TRY	__END_CATCH}//////////////////////////////////////////////////////////////////////////////// EffectReloadTimer::unaffect()//////////////////////////////////////////////////////////////////////////////void EffectReloadTimer::unaffect()	throw(Error){	__BEGIN_TRY	unaffect((Creature*)m_pTarget);		__END_CATCH}//////////////////////////////////////////////////////////////////////////////// EffectReloadTimer::unaffect()//////////////////////////////////////////////////////////////////////////////void EffectReloadTimer::unaffect(Creature* pCreature)	throw(Error){	__BEGIN_TRY	//cout << "EffectReloadTimer " << "unaffect BEGIN" << endl;	Assert(pCreature != NULL);	Assert(pCreature->isSlayer());	Slayer*    pSlayer     = dynamic_cast<Slayer*>(pCreature);	Player*    pPlayer     = pSlayer->getPlayer();	Item*      pArmsItem   = pSlayer->getWearItem(Slayer::WEAR_RIGHTHAND);	Bullet_t   BulletNum   = 0;	Item*      pItem       = NULL;	Item*      pBelt       = NULL;	Inventory* pInventory  = NULL;	bool       bSuccess    = false;	// 老窜 己傍窍电 角菩窍电 敲贰弊绰 力芭矫挪促.	pSlayer->removeFlag(Effect::EFFECT_CLASS_RELOAD_TIMER);	if (pArmsItem != NULL) 	{		if (isArmsWeapon(pArmsItem)) 		{			if (m_bFromInventory)			{				// 牢亥配府俊辑 流立 府肺靛窍绰 版快扼搁,				// 牢亥配府 郴何俊辑 酒捞袍阑 茫绰促.				pInventory = pSlayer->getInventory();				pItem      = pInventory->getItem(m_invenX, m_invenY);			}			else			{				// 骇飘俊辑 府肺靛窍绰 版快扼搁 				// 骇飘 郴何俊辑 酒捞袍阑 茫绰促.				if (pSlayer->isWear(Slayer::WEAR_BELT)) 				{					pBelt      = pSlayer->getWearItem(Slayer::WEAR_BELT);					pInventory =((Belt*)pBelt)->getInventory();					pItem      = pInventory->getItem(m_SlotID, 0);				}			}			if (pItem == NULL || pInventory == NULL)			{				//cout << "EffectReloadTimer : 酒捞袍捞 澄捞芭唱, 牢亥配府啊 澄涝聪促." << endl;				//cout << "EffectReloadTimer " << "unaffect END" << endl;				return;			}				ObjectID_t ItemObjectID = pItem->getObjectID();			// 酒捞袍捞 乐绰瘤 弊 酒捞袍狼 ObjectID啊 老摹窍绰瘤 眉农茄促.			if (ItemObjectID == m_ObjectID && 				pItem->getItemClass() == Item::ITEM_CLASS_MAGAZINE)			{				BulletNum = reloadArmsItem(pArmsItem, pItem);				// 府肺靛啊 沥惑利栏肺 登菌促搁 历厘秦 霖促.				if (BulletNum != 0)				{					//pArmsItem->save(pSlayer->getName(), STORAGE_GEAR, 0, Slayer::WEAR_RIGHTHAND, 0);					// 酒捞袍 历厘 弥利拳					// by sigi. 2002.5.16//					Gun* pGun = dynamic_cast<Gun*>(pArmsItem);					char pField[80];					sprintf(pField, "BulletCount=%d, Silver=%d", pArmsItem->getBulletCount(), pArmsItem->getSilver());					pArmsItem->tinysave(pField);					// 藕芒狼 肮荐啊 2俺 捞惑捞扼搁...					if (pItem->getNum() > 1) 					{						// 酒捞袍狼 肮荐甫 临捞绊,						// 牢亥配府 郴何狼 醚 肮荐 棺 公霸甫 临牢促.						pItem->setNum(pItem->getNum() - 1);						pInventory->decreaseItemNum();						pInventory->decreaseWeight(pItem->getWeight());								// 临绢电 酒捞袍狼 肮荐甫 历厘茄促.						if (m_bFromInventory) 						{							//pItem->save(pSlayer->getName(), STORAGE_INVENTORY, 0, m_invenX, m_invenY);							// by sigi. 2002.5.16							sprintf(pField, "Num=%d", pItem->getNum());							pItem->tinysave(pField);						}						else 						{							//pItem->save(pSlayer->getName(), STORAGE_BELT, pBelt->getItemID(), m_SlotID, 0);							// by sigi. 2002.5.16							sprintf(pField, "Num=%d", pItem->getNum());							pItem->tinysave(pField);						}					} 					// 藕芒狼 肮荐啊 1俺扼搁 昏力秦拎具 茄促.					else 					{						if (m_bFromInventory) pInventory->deleteItem(m_invenX, m_invenY);						else pInventory->deleteItem(m_SlotID, 0);						pItem->destroy();						SAFE_DELETE(pItem);					}					bSuccess = true;				} // if (BulletNum != 0)			}		}	} 	if (bSuccess)	{		GCReloadOK ok;		ok.setBulletNum(BulletNum);		pPlayer->sendPacket(&ok);	}	//cout << "EffectReloadTimer " << "unaffect END" << endl;	__END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void EffectReloadTimer::unaffect(Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pObject)	throw(Error){	__BEGIN_TRY	__END_CATCH}//////////////////////////////////////////////////////////////////////////////// get debug string//////////////////////////////////////////////////////////////////////////////string EffectReloadTimer::toString()	const throw(){	__BEGIN_TRY	StringStream msg;	msg << "EffectReloadTimer("		<< "ObjectID:" << getObjectID()		<< ")";	return msg.toString();	__END_CATCH}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -