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

📄 actiongivequestitem.cpp

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 CPP
字号:
////////////////////////////////////////////////////////////////////////////////// Filename    : ActionGiveQuestItem.cpp// Written By  : // Description :////////////////////////////////////////////////////////////////////////////////#include "ActionGiveQuestItem.h"#include "Creature.h"#include "NPC.h"#include "GamePlayer.h"#include "PlayerCreature.h"#include "Item.h"#include "PacketUtil.h"#include "mission/QuestManager.h"#include "mission/EventQuestAdvance.h"#include "Gpackets/GCSystemMessage.h"#include "Gpackets/GCNPCResponse.h"#include "Gpackets/GCNPCAsk.h"#include "Gpackets/GCCreateItem.h"////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////void ActionGiveQuestItem::read (PropertyBuffer & propertyBuffer)    throw (Error){    __BEGIN_TRY	try 	{		// read script id		m_CounterScriptID = propertyBuffer.getPropertyInt( "CounterScriptID" );	} 	catch (NoSuchElementException & nsee)	{		throw Error(nsee.toString());	}	    __END_CATCH}////////////////////////////////////////////////////////////////////////////////// 咀记阑 角青茄促.////////////////////////////////////////////////////////////////////////////////void ActionGiveQuestItem::execute (Creature * pCreature1 , Creature * pCreature2) 	throw (Error){	__BEGIN_TRY	Assert(pCreature1 != NULL);	Assert(pCreature2 != NULL);	Assert(pCreature1->isNPC());	Assert(pCreature2->isPC());	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);	Assert( pPC != NULL );	TPOINT pt;	Item* pItem = pPC->getQuestItem();	if ( pItem == NULL || !pPC->getInventory()->getEmptySlot( pItem, pt ) )	{		GCNPCAsk gcNPCAsk;		gcNPCAsk.setObjectID( pCreature1->getObjectID() );		gcNPCAsk.setScriptID( m_CounterScriptID );		gcNPCAsk.setNPCID( dynamic_cast<NPC*>(pCreature1)->getNPCID() );		pPC->getPlayer()->sendPacket( &gcNPCAsk );		return;	}	if ( pPC->getInventory()->addItem( pItem, pt ) )	{		pPC->setQuestItem( NULL );		pPC->getZone()->registerObject( pItem );		pItem->create( pPC->getName(), STORAGE_INVENTORY, 0, pt.x, pt.y );		if ( pItem->isUnique() || pItem->isTimeLimitItem() )		{			pPC->addTimeLimitItem( pItem, 43200 );		}		GCCreateItem gcCreateItem;		makeGCCreateItem( &gcCreateItem, pItem, pt.x, pt.y );		pPC->getPlayer()->sendPacket( &gcCreateItem );	}	__END_CATCH}////////////////////////////////////////////////////////////////////////////////// get debug string////////////////////////////////////////////////////////////////////////////////string ActionGiveQuestItem::toString () const 	throw (){	__BEGIN_TRY	StringStream msg;	msg << "ActionGiveQuestItem("	    << ")";	return msg.toString();	__END_CATCH}

⌨️ 快捷键说明

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