예제 #1
0
void NFCShopModule::OnClienBuyItem(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
	CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqAckBuyObjectFormShop);

	const std::string& strShopItemID = xMsg.config_id();
	NFVector3 v;
	v.SetX(xMsg.x());
	v.SetY(xMsg.y());
	v.SetZ(xMsg.z());

	ReqBuyItem(nPlayerID, strShopItemID, v);
}
예제 #2
0
void NFCGamePVPModule::OnAckSearchOpponentProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen)
{
	CLIENT_MSG_PROCESS(nMsgID, msg, nLen, NFMsg::AckSearchOppnent);

	if (!m_pKernelModule->ExistObject(nPlayerID))
	{
		return;
	}


	m_pKernelModule->SetPropertyObject(nPlayerID, NFrame::Player::OpponentFighting(), NFGUID());
	m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::FightingStar(), 0);
	m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::PVPType(), NFMsg::EPVPType::PVP_INDIVIDUAL);

	m_pSceneProcessModule->RequestEnterScene(nPlayerID, xMsg.scene_id(), 0, NFDataList());

	int nNoWSceneID = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::SceneID());
	int nGroupID = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::GroupID());

	if (nNoWSceneID != xMsg.scene_id())
	{
		return;
	}
	
	//process opponent data
	ProcessOpponentData(nPlayerID, xMsg);

	m_pGameServerNet_ServerModule->SendMsgToGate(NFMsg::EGMI_ACK_SEARCH_OPPNENT, std::string(msg, nLen), nPlayerID);

	for (int i = 0; i < xMsg.title().building_size(); ++i)
	{
		const NFMsg::TileBuilding& xTileBuilding = xMsg.title().building().Get(i);

		NFGUID xBuildingID = NFINetModule::PBToNF(xTileBuilding.guid());
		NFVector3 vPos;
		vPos.SetX(xTileBuilding.x());
		vPos.SetY(xTileBuilding.y());
		std::string strCnfID = xTileBuilding.configid();

		NFDataList xDataArg;
		xDataArg.AddString(NFrame::NPC::Position());
		xDataArg.AddVector3(vPos);
		xDataArg.AddString(NFrame::NPC::MasterID());
		xDataArg.AddObject(NFINetModule::PBToNF(xMsg.opponent()));
		xDataArg.AddString(NFrame::NPC::AIOwnerID());
		xDataArg.AddObject(nPlayerID);
		xDataArg.AddString(NFrame::NPC::NPCType());
		xDataArg.AddInt(NFMsg::ENPCType::ENPCTYPE_TURRET);

		m_pKernelModule->CreateObject(xBuildingID, nNoWSceneID, nGroupID, NFrame::NPC::ThisName(), strCnfID, xDataArg);
	}
}