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

📄 actionrandomsay.cpp

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 CPP
字号:
////////////////////////////////////////////////////////////////////////////////// Filename    : ActionRandomSay.cpp// Written By  : // Description :////////////////////////////////////////////////////////////////////////////////#include "ActionRandomSay.h"#include "Creature.h"#include "NPC.h"#include "Script.h"#include "ScriptManager.h"#include "GamePlayer.h"#include "Gpackets/GCNPCSay.h"////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////void ActionRandomSay::read (PropertyBuffer & propertyBuffer)    throw (Error){    __BEGIN_TRY	try 	{		// read script id		m_StartScriptID = propertyBuffer.getPropertyInt("StartScriptID");		m_EndScriptID = propertyBuffer.getPropertyInt("EndScriptID");	}	catch (NoSuchElementException & nsee)	{		throw Error(nsee.toString());	}	    __END_CATCH}////////////////////////////////////////////////////////////////////////////////// 咀记阑 角青茄促.////////////////////////////////////////////////////////////////////////////////void ActionRandomSay::execute (Creature * pCreature1 , Creature * pCreature2) 	throw (Error){	__BEGIN_TRY	__BEGIN_DEBUG	Assert(pCreature1 != NULL);	Assert(pCreature2 == NULL);	Assert(pCreature1->isNPC());	// RandomSay绰 酒贰俊辑 焊促矫乔, 烙狼狼 裹困(Start客 End) 救狼 	// 胶农赋飘 吝 罚待阑 倒妨 窍唱甫 努扼捞攫飘俊霸 焊郴绰 侥捞促.	// 弊矾骨肺 Start客 End 荤捞俊 粮犁窍瘤 臼绰 胶农赋飘啊 乐栏搁 帮鄂窍促.	// 胶农赋飘 抛捞喉阑 父甸 锭, RandomSay俊 荤侩窍绰 巴篮 	// 单捞磐啊 馆靛矫 楷加利栏肺 粮犁窍霸 父甸绢具 茄促.	NPC*          pNPC     = dynamic_cast<NPC*>(pCreature1);	ScriptID_t    scriptID = m_StartScriptID + random() % (m_EndScriptID - m_StartScriptID + 1);	const Script* pScript  = g_pPublicScriptManager->getScript(scriptID);	GCNPCSay gcNPCSay;	gcNPCSay.setObjectID(pNPC->getObjectID());	gcNPCSay.setScriptID(pScript->getScriptID());	gcNPCSay.setSubjectID(0);	Zone * pZone = pNPC->getZone();	Assert(pZone != NULL);	pZone->broadcastPacket(pNPC->getX() , pNPC->getY() , &gcNPCSay);	__END_DEBUG	__END_CATCH}////////////////////////////////////////////////////////////////////////////////// get debug string////////////////////////////////////////////////////////////////////////////////string ActionRandomSay::toString () const	throw (){	__BEGIN_TRY	StringStream msg;	msg << "ActionRandomSay("		<< ",ScriptID:"  << (int)m_StartScriptID << "-" << (int)m_EndScriptID		<< ")";	return msg.toString();	__END_CATCH}

⌨️ 快捷键说明

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