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


C++ CDBAgent::CreateKnights方法代码示例

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


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

示例1: ReqCreateKnights

void CKnightsManager::ReqCreateKnights(CUser *pUser, Packet & pkt)
{
	if (pUser == nullptr)
		return;

	Packet result(WIZ_KNIGHTS_PROCESS, uint8(KNIGHTS_CREATE));
	string strKnightsName, strChief;
	uint16 sClanID;
	uint8 bFlag, bNation;
	int8 bResult;

	pkt >> bFlag >> sClanID >> bNation >> strKnightsName >> strChief;
	bResult = g_DBAgent.CreateKnights(sClanID, bNation, strKnightsName, strChief, bFlag);

	if (bResult < 0)
	{
		result << bResult;
		pUser->Send(&result);
		return;
	}

	CKnights *pKnights = new CKnights();

	pKnights->m_sIndex = sClanID;
	pKnights->m_byFlag = bFlag;
	pKnights->m_byNation = bNation;

	pKnights->m_strName = strKnightsName;
	pKnights->m_strChief = pUser->GetName();

	pUser->GoldLose(CLAN_COIN_REQUIREMENT, false);

	g_pMain->m_KnightsArray.PutData(pKnights->m_sIndex, pKnights);

	pKnights->AddUser(pUser);

	// Ensure the clan leader's fame is set
	// CKnights::AddUser() will default it to TRAINEE, so it needs to be set afterwards.
	pUser->m_bFame = CHIEF;

	result	<< uint8(1) << pUser->GetSocketID() 
		<< sClanID << strKnightsName
		<< pKnights->m_byGrade << pKnights->m_byRanking
		<< pUser->m_iGold;

	pUser->SendToRegion(&result);
}
开发者ID:AdemOsman,项目名称:koserver,代码行数:47,代码来源:DatabaseThread.cpp

示例2: ReqCreateKnights

void CKnightsManager::ReqCreateKnights(CUser *pUser, Packet & pkt)
{
	if (pUser == nullptr)
		return;

	Packet result(WIZ_KNIGHTS_PROCESS, uint8(KNIGHTS_CREATE));
	string strKnightsName, strChief;
	uint16 sClanID;
	uint8 bFlag, bNation;
	int8 bResult;

	pkt >> bFlag >> sClanID >> bNation >> strKnightsName >> strChief;
	bResult = g_DBAgent.CreateKnights(sClanID, bNation, strKnightsName, strChief, bFlag);

	if (bResult < 0)
	{
		result << bResult;
		pUser->Send(&result);
		return;
	}

	CKnights *pKnights = new CKnights();

	pKnights->m_sIndex = sClanID;
	pKnights->m_byFlag = bFlag;
	pKnights->m_byNation = bNation;

	pKnights->m_strName = strKnightsName;
	pKnights->m_strChief = pUser->GetName();

	pUser->m_iGold -= CLAN_COIN_REQUIREMENT;
	pUser->m_bFame = CHIEF;

	g_pMain->m_KnightsArray.PutData(pKnights->m_sIndex, pKnights);

	pKnights->AddUser(pUser);

	result	<< uint8(1) << pUser->GetSocketID() 
			<< sClanID << strKnightsName
			<< pKnights->m_byGrade << pKnights->m_byRanking
			<< pUser->m_iGold;

	pUser->SendToRegion(&result);
}
开发者ID:Brandon1115,项目名称:snoxd-koserver,代码行数:44,代码来源:DatabaseThread.cpp


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