当前位置: 首页>>代码示例>>C++>>正文


C++ MCommand::AddParameter方法代码示例

本文整理汇总了C++中MCommand::AddParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ MCommand::AddParameter方法的具体用法?C++ MCommand::AddParameter怎么用?C++ MCommand::AddParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MCommand的用法示例。


在下文中一共展示了MCommand::AddParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Spawn

bool MMatchNPCManager::Spawn(MUID& uidNPC, MUID& uidController, unsigned char nSpawnPositionIndex)
{
	MMatchObject* pObject = MMatchServer::GetInstance()->GetObject(uidController);
	if ((pObject) && (m_pStage))
	{
		MMatchNPCObject* pNPCObject = GetNPCObject(uidNPC);
		if (pNPCObject)
		{
			SetNPCObjectToControllerInfo(uidController, pNPCObject);

			// route cmd
			MCommand* pCmd = MMatchServer::GetInstance()->CreateCommand(MC_QUEST_NPC_SPAWN, uidController);
			pCmd->AddParameter(new MCmdParamUID(uidController));
			pCmd->AddParameter(new MCmdParamUID(uidNPC));
			pCmd->AddParameter(new MCmdParamUChar((unsigned char)pNPCObject->GetType()));
			pCmd->AddParameter(new MCmdParamUChar((unsigned char)nSpawnPositionIndex));
			MMatchServer::GetInstance()->RouteToBattle(m_pStage->GetUID(), pCmd);


//			#ifdef _DEBUG
//			char text[256];
//			sprintf(text, "Spawn(%u:%u) - (%u:%u)\n", uidNPC.High, uidNPC.Low, uidController.High, uidController.Low);
//			OutputDebugString(text);
//			#endif

			return true;
		}
	}
	return false;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:30,代码来源:MMatchNPCObject.cpp

示例2: OnAsyncInsertEvent

void MMatchServer::OnAsyncInsertEvent( MAsyncJob* pJobResult )
{
	if( 0 == pJobResult )
		return;

	MAsyncDBJob_EventLog* pEventJob = 
		reinterpret_cast< MAsyncDBJob_EventLog* >( pJobResult );

	if( pEventJob->GetAnnounce().empty() )
		return;

	if( MASYNC_RESULT_SUCCEED == pJobResult->GetResult() )
	{
		MCommand* pCmd;
		AsyncEventObjVec::const_iterator it, end;
		const AsyncEventObjVec& EventObjList = pEventJob->GetEventObjList();

		end = EventObjList.end();
		for( it = EventObjList.begin(); it != end; ++it )
		{
			if( MUID(0, 0) != it->uidUser )
			{
				pCmd = CreateCommand( MC_MATCH_ANNOUNCE, it->uidUser );
				if( 0 != pCmd )
				{
					pCmd->AddParameter( new MCmdParamUInt(0) );
					pCmd->AddParameter( new MCmdParamStr(pEventJob->GetAnnounce().c_str()) );
					Post( pCmd );
				}
			}
		}
	}
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:33,代码来源:MMatchServer_Async.cpp

示例3: SendCommandByTunneling

void MMatchClient::SendCommandByTunneling(MCommand* pCommand)
{
	if (GetAllowTunneling() == false) {
	} else {
		if (GetBridgePeerFlag() == false) {
			MCommand* pCmd = CreateCommand(MC_AGENT_TUNNELING_TCP, GetAgentServerUID());
				pCmd->AddParameter(new MCmdParamUID(GetPlayerUID()));
				pCmd->AddParameter(new MCmdParamUID(pCommand->GetReceiverUID()));
				
				// Create Param : Command Blob ////
				if (!MakeTunnelingCommandBlob(pCmd, pCommand))
				{
					delete pCmd; pCmd=NULL; return;
				}
				///////////////////////////////////
			SendCommandToAgent(pCmd);
			delete pCmd;	// PACKETQUEUE 만들때까지 delete 임시로 사용
		} else {
			MCommand* pCmd = CreateCommand(MC_AGENT_TUNNELING_UDP, GetAgentServerUID());
				pCmd->AddParameter(new MCmdParamUID(GetPlayerUID()));
				pCmd->AddParameter(new MCmdParamUID(pCommand->GetReceiverUID()));
				// Create Param : Command Blob ////
				if (!MakeTunnelingCommandBlob(pCmd, pCommand))
				{
					delete pCmd; pCmd=NULL; return;
				}
				///////////////////////////////////
			SendCommandByUDP(pCmd, GetAgentIP(), GetAgentPeerPort());
			delete pCmd;	// PACKETQUEUE 만들때까지 delete 임시로 사용
		}
	}
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:32,代码来源:MMatchClient.cpp

示例4: AssignControl

bool MMatchNPCManager::AssignControl(MUID& uidNPC, MUID& uidPlayer)
{
	MMatchObject* pObject = MMatchServer::GetInstance()->GetObject(uidPlayer);
	if (!pObject) return false;
	MMatchNPCObject* pNPCObject = GetNPCObject(uidNPC);
	if (!pNPCObject) return false;

	// ControllerInfo 세팅
	SetNPCObjectToControllerInfo(uidPlayer, pNPCObject);

	// route cmd
	MCommand* pCmd = MMatchServer::GetInstance()->CreateCommand(MC_QUEST_ENTRUST_NPC_CONTROL, uidPlayer);
	pCmd->AddParameter(new MCmdParamUID(uidPlayer));
	pCmd->AddParameter(new MCmdParamUID(uidNPC));
	MMatchServer::GetInstance()->RouteToBattle(m_pStage->GetUID(), pCmd);

	#ifdef _DEBUG
	char text[256];
	sprintf(text, "AssignControl(%u:%u) - (%u:%u)\n", uidNPC.High, uidNPC.Low, uidPlayer.High, uidPlayer.Low);
	OutputDebugString(text);
	#endif


	return true;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:25,代码来源:MMatchNPCObject.cpp

示例5: OnAsyncBuyQuestItem

void MMatchServer::OnAsyncBuyQuestItem( MAsyncJob* pJobReslt )
{
	MAsyncDBJob_BuyQuestItem* pJob = (MAsyncDBJob_BuyQuestItem*)pJobReslt;
	if( MASYNC_RESULT_SUCCEED != pJob->GetResult() ){ return; }

	MMatchObject* pPlayer = GetObject( pJob->GetPlayerUID() );
	if( NULL == pPlayer ) {	return; }

	MMatchCharInfo* pCharInfo = pPlayer->GetCharInfo();
	if( NULL == pCharInfo ) { return; }

	// 아이템 거래 카운트 증가. 내부에서 디비 업데이트 결정.
	pCharInfo->GetDBQuestCachingData().IncreaseShopTradeCount(pJob->GetItemCount());
	pCharInfo->m_nBP -= pJob->GetPrice();

	
	MCommand* pNewCmd = CreateCommand( MC_MATCH_RESPONSE_BUY_QUEST_ITEM, pJob->GetPlayerUID() );
	if( 0 == pNewCmd ) {
		mlog( "MMatchServer::OnResponseBuyQuestItem - new Command실패.\n" );
		return;
	}
	
	pNewCmd->AddParameter( new MCmdParamInt(MOK) );
	pNewCmd->AddParameter( new MCmdParamInt(pCharInfo->m_nBP) );
	PostSafeQueue( pNewCmd );

	// 퀘스트 아이템 리스트를 다시 전송함.
	OnRequestCharQuestItemList( pJob->GetPlayerUID() );
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:29,代码来源:MMatchServer_Async.cpp

示例6: GetResultCmd

MCommand* MMatchObjectCacheBuilder::GetResultCmd(MATCHCACHEMODE nMode, MCommandCommunicator* pCmdComm)
{
	MCommand* pCmd = pCmdComm->CreateCommand(MC_MATCH_OBJECT_CACHE, MUID(0,0));
	pCmd->AddParameter(new MCmdParamUChar(nMode));
	int nCount = (int)m_ObjectCacheList.size();
	void* pCacheArray = MMakeBlobArray(sizeof(MMatchObjCache), nCount);
	int nIndex=0;
	for (MMatchObjCacheList::iterator itor=m_ObjectCacheList.begin(); itor!=m_ObjectCacheList.end(); itor++) {
		MMatchObjCache* pTrgCache = (MMatchObjCache*)MGetBlobArrayElement(pCacheArray, nIndex++);
		MMatchObjCache* pSrcCache = (*itor);

		
		pTrgCache->SetInfo(pSrcCache->GetUID(), pSrcCache->GetName(), pSrcCache->GetClanName(),
						   pSrcCache->GetLevel(), pSrcCache->GetUGrade(), pSrcCache->GetPGrade()
						   , pSrcCache->GetRank(), pSrcCache->GetKillCount(), pSrcCache->GetDeathCount(), pSrcCache->GetDTGrade() );

		pTrgCache->SetFlags(pSrcCache->GetFlags());
		pTrgCache->SetCLID(pSrcCache->GetCLID());
		pTrgCache->SetEmblemChecksum(pSrcCache->GetEmblemChecksum());

		pTrgCache->AssignCostume(pSrcCache->GetCostume());
	}
	pCmd->AddParameter(new MCmdParamBlob(pCacheArray, MGetBlobArraySize(pCacheArray)));
	MEraseBlobArray(pCacheArray);

	return pCmd;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:27,代码来源:MMatchObjCache.cpp

示例7: CastStageBridgePeer

void MMatchClient::CastStageBridgePeer(const MUID& uidChar, const MUID& uidStage)
{
	MCommand* pCmd = new MCommand(m_CommandManager.GetCommandDescByID(MC_MATCH_BRIDGEPEER), GetServerUID(), m_This);		
	pCmd->AddParameter(new MCommandParameterUID(uidChar));
	pCmd->AddParameter(new MCommandParameterUInt(0));	// 수신측에서 IP로 치환됨
	pCmd->AddParameter(new MCommandParameterUInt(0));		// 수신측에서 Port로 치환됨
	
	MSafeUDP* pSafeUDP = GetSafeUDP();
	SendCommandByUDP(pCmd, GetServerIP(), GetServerPeerPort());

	delete pCmd;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:12,代码来源:MMatchClient.cpp

示例8: OnReport

void MMatchServer::OnReport(const MUID& uidSender, const char* pName, const char* pReason)
{
	MMatchObject* pObj = GetObject(uidSender);

	if (pObj && IsAdminGrade(pObj))
	{
		char message[512];
		if (strstr(pName, "%") || strstr(pReason, "%")) return;
		sprintf(message, "[REPORT]<%s> - %s : %s", pObj->GetCharInfo()->m_szName, pName, pReason);
		MCommand* pCmd = CreateCommand(MC_MATCH_ANNOUNCE, MUID(0,0));
		pCmd->AddParameter(new MCommandParameterUInt(0));
		pCmd->AddParameter(new MCommandParameterString(message));
	}
}
开发者ID:kooksGame,项目名称:life-marvelous,代码行数:14,代码来源:MMatchServer_Admin.cpp

示例9: CastAgentPeerConnect

void MMatchClient::CastAgentPeerConnect()
{
	MCommand* pCmd = new MCommand(m_CommandManager.GetCommandDescByID(MC_AGENT_PEER_BINDUDP), GetAgentServerUID(), m_This);		
	pCmd->AddParameter(new MCommandParameterUID(GetPlayerUID()));
	pCmd->AddParameter(new MCommandParameterString("localhost"));
	pCmd->AddParameter(new MCommandParameterUInt(0));
	pCmd->AddParameter(new MCommandParameterString(""));	// 수신측에서 IP로 치환됨
	pCmd->AddParameter(new MCommandParameterUInt(0));		// 수신측에서 Port로 치환됨
	
	// MSafeUDP* pSafeUDP = GetSafeUDP();
	SendCommandByUDP(pCmd, GetAgentIP(), GetAgentPeerPort());

	delete pCmd;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:14,代码来源:MMatchClient.cpp

示例10: OnAsyncGetAccountItemList

void MMatchServer::OnAsyncGetAccountItemList( MAsyncJob* pJobResult )
{
	MAsyncDBJob_GetAccountItemList* pJob = (MAsyncDBJob_GetAccountItemList*)pJobResult;

	if( MASYNC_RESULT_SUCCEED != pJob->GetResult() ) {
		mlog("GetAccountItemList Failed\n");
		return;
	}

	MMatchObject* pObj = GetObject( pJob->GetPlayerUID() );
	if( NULL == pObj ) return;

	if( !pJob->GetExpiredAccountItems().empty() ) {
		ResponseExpiredItemIDList(pObj, pJob->GetExpiredAccountItems());
	}

	const int nAccountItemCount = pJob->GetAccountItemCount();

	if (nAccountItemCount > 0) {
		MAccountItemNode* accountItems = pJob->GetAccountItemList();
		if( NULL == accountItems ) return;

		MCommand* pNew = CreateCommand(MC_MATCH_RESPONSE_ACCOUNT_ITEMLIST, pObj->GetUID());

		// 갖고 있는 아이템 리스트 전송
		int nCountableAccountItemCount = 0;
		for(int i = 0; i < nAccountItemCount; i++ ) {
			if( accountItems[i].nCount > 0 && accountItems[i].nItemID > 0 ) { 
				nCountableAccountItemCount++; 
			}
		}

		void* pItemArray = MMakeBlobArray(sizeof(MTD_AccountItemNode), nCountableAccountItemCount);		

		int nIndex = 0;
		for (int i = 0; i < nAccountItemCount; i++)
		{
			if( accountItems[i].nItemID == 0 ) continue;
			MTD_AccountItemNode* pItemNode = (MTD_AccountItemNode*)MGetBlobArrayElement(pItemArray, nIndex);			

			_ASSERTE( ((NULL != MGetMatchItemDescMgr()->GetItemDesc(accountItems[i].nItemID)) 
				|| (NULL != m_GambleMachine.GetGambleItemByGambleItemID(accountItems[i].nItemID)))
				&& "zitem.xml or GambleItem에 기술되어 있지 않는 아이템입니다." );

			if( accountItems[i].nCount > 0 ) {
				Make_MTDAccountItemNode(pItemNode, accountItems[i].nAIID, accountItems[i].nItemID
					, accountItems[i].nRentMinutePeriodRemainder, accountItems[i].nCount);

				nIndex++;

				if( nIndex == nCountableAccountItemCount ) { break;	}
			}			
		}

		pNew->AddParameter(new MCommandParameterBlob(pItemArray, MGetBlobArraySize(pItemArray)));
		MEraseBlobArray(pItemArray);

		PostSafeQueue( pNew );
	}
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:60,代码来源:MMatchServer_Async.cpp

示例11: OnAdminRequestKickPlayer

void MMatchServer::OnAdminRequestKickPlayer(const MUID& uidAdmin, const char* szPlayer)
{
	MMatchObject* pObj = GetObject(uidAdmin);
	if (pObj == NULL)			return;
	if (!IsAdminGrade(pObj))	return;
	if ((strlen(szPlayer)) < 2) return;

	int nRet = MOK;
	MMatchObject* pTargetObj = GetPlayerByName(szPlayer);
	if (pTargetObj != NULL) 
	{
#ifdef LOCALE_KOREA
		pTargetObj->DisconnectHacker( MMHT_COMMAND_BLOCK_BY_ADMIN );
#else
		// Notify Message 필요 -> 관리자 전용 - 해결(특별한 메세지 필요 없음)
		
		Disconnect(pTargetObj->GetUID());
#endif
	} else {
		nRet = MERR_ADMIN_NO_TARGET;
	}

	MCommand* pNew = CreateCommand(MC_ADMIN_RESPONSE_KICK_PLAYER, MUID(0,0));
	pNew->AddParameter(new MCmdParamInt(nRet));
	RouteToListener(pObj, pNew);
}
开发者ID:kooksGame,项目名称:life-marvelous,代码行数:26,代码来源:MMatchServer_Admin.cpp

示例12: OnAdminRequestBlockPlayer

void MMatchServer::OnAdminRequestBlockPlayer(const MUID& uidAdmin, const char* szPlayer, const int nPenaltyHour)
{
	MMatchObject* pObj = GetObject(uidAdmin);
	if (pObj == NULL)			return;	
	if (!IsAdminGrade(pObj))	return;
	if ((strlen(szPlayer)) < 2) return;

	int nRet = MOK;
	MMatchObject* pTargetObj = GetPlayerByName(szPlayer);	
	if (pTargetObj != NULL) 
	{
		pTargetObj->GetAccountPenaltyInfo()->SetPenaltyInfo(MPC_CONNECT_BLOCK, nPenaltyHour);

		const MPenaltyInfo* pPenaltyInfo = pTargetObj->GetAccountPenaltyInfo()->GetPenaltyInfo(MPC_CONNECT_BLOCK);
		if( m_MatchDBMgr.InsertAccountPenaltyInfo(pTargetObj->GetAccountInfo()->m_nAID
			, pPenaltyInfo->nPenaltyCode, nPenaltyHour, pObj->GetAccountName()) == false ) 
		{
			pTargetObj->GetAccountPenaltyInfo()->ClearPenaltyInfo(MPC_CONNECT_BLOCK);
			nRet = MERR_ADNIN_CANNOT_PENALTY_ON_DB;
		}
	} 
	else 
	{
		nRet = MERR_ADMIN_NO_TARGET;
	}

	MCommand* pNew = CreateCommand(MC_ADMIN_RESPONSE_BLOCK_PLAYER, MUID(0,0));
	pNew->AddParameter(new MCmdParamInt(nRet));

	if( nRet == MOK ) {
		Disconnect(pTargetObj->GetUID());
	}

	RouteToListener(pObj, pNew);
}
开发者ID:kooksGame,项目名称:life-marvelous,代码行数:35,代码来源:MMatchServer_Admin.cpp

示例13: RouteTrapActivationForForcedEnterd

void MMatchActiveTrapMgr::RouteTrapActivationForForcedEnterd(MMatchActiveTrap* pTrap)
{
	OutputDebugStr("Notify Trap activation to ForcedEnteredPlayer\n");

	if (!pTrap || !pTrap->IsActivated()) { _ASSERT(0); return; }
	if (!m_pStage) return;
	
	int numTarget = (int)pTrap->m_vecUidForcedEntered.size();
	if (numTarget <= 0) return;

	void* pTrapArray = MMakeBlobArray(sizeof(MTD_ActivatedTrap), 1);
	
	MTD_ActivatedTrap* pNode = (MTD_ActivatedTrap*)MGetBlobArrayElement(pTrapArray, 0);
	Make_MTDActivatedTrap(pNode, pTrap);

	MCommand* pCommand = MMatchServer::GetInstance()->CreateCommand(MC_MATCH_NOTIFY_ACTIATED_TRAPITEM_LIST, MUID(0,0));
	pCommand->AddParameter(new MCommandParameterBlob(pTrapArray, MGetBlobArraySize(pTrapArray)));

	MMatchObject* pObj;
	for (int i=0; i<numTarget; ++i)
	{
		pObj = m_pStage->GetObj( pTrap->m_vecUidForcedEntered[i]);
		if (!pObj) continue;

		MCommand* pSendCmd = pCommand->Clone();
		MMatchServer::GetInstance()->RouteToListener(pObj, pSendCmd);
	}

	delete pCommand;
	MEraseBlobArray(pTrapArray);

	pTrap->m_vecUidForcedEntered.clear();
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:33,代码来源:MMatchActiveTrapMgr.cpp

示例14: OnResponseAgentLogin

void MMatchClient::OnResponseAgentLogin()
{
	MCommand* pCmd = CreateCommand(MC_AGENT_PEER_BINDTCP, GetAgentServerUID());
	pCmd->AddParameter(new MCmdParamUID(GetPlayerUID()));
	Post(pCmd);	

	mlog("Logged in Agent, Bind TCP \n");
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:8,代码来源:MMatchClient.cpp

示例15: OnAsyncSurvivalModePrivateRanking

void MMatchServer::OnAsyncSurvivalModePrivateRanking(MAsyncJob* pJobResult)
{
	MAsyncDBJob_GetSurvivalModePrivateRanking* pJob = (MAsyncDBJob_GetSurvivalModePrivateRanking*)pJobResult;

	if( MASYNC_RESULT_SUCCEED != pJob->GetResult() )
	{
		mlog("MMatchServer::OnAsyncSurvivalModePrivateRanking - 실패! stageUID[%d] playerCID[%d]\n", pJob->GetStageUID(), pJob->GetCID());
		return;
	}
#ifdef _DEBUG
	mlog("MMatchServer::OnAsyncSurvivalModePrivateRanking - Test Log입니다. 성공!\n");

	// 다음은 MAsyncDBJob_GetSurvivalModePrivateRanking Class의 사용 요령입니다.
	// Class에서 더 필요한 부분이 있으면 수정하시면 됩니다.
	mlog("-------- User Ranking Info --------\n");
	mlog("User CID = %d\n", pJob->GetCID());

	for(DWORD dwScenarioID = 1; dwScenarioID < MAX_SURVIVAL_SCENARIO_COUNT + 1; dwScenarioID++)
	{
		RANKINGINFO* pRankingInfo = pJob->GetPrivateRankingInfo(dwScenarioID);

		mlog("Scenario ID = %01d, Ranking = %d, Ranking Point = %d\n", 
			dwScenarioID, pRankingInfo->dwRanking, pRankingInfo->dwRankingPoint);
	}
#endif

	_ASSERT( pJob->GetScenarioID()-1 < MAX_SURVIVAL_SCENARIO_COUNT );
	RANKINGINFO* pRankingInfo = pJob->GetPrivateRankingInfo( pJob->GetScenarioID() );
	if (pRankingInfo)
	{
		// 플레이어에게 랭킹 정보를 보낸다		
		MCommand* pCmdPrivateRanking = MGetMatchServer()->CreateCommand( MC_SURVIVAL_PRIVATERANKING, MUID(0, 0) );
		if( NULL == pCmdPrivateRanking )
			return;

		pCmdPrivateRanking->AddParameter( new MCommandParameterUInt(pRankingInfo->dwRanking) );
		pCmdPrivateRanking->AddParameter( new MCommandParameterUInt(pRankingInfo->dwRankingPoint) );
		
		RouteToObjInStage(pJob->GetStageUID(), pJob->GetPlayerUID(), pCmdPrivateRanking);
	}
	else _ASSERT(0);
	
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:43,代码来源:MMatchServer_Async.cpp


注:本文中的MCommand::AddParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。