GunZ 1.5 (Summer of 2011) Source.

Page 6 of 12 FirstFirst 123456789101112 LastLast
Results 76 to 90 of 168
  1. #76
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Quote Originally Posted by Ryukrey View Post
    Is it bugged or what? Damn bad source.. (MAIET fault not your Dawson) When i delete the MMonitor.h references it give other errors..
    Boring to "fix".
    The source is fine... you just don't know how to code @_@.

    edit: @ everyone else asking for shit "I need blah, please give me bleh" Stop being so damn greedy.

  2. #77
    Kyura Ryukrey is offline
    MemberRank
    Jan 2010 Join Date
    ItalyLocation
    354Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Quote Originally Posted by Dawson View Post
    The source is fine... you just don't know how to code @_@.
    You think this..

  3. #78
    Freelance GunZ Developer Touchwise is offline
    MemberRank
    Aug 2009 Join Date
    The NetherlandsLocation
    754Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Ryu learn to code? it's as ez as fux mate?

    Quote Originally Posted by Dawson View Post
    The source is fine... you just don't know how to code @_@.

    edit: @ everyone else asking for shit "I need blah, please give me bleh" Stop being so damn greedy.
    Thanks quoted for the truth! Source is totally fine works great all tough it just sucks i don't got the freaking time to work on it... I need some vacation ..

  4. #79
    Kyura Ryukrey is offline
    MemberRank
    Jan 2010 Join Date
    ItalyLocation
    354Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Quote Originally Posted by Touchwise View Post
    Ryu learn to code? it's as ez as fux mate?
    Oh.. Thanks ..

  5. #80
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Quote Originally Posted by Phoenix View Post
    Challenge Quests are not included in this source.
    Code:
    #include "stdafx.h"
    #include "ZRuleQuestChallenge.h"
    #include "ZMatch.h"
    #include "MActorDef.h"
    #include "MNewQuestScenario.h"
    #include "ZFSMManager.h"
    #include "ZActorActionManager.h"
    #include "ZActorAction.h"
    #include "ZActorWithFSM.h"
    #include "ZApplication.h"
    #include "ZFSMManager.h"
    #include "ZFSMParser.h"
    #include "ZFSM.h"
    
    ZRuleQuestChallenge::ZRuleQuestChallenge(ZMatch* pMatch) 
     : ZRule(pMatch)
     , m_pFsmManager(new ZFSMManager)
     , m_pActorDefMgr(new MActorDefManager)
     , m_pActorActionMgr(new ZActorActionManager)
     , m_pScenario(NULL)
     , m_nCurrSector(0)
    {
    }
    
    ZRuleQuestChallenge::~ZRuleQuestChallenge()
    {
    	delete m_pFsmManager;
    	delete m_pActorDefMgr;
    	delete m_pActorActionMgr;
    }
    
    bool ZRuleQuestChallenge::LoadScenarioMap(const char* szScenarioName)
    {
    	MNewQuestScenarioManager* pScenarioMgr = ZApplication::GetStageInterface()->GetChallengeQuestScenario();
    	if (!pScenarioMgr) { _ASSERT(0); return false; }
    	MNewQuestScenario* pScenario = pScenarioMgr->GetScenario(szScenarioName);
    	if (!pScenario) { _ASSERT(0); return false; }
    
    	int numSector = pScenario->GetNumSector();
    	for (int i=0; i<numSector; ++i)
    	{
    		MNewQuestSector* pSector = pScenario->GetSector(i);
    		if (!pSector)  { _ASSERT(0); return false; }
    
    		const char* szMapName = pSector->GetMapName();
    		_ASSERT(0 != strlen(szMapName));
    		ZGetWorldManager()->AddWorld(szMapName);
    	}
    
    	return true;
    }
    
    int ZRuleQuestChallenge::GetRoundMax()
    {
    	if (!m_pScenario) {
    		_ASSERT(0);
    		return 1;
    	}
    
    	return m_pScenario->GetNumSector();
    }
    
    
    bool ZRuleQuestChallenge::Init()
    {
    	//todok quest °ÔÀÓÀ» ÇÒ¶§¸¶´Ù »õ·Î ·ÎµùÇÏ´Â °ÍÀ» °³¼±ÇÏÀÚ.
    
    	// npc action Àбâ
    	string strActionFile("system/zactoraction.xml");
    #ifndef _DEBUG
    	strActionFile += ".mef";
    #endif
    	if (!m_pActorActionMgr->ReadXml(ZApplication::GetFileSystem(), strActionFile.c_str()))
    	{
    		mlog("Error while Load %s\n", strActionFile.c_str());
    		return false;
    	}
    
    	// npc fsm ±â¹Ý AI Àбâ
    	string strAIFSMFile("system/aifsm.xml");
    #ifndef _DEBUG
    	strAIFSMFile += ".mef";
    #endif
    	vector<ZFSM*> vecFSM;
    	ZFSMParser fsmParser;
    	if (!fsmParser.ReadXml(ZApplication::GetFileSystem(), strAIFSMFile.c_str(), vecFSM, m_pActorActionMgr))
    	{
    		mlog("Error while Load %s\n", strAIFSMFile.c_str());
    		return false;
    	}
    	m_pFsmManager->AddFsm(&vecFSM[0], (unsigned int)vecFSM.size());
    
    
    	// npc ¸ðµ¨ Àбâ
    	string strNpcMeshListFile("model/npc2.xml");
    #ifndef _DEBUG
    	strNpcMeshListFile += ".mef";
    #endif	
    	if (ZGetNpcMeshMgr()->LoadXmlList(strNpcMeshListFile.c_str()) == -1)
    	{
    		mlog("Error while Load %s\n", strNpcMeshListFile.c_str());
    		return false;
    	}
    
    	// npc Á¤ÀÇ Àбâ
    	string strNpcDefFile("system/npc2.xml");
    #ifndef _DEBUG
    	strNpcDefFile += ".mef";
    #endif
    	if (!m_pActorDefMgr->ReadXml(ZApplication::GetFileSystem(), strNpcDefFile.c_str()))
    	{
    		mlog("Error while Read %s\n", strNpcDefFile.c_str());
    		return false;
    	}
    
    
    	// ÀÌ Äù½ºÆ®ÀÇ ½Ã³ª¸®¿À °´Ã¼ ¾Ë¾ÆµÎ±â
    	const char* szScenarioName = ZGetGameClient()->GetMatchStageSetting()->GetMapName();
    	
    	MNewQuestScenarioManager* pScenarioMgr = ZApplication::GetStageInterface()->GetChallengeQuestScenario();
    	if (!pScenarioMgr) { _ASSERT(0); return false; }
    	MNewQuestScenario* pScenario = pScenarioMgr->GetScenario(szScenarioName);
    	if (!pScenario) { _ASSERT(0); return false; }
    
    	m_pScenario = pScenario;
    
    	m_nCurrSector = 0;
    
    	return true;
    }
    
    void ZRuleQuestChallenge::OnUpdate( float fDelta )
    {
    	if (ZGetGame() == NULL) return;
    
    	//MUID uidChar(ZGetMyUID());
    	//static int tempUid = 111;
    	//MUID uidNPC(1,tempUid);
    	////unsigned char nNPCType, nPositionIndex;
    
    	////pCommand->GetParameter(&uidChar,			0, MPT_UID);
    	////pCommand->GetParameter(&uidNPC,				1, MPT_UID);
    	////pCommand->GetParameter(&nNPCType,			2, MPT_UCHAR);
    	////pCommand->GetParameter(&nPositionIndex,		3, MPT_UCHAR);
    
    	//// ÀÏ´Ü Á×Àº ³ðÀº Á¦°ÅÇÑ´Ù
    	//ZNPCObjectMap* pNpcMap = ZGetObjectManager()->GetNPCObjectMap();
    	//for (ZNPCObjectMap::iterator it=pNpcMap->begin(); it!=pNpcMap->end(); )
    	//{
    	//	if (it->second->IsDie())
    	//	{
    	//		delete it->second;
    	//		it = pNpcMap->erase(it);
    	//	}
    	//	else
    	//		++it;
    	//}
    
    	//// µ¿½Ã ½ºÆù ¼ö¸¦ Á¦ÇÑÇÑ´Ù
    	//if (5 <= pNpcMap->size())
    	//	return;
    
    	//tempUid++;
    	//uidNPC = MUID(1, tempUid);
    
    	///*
    	//MQUEST_NPC NPCType = NPC_GOBLIN_GUNNER;
    
    	////ZMapSpawnType nSpawnType = ZMST_NPC_MELEE;
    
    	//ZMapSpawnManager* pMSM = ZGetGame()->GetMapDesc()->GetSpawnManager();
    
    	//MQuestNPCInfo* pNPCInfo = ZGetQuest()->GetNPCCatalogue()->GetInfo(NPCType);
    	////MQuestNPCInfo* pNPCInfo = GetNPCInfo(NPCType);
    	//if (pNPCInfo == NULL) return;
    
    	//ZMapSpawnData* pSpawnData = pMSM->GetSpawnData(ZMST_NPC_MELEE, 0);
    
    	//rvector NPCPos = rvector(0,0,0);
    	//rvector NPCDir = rvector(1,0,0);
    
    	//if (pSpawnData)
    	//{
    	//	NPCPos = pSpawnData->m_Pos;
    	//	NPCDir = pSpawnData->m_Dir;
    	//}*/
    
    	//bool bMyControl = (uidChar == ZGetMyUID());
    	//SpawnActor("knifeman", uidNPC, bMyControl);
    
    
    	//todokkkkk Á×Àº ¿£ÇǾ¾ ¼­¹ö¿¡ ¾Ë¸²
    }
    
    void ZRuleQuestChallenge::OnSetRoundState( MMATCH_ROUNDSTATE roundState )
    {
    	switch(roundState) 
    	{
    	case MMATCH_ROUNDSTATE_PREPARE: 
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_PRE_COUNTDOWN:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_COUNTDOWN : 
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_PLAY:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_FINISH:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_EXIT:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_FREE:
    		{
    		}
    		break;
    	};
    }
    
    float ZRuleQuestChallenge::FilterDelayedCommand( MCommand* pCommand )
    {
    	switch (pCommand->GetID())
    	{
    	case MC_NEWQUEST_PEER_NPC_ATTACK_MELEE:	//todok ÀÌÁ¦ »ç¿ëÇÏÁö ¾ÊÀ½
    		{
    			char szActionName[64];	//todokkkk ¾×¼Ç À̸§À» º¸³»Áö ¸»°í Á¤¼ö°°Àº È¿À²ÀûÀÎ °ªÀ¸·Î ±¸º°ÇÒ¼ö ÀÖ°Ô ÇÏÀÚ
    			pCommand->GetParameter(szActionName,	1, MPT_STR, sizeof(szActionName));
    
    			IActorAction* pAction = m_pActorActionMgr->GetAction(szActionName);
    			if (!pAction) { _ASSERT(0); break; }
    
    			const ZActorActionMeleeShot* pMeleeShot = pAction->GetMeleeShot();
    			return pMeleeShot->GetDelay();
    		}
    	}
    
    	return 0;
    }
    
    bool ZRuleQuestChallenge::OnCommand( MCommand* pCommand )
    {
    	switch (pCommand->GetID())
    	{
    	case MC_NEWQUEST_PEER_NPC_ATTACK_MELEE:	//todok ÀÌÁ¦ »ç¿ëÇÏÁö ¾ÊÀ½
    		{
    			MUID uidNpc;
    			char szActionName[64];	//todokkkk ¾×¼Ç À̸§À» º¸³»Áö ¸»°í Á¤¼ö°°Àº È¿À²ÀûÀÎ °ªÀ¸·Î ±¸º°ÇÒ¼ö ÀÖ°Ô ÇÏÀÚ
    			pCommand->GetParameter(&uidNpc, 0, MPT_UID);
    			pCommand->GetParameter(szActionName,	1, MPT_STR, sizeof(szActionName));
    
    			ZActorBase* pActor = ZGetObjectManager()->GetNPCObject(uidNpc);
    			ZActorWithFSM* pActorWithFSM = MDynamicCast(ZActorWithFSM, pActor);
    			if (pActorWithFSM)
    			{
    				pActorWithFSM->OnPeerMeleeShot(szActionName);
    			}
    
    			return true;
    		}
    	case MC_NEWQUEST_NPC_SPAWN:
    		{
    			MUID uidController;
    			MUID uidNpc;
    			char szActorDefName[128];
    			unsigned char nCustomSpawnTypeIndex, nSpawnIndex;
    			pCommand->GetParameter(&uidController,	0, MPT_UID);
    			pCommand->GetParameter(&uidNpc,			1, MPT_UID);
    			pCommand->GetParameter(szActorDefName,	2, MPT_STR, sizeof(szActorDefName));
    			pCommand->GetParameter(&nCustomSpawnTypeIndex,	3, MPT_UCHAR);
    			pCommand->GetParameter(&nSpawnIndex,			4, MPT_UCHAR);
    
    			SpawnActor(szActorDefName, uidNpc, nCustomSpawnTypeIndex, nSpawnIndex, ZGetMyUID()==uidController);
    			return true;
    		}
    
    	case MC_NEWQUEST_NPC_DEAD:
    		{
    			MUID uidKiller, uidNPC;
    
    			pCommand->GetParameter(&uidKiller,	0, MPT_UID);
    			pCommand->GetParameter(&uidNPC,		1, MPT_UID);
    
    			ZActorWithFSM* pActor = (ZActorWithFSM*)ZGetObjectManager()->GetNPCObject(uidNPC);
    			if (pActor)
    			{
    				ZGetObjectManager()->Delete(pActor);
    
    				//todok ¾Æ·¡ ÁÖ¼® ±¸ÇöÇØÁà¾ß ÇÔ
    				/*m_GameInfo.IncreaseNPCKilled();
    
    				ZCharacter* pCharacter = (ZCharacter*) ZGetCharacterManager()->Find(uidKiller);
    				if (pCharacter)
    				{
    					ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pCharacter->GetModule(ZMID_QUESTSTATUS);
    					if (pMod)
    					{
    						pMod->AddKills();
    					}
    				}*/
    			}
    			return true;
    		}
    
    	case MC_NEWQUEST_MOVE_TO_NEXT_SECTOR:
    		{
    			MoveToNextSector();
    			return true;
    		}
    
    	case MC_NEWQUEST_PEER_NPC_BASICINFO:
    		{
    			MCommandParameter* pParam = pCommand->GetParameter(0);
    			if(pParam->GetType()!=MPT_BLOB)
    			{
    				_ASSERT(0); break;
    			}
    
    			ZACTOR_WITHFSM_BASICINFO* pbi= (ZACTOR_WITHFSM_BASICINFO*)pParam->GetPointer();
    			ZActorWithFSM* pActor = (ZActorWithFSM*)ZGetObjectManager()->GetNPCObject(pbi->uidNPC);
    			if (pActor)
    			{
    				pActor->OnBasicInfo(pbi);
    			}
    
    			return true;
    		}
    	case MC_NEWQUEST_PEER_NPC_ACTION_EXECUTE:
    		{
    			MUID uidNpc;
    			int nActionIndex;
    			pCommand->GetParameter(&uidNpc, 0, MPT_UID);
    			pCommand->GetParameter(&nActionIndex, 1, MPT_INT, sizeof(nActionIndex));
    
    			ZActorBase* pActor = ZGetObjectManager()->GetNPCObject(uidNpc);
    			ZActorWithFSM* pActorWithFSM = MDynamicCast(ZActorWithFSM, pActor);
    			if (pActorWithFSM)
    			{
    				pActorWithFSM->OnPeerActionExecute(nActionIndex);
    			}
    
    			return true;
    		}
    	}
    
    	return false;
    }
    
    void ZRuleQuestChallenge::SpawnActor(const char* szActorDefName, MUID& uid, int nCustomSpawnTypeIndex, int nSpawnIndex, bool bMyControl)
    {
    	rvector pos(0,0,0);
    	rvector dir(1,0,0);
    
    	ZMapSpawnManager* pMSM = ZGetGame()->GetMapDesc()->GetSpawnManager();
    	if (pMSM)
    	{
    		ZMapSpawnData* pSpawnData = pMSM->GetCustomSpawnData(nCustomSpawnTypeIndex, nSpawnIndex);
    		if (pSpawnData)
    		{
    			pos = pSpawnData->m_Pos;
    			dir = pSpawnData->m_Dir;
    		}
    	}
    
    	MActorDef* pActorDef = m_pActorDefMgr->GetDef(szActorDefName);
    	if (!pActorDef) 
    	{
    		mlog("ERROR : cannot found actordef:\'%s\'\n", szActorDefName);
    		_ASSERT(0); 
    		return; 
    	}
    
    	// ¸¸¾à ¸®¼Ò½º ·ÎµùÀ» ¾ÈÇßÀ¸¸é ·Îµå - ÀÌ·²ÀÏÀº Å×½ºÆ®»©°ï ¾ø¾î¾ßÇÑ´Ù.
    	RMesh* pNPCMesh = ZGetNpcMeshMgr()->Get(pActorDef->GetName());
    	if (pNPCMesh)
    	{
    		if (!pNPCMesh->m_isMeshLoaded)
    		{
    			ZGetNpcMeshMgr()->Load(pActorDef->GetName());
    			ZGetNpcMeshMgr()->ReloadAllAnimation();
    		}
    	}
    
    	ZActorWithFSM* pNewActor = new ZActorWithFSM(ZGetGame(), m_pActorActionMgr);
    	pNewActor->InitWithActorDef(pActorDef, m_pFsmManager);
    	pNewActor->SetUID(uid);
    	pNewActor->SetPosition(pos);
    	pNewActor->SetDirection(dir);
    	pNewActor->SetMyControl(bMyControl);
    
    	ZGetObjectManager()->Add(pNewActor);
    	ZGetEffectManager()->AddReBirthEffect(pNewActor->GetPosition());
    }
    
    void ZRuleQuestChallenge::MoveToNextSector()
    {
    	ZCharacter *pMyChar = ZGetGame()->m_pMyCharacter;
    	pMyChar->InitStatus();
    
    	// Àü È­¸é¿¡¼­ ³²¾ÆÀÖÀ» ¼ö Àִ ź°ú ÀÌÆåÆ®¸¦ Á¦°Å
    	ZGetEffectManager()->Clear();
    	ZGetGame()->m_WeaponManager.Clear();
    
    	// »õ·Î¿î ¿ùµå·Î À̵¿!!
    	++m_nCurrSector;	//todok ÇöÀç ¼½ÅͰ¡ ¸¶Áö¸· ¼½ÅͶó¸é? ±¦ÂúÀº°Ç°¡..
    	ZGetWorldManager()->SetCurrent(m_nCurrSector);
    	//todok ¶ó¿îµå ÇüÅ·Π·êÀ» ±¸ÇöÇ߱⠶§¹®¿¡ ÀÌ ÄÚµå´Â ÀÌÁ¦ ÇÊ¿ä ¾ø´Âµí
    	//// À̹ø¿¡ À̵¿ÇÒ Ä³¸¯ÅÍÀÇ À§Ä¡
    	//int nPosIndex = ZGetCharacterManager()->GetCharacterIndex(pMyChar->GetUID(), false);
    	//if (nPosIndex < 0) nPosIndex=0;
    	//ZMapSpawnData* pSpawnData = ZGetWorld()->GetDesc()->GetSpawnManager()->GetSoloData(nPosIndex);
    	//// »õ ÁÂÇ¥·Î À̵¿
    	//if (pSpawnData!=NULL && pMyChar!=NULL)
    	//{
    	//	pMyChar->SetPosition(pSpawnData->m_Pos);
    	//	pMyChar->SetDirection(pSpawnData->m_Dir);
    	//	ZGetEffectManager()->AddReBirthEffect(pSpawnData->m_Pos);
    	//}
    
    	//todok quest Àӽ÷ΠÁÖ¼®ÇÔ ±¸ÇöÇØ¾ß ÇÑ´Ù
    	//// ¾Æ¹«µµ º¸¿©ÁÖÁö ¾Ê´Â´Ù.
    	//for(ZCharacterManager::iterator i = ZGetCharacterManager()->begin();i!=ZGetCharacterManager()->end();i++)
    	//{
    	//	i->second->SetVisible(false);
    	//}
    
    	//// ko¼ö µ¿±âÈ­
    	//ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pMyChar->GetModule(ZMID_QUESTSTATUS);
    	//if (pMod)
    	//{
    	//	int nKills = pMod->GetKills();
    	//	ZGetScreenEffectManager()->SetKO(nKills);
    	//}
    }
    ;)

  6. #81
    Novice Raaawrr is offline
    MemberRank
    Dec 2011 Join Date
    4Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Do not let me compile the matchserver tells me mmonitor.h missing, I can do?

  7. #82
    Freelance GunZ Developer Touchwise is offline
    MemberRank
    Aug 2009 Join Date
    The NetherlandsLocation
    754Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Raaawrr GOD DAMMIT READ OTHER POSTS!!!!!!


    And thank you jacob!

  8. #83
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Quote Originally Posted by ThePhailure772 View Post
    Code:
    #include "stdafx.h"
    #include "ZRuleQuestChallenge.h"
    #include "ZMatch.h"
    #include "MActorDef.h"
    #include "MNewQuestScenario.h"
    #include "ZFSMManager.h"
    #include "ZActorActionManager.h"
    #include "ZActorAction.h"
    #include "ZActorWithFSM.h"
    #include "ZApplication.h"
    #include "ZFSMManager.h"
    #include "ZFSMParser.h"
    #include "ZFSM.h"
    
    ZRuleQuestChallenge::ZRuleQuestChallenge(ZMatch* pMatch) 
     : ZRule(pMatch)
     , m_pFsmManager(new ZFSMManager)
     , m_pActorDefMgr(new MActorDefManager)
     , m_pActorActionMgr(new ZActorActionManager)
     , m_pScenario(NULL)
     , m_nCurrSector(0)
    {
    }
    
    ZRuleQuestChallenge::~ZRuleQuestChallenge()
    {
    	delete m_pFsmManager;
    	delete m_pActorDefMgr;
    	delete m_pActorActionMgr;
    }
    
    bool ZRuleQuestChallenge::LoadScenarioMap(const char* szScenarioName)
    {
    	MNewQuestScenarioManager* pScenarioMgr = ZApplication::GetStageInterface()->GetChallengeQuestScenario();
    	if (!pScenarioMgr) { _ASSERT(0); return false; }
    	MNewQuestScenario* pScenario = pScenarioMgr->GetScenario(szScenarioName);
    	if (!pScenario) { _ASSERT(0); return false; }
    
    	int numSector = pScenario->GetNumSector();
    	for (int i=0; i<numSector; ++i)
    	{
    		MNewQuestSector* pSector = pScenario->GetSector(i);
    		if (!pSector)  { _ASSERT(0); return false; }
    
    		const char* szMapName = pSector->GetMapName();
    		_ASSERT(0 != strlen(szMapName));
    		ZGetWorldManager()->AddWorld(szMapName);
    	}
    
    	return true;
    }
    
    int ZRuleQuestChallenge::GetRoundMax()
    {
    	if (!m_pScenario) {
    		_ASSERT(0);
    		return 1;
    	}
    
    	return m_pScenario->GetNumSector();
    }
    
    
    bool ZRuleQuestChallenge::Init()
    {
    	//todok quest °ÔÀÓÀ» ÇÒ¶§¸¶´Ù »õ·Î ·ÎµùÇÏ´Â °ÍÀ» °³¼±ÇÏÀÚ.
    
    	// npc action Àбâ
    	string strActionFile("system/zactoraction.xml");
    #ifndef _DEBUG
    	strActionFile += ".mef";
    #endif
    	if (!m_pActorActionMgr->ReadXml(ZApplication::GetFileSystem(), strActionFile.c_str()))
    	{
    		mlog("Error while Load %s\n", strActionFile.c_str());
    		return false;
    	}
    
    	// npc fsm ±â¹Ý AI Àбâ
    	string strAIFSMFile("system/aifsm.xml");
    #ifndef _DEBUG
    	strAIFSMFile += ".mef";
    #endif
    	vector<ZFSM*> vecFSM;
    	ZFSMParser fsmParser;
    	if (!fsmParser.ReadXml(ZApplication::GetFileSystem(), strAIFSMFile.c_str(), vecFSM, m_pActorActionMgr))
    	{
    		mlog("Error while Load %s\n", strAIFSMFile.c_str());
    		return false;
    	}
    	m_pFsmManager->AddFsm(&vecFSM[0], (unsigned int)vecFSM.size());
    
    
    	// npc ¸ðµ¨ Àбâ
    	string strNpcMeshListFile("model/npc2.xml");
    #ifndef _DEBUG
    	strNpcMeshListFile += ".mef";
    #endif	
    	if (ZGetNpcMeshMgr()->LoadXmlList(strNpcMeshListFile.c_str()) == -1)
    	{
    		mlog("Error while Load %s\n", strNpcMeshListFile.c_str());
    		return false;
    	}
    
    	// npc Á¤ÀÇ Àбâ
    	string strNpcDefFile("system/npc2.xml");
    #ifndef _DEBUG
    	strNpcDefFile += ".mef";
    #endif
    	if (!m_pActorDefMgr->ReadXml(ZApplication::GetFileSystem(), strNpcDefFile.c_str()))
    	{
    		mlog("Error while Read %s\n", strNpcDefFile.c_str());
    		return false;
    	}
    
    
    	// ÀÌ Äù½ºÆ®ÀÇ ½Ã³ª¸®¿À °´Ã¼ ¾Ë¾ÆµÎ±â
    	const char* szScenarioName = ZGetGameClient()->GetMatchStageSetting()->GetMapName();
    	
    	MNewQuestScenarioManager* pScenarioMgr = ZApplication::GetStageInterface()->GetChallengeQuestScenario();
    	if (!pScenarioMgr) { _ASSERT(0); return false; }
    	MNewQuestScenario* pScenario = pScenarioMgr->GetScenario(szScenarioName);
    	if (!pScenario) { _ASSERT(0); return false; }
    
    	m_pScenario = pScenario;
    
    	m_nCurrSector = 0;
    
    	return true;
    }
    
    void ZRuleQuestChallenge::OnUpdate( float fDelta )
    {
    	if (ZGetGame() == NULL) return;
    
    	//MUID uidChar(ZGetMyUID());
    	//static int tempUid = 111;
    	//MUID uidNPC(1,tempUid);
    	////unsigned char nNPCType, nPositionIndex;
    
    	////pCommand->GetParameter(&uidChar,			0, MPT_UID);
    	////pCommand->GetParameter(&uidNPC,				1, MPT_UID);
    	////pCommand->GetParameter(&nNPCType,			2, MPT_UCHAR);
    	////pCommand->GetParameter(&nPositionIndex,		3, MPT_UCHAR);
    
    	//// ÀÏ´Ü Á×Àº ³ðÀº Á¦°ÅÇÑ´Ù
    	//ZNPCObjectMap* pNpcMap = ZGetObjectManager()->GetNPCObjectMap();
    	//for (ZNPCObjectMap::iterator it=pNpcMap->begin(); it!=pNpcMap->end(); )
    	//{
    	//	if (it->second->IsDie())
    	//	{
    	//		delete it->second;
    	//		it = pNpcMap->erase(it);
    	//	}
    	//	else
    	//		++it;
    	//}
    
    	//// µ¿½Ã ½ºÆù ¼ö¸¦ Á¦ÇÑÇÑ´Ù
    	//if (5 <= pNpcMap->size())
    	//	return;
    
    	//tempUid++;
    	//uidNPC = MUID(1, tempUid);
    
    	///*
    	//MQUEST_NPC NPCType = NPC_GOBLIN_GUNNER;
    
    	////ZMapSpawnType nSpawnType = ZMST_NPC_MELEE;
    
    	//ZMapSpawnManager* pMSM = ZGetGame()->GetMapDesc()->GetSpawnManager();
    
    	//MQuestNPCInfo* pNPCInfo = ZGetQuest()->GetNPCCatalogue()->GetInfo(NPCType);
    	////MQuestNPCInfo* pNPCInfo = GetNPCInfo(NPCType);
    	//if (pNPCInfo == NULL) return;
    
    	//ZMapSpawnData* pSpawnData = pMSM->GetSpawnData(ZMST_NPC_MELEE, 0);
    
    	//rvector NPCPos = rvector(0,0,0);
    	//rvector NPCDir = rvector(1,0,0);
    
    	//if (pSpawnData)
    	//{
    	//	NPCPos = pSpawnData->m_Pos;
    	//	NPCDir = pSpawnData->m_Dir;
    	//}*/
    
    	//bool bMyControl = (uidChar == ZGetMyUID());
    	//SpawnActor("knifeman", uidNPC, bMyControl);
    
    
    	//todokkkkk Á×Àº ¿£ÇǾ¾ ¼­¹ö¿¡ ¾Ë¸²
    }
    
    void ZRuleQuestChallenge::OnSetRoundState( MMATCH_ROUNDSTATE roundState )
    {
    	switch(roundState) 
    	{
    	case MMATCH_ROUNDSTATE_PREPARE: 
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_PRE_COUNTDOWN:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_COUNTDOWN : 
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_PLAY:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_FINISH:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_EXIT:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_FREE:
    		{
    		}
    		break;
    	};
    }
    
    float ZRuleQuestChallenge::FilterDelayedCommand( MCommand* pCommand )
    {
    	switch (pCommand->GetID())
    	{
    	case MC_NEWQUEST_PEER_NPC_ATTACK_MELEE:	//todok ÀÌÁ¦ »ç¿ëÇÏÁö ¾ÊÀ½
    		{
    			char szActionName[64];	//todokkkk ¾×¼Ç À̸§À» º¸³»Áö ¸»°í Á¤¼ö°°Àº È¿À²ÀûÀÎ °ªÀ¸·Î ±¸º°ÇÒ¼ö ÀÖ°Ô ÇÏÀÚ
    			pCommand->GetParameter(szActionName,	1, MPT_STR, sizeof(szActionName));
    
    			IActorAction* pAction = m_pActorActionMgr->GetAction(szActionName);
    			if (!pAction) { _ASSERT(0); break; }
    
    			const ZActorActionMeleeShot* pMeleeShot = pAction->GetMeleeShot();
    			return pMeleeShot->GetDelay();
    		}
    	}
    
    	return 0;
    }
    
    bool ZRuleQuestChallenge::OnCommand( MCommand* pCommand )
    {
    	switch (pCommand->GetID())
    	{
    	case MC_NEWQUEST_PEER_NPC_ATTACK_MELEE:	//todok ÀÌÁ¦ »ç¿ëÇÏÁö ¾ÊÀ½
    		{
    			MUID uidNpc;
    			char szActionName[64];	//todokkkk ¾×¼Ç À̸§À» º¸³»Áö ¸»°í Á¤¼ö°°Àº È¿À²ÀûÀÎ °ªÀ¸·Î ±¸º°ÇÒ¼ö ÀÖ°Ô ÇÏÀÚ
    			pCommand->GetParameter(&uidNpc, 0, MPT_UID);
    			pCommand->GetParameter(szActionName,	1, MPT_STR, sizeof(szActionName));
    
    			ZActorBase* pActor = ZGetObjectManager()->GetNPCObject(uidNpc);
    			ZActorWithFSM* pActorWithFSM = MDynamicCast(ZActorWithFSM, pActor);
    			if (pActorWithFSM)
    			{
    				pActorWithFSM->OnPeerMeleeShot(szActionName);
    			}
    
    			return true;
    		}
    	case MC_NEWQUEST_NPC_SPAWN:
    		{
    			MUID uidController;
    			MUID uidNpc;
    			char szActorDefName[128];
    			unsigned char nCustomSpawnTypeIndex, nSpawnIndex;
    			pCommand->GetParameter(&uidController,	0, MPT_UID);
    			pCommand->GetParameter(&uidNpc,			1, MPT_UID);
    			pCommand->GetParameter(szActorDefName,	2, MPT_STR, sizeof(szActorDefName));
    			pCommand->GetParameter(&nCustomSpawnTypeIndex,	3, MPT_UCHAR);
    			pCommand->GetParameter(&nSpawnIndex,			4, MPT_UCHAR);
    
    			SpawnActor(szActorDefName, uidNpc, nCustomSpawnTypeIndex, nSpawnIndex, ZGetMyUID()==uidController);
    			return true;
    		}
    
    	case MC_NEWQUEST_NPC_DEAD:
    		{
    			MUID uidKiller, uidNPC;
    
    			pCommand->GetParameter(&uidKiller,	0, MPT_UID);
    			pCommand->GetParameter(&uidNPC,		1, MPT_UID);
    
    			ZActorWithFSM* pActor = (ZActorWithFSM*)ZGetObjectManager()->GetNPCObject(uidNPC);
    			if (pActor)
    			{
    				ZGetObjectManager()->Delete(pActor);
    
    				//todok ¾Æ·¡ ÁÖ¼® ±¸ÇöÇØÁà¾ß ÇÔ
    				/*m_GameInfo.IncreaseNPCKilled();
    
    				ZCharacter* pCharacter = (ZCharacter*) ZGetCharacterManager()->Find(uidKiller);
    				if (pCharacter)
    				{
    					ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pCharacter->GetModule(ZMID_QUESTSTATUS);
    					if (pMod)
    					{
    						pMod->AddKills();
    					}
    				}*/
    			}
    			return true;
    		}
    
    	case MC_NEWQUEST_MOVE_TO_NEXT_SECTOR:
    		{
    			MoveToNextSector();
    			return true;
    		}
    
    	case MC_NEWQUEST_PEER_NPC_BASICINFO:
    		{
    			MCommandParameter* pParam = pCommand->GetParameter(0);
    			if(pParam->GetType()!=MPT_BLOB)
    			{
    				_ASSERT(0); break;
    			}
    
    			ZACTOR_WITHFSM_BASICINFO* pbi= (ZACTOR_WITHFSM_BASICINFO*)pParam->GetPointer();
    			ZActorWithFSM* pActor = (ZActorWithFSM*)ZGetObjectManager()->GetNPCObject(pbi->uidNPC);
    			if (pActor)
    			{
    				pActor->OnBasicInfo(pbi);
    			}
    
    			return true;
    		}
    	case MC_NEWQUEST_PEER_NPC_ACTION_EXECUTE:
    		{
    			MUID uidNpc;
    			int nActionIndex;
    			pCommand->GetParameter(&uidNpc, 0, MPT_UID);
    			pCommand->GetParameter(&nActionIndex, 1, MPT_INT, sizeof(nActionIndex));
    
    			ZActorBase* pActor = ZGetObjectManager()->GetNPCObject(uidNpc);
    			ZActorWithFSM* pActorWithFSM = MDynamicCast(ZActorWithFSM, pActor);
    			if (pActorWithFSM)
    			{
    				pActorWithFSM->OnPeerActionExecute(nActionIndex);
    			}
    
    			return true;
    		}
    	}
    
    	return false;
    }
    
    void ZRuleQuestChallenge::SpawnActor(const char* szActorDefName, MUID& uid, int nCustomSpawnTypeIndex, int nSpawnIndex, bool bMyControl)
    {
    	rvector pos(0,0,0);
    	rvector dir(1,0,0);
    
    	ZMapSpawnManager* pMSM = ZGetGame()->GetMapDesc()->GetSpawnManager();
    	if (pMSM)
    	{
    		ZMapSpawnData* pSpawnData = pMSM->GetCustomSpawnData(nCustomSpawnTypeIndex, nSpawnIndex);
    		if (pSpawnData)
    		{
    			pos = pSpawnData->m_Pos;
    			dir = pSpawnData->m_Dir;
    		}
    	}
    
    	MActorDef* pActorDef = m_pActorDefMgr->GetDef(szActorDefName);
    	if (!pActorDef) 
    	{
    		mlog("ERROR : cannot found actordef:\'%s\'\n", szActorDefName);
    		_ASSERT(0); 
    		return; 
    	}
    
    	// ¸¸¾à ¸®¼Ò½º ·ÎµùÀ» ¾ÈÇßÀ¸¸é ·Îµå - ÀÌ·²ÀÏÀº Å×½ºÆ®»©°ï ¾ø¾î¾ßÇÑ´Ù.
    	RMesh* pNPCMesh = ZGetNpcMeshMgr()->Get(pActorDef->GetName());
    	if (pNPCMesh)
    	{
    		if (!pNPCMesh->m_isMeshLoaded)
    		{
    			ZGetNpcMeshMgr()->Load(pActorDef->GetName());
    			ZGetNpcMeshMgr()->ReloadAllAnimation();
    		}
    	}
    
    	ZActorWithFSM* pNewActor = new ZActorWithFSM(ZGetGame(), m_pActorActionMgr);
    	pNewActor->InitWithActorDef(pActorDef, m_pFsmManager);
    	pNewActor->SetUID(uid);
    	pNewActor->SetPosition(pos);
    	pNewActor->SetDirection(dir);
    	pNewActor->SetMyControl(bMyControl);
    
    	ZGetObjectManager()->Add(pNewActor);
    	ZGetEffectManager()->AddReBirthEffect(pNewActor->GetPosition());
    }
    
    void ZRuleQuestChallenge::MoveToNextSector()
    {
    	ZCharacter *pMyChar = ZGetGame()->m_pMyCharacter;
    	pMyChar->InitStatus();
    
    	// Àü È­¸é¿¡¼­ ³²¾ÆÀÖÀ» ¼ö Àִ ź°ú ÀÌÆåÆ®¸¦ Á¦°Å
    	ZGetEffectManager()->Clear();
    	ZGetGame()->m_WeaponManager.Clear();
    
    	// »õ·Î¿î ¿ùµå·Î À̵¿!!
    	++m_nCurrSector;	//todok ÇöÀç ¼½ÅͰ¡ ¸¶Áö¸· ¼½ÅͶó¸é? ±¦ÂúÀº°Ç°¡..
    	ZGetWorldManager()->SetCurrent(m_nCurrSector);
    	//todok ¶ó¿îµå ÇüÅ·Π·êÀ» ±¸ÇöÇ߱⠶§¹®¿¡ ÀÌ ÄÚµå´Â ÀÌÁ¦ ÇÊ¿ä ¾ø´Âµí
    	//// À̹ø¿¡ À̵¿ÇÒ Ä³¸¯ÅÍÀÇ À§Ä¡
    	//int nPosIndex = ZGetCharacterManager()->GetCharacterIndex(pMyChar->GetUID(), false);
    	//if (nPosIndex < 0) nPosIndex=0;
    	//ZMapSpawnData* pSpawnData = ZGetWorld()->GetDesc()->GetSpawnManager()->GetSoloData(nPosIndex);
    	//// »õ ÁÂÇ¥·Î À̵¿
    	//if (pSpawnData!=NULL && pMyChar!=NULL)
    	//{
    	//	pMyChar->SetPosition(pSpawnData->m_Pos);
    	//	pMyChar->SetDirection(pSpawnData->m_Dir);
    	//	ZGetEffectManager()->AddReBirthEffect(pSpawnData->m_Pos);
    	//}
    
    	//todok quest Àӽ÷ΠÁÖ¼®ÇÔ ±¸ÇöÇØ¾ß ÇÑ´Ù
    	//// ¾Æ¹«µµ º¸¿©ÁÖÁö ¾Ê´Â´Ù.
    	//for(ZCharacterManager::iterator i = ZGetCharacterManager()->begin();i!=ZGetCharacterManager()->end();i++)
    	//{
    	//	i->second->SetVisible(false);
    	//}
    
    	//// ko¼ö µ¿±âÈ­
    	//ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pMyChar->GetModule(ZMID_QUESTSTATUS);
    	//if (pMod)
    	//{
    	//	int nKills = pMod->GetKills();
    	//	ZGetScreenEffectManager()->SetKO(nKills);
    	//}
    }
    ;)
    So, that's the complete Challenge Quest source?

  9. #84
    Valued Member Kahazard is offline
    MemberRank
    Oct 2011 Join Date
    126Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Quote Originally Posted by Vusion View Post
    So, that's the complete Challenge Quest source?
    no, i think is ZRuleQuestChallenge.cpp from match server.

  10. #85
    Gunz Developer / Support _System32_ is offline
    MemberRank
    Feb 2008 Join Date
    VenezuelaLocation
    583Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    For us it is happiness, to have in our hands. The possibility of improving private platform.

    We do it for pleasure, or perhaps because we really want to learn a little more.

    Thank you for your contribution Dawson.

  11. #86
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Quote Originally Posted by ThePhailure772 View Post
    Code:
    #include "stdafx.h"
    #include "ZRuleQuestChallenge.h"
    #include "ZMatch.h"
    #include "MActorDef.h"
    #include "MNewQuestScenario.h"
    #include "ZFSMManager.h"
    #include "ZActorActionManager.h"
    #include "ZActorAction.h"
    #include "ZActorWithFSM.h"
    #include "ZApplication.h"
    #include "ZFSMManager.h"
    #include "ZFSMParser.h"
    #include "ZFSM.h"
    
    ZRuleQuestChallenge::ZRuleQuestChallenge(ZMatch* pMatch) 
     : ZRule(pMatch)
     , m_pFsmManager(new ZFSMManager)
     , m_pActorDefMgr(new MActorDefManager)
     , m_pActorActionMgr(new ZActorActionManager)
     , m_pScenario(NULL)
     , m_nCurrSector(0)
    {
    }
    
    ZRuleQuestChallenge::~ZRuleQuestChallenge()
    {
    	delete m_pFsmManager;
    	delete m_pActorDefMgr;
    	delete m_pActorActionMgr;
    }
    
    bool ZRuleQuestChallenge::LoadScenarioMap(const char* szScenarioName)
    {
    	MNewQuestScenarioManager* pScenarioMgr = ZApplication::GetStageInterface()->GetChallengeQuestScenario();
    	if (!pScenarioMgr) { _ASSERT(0); return false; }
    	MNewQuestScenario* pScenario = pScenarioMgr->GetScenario(szScenarioName);
    	if (!pScenario) { _ASSERT(0); return false; }
    
    	int numSector = pScenario->GetNumSector();
    	for (int i=0; i<numSector; ++i)
    	{
    		MNewQuestSector* pSector = pScenario->GetSector(i);
    		if (!pSector)  { _ASSERT(0); return false; }
    
    		const char* szMapName = pSector->GetMapName();
    		_ASSERT(0 != strlen(szMapName));
    		ZGetWorldManager()->AddWorld(szMapName);
    	}
    
    	return true;
    }
    
    int ZRuleQuestChallenge::GetRoundMax()
    {
    	if (!m_pScenario) {
    		_ASSERT(0);
    		return 1;
    	}
    
    	return m_pScenario->GetNumSector();
    }
    
    
    bool ZRuleQuestChallenge::Init()
    {
    	//todok quest °ÔÀÓÀ» ÇÒ¶§¸¶´Ù »õ·Î ·ÎµùÇÏ´Â °ÍÀ» °³¼±ÇÏÀÚ.
    
    	// npc action Àбâ
    	string strActionFile("system/zactoraction.xml");
    #ifndef _DEBUG
    	strActionFile += ".mef";
    #endif
    	if (!m_pActorActionMgr->ReadXml(ZApplication::GetFileSystem(), strActionFile.c_str()))
    	{
    		mlog("Error while Load %s\n", strActionFile.c_str());
    		return false;
    	}
    
    	// npc fsm ±â¹Ý AI Àбâ
    	string strAIFSMFile("system/aifsm.xml");
    #ifndef _DEBUG
    	strAIFSMFile += ".mef";
    #endif
    	vector<ZFSM*> vecFSM;
    	ZFSMParser fsmParser;
    	if (!fsmParser.ReadXml(ZApplication::GetFileSystem(), strAIFSMFile.c_str(), vecFSM, m_pActorActionMgr))
    	{
    		mlog("Error while Load %s\n", strAIFSMFile.c_str());
    		return false;
    	}
    	m_pFsmManager->AddFsm(&vecFSM[0], (unsigned int)vecFSM.size());
    
    
    	// npc ¸ðµ¨ Àбâ
    	string strNpcMeshListFile("model/npc2.xml");
    #ifndef _DEBUG
    	strNpcMeshListFile += ".mef";
    #endif	
    	if (ZGetNpcMeshMgr()->LoadXmlList(strNpcMeshListFile.c_str()) == -1)
    	{
    		mlog("Error while Load %s\n", strNpcMeshListFile.c_str());
    		return false;
    	}
    
    	// npc Á¤ÀÇ Àбâ
    	string strNpcDefFile("system/npc2.xml");
    #ifndef _DEBUG
    	strNpcDefFile += ".mef";
    #endif
    	if (!m_pActorDefMgr->ReadXml(ZApplication::GetFileSystem(), strNpcDefFile.c_str()))
    	{
    		mlog("Error while Read %s\n", strNpcDefFile.c_str());
    		return false;
    	}
    
    
    	// ÀÌ Äù½ºÆ®ÀÇ ½Ã³ª¸®¿À °´Ã¼ ¾Ë¾ÆµÎ±â
    	const char* szScenarioName = ZGetGameClient()->GetMatchStageSetting()->GetMapName();
    	
    	MNewQuestScenarioManager* pScenarioMgr = ZApplication::GetStageInterface()->GetChallengeQuestScenario();
    	if (!pScenarioMgr) { _ASSERT(0); return false; }
    	MNewQuestScenario* pScenario = pScenarioMgr->GetScenario(szScenarioName);
    	if (!pScenario) { _ASSERT(0); return false; }
    
    	m_pScenario = pScenario;
    
    	m_nCurrSector = 0;
    
    	return true;
    }
    
    void ZRuleQuestChallenge::OnUpdate( float fDelta )
    {
    	if (ZGetGame() == NULL) return;
    
    	//MUID uidChar(ZGetMyUID());
    	//static int tempUid = 111;
    	//MUID uidNPC(1,tempUid);
    	////unsigned char nNPCType, nPositionIndex;
    
    	////pCommand->GetParameter(&uidChar,			0, MPT_UID);
    	////pCommand->GetParameter(&uidNPC,				1, MPT_UID);
    	////pCommand->GetParameter(&nNPCType,			2, MPT_UCHAR);
    	////pCommand->GetParameter(&nPositionIndex,		3, MPT_UCHAR);
    
    	//// ÀÏ´Ü Á×Àº ³ðÀº Á¦°ÅÇÑ´Ù
    	//ZNPCObjectMap* pNpcMap = ZGetObjectManager()->GetNPCObjectMap();
    	//for (ZNPCObjectMap::iterator it=pNpcMap->begin(); it!=pNpcMap->end(); )
    	//{
    	//	if (it->second->IsDie())
    	//	{
    	//		delete it->second;
    	//		it = pNpcMap->erase(it);
    	//	}
    	//	else
    	//		++it;
    	//}
    
    	//// µ¿½Ã ½ºÆù ¼ö¸¦ Á¦ÇÑÇÑ´Ù
    	//if (5 <= pNpcMap->size())
    	//	return;
    
    	//tempUid++;
    	//uidNPC = MUID(1, tempUid);
    
    	///*
    	//MQUEST_NPC NPCType = NPC_GOBLIN_GUNNER;
    
    	////ZMapSpawnType nSpawnType = ZMST_NPC_MELEE;
    
    	//ZMapSpawnManager* pMSM = ZGetGame()->GetMapDesc()->GetSpawnManager();
    
    	//MQuestNPCInfo* pNPCInfo = ZGetQuest()->GetNPCCatalogue()->GetInfo(NPCType);
    	////MQuestNPCInfo* pNPCInfo = GetNPCInfo(NPCType);
    	//if (pNPCInfo == NULL) return;
    
    	//ZMapSpawnData* pSpawnData = pMSM->GetSpawnData(ZMST_NPC_MELEE, 0);
    
    	//rvector NPCPos = rvector(0,0,0);
    	//rvector NPCDir = rvector(1,0,0);
    
    	//if (pSpawnData)
    	//{
    	//	NPCPos = pSpawnData->m_Pos;
    	//	NPCDir = pSpawnData->m_Dir;
    	//}*/
    
    	//bool bMyControl = (uidChar == ZGetMyUID());
    	//SpawnActor("knifeman", uidNPC, bMyControl);
    
    
    	//todokkkkk Á×Àº ¿£ÇǾ¾ ¼­¹ö¿¡ ¾Ë¸²
    }
    
    void ZRuleQuestChallenge::OnSetRoundState( MMATCH_ROUNDSTATE roundState )
    {
    	switch(roundState) 
    	{
    	case MMATCH_ROUNDSTATE_PREPARE: 
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_PRE_COUNTDOWN:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_COUNTDOWN : 
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_PLAY:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_FINISH:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_EXIT:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_FREE:
    		{
    		}
    		break;
    	};
    }
    
    float ZRuleQuestChallenge::FilterDelayedCommand( MCommand* pCommand )
    {
    	switch (pCommand->GetID())
    	{
    	case MC_NEWQUEST_PEER_NPC_ATTACK_MELEE:	//todok ÀÌÁ¦ »ç¿ëÇÏÁö ¾ÊÀ½
    		{
    			char szActionName[64];	//todokkkk ¾×¼Ç À̸§À» º¸³»Áö ¸»°í Á¤¼ö°°Àº È¿À²ÀûÀÎ °ªÀ¸·Î ±¸º°ÇÒ¼ö ÀÖ°Ô ÇÏÀÚ
    			pCommand->GetParameter(szActionName,	1, MPT_STR, sizeof(szActionName));
    
    			IActorAction* pAction = m_pActorActionMgr->GetAction(szActionName);
    			if (!pAction) { _ASSERT(0); break; }
    
    			const ZActorActionMeleeShot* pMeleeShot = pAction->GetMeleeShot();
    			return pMeleeShot->GetDelay();
    		}
    	}
    
    	return 0;
    }
    
    bool ZRuleQuestChallenge::OnCommand( MCommand* pCommand )
    {
    	switch (pCommand->GetID())
    	{
    	case MC_NEWQUEST_PEER_NPC_ATTACK_MELEE:	//todok ÀÌÁ¦ »ç¿ëÇÏÁö ¾ÊÀ½
    		{
    			MUID uidNpc;
    			char szActionName[64];	//todokkkk ¾×¼Ç À̸§À» º¸³»Áö ¸»°í Á¤¼ö°°Àº È¿À²ÀûÀÎ °ªÀ¸·Î ±¸º°ÇÒ¼ö ÀÖ°Ô ÇÏÀÚ
    			pCommand->GetParameter(&uidNpc, 0, MPT_UID);
    			pCommand->GetParameter(szActionName,	1, MPT_STR, sizeof(szActionName));
    
    			ZActorBase* pActor = ZGetObjectManager()->GetNPCObject(uidNpc);
    			ZActorWithFSM* pActorWithFSM = MDynamicCast(ZActorWithFSM, pActor);
    			if (pActorWithFSM)
    			{
    				pActorWithFSM->OnPeerMeleeShot(szActionName);
    			}
    
    			return true;
    		}
    	case MC_NEWQUEST_NPC_SPAWN:
    		{
    			MUID uidController;
    			MUID uidNpc;
    			char szActorDefName[128];
    			unsigned char nCustomSpawnTypeIndex, nSpawnIndex;
    			pCommand->GetParameter(&uidController,	0, MPT_UID);
    			pCommand->GetParameter(&uidNpc,			1, MPT_UID);
    			pCommand->GetParameter(szActorDefName,	2, MPT_STR, sizeof(szActorDefName));
    			pCommand->GetParameter(&nCustomSpawnTypeIndex,	3, MPT_UCHAR);
    			pCommand->GetParameter(&nSpawnIndex,			4, MPT_UCHAR);
    
    			SpawnActor(szActorDefName, uidNpc, nCustomSpawnTypeIndex, nSpawnIndex, ZGetMyUID()==uidController);
    			return true;
    		}
    
    	case MC_NEWQUEST_NPC_DEAD:
    		{
    			MUID uidKiller, uidNPC;
    
    			pCommand->GetParameter(&uidKiller,	0, MPT_UID);
    			pCommand->GetParameter(&uidNPC,		1, MPT_UID);
    
    			ZActorWithFSM* pActor = (ZActorWithFSM*)ZGetObjectManager()->GetNPCObject(uidNPC);
    			if (pActor)
    			{
    				ZGetObjectManager()->Delete(pActor);
    
    				//todok ¾Æ·¡ ÁÖ¼® ±¸ÇöÇØÁà¾ß ÇÔ
    				/*m_GameInfo.IncreaseNPCKilled();
    
    				ZCharacter* pCharacter = (ZCharacter*) ZGetCharacterManager()->Find(uidKiller);
    				if (pCharacter)
    				{
    					ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pCharacter->GetModule(ZMID_QUESTSTATUS);
    					if (pMod)
    					{
    						pMod->AddKills();
    					}
    				}*/
    			}
    			return true;
    		}
    
    	case MC_NEWQUEST_MOVE_TO_NEXT_SECTOR:
    		{
    			MoveToNextSector();
    			return true;
    		}
    
    	case MC_NEWQUEST_PEER_NPC_BASICINFO:
    		{
    			MCommandParameter* pParam = pCommand->GetParameter(0);
    			if(pParam->GetType()!=MPT_BLOB)
    			{
    				_ASSERT(0); break;
    			}
    
    			ZACTOR_WITHFSM_BASICINFO* pbi= (ZACTOR_WITHFSM_BASICINFO*)pParam->GetPointer();
    			ZActorWithFSM* pActor = (ZActorWithFSM*)ZGetObjectManager()->GetNPCObject(pbi->uidNPC);
    			if (pActor)
    			{
    				pActor->OnBasicInfo(pbi);
    			}
    
    			return true;
    		}
    	case MC_NEWQUEST_PEER_NPC_ACTION_EXECUTE:
    		{
    			MUID uidNpc;
    			int nActionIndex;
    			pCommand->GetParameter(&uidNpc, 0, MPT_UID);
    			pCommand->GetParameter(&nActionIndex, 1, MPT_INT, sizeof(nActionIndex));
    
    			ZActorBase* pActor = ZGetObjectManager()->GetNPCObject(uidNpc);
    			ZActorWithFSM* pActorWithFSM = MDynamicCast(ZActorWithFSM, pActor);
    			if (pActorWithFSM)
    			{
    				pActorWithFSM->OnPeerActionExecute(nActionIndex);
    			}
    
    			return true;
    		}
    	}
    
    	return false;
    }
    
    void ZRuleQuestChallenge::SpawnActor(const char* szActorDefName, MUID& uid, int nCustomSpawnTypeIndex, int nSpawnIndex, bool bMyControl)
    {
    	rvector pos(0,0,0);
    	rvector dir(1,0,0);
    
    	ZMapSpawnManager* pMSM = ZGetGame()->GetMapDesc()->GetSpawnManager();
    	if (pMSM)
    	{
    		ZMapSpawnData* pSpawnData = pMSM->GetCustomSpawnData(nCustomSpawnTypeIndex, nSpawnIndex);
    		if (pSpawnData)
    		{
    			pos = pSpawnData->m_Pos;
    			dir = pSpawnData->m_Dir;
    		}
    	}
    
    	MActorDef* pActorDef = m_pActorDefMgr->GetDef(szActorDefName);
    	if (!pActorDef) 
    	{
    		mlog("ERROR : cannot found actordef:\'%s\'\n", szActorDefName);
    		_ASSERT(0); 
    		return; 
    	}
    
    	// ¸¸¾à ¸®¼Ò½º ·ÎµùÀ» ¾ÈÇßÀ¸¸é ·Îµå - ÀÌ·²ÀÏÀº Å×½ºÆ®»©°ï ¾ø¾î¾ßÇÑ´Ù.
    	RMesh* pNPCMesh = ZGetNpcMeshMgr()->Get(pActorDef->GetName());
    	if (pNPCMesh)
    	{
    		if (!pNPCMesh->m_isMeshLoaded)
    		{
    			ZGetNpcMeshMgr()->Load(pActorDef->GetName());
    			ZGetNpcMeshMgr()->ReloadAllAnimation();
    		}
    	}
    
    	ZActorWithFSM* pNewActor = new ZActorWithFSM(ZGetGame(), m_pActorActionMgr);
    	pNewActor->InitWithActorDef(pActorDef, m_pFsmManager);
    	pNewActor->SetUID(uid);
    	pNewActor->SetPosition(pos);
    	pNewActor->SetDirection(dir);
    	pNewActor->SetMyControl(bMyControl);
    
    	ZGetObjectManager()->Add(pNewActor);
    	ZGetEffectManager()->AddReBirthEffect(pNewActor->GetPosition());
    }
    
    void ZRuleQuestChallenge::MoveToNextSector()
    {
    	ZCharacter *pMyChar = ZGetGame()->m_pMyCharacter;
    	pMyChar->InitStatus();
    
    	// Àü È­¸é¿¡¼­ ³²¾ÆÀÖÀ» ¼ö Àִ ź°ú ÀÌÆåÆ®¸¦ Á¦°Å
    	ZGetEffectManager()->Clear();
    	ZGetGame()->m_WeaponManager.Clear();
    
    	// »õ·Î¿î ¿ùµå·Î À̵¿!!
    	++m_nCurrSector;	//todok ÇöÀç ¼½ÅͰ¡ ¸¶Áö¸· ¼½ÅͶó¸é? ±¦ÂúÀº°Ç°¡..
    	ZGetWorldManager()->SetCurrent(m_nCurrSector);
    	//todok ¶ó¿îµå ÇüÅ·Π·êÀ» ±¸ÇöÇ߱⠶§¹®¿¡ ÀÌ ÄÚµå´Â ÀÌÁ¦ ÇÊ¿ä ¾ø´Âµí
    	//// À̹ø¿¡ À̵¿ÇÒ Ä³¸¯ÅÍÀÇ À§Ä¡
    	//int nPosIndex = ZGetCharacterManager()->GetCharacterIndex(pMyChar->GetUID(), false);
    	//if (nPosIndex < 0) nPosIndex=0;
    	//ZMapSpawnData* pSpawnData = ZGetWorld()->GetDesc()->GetSpawnManager()->GetSoloData(nPosIndex);
    	//// »õ ÁÂÇ¥·Î À̵¿
    	//if (pSpawnData!=NULL && pMyChar!=NULL)
    	//{
    	//	pMyChar->SetPosition(pSpawnData->m_Pos);
    	//	pMyChar->SetDirection(pSpawnData->m_Dir);
    	//	ZGetEffectManager()->AddReBirthEffect(pSpawnData->m_Pos);
    	//}
    
    	//todok quest Àӽ÷ΠÁÖ¼®ÇÔ ±¸ÇöÇØ¾ß ÇÑ´Ù
    	//// ¾Æ¹«µµ º¸¿©ÁÖÁö ¾Ê´Â´Ù.
    	//for(ZCharacterManager::iterator i = ZGetCharacterManager()->begin();i!=ZGetCharacterManager()->end();i++)
    	//{
    	//	i->second->SetVisible(false);
    	//}
    
    	//// ko¼ö µ¿±âÈ­
    	//ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pMyChar->GetModule(ZMID_QUESTSTATUS);
    	//if (pMod)
    	//{
    	//	int nKills = pMod->GetKills();
    	//	ZGetScreenEffectManager()->SetKO(nKills);
    	//}
    }
    ;)

    Your welcome.

  12. #87
    Enthusiast Yunuss is offline
    MemberRank
    Dec 2011 Join Date
    27Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Thank you, I was waiting for this release!

  13. #88
    Gregon13 OldSchoolGZ is offline
    MemberRank
    Jan 2012 Join Date
    CanadaLocation
    244Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Interesting looking forward to take a look at these files, it's been awhile since I've been here I have forgotten my password for my older accounts but all in all glad to be back

  14. #89
    Proficient Member DarkEagle is offline
    MemberRank
    May 2004 Join Date
    In your heartLocation
    177Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Who can write code for anti hook .dll files to .exe?
    please sharing it.
    thank you very much.

  15. #90
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: GunZ 1.5 (Summer of 2011) Source.

    Quote Originally Posted by ThePhailure772 View Post
    Code:
    #include "stdafx.h"
    #include "ZRuleQuestChallenge.h"
    #include "ZMatch.h"
    #include "MActorDef.h"
    #include "MNewQuestScenario.h"
    #include "ZFSMManager.h"
    #include "ZActorActionManager.h"
    #include "ZActorAction.h"
    #include "ZActorWithFSM.h"
    #include "ZApplication.h"
    #include "ZFSMManager.h"
    #include "ZFSMParser.h"
    #include "ZFSM.h"
    
    ZRuleQuestChallenge::ZRuleQuestChallenge(ZMatch* pMatch) 
     : ZRule(pMatch)
     , m_pFsmManager(new ZFSMManager)
     , m_pActorDefMgr(new MActorDefManager)
     , m_pActorActionMgr(new ZActorActionManager)
     , m_pScenario(NULL)
     , m_nCurrSector(0)
    {
    }
    
    ZRuleQuestChallenge::~ZRuleQuestChallenge()
    {
    	delete m_pFsmManager;
    	delete m_pActorDefMgr;
    	delete m_pActorActionMgr;
    }
    
    bool ZRuleQuestChallenge::LoadScenarioMap(const char* szScenarioName)
    {
    	MNewQuestScenarioManager* pScenarioMgr = ZApplication::GetStageInterface()->GetChallengeQuestScenario();
    	if (!pScenarioMgr) { _ASSERT(0); return false; }
    	MNewQuestScenario* pScenario = pScenarioMgr->GetScenario(szScenarioName);
    	if (!pScenario) { _ASSERT(0); return false; }
    
    	int numSector = pScenario->GetNumSector();
    	for (int i=0; i<numSector; ++i)
    	{
    		MNewQuestSector* pSector = pScenario->GetSector(i);
    		if (!pSector)  { _ASSERT(0); return false; }
    
    		const char* szMapName = pSector->GetMapName();
    		_ASSERT(0 != strlen(szMapName));
    		ZGetWorldManager()->AddWorld(szMapName);
    	}
    
    	return true;
    }
    
    int ZRuleQuestChallenge::GetRoundMax()
    {
    	if (!m_pScenario) {
    		_ASSERT(0);
    		return 1;
    	}
    
    	return m_pScenario->GetNumSector();
    }
    
    
    bool ZRuleQuestChallenge::Init()
    {
    	//todok quest °ÔÀÓÀ» ÇÒ¶§¸¶´Ù »õ·Î ·ÎµùÇÏ´Â °ÍÀ» °³¼±ÇÏÀÚ.
    
    	// npc action Àбâ
    	string strActionFile("system/zactoraction.xml");
    #ifndef _DEBUG
    	strActionFile += ".mef";
    #endif
    	if (!m_pActorActionMgr->ReadXml(ZApplication::GetFileSystem(), strActionFile.c_str()))
    	{
    		mlog("Error while Load %s\n", strActionFile.c_str());
    		return false;
    	}
    
    	// npc fsm ±â¹Ý AI Àбâ
    	string strAIFSMFile("system/aifsm.xml");
    #ifndef _DEBUG
    	strAIFSMFile += ".mef";
    #endif
    	vector<ZFSM*> vecFSM;
    	ZFSMParser fsmParser;
    	if (!fsmParser.ReadXml(ZApplication::GetFileSystem(), strAIFSMFile.c_str(), vecFSM, m_pActorActionMgr))
    	{
    		mlog("Error while Load %s\n", strAIFSMFile.c_str());
    		return false;
    	}
    	m_pFsmManager->AddFsm(&vecFSM[0], (unsigned int)vecFSM.size());
    
    
    	// npc ¸ðµ¨ Àбâ
    	string strNpcMeshListFile("model/npc2.xml");
    #ifndef _DEBUG
    	strNpcMeshListFile += ".mef";
    #endif	
    	if (ZGetNpcMeshMgr()->LoadXmlList(strNpcMeshListFile.c_str()) == -1)
    	{
    		mlog("Error while Load %s\n", strNpcMeshListFile.c_str());
    		return false;
    	}
    
    	// npc Á¤ÀÇ Àбâ
    	string strNpcDefFile("system/npc2.xml");
    #ifndef _DEBUG
    	strNpcDefFile += ".mef";
    #endif
    	if (!m_pActorDefMgr->ReadXml(ZApplication::GetFileSystem(), strNpcDefFile.c_str()))
    	{
    		mlog("Error while Read %s\n", strNpcDefFile.c_str());
    		return false;
    	}
    
    
    	// ÀÌ Äù½ºÆ®ÀÇ ½Ã³ª¸®¿À °´Ã¼ ¾Ë¾ÆµÎ±â
    	const char* szScenarioName = ZGetGameClient()->GetMatchStageSetting()->GetMapName();
    	
    	MNewQuestScenarioManager* pScenarioMgr = ZApplication::GetStageInterface()->GetChallengeQuestScenario();
    	if (!pScenarioMgr) { _ASSERT(0); return false; }
    	MNewQuestScenario* pScenario = pScenarioMgr->GetScenario(szScenarioName);
    	if (!pScenario) { _ASSERT(0); return false; }
    
    	m_pScenario = pScenario;
    
    	m_nCurrSector = 0;
    
    	return true;
    }
    
    void ZRuleQuestChallenge::OnUpdate( float fDelta )
    {
    	if (ZGetGame() == NULL) return;
    
    	//MUID uidChar(ZGetMyUID());
    	//static int tempUid = 111;
    	//MUID uidNPC(1,tempUid);
    	////unsigned char nNPCType, nPositionIndex;
    
    	////pCommand->GetParameter(&uidChar,			0, MPT_UID);
    	////pCommand->GetParameter(&uidNPC,				1, MPT_UID);
    	////pCommand->GetParameter(&nNPCType,			2, MPT_UCHAR);
    	////pCommand->GetParameter(&nPositionIndex,		3, MPT_UCHAR);
    
    	//// ÀÏ´Ü Á×Àº ³ðÀº Á¦°ÅÇÑ´Ù
    	//ZNPCObjectMap* pNpcMap = ZGetObjectManager()->GetNPCObjectMap();
    	//for (ZNPCObjectMap::iterator it=pNpcMap->begin(); it!=pNpcMap->end(); )
    	//{
    	//	if (it->second->IsDie())
    	//	{
    	//		delete it->second;
    	//		it = pNpcMap->erase(it);
    	//	}
    	//	else
    	//		++it;
    	//}
    
    	//// µ¿½Ã ½ºÆù ¼ö¸¦ Á¦ÇÑÇÑ´Ù
    	//if (5 <= pNpcMap->size())
    	//	return;
    
    	//tempUid++;
    	//uidNPC = MUID(1, tempUid);
    
    	///*
    	//MQUEST_NPC NPCType = NPC_GOBLIN_GUNNER;
    
    	////ZMapSpawnType nSpawnType = ZMST_NPC_MELEE;
    
    	//ZMapSpawnManager* pMSM = ZGetGame()->GetMapDesc()->GetSpawnManager();
    
    	//MQuestNPCInfo* pNPCInfo = ZGetQuest()->GetNPCCatalogue()->GetInfo(NPCType);
    	////MQuestNPCInfo* pNPCInfo = GetNPCInfo(NPCType);
    	//if (pNPCInfo == NULL) return;
    
    	//ZMapSpawnData* pSpawnData = pMSM->GetSpawnData(ZMST_NPC_MELEE, 0);
    
    	//rvector NPCPos = rvector(0,0,0);
    	//rvector NPCDir = rvector(1,0,0);
    
    	//if (pSpawnData)
    	//{
    	//	NPCPos = pSpawnData->m_Pos;
    	//	NPCDir = pSpawnData->m_Dir;
    	//}*/
    
    	//bool bMyControl = (uidChar == ZGetMyUID());
    	//SpawnActor("knifeman", uidNPC, bMyControl);
    
    
    	//todokkkkk Á×Àº ¿£ÇǾ¾ ¼­¹ö¿¡ ¾Ë¸²
    }
    
    void ZRuleQuestChallenge::OnSetRoundState( MMATCH_ROUNDSTATE roundState )
    {
    	switch(roundState) 
    	{
    	case MMATCH_ROUNDSTATE_PREPARE: 
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_PRE_COUNTDOWN:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_COUNTDOWN : 
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_PLAY:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_FINISH:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_EXIT:
    		{
    		}
    		break;
    	case MMATCH_ROUNDSTATE_FREE:
    		{
    		}
    		break;
    	};
    }
    
    float ZRuleQuestChallenge::FilterDelayedCommand( MCommand* pCommand )
    {
    	switch (pCommand->GetID())
    	{
    	case MC_NEWQUEST_PEER_NPC_ATTACK_MELEE:	//todok ÀÌÁ¦ »ç¿ëÇÏÁö ¾ÊÀ½
    		{
    			char szActionName[64];	//todokkkk ¾×¼Ç À̸§À» º¸³»Áö ¸»°í Á¤¼ö°°Àº È¿À²ÀûÀÎ °ªÀ¸·Î ±¸º°ÇÒ¼ö ÀÖ°Ô ÇÏÀÚ
    			pCommand->GetParameter(szActionName,	1, MPT_STR, sizeof(szActionName));
    
    			IActorAction* pAction = m_pActorActionMgr->GetAction(szActionName);
    			if (!pAction) { _ASSERT(0); break; }
    
    			const ZActorActionMeleeShot* pMeleeShot = pAction->GetMeleeShot();
    			return pMeleeShot->GetDelay();
    		}
    	}
    
    	return 0;
    }
    
    bool ZRuleQuestChallenge::OnCommand( MCommand* pCommand )
    {
    	switch (pCommand->GetID())
    	{
    	case MC_NEWQUEST_PEER_NPC_ATTACK_MELEE:	//todok ÀÌÁ¦ »ç¿ëÇÏÁö ¾ÊÀ½
    		{
    			MUID uidNpc;
    			char szActionName[64];	//todokkkk ¾×¼Ç À̸§À» º¸³»Áö ¸»°í Á¤¼ö°°Àº È¿À²ÀûÀÎ °ªÀ¸·Î ±¸º°ÇÒ¼ö ÀÖ°Ô ÇÏÀÚ
    			pCommand->GetParameter(&uidNpc, 0, MPT_UID);
    			pCommand->GetParameter(szActionName,	1, MPT_STR, sizeof(szActionName));
    
    			ZActorBase* pActor = ZGetObjectManager()->GetNPCObject(uidNpc);
    			ZActorWithFSM* pActorWithFSM = MDynamicCast(ZActorWithFSM, pActor);
    			if (pActorWithFSM)
    			{
    				pActorWithFSM->OnPeerMeleeShot(szActionName);
    			}
    
    			return true;
    		}
    	case MC_NEWQUEST_NPC_SPAWN:
    		{
    			MUID uidController;
    			MUID uidNpc;
    			char szActorDefName[128];
    			unsigned char nCustomSpawnTypeIndex, nSpawnIndex;
    			pCommand->GetParameter(&uidController,	0, MPT_UID);
    			pCommand->GetParameter(&uidNpc,			1, MPT_UID);
    			pCommand->GetParameter(szActorDefName,	2, MPT_STR, sizeof(szActorDefName));
    			pCommand->GetParameter(&nCustomSpawnTypeIndex,	3, MPT_UCHAR);
    			pCommand->GetParameter(&nSpawnIndex,			4, MPT_UCHAR);
    
    			SpawnActor(szActorDefName, uidNpc, nCustomSpawnTypeIndex, nSpawnIndex, ZGetMyUID()==uidController);
    			return true;
    		}
    
    	case MC_NEWQUEST_NPC_DEAD:
    		{
    			MUID uidKiller, uidNPC;
    
    			pCommand->GetParameter(&uidKiller,	0, MPT_UID);
    			pCommand->GetParameter(&uidNPC,		1, MPT_UID);
    
    			ZActorWithFSM* pActor = (ZActorWithFSM*)ZGetObjectManager()->GetNPCObject(uidNPC);
    			if (pActor)
    			{
    				ZGetObjectManager()->Delete(pActor);
    
    				//todok ¾Æ·¡ ÁÖ¼® ±¸ÇöÇØÁà¾ß ÇÔ
    				/*m_GameInfo.IncreaseNPCKilled();
    
    				ZCharacter* pCharacter = (ZCharacter*) ZGetCharacterManager()->Find(uidKiller);
    				if (pCharacter)
    				{
    					ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pCharacter->GetModule(ZMID_QUESTSTATUS);
    					if (pMod)
    					{
    						pMod->AddKills();
    					}
    				}*/
    			}
    			return true;
    		}
    
    	case MC_NEWQUEST_MOVE_TO_NEXT_SECTOR:
    		{
    			MoveToNextSector();
    			return true;
    		}
    
    	case MC_NEWQUEST_PEER_NPC_BASICINFO:
    		{
    			MCommandParameter* pParam = pCommand->GetParameter(0);
    			if(pParam->GetType()!=MPT_BLOB)
    			{
    				_ASSERT(0); break;
    			}
    
    			ZACTOR_WITHFSM_BASICINFO* pbi= (ZACTOR_WITHFSM_BASICINFO*)pParam->GetPointer();
    			ZActorWithFSM* pActor = (ZActorWithFSM*)ZGetObjectManager()->GetNPCObject(pbi->uidNPC);
    			if (pActor)
    			{
    				pActor->OnBasicInfo(pbi);
    			}
    
    			return true;
    		}
    	case MC_NEWQUEST_PEER_NPC_ACTION_EXECUTE:
    		{
    			MUID uidNpc;
    			int nActionIndex;
    			pCommand->GetParameter(&uidNpc, 0, MPT_UID);
    			pCommand->GetParameter(&nActionIndex, 1, MPT_INT, sizeof(nActionIndex));
    
    			ZActorBase* pActor = ZGetObjectManager()->GetNPCObject(uidNpc);
    			ZActorWithFSM* pActorWithFSM = MDynamicCast(ZActorWithFSM, pActor);
    			if (pActorWithFSM)
    			{
    				pActorWithFSM->OnPeerActionExecute(nActionIndex);
    			}
    
    			return true;
    		}
    	}
    
    	return false;
    }
    
    void ZRuleQuestChallenge::SpawnActor(const char* szActorDefName, MUID& uid, int nCustomSpawnTypeIndex, int nSpawnIndex, bool bMyControl)
    {
    	rvector pos(0,0,0);
    	rvector dir(1,0,0);
    
    	ZMapSpawnManager* pMSM = ZGetGame()->GetMapDesc()->GetSpawnManager();
    	if (pMSM)
    	{
    		ZMapSpawnData* pSpawnData = pMSM->GetCustomSpawnData(nCustomSpawnTypeIndex, nSpawnIndex);
    		if (pSpawnData)
    		{
    			pos = pSpawnData->m_Pos;
    			dir = pSpawnData->m_Dir;
    		}
    	}
    
    	MActorDef* pActorDef = m_pActorDefMgr->GetDef(szActorDefName);
    	if (!pActorDef) 
    	{
    		mlog("ERROR : cannot found actordef:\'%s\'\n", szActorDefName);
    		_ASSERT(0); 
    		return; 
    	}
    
    	// ¸¸¾à ¸®¼Ò½º ·ÎµùÀ» ¾ÈÇßÀ¸¸é ·Îµå - ÀÌ·²ÀÏÀº Å×½ºÆ®»©°ï ¾ø¾î¾ßÇÑ´Ù.
    	RMesh* pNPCMesh = ZGetNpcMeshMgr()->Get(pActorDef->GetName());
    	if (pNPCMesh)
    	{
    		if (!pNPCMesh->m_isMeshLoaded)
    		{
    			ZGetNpcMeshMgr()->Load(pActorDef->GetName());
    			ZGetNpcMeshMgr()->ReloadAllAnimation();
    		}
    	}
    
    	ZActorWithFSM* pNewActor = new ZActorWithFSM(ZGetGame(), m_pActorActionMgr);
    	pNewActor->InitWithActorDef(pActorDef, m_pFsmManager);
    	pNewActor->SetUID(uid);
    	pNewActor->SetPosition(pos);
    	pNewActor->SetDirection(dir);
    	pNewActor->SetMyControl(bMyControl);
    
    	ZGetObjectManager()->Add(pNewActor);
    	ZGetEffectManager()->AddReBirthEffect(pNewActor->GetPosition());
    }
    
    void ZRuleQuestChallenge::MoveToNextSector()
    {
    	ZCharacter *pMyChar = ZGetGame()->m_pMyCharacter;
    	pMyChar->InitStatus();
    
    	// Àü È­¸é¿¡¼­ ³²¾ÆÀÖÀ» ¼ö Àִ ź°ú ÀÌÆåÆ®¸¦ Á¦°Å
    	ZGetEffectManager()->Clear();
    	ZGetGame()->m_WeaponManager.Clear();
    
    	// »õ·Î¿î ¿ùµå·Î À̵¿!!
    	++m_nCurrSector;	//todok ÇöÀç ¼½ÅͰ¡ ¸¶Áö¸· ¼½ÅͶó¸é? ±¦ÂúÀº°Ç°¡..
    	ZGetWorldManager()->SetCurrent(m_nCurrSector);
    	//todok ¶ó¿îµå ÇüÅ·Π·êÀ» ±¸ÇöÇ߱⠶§¹®¿¡ ÀÌ ÄÚµå´Â ÀÌÁ¦ ÇÊ¿ä ¾ø´Âµí
    	//// À̹ø¿¡ À̵¿ÇÒ Ä³¸¯ÅÍÀÇ À§Ä¡
    	//int nPosIndex = ZGetCharacterManager()->GetCharacterIndex(pMyChar->GetUID(), false);
    	//if (nPosIndex < 0) nPosIndex=0;
    	//ZMapSpawnData* pSpawnData = ZGetWorld()->GetDesc()->GetSpawnManager()->GetSoloData(nPosIndex);
    	//// »õ ÁÂÇ¥·Î À̵¿
    	//if (pSpawnData!=NULL && pMyChar!=NULL)
    	//{
    	//	pMyChar->SetPosition(pSpawnData->m_Pos);
    	//	pMyChar->SetDirection(pSpawnData->m_Dir);
    	//	ZGetEffectManager()->AddReBirthEffect(pSpawnData->m_Pos);
    	//}
    
    	//todok quest Àӽ÷ΠÁÖ¼®ÇÔ ±¸ÇöÇØ¾ß ÇÑ´Ù
    	//// ¾Æ¹«µµ º¸¿©ÁÖÁö ¾Ê´Â´Ù.
    	//for(ZCharacterManager::iterator i = ZGetCharacterManager()->begin();i!=ZGetCharacterManager()->end();i++)
    	//{
    	//	i->second->SetVisible(false);
    	//}
    
    	//// ko¼ö µ¿±âÈ­
    	//ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pMyChar->GetModule(ZMID_QUESTSTATUS);
    	//if (pMod)
    	//{
    	//	int nKills = pMod->GetKills();
    	//	ZGetScreenEffectManager()->SetKO(nKills);
    	//}
    }
    ;)
    This is the full?



Advertisement