cgsayhandler.cpp

来自「dk1游戏的原代码文件,完整.编译系统redhat7.3,mysql 3.23 」· C++ 代码 · 共 1,958 行 · 第 1/5 页

CPP
1,958
字号
//////////////////////////////////////////////////////////////////////////////// Filename    : CGSayHandler.cc// Written By  : elca@ewestsoft.com// Description ://////////////////////////////////////////////////////////////////////////////#include "CGSay.h"#ifdef __GAME_SERVER__	#include <stdio.h>	#include "GamePlayer.h"    #include "ZoneGroupManager.h"    #include "ZoneInfoManager.h"    #include "ZonePlayerManager.h"	#include "DB.h"    #include "InfoClassManager.h"    #include "ItemInfoManager.h"	#include "ItemFactoryManager.h"	#include "Monster.h"	#include "IncomingPlayerManager.h"	#include "Zone.h"	#include "ZoneUtil.h"	#include "EffectShutDown.h"	#include "NPC.h"	#include "Slayer.h"	#include "Vampire.h"	#include "Ousters.h"	#include "PCFinder.h"	#include "NPCInfo.h"	#include "VSDateTime.h"	#include "Guild.h"	#include "Relic.h"	#include "RelicUtil.h"	#include "CombatInfoManager.h"	#include "ClientManager.h"	#include "OptionInfo.h"	#include "ItemUtil.h"	#include "MonsterManager.h"	#include <list>	#include "StringPool.h"	#include "GoodsInventory.h"	#include "PacketUtil.h"	#include "skill/Sniping.h"	#include "Gpackets/GCUpdateInfo.h"    #include "Gpackets/GCSystemMessage.h"    #include "Gpackets/GCDeleteObject.h"    #include "Gpackets/GCAddVampire.h"    #include "Gpackets/GCAddSlayer.h"    #include "Gpackets/GCAddOusters.h"	#include "Gpackets/GCSay.h"	#include "Gpackets/GCCreateItem.h"	#include "Gpackets/GCAddEffect.h"	#include "Gpackets/GCAddEffectToTile.h"	#include "Gpackets/GCRemoveEffect.h"	#include "Mine.h"	#include "Properties.h"	#include "VariableManager.h"	#include "Properties.h"	#include "GameServerInfoManager.h"	#include "LoginServerManager.h"	#include "Gpackets/GGCommand.h"	#include "ZoneInfoManager.h"	#include "ZoneGroupManager.h"	#include "UniqueItemManager.h"	#include "MasterLairManager.h"	#include "EffectGhost.h"	#include "EventManager.h"	#include "EventReloadInfo.h"	#include "CreatureUtil.h"	#include "ShrineInfoManager.h"	#include "CastleInfoManager.h"	#include "war/WarSystem.h"	#include "EffectLoud.h"	#include "EffectMute.h"	#include "LevelWarManager.h"	#include "LogNameManager.h"	#include "war/RaceWarLimiter.h"	#include "PKZoneInfoManager.h"	#include "PCManager.h"	#include "SharedServerManager.h"	#include "GuildManager.h"	#include "GameServerGroupInfoManager.h"	#include "BillingPlayerManager.h"	#include "mission/QuestManager.h"	#include "mission/MonsterKillQuestStatus.h"	#include "Gpackets/GSRequestGuildInfo.h"	#include "Gpackets/GCActiveGuildList.h"	#include "Gpackets/GCNoticeEvent.h"	#include "Gpackets/GSModifyGuildMember.h"	#include "Gpackets/GCStatusCurrentHP.h"	#include "Gpackets/GCNotifyWin.h"	#include "Gpackets/GCMiniGameScores.h"	#include "Gpackets/GCPetStashList.h"	#include "Cpackets/CGModifyGuildIntro.h"	#include "Cpackets/CGModifyGuildMemberIntro.h"	#include "Cpackets/CGSkillToNamed.h"	#include "item/SlayerPortalItem.h"	#include "item/OustersSummonItem.h"	#include "item/PetItem.h"	#include "ctf/FlagManager.h"		#include "EventZoneInfo.h"#endif////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////void CGSayHandler::execute (CGSay* pPacket , Player* pPlayer)	 throw (ProtocolException , Error){	__BEGIN_TRY __BEGIN_DEBUG_EX		#ifdef __GAME_SERVER__	Assert(pPacket != NULL);	Assert(pPlayer != NULL);	try {	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);	// 辑滚俊辑 努扼捞攫飘肺 傈价窍骨肺 GC- 菩哦阑 荤侩秦具 茄促.	GCSay gcSay;		Creature* pCreature = pGamePlayer->getCreature();	// 农府贸 捞抚苞 皋矫瘤甫 菩哦俊 措涝茄促.	gcSay.setObjectID(pCreature->getObjectID());		gcSay.setColor( pPacket->getColor() );	string msg = pPacket->getMessage();	gcSay.setMessage(msg);	bool Success = true;	uint i = msg.find_first_of('*' , 0);	if ( i == 0 ) 	{		Success = false;		// 辨靛侩 烙矫 疙飞甸		if ( msg.substr(i+1, 4) == "zone" && !(pCreature->isPLAYER()) )		{			opzone( msg, i );		}		else if ( msg.substr(i+1, 5) == "guild" && pCreature->isGOD() )		{			opguild( msg, i, pCreature );		}		/////////////////////		// world疙飞绢绰 档快固 纳腐磐档 镜 荐 乐促.		if (msg.substr(i+1 , 5) == "world" && !(pCreature->isPLAYER()) )		{			// 泅犁 辑滚				uint j = msg.find_first_of(' ' , i+1);			string command = msg.substr(j+1, msg.size()-j-1).c_str();			uint k = command.find_first_of('*', 0);			opExecute(pCreature, pGamePlayer, command, k);			// 促弗 server俊档 焊辰促. bSameWorldOnly==true			opworld(pGamePlayer, msg, i, true);		}		else if (msg.substr(i+1 , 8) == "allworld" && (pCreature->isDM() || pCreature->isGOD())) {			// 泅犁 辑滚				uint j = msg.find_first_of(' ' , i+1);			string command = msg.substr(j+1, msg.size()-j-1).c_str();			uint k = command.find_first_of('*', 0);			opExecute(pCreature, pGamePlayer, command, k);			// 促弗 server俊档 焊辰促. bSameWorldOnly==false			opworld(pGamePlayer, msg, i, false);		}		else		{			opExecute(pCreature, pGamePlayer, msg, i);		}	}	// 盲泼 肺弊甫 巢变促. by sigi. 2002.10.30	if (LogNameManager::getInstance().isExist( pCreature->getName() ))	{		filelog("chatLog.txt", "[Say] %s> %s", pCreature->getName().c_str(), msg.c_str());	}	// invisibility惑怕搁 乾促.	if (pCreature->isFlag(Effect::EFFECT_CLASS_INVISIBILITY))	{		Zone* pZone = pCreature->getZone();		Assert(pZone);		addVisibleCreature(pZone, pCreature, true);	}	if (pCreature->isFlag(Effect::EFFECT_CLASS_SNIPING_MODE)) 	{		g_Sniping.checkRevealRatio(pCreature, 20, 10);	}	bool isVampire = false;	// 轨颇捞绢啊 戳措, 冠零捞搁 富且荐绝促.	if (pCreature->isVampire())	{		Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);				if (pVampire->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_WOLF) || pVampire->isFlag(Effect::EFFECT_CLASS_TRANSFORM_TO_BAT)				|| pVampire->isFlag( Effect::EFFECT_CLASS_TRANSFORM_TO_WERWOLF ) )		{			Success = false;		}		isVampire = true;	}	if (pGamePlayer->isPenaltyFlag(PENALTY_TYPE_MUTE)) {		Success = false;	}	if (pCreature->isFlag(Effect::EFFECT_CLASS_MUTE)) {		Success = false;	}	if (Success) {		// 林函 PC甸俊霸 宏肺靛某胶飘茄促.//		pCreature->getZone()->broadcastSayPacket(pCreature->getX() , pCreature->getY() , &gcSay , pCreature, isVampire);		pCreature->getZone()->broadcastPacket(pCreature->getX() , pCreature->getY() , &gcSay , pCreature);	}	} catch (Throwable & t) {		//cout << t.toString() << endl;	}#endif			__END_DEBUG_EX __END_CATCH}#ifdef __GAME_SERVER__void CGSayHandler::opExecute(Creature* pCreature, GamePlayer* pGamePlayer, string msg, int i)	throw(ProtocolException, Error){	__BEGIN_TRY	if (msg.substr(i+1 , 4) == "save"		&& (pCreature->isDM() || pCreature->isGOD() )) {		opsave(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 4) == "wall" && !(pCreature->isPLAYER())) {		//cout << "==================Operator Order Wall Execute==================" << endl;		opwall(pGamePlayer, msg, i);	}	// halt	else if (msg.substr(i+1 , 8) == "shutdown" && (pCreature->isDM() || pCreature->isGOD())) {		//cout << "==================Operator Order Shutdown Execute==================" << endl;		opshutdown(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 3) == "pay" && !(pCreature->isPLAYER())){			oppay(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 4) == "kick" && !(pCreature->isPLAYER())){		//cout << "==================Operator Order kick Execute==================" << endl;		opkick(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 4) == "mute" && !(pCreature->isPLAYER())){		//cout << "==================Operator Order mute Execute==================" << endl;		opmute(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 8) == "denychat" && !(pCreature->isPLAYER())){		//cout << "==================Operator Order denychat Execute==================" << endl;		opdenychat(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 8) == "freezing" && !(pCreature->isPLAYER())){		//cout << "==================Operator Order freezing Execute==================" << endl;		opfreezing(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 4) == "deny" && (pCreature->isDM() || pCreature->isGOD()) ) {		//cout << "==================Operator Order deny Execute==================" << endl;		opdeny(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 4) == "info" && !(pCreature->isPLAYER())){		//cout << "==================Operator Order info Execute==================" << endl;		opinfo(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 5) == "trace" && !(pCreature->isPLAYER())){		//cout << "==================Operator Order trace Execute==================" << endl;		optrace(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 4) == "warp" && !(pCreature->isPLAYER())){		//cout << "==================Operator Order warp Execute==================" << endl;		opwarp(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 6) == "create" && (pCreature->isGOD())){		//cout << "==================Operator Order create Execute==================" << endl;		opcreate(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 6) == "summon" && (pCreature->isGOD() || pCreature->isDM())){		//cout << "==================Operator Order create Execute==================" << endl;		opsummon(pGamePlayer, msg, i);	}		else if (msg.substr(i+1 , 5) == "grant" && pCreature->isGOD()){		//cout << "==================Operator Order grant Execute==================" << endl;		opgrant(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 7) == "command" && (pCreature->isGOD() || pCreature->isDM())){		opcommand(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 3) == "fun" && !(pCreature->isPLAYER())){			opfun(pGamePlayer, msg, i);	}	else if ( msg.substr(i+1, 18) == "billing disconnect" && pCreature->isGOD() )	{		#ifdef __CONNECT_BILLING_SYSTEM__		g_pBillingPlayerManager->setForceDisconnect();		#endif	}	/*	if (msg.substr(i+1 , 7) == "mrecall" && (pCreature->isGOD() || pCreature->isDM())) {		Zone* pZone = pCreature->getZone();		uint j = msg.find_first_of(' ' , i+1);		BYTE MonsterType = atoi(msg.substr(j+1, msg.size()-j-1).c_str());		Monster* pMonster = new Monster(MonsterType);		pZone->addCreature(pMonster, pCreature->getX(), pCreature->getY(), pCreature->getDir(), true);	}	*/	else if (msg.substr(i+1 , 6) == "recall" && !(pCreature->isPLAYER())){		//cout << "==================Operator Order recall Execute==================" << endl;		oprecall(pGamePlayer, msg, i);	}	else if (msg.substr(i+1 , 4) == "user" && !(pCreature->isPLAYER())){

⌨️ 快捷键说明

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