//--------------------------------------------收消息------------------------------------------------------------- void NFCChatLogic::OnChatProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { NFGUID nPlayerID; NFMsg::ReqAckPlayerChat xMsg; if (!NFINetModule::ReceivePB(nMsgID, msg, nLen, xMsg, nPlayerID)) { return; } NFDataList var; var.AddObject(NFINetModule::PBToNF(xMsg.chat_id())); var.AddInt(xMsg.chat_type()); var.AddString(xMsg.chat_name()); var.AddString(xMsg.chat_info()); var.AddInt(xMsg.container_data_size()); for (size_t i = 0; i < xMsg.container_data_size(); i++) { var.AddInt(xMsg.container_data(i).containertype()); var.AddString(xMsg.container_data(i).data_info()); } switch (xMsg.chat_type()) { case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_WORLD: { DoEvent(E_ChatEvent_ChatWorld, var); } break; case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_GUILD: { DoEvent(E_ChatEvent_ChatGuild, var); } break; case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_PRIVATE: { DoEvent(E_ChatEvent_ChatPrivate, var); } break; case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_TEAM: { DoEvent(E_ChatEvent_ChatTeam, var); } break; default: break;; } }
void NFCGSSwichServerModule::OnReqSwichServer(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS_NO_OBJECT(nMsgID, msg, nLen, NFMsg::ReqSwitchServer); if (nPlayerID != NFINetModule::PBToNF(xMsg.selfid())) { return; } if (xMsg.target_serverid() != pPluginManager->GetAppID()) { m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, nPlayerID, "Target server is not this server", xMsg.target_serverid(), __FUNCTION__, __LINE__); return; } const NFGUID nClientID = NFINetModule::PBToNF(xMsg.client_id()); const int nGateID = (int)xMsg.gate_serverid(); const int nSceneID = (int)xMsg.sceneid(); const int nGroup = (int)xMsg.groupid(); //if (!AddPlayerGateInfo(nPlayerID, nClientID, nGateID)) // { // return; // } NFDataList var; var.AddString(NFrame::Player::GateID()); var.AddInt(nGateID); NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->CreateObject(nPlayerID, nSceneID, 0, NFrame::Player::ThisName(), "", var); if (NULL == pObject.get()) { //mRoleBaseData //mRoleFDData return; } pObject->SetPropertyInt(NFrame::Player::GateID(), nGateID); pObject->SetPropertyInt(NFrame::Player::GameID(), pPluginManager->GetAppID()); m_pKernelModule->DoEvent(pObject->Self(), NFrame::Player::ThisName(), CLASS_OBJECT_EVENT::COE_CREATE_FINISH, NFDataList()); m_pScenemodule->RequestEnterScene(pObject->Self(), nSceneID, nGroup, 0, NFDataList()); //m_pEventModule->DoEvent(pObject->Self(), NFED_ON_CLIENT_ENTER_SCENE, varEntry); if (!m_pGameServerNet_ServerModule->AddPlayerGateInfo(nPlayerID, nClientID, nGateID)) { m_pKernelModule->DestroyObject(nPlayerID); return ; } m_pGameServerNet_ServerModule->SendMsgPBToGate(NFMsg::EGMI_REQSWICHSERVER, xMsg, nPlayerID); m_pNetClientModule->SendSuitByPB(NF_SERVER_TYPES::NF_ST_WORLD, nPlayerID.ToString(), NFMsg::EGMI_ACKSWICHSERVER, xMsg); }
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); } }
bool NFCHelloWorld2::AfterInit() { NFDataList xData; xData.AddInt(111); // #ifdef NF_USE_ACTOR // if(pPluginManager->GetActorID() == NFIActorManager::EACTOR_MAIN) // #endif { std::cout << "Hello, world2, AfterInit" << std::endl; //created a object for this test NFIObject* pObject = new NFCObject(NFGUID(0, 1), pPluginManager); //add a property name is "Hello" of this object pObject->GetPropertyManager()->AddProperty(pObject->Self(), "Hello", TDATA_STRING); //add a property name is "World" of this object pObject->GetPropertyManager()->AddProperty(pObject->Self(), "World", TDATA_INT); //set the "world" property value as 1111 pObject->SetPropertyInt("World", 1111); int n1 = pObject->GetPropertyInt("World"); //get the "world" property value and printf it const int nProperty1 = pObject->GetPropertyInt("World"); std::cout << "Property World:" << nProperty1 << std::endl; //add a call back functin for "world" property pObject->AddPropertyCallBack("World", this, &NFCHelloWorld2::OnPropertyCallBackEvent); ////set the "world" property value as 2222[than the function "HelloWorld2::OnPropertyCallBackEvent" will be called] pObject->SetPropertyInt("World", 2222); int n2 = pObject->GetPropertyInt("World"); //get the "world" property value and printf it const int nProperty2 = pObject->GetPropertyInt("World"); std::cout << "Property World:" << nProperty2 << std::endl; } return true; }
bool NFCEquipPropertyModule::CalEquipRandomProperty(const NFGUID& self, const NFGUID& xEquipGUID, NFDataList& xDataList) { NF_SHARE_PTR<NFIRecord> pBagRecord = m_pKernelModule->FindRecord(self, NFrame::Player::BagEquipList::ThisName()); if (nullptr == pBagRecord) { return false; } NF_SHARE_PTR<NFIRecord> pCommPropertyValueRecord = m_pKernelModule->FindRecord(self, NFrame::Player::CommValue::ThisName()); if (nullptr == pCommPropertyValueRecord) { return false; } NFDataList varFind; if (pBagRecord->FindObject(NFrame::Player::BagEquipList::GUID, xEquipGUID, varFind) != 1) { return false; } const int nRow = varFind.Int32(0); xDataList.Clear(); /////////////RandomBase///////////////////////////////////////// const std::string& strConfigID = pBagRecord->GetString(nRow, NFrame::Player::BagEquipList::BagEquipList::RandPropertyID); const std::string& strPropertyEffectData = m_pElementModule->GetPropertyString(strConfigID, NFrame::Equip::EffectData()); if (!strPropertyEffectData.empty()) { for (int i = 0; i < pCommPropertyValueRecord->GetCols(); ++i) { const std::string& strColTag = pCommPropertyValueRecord->GetColTag(i); int64_t nValue = m_pElementModule->GetPropertyInt(strPropertyEffectData, strColTag); xDataList.AddInt(nValue); } } return true; }
void NFCCreateRoleModule::OnDBLoadRoleDataProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen) { NFGUID nClientID; NFMsg::RoleDataPack xMsg; if (!m_pNetModule->ReceivePB(nMsgID, msg, nLen, xMsg, nClientID)) { //releasing all the resource that allow when the user login, then kick off the user // TODO //m_pGameServerNet_ServerModule->RemovePlayerGateInfo(); //Avtually, the developer may not know the user id in this situation, therefore the developer must record the login-time when the user coming //and check the time per min to kick off the user who are not active. return; } NFGUID nRoleID = NFINetModule::PBToNF(xMsg.id()); if (m_pKernelModule->GetObject(nRoleID)) { //it should be rebind with proxy's netobject m_pKernelModule->DestroyObject(nRoleID); } mxObjectDataCache[nRoleID] = xMsg; NF_SHARE_PTR<NFIGameServerNet_ServerModule::GateBaseInfo> pGateInfo = m_pGameServerNet_ServerModule->GetPlayerGateInfo(nRoleID); if (nullptr != pGateInfo) { if (pGateInfo->eStatus == NFIGameServerNet_ServerModule::GateBaseInfo::E_LOADING) { pGateInfo->eStatus = NFIGameServerNet_ServerModule::GateBaseInfo::E_LOADED; } } NFDataList var; var.AddString(NFrame::Player::GateID()); var.AddInt(pGateInfo->nGateID); var.AddString(NFrame::Player::GameID()); var.AddInt(pPluginManager->GetAppID()); var.AddString(NFrame::Player::HomeSceneID()); var.AddInt(1); var.AddString(NFrame::Player::SceneID()); var.AddInt(1); NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->CreateObject(nRoleID, 1, 0, NFrame::Player::ThisName(), "", var); if (nullptr == pObject) { //mRoleBaseData //mRoleFDData mxObjectDataCache.erase(nRoleID); return; } //get data first then create player m_pSceneProcessModule->RequestEnterScene(pObject->Self(), 1, -1, 0, NFDataList()); }
bool NFCEquipPropertyModule::CalEquipProperty(const NFGUID& self, const NFGUID& xEquipGUID, NFDataList& xDataList) { NF_SHARE_PTR<NFIRecord> pBagRecord = m_pKernelModule->FindRecord(self, NFrame::Player::BagEquipList::ThisName()); if (nullptr == pBagRecord) { return false; } NF_SHARE_PTR<NFIRecord> pCommPropertyValueRecord = m_pKernelModule->FindRecord(self, NFrame::Player::CommValue::ThisName()); if (nullptr == pCommPropertyValueRecord) { return false; } NFDataList varFind; if (pBagRecord->FindObject(NFrame::Player::BagEquipList::GUID, xEquipGUID, varFind) != 1) { return false; } //const int nRow = varFind.Int32(0); xDataList.Clear(); NFDataList xEquipBaseValue; CalEquipBaseProperty(self, xEquipGUID, xEquipBaseValue); NFDataList xEquipRandonValue; CalEquipRandomProperty(self, xEquipGUID, xEquipRandonValue); NFDataList xEquipGemValue; CalEquipGemProperty(self, xEquipGUID, xEquipGemValue); NFDataList xEquipIntensifyValue; CalEquipIntensifyProperty(self, xEquipGUID, xEquipIntensifyValue); NFDataList xEquipElementValue; CalEquipElementProperty(self, xEquipGUID, xEquipElementValue); for (int i = 0; i < pCommPropertyValueRecord->GetCols(); ++i) { int64_t nBaseValue = 0; int64_t nRandonValue = 0; int64_t nGemValue = 0; int64_t nIntensifyValue = 0; int64_t nElementValue = 0; if (xEquipBaseValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nBaseValue = xEquipBaseValue.Int(i); } if (xEquipRandonValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nRandonValue = xEquipRandonValue.Int(i); } if (xEquipGemValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nGemValue = xEquipGemValue.Int(i); } if (xEquipIntensifyValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nIntensifyValue = xEquipIntensifyValue.Int(i); } if (xEquipElementValue.GetCount() == pCommPropertyValueRecord->GetCols()) { nElementValue = xEquipElementValue.Int(i); } int64_t nAllValue = nBaseValue + nRandonValue + nGemValue + nIntensifyValue + nElementValue; xDataList.AddInt(nAllValue); } return true; }
bool NFCEquipPropertyModule::CalEquipElementProperty(const NFGUID& self, const NFGUID& xEquipGUID, NFDataList& xDataList) { NF_SHARE_PTR<NFIRecord> pBagRecord = m_pKernelModule->FindRecord(self, NFrame::Player::BagEquipList::ThisName()); if (nullptr == pBagRecord) { return false; } NF_SHARE_PTR<NFIRecord> pCommPropertyValueRecord = m_pKernelModule->FindRecord(self, NFrame::Player::CommValue::ThisName()); if (nullptr == pCommPropertyValueRecord) { return false; } NFDataList varFind; if (pBagRecord->FindObject(NFrame::Player::BagEquipList::GUID, xEquipGUID, varFind) != 1) { return false; } const int nRow = varFind.Int32(0); xDataList.Clear(); /////////////element///////////////////////////////////////// const std::string& strEquipConfig = pBagRecord->GetString(nRow, NFrame::Player::BagEquipList::ConfigID); //const int nHeroType = m_pElementModule->GetPropertyInt32(strEquipConfig, NFrame::Item::HeroTye()); const int nItemType = m_pElementModule->GetPropertyInt32(strEquipConfig, NFrame::Item::ItemType()); const int nItemSubType = m_pElementModule->GetPropertyInt32(strEquipConfig, NFrame::Item::ItemSubType()); if (nItemType != NFMsg::EItemType::EIT_EQUIP) { return false; } for (int i = 0; i < pCommPropertyValueRecord->GetCols(); ++i) { xDataList.AddInt(0); } //conditional the item type to define what property to give double dwCoefficientAtk = 2.0; double dwCoefficientDef = 1.0; int nFireLevel = pBagRecord->GetInt32(nRow, NFrame::Player::BagEquipList::ElementLevel1_FIRE); int nLightLevel = pBagRecord->GetInt32(nRow, NFrame::Player::BagEquipList::ElementLevel2_LIGHT); int nWindLevel = pBagRecord->GetInt32(nRow, NFrame::Player::BagEquipList::ElementLevel3_Wind); int nIceLevel = pBagRecord->GetInt32(nRow, NFrame::Player::BagEquipList::ElementLevel4_ICE); int nPoisonLevel = pBagRecord->GetInt32(nRow, NFrame::Player::BagEquipList::ElementLevel5_POISON); int nWindValue = nWindLevel * nWindLevel; int nFireValue = nFireLevel * nFireLevel; int nLightValue = nLightLevel * nLightLevel; int nIceValue = nIceLevel * nIceLevel; int nPoisonValue = nPoisonLevel * nPoisonLevel; if (nItemSubType == NFMsg::EGameEquipSubType::EQUIPTYPE_WEAPON) { xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nWindValue * dwCoefficientAtk); xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nFireValue * dwCoefficientAtk); xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nLightValue * dwCoefficientAtk); xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nIceValue * dwCoefficientAtk); xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nPoisonValue * dwCoefficientAtk); } else { xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nWindValue * dwCoefficientDef); xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nFireValue * dwCoefficientDef); xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nLightValue * dwCoefficientDef); xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nIceValue * dwCoefficientDef); xDataList.SetInt(NFrame::Player::CommValue::ATK_FIRE, nPoisonValue * dwCoefficientDef); } return true; return true; }
bool NFCEquipPropertyModule::CalEquipIntensifyProperty(const NFGUID& self, const NFGUID& xEquipGUID, NFDataList& xDataList) { NF_SHARE_PTR<NFIRecord> pBagRecord = m_pKernelModule->FindRecord(self, NFrame::Player::BagEquipList::ThisName()); if (nullptr == pBagRecord) { return false; } NF_SHARE_PTR<NFIRecord> pCommPropertyValueRecord = m_pKernelModule->FindRecord(self, NFrame::Player::CommValue::ThisName()); if (nullptr == pCommPropertyValueRecord) { return false; } NFDataList varFind; if (pBagRecord->FindObject(NFrame::Player::BagEquipList::GUID, xEquipGUID, varFind) != 1) { return false; } const int nRow = varFind.Int32(0); xDataList.Clear(); /////////////GemBase///////////////////////////////////////// const int nIntensify = pBagRecord->GetInt32(nRow, NFrame::Player::BagEquipList::IntensifyLevel); if (nIntensify <= 0) { return false; } const std::string& strEquipConfig = pBagRecord->GetString(nRow, NFrame::Player::BagEquipList::ConfigID); //const int nHeroType = m_pElementModule->GetPropertyInt32(strEquipConfig, NFrame::Item::HeroTye()); const int nItemType = m_pElementModule->GetPropertyInt32(strEquipConfig, NFrame::Item::ItemType()); const int nItemSubType = m_pElementModule->GetPropertyInt32(strEquipConfig, NFrame::Item::ItemSubType()); if (nItemType != NFMsg::EItemType::EIT_EQUIP) { return false; } for (int i = 0; i < pCommPropertyValueRecord->GetCols(); ++i) { xDataList.AddInt(0); } //conditional the item type to define what property to give double dwCoefficientAtk = 2.0; double dwCoefficientDef = 1.0; int nMAXHPValue = nIntensify * nIntensify; int nAttackValue = nIntensify * nIntensify; int nDefValue = nIntensify * nIntensify; if (nItemSubType == NFMsg::EGameEquipSubType::EQUIPTYPE_WEAPON) { nAttackValue *= dwCoefficientAtk; } else { nDefValue *= dwCoefficientDef; } xDataList.SetInt(NFrame::Player::CommValue::MAXHP, nMAXHPValue); xDataList.SetInt(NFrame::Player::CommValue::ATK_VALUE, nAttackValue); xDataList.SetInt(NFrame::Player::CommValue::DEF_VALUE, nDefValue); return true; }
bool NFCEquipPropertyModule::CalEquipGemProperty(const NFGUID& self, const NFGUID& xEquipGUID, NFDataList& xDataList) { NF_SHARE_PTR<NFIRecord> pBagRecord = m_pKernelModule->FindRecord(self, NFrame::Player::BagEquipList::ThisName()); if (nullptr == pBagRecord) { return false; } NF_SHARE_PTR<NFIRecord> pCommPropertyValueRecord = m_pKernelModule->FindRecord(self, NFrame::Player::CommValue::ThisName()); if (nullptr == pCommPropertyValueRecord) { return false; } NFDataList varFind; if (pBagRecord->FindObject(NFrame::Player::BagEquipList::GUID, xEquipGUID, varFind) != 1) { return false; } const int nRow = varFind.Int32(0); xDataList.Clear(); /////////////GemBase///////////////////////////////////////// int nSlotCount = pBagRecord->GetInt32(nRow, NFrame::Player::BagEquipList::SlotCount); if (nSlotCount <= 0) { return false; } for (int i = 0; i < pCommPropertyValueRecord->GetCols(); ++i) { xDataList.AddInt(0); } for (int i = NFrame::Player::BagEquipList::InlayStone1; i <= NFrame::Player::BagEquipList::InlayStone10; ++i) { int nIndex = i - NFrame::Player::BagEquipList::InlayStone1; if (nIndex > nSlotCount) { break; } const std::string& strGemID = pBagRecord->GetString(nRow, i); if (strGemID.empty()) { continue; } const std::string& strGemEffectData = m_pElementModule->GetPropertyString(strGemID, NFrame::Item::EffectData()); if (strGemEffectData.empty()) { continue; } //one gem for (int j = 0; j < pCommPropertyValueRecord->GetCols(); ++j) { const std::string& strColTag = pCommPropertyValueRecord->GetColTag(j); int64_t nValue = m_pElementModule->GetPropertyInt(strGemEffectData, strColTag); int64_t nOldValue = xDataList.Int(j); xDataList.SetInt(j, nOldValue + nValue); } } return true; }
void NFCCreateRoleModule::OnClienEnterGameProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen) { NFGUID nClientID; NFMsg::ReqEnterGameServer xMsg; if (!m_pNetModule->ReceivePB( nMsgID, msg, nLen, xMsg, nClientID)) { return; } NFGUID nRoleID = NFINetModule::PBToNF(xMsg.id()); if (m_pKernelModule->GetObject(nRoleID)) { //it should be rebind with proxy's netobject m_pKernelModule->DestroyObject(nRoleID); } ////////////////////////////////////////////////////////////////////////// NF_SHARE_PTR<NFIGameServerNet_ServerModule::GateBaseInfo> pGateInfo = m_pGameServerNet_ServerModule->GetPlayerGateInfo(nRoleID); if (nullptr != pGateInfo) { m_pGameServerNet_ServerModule->RemovePlayerGateInfo(nRoleID); } NF_SHARE_PTR<NFIGameServerNet_ServerModule::GateServerInfo> pGateServerinfo = m_pGameServerNet_ServerModule->GetGateServerInfoBySockIndex(nSockIndex); if (nullptr == pGateServerinfo) { return; } int nGateID = -1; if (pGateServerinfo->xServerData.pData) { nGateID = pGateServerinfo->xServerData.pData->server_id(); } if (nGateID < 0) { return; } if (!m_pGameServerNet_ServerModule->AddPlayerGateInfo(nRoleID, nClientID, nGateID)) { return; } if (m_pPlayerRedisModule->LoadPlayerData(nRoleID)) { int nHomeSceneID = m_pPlayerRedisModule->GetPlayerHomeSceneID(nRoleID); if (nHomeSceneID <= 0) { nHomeSceneID = m_pPVPModule->RandomTileScene(); } NFDataList var; var.AddString(NFrame::Player::Name()); var.AddString(xMsg.name()); var.AddString(NFrame::Player::GateID()); var.AddInt(nGateID); var.AddString(NFrame::Player::GameID()); var.AddInt(pPluginManager->GetAppID()); var.AddString(NFrame::Player::HomeSceneID()); var.AddInt(nHomeSceneID); var.AddString(NFrame::Player::SceneID()); var.AddInt(nHomeSceneID); var.AddString(NFrame::Player::ViewOppnent()); var.AddObject(nRoleID); NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->CreateObject(nRoleID, nHomeSceneID, 0, NFrame::Player::ThisName(), "", var); if (nullptr == pObject) { //mRoleBaseData //mRoleFDData return; } //get data first then create player m_pSceneProcessModule->RequestEnterScene(pObject->Self(), nHomeSceneID, -1, 0, NFDataList()); } }
bool NFCItemModule::UseItem(const NFGUID & self, const std::string & strItemID, const NFGUID & xTargetID) { int nCount = 1; if (!m_pElementModule->ExistElement(strItemID) || !m_pKernelModule->GetObject(xTargetID)) { return false; } if (!ConsumeDataItemProperty(self, strItemID)) { return false; } if (!m_pPackModule->DeleteItem(self, strItemID, nCount)) { return false; } NFMsg::EItemType eItemType = (NFMsg::EItemType)m_pElementModule->GetPropertyInt(strItemID, NFrame::Item::ItemType()); NF_SHARE_PTR<NFIItemConsumeProcessModule> pConsumeProcessModule = m_pItemConsumeManagerModule->GetConsumeModule(eItemType); if (!pConsumeProcessModule) { return false; } switch (eItemType) { case NFMsg::EItemType::EIT_CARD: case NFMsg::EItemType::EIT_EQUIP: case NFMsg::EItemType::EIT_GEM: case NFMsg::EItemType::EIT_TOKEN: { if (pConsumeProcessModule->ConsumeLegal(self, strItemID, NFDataList()) == 0) { pConsumeProcessModule->ConsumeProcess(self, strItemID, NFDataList()); } } break; case NFMsg::EItemType::EIT_ITEM: { NFDataList xTarget; xTarget.AddObject(xTargetID); xTarget.AddString(strItemID); //this is Item Config ID xTarget.AddInt(nCount); //this is Item Count to Consume if (pConsumeProcessModule->ConsumeLegal(self, strItemID, xTarget) == 0) { pConsumeProcessModule->ConsumeProcess(self, strItemID, xTarget); } } break; break; default: break; } /* AddItemEffectDataProperty(self, xTargetID, strItemID); const std::string& strAwardPackID = m_pElementModule->GetPropertyString(strItemID, "AwardData"); if (!strAwardPackID.empty()) { DoAwardPack( self, strAwardPackID); } */ return false; }