void NFCTeamModule::OnLeaveTeamProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqAckLeaveTeam); if (LeaveTeam(nPlayerID, NFINetModule::PBToNF(xMsg.team_id()))) { NFMsg::ReqAckLeaveTeam xAck; *xAck.mutable_team_id() = xMsg.team_id(); NFGUID xTeam = NFINetModule::PBToNF(xMsg.team_id()); NFMsg::TeamInfo xTeamInfo; if (!GetTeamInfo(nPlayerID, xTeam, xTeamInfo)) { xAck.mutable_xteaminfo()->CopyFrom(xTeamInfo); } m_pNetModule->SendMsgPB(NFMsg::EGMI_ACK_LEAVE_TEAM, xAck, nSockIndex, nPlayerID); BroadcastMsgToTeam(nPlayerID, xTeam, NFMsg::EGMI_ACK_LEAVE_TEAM, xAck); } else { NFMsg::ReqAckLeaveTeam xAck; *xAck.mutable_team_id() = NFINetModule::NFToPB(NFGUID()); m_pNetModule->SendMsgPB(NFMsg::EGMI_ACK_LEAVE_TEAM, xAck, nSockIndex, nPlayerID); } }
void NFGamePVPModule::OnReqStartPVPOpponentProcess(const NFSOCK nSockIndex, const int nMsgID, const char *msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqAckStartBattle); const int nSceneID = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::SceneID()); E_SCENE_TYPE sceneType = (E_SCENE_TYPE)m_pElementModule->GetPropertyInt(std::to_string(nSceneID), NFrame::Scene::Type()); if (sceneType != E_SCENE_TYPE::SCENE_TYPE_NORMAL) { return; } NFGUID xWarGUID = m_pKernelModule->CreateGUID(); NFGUID xViewOpponent = m_pKernelModule->GetPropertyObject(nPlayerID, NFrame::Player::OpponentID()); m_pKernelModule->SetPropertyObject(nPlayerID, NFrame::Player::OpponentFighting(), xViewOpponent); m_pKernelModule->SetPropertyObject(nPlayerID, NFrame::Player::WarID(), xWarGUID); m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::WarEventTime(), NFGetTimeMS()); int nGambleGold = xMsg.gold(); int nGambleDiamond = xMsg.diamond(); if (nGambleGold > 0) { m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::GambleGold(), nGambleGold); } if (nGambleDiamond > 0) { m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::GambleDiamond(), nGambleDiamond); } NFMsg::ReqAckStartBattle xReqAckStartBattle; xReqAckStartBattle.set_gold(nGambleGold); xReqAckStartBattle.set_diamond(nGambleDiamond); m_pGameServerNet_ServerModule->SendMsgPBToGate(NFMsg::EGMI_ACK_START_OPPNENT, xReqAckStartBattle, nPlayerID); }
void NFGamePVPModule::OnReqAddGambleProcess(const NFSOCK nSockIndex, const int nMsgID, const char *msg, const uint32_t nLen) { //attack record and beattack record CLIENT_MSG_PROCESS(nMsgID, msg, nLen, NFMsg::ReqAddGambleValue); if (xMsg.number() <= 0) { return; } if (xMsg.property() == NFrame::Player::GambleGold()) { if (m_pPropertyModule->ConsumeGold(nPlayerID, xMsg.number())) { int64_t nGambleGold = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::GambleGold()); m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::GambleGold(), nGambleGold + xMsg.number()); } } else if (xMsg.property() == NFrame::Player::GambleDiamond()) { if (m_pPropertyModule->ConsumeDiamond(nPlayerID, xMsg.number())) { int64_t nGambleDiamond = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::GambleDiamond()); m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::GambleDiamond(), nGambleDiamond + xMsg.number()); } } }
void NFCGamePVPModule::OnReqStartPVPOpponentProcess(const NFSOCK nSockIndex, const int nMsgID, const char *msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqAckStartBattle); int pvpType = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::PVPType()); if (pvpType == NFMsg::EPVPType::PVP_HOME) { return; } NFGUID xWarGUID = m_pKernelModule->CreateGUID(); NFGUID xViewOpponent = m_pKernelModule->GetPropertyObject(nPlayerID, NFrame::Player::OpponentID()); m_pKernelModule->SetPropertyObject(nPlayerID, NFrame::Player::OpponentFighting(), xViewOpponent); m_pKernelModule->SetPropertyObject(nPlayerID, NFrame::Player::WarID(), xWarGUID); m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::WarEventTime(), NFGetTimeMS()); int nGambleGold = xMsg.gold(); int nGambleDiamond = xMsg.diamond(); if (nGambleGold > 0) { m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::GambleGold(), nGambleGold); } if (nGambleDiamond > 0) { m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::GambleDiamond(), nGambleDiamond); } NFMsg::ReqAckStartBattle xReqAckStartBattle; xReqAckStartBattle.set_gold(nGambleGold); xReqAckStartBattle.set_diamond(nGambleDiamond); m_pGameServerNet_ServerModule->SendMsgPBToGate(NFMsg::EGMI_ACK_START_OPPNENT, xReqAckStartBattle, nPlayerID); }
void NFCSLGBuildingModule::OnSLGClienUpgradeBuilding(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqUpBuildLv); const NFGUID xBuilID = NFINetModule::PBToNF(xMsg.object_guid()); Upgrade(nPlayerID, xBuilID); }
void NFCMapModule::ReqBigMapsInfo(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqBigMapInfo); NF_SHARE_PTR<NFIClass> xLogicClass = m_pLogicClassModule->GetElement("Map"); //find all title info NFMsg::AckBigMapInfo xAckBigMapInfo; std::vector<NFMsg::BigMapGridBaseInfo> xBigMapGridBaseInfoList; if (m_pBigMapRedisModule->GetGridBaseInfo(xBigMapGridBaseInfoList)) { for (std::vector<NFMsg::BigMapGridBaseInfo>::iterator it = xBigMapGridBaseInfoList.begin(); it != xBigMapGridBaseInfoList.end(); ++it) { NFMsg::BigMapGridBaseInfo* pBigMapGridBaseInfo = xAckBigMapInfo.add_grid_base_info(); if (pBigMapGridBaseInfo) { pBigMapGridBaseInfo->CopyFrom(*it); } } m_pGameServerNet_ServerModule->SendMsgPBToGate(NFMsg::EGMI_ACK_BIG_MAP_INFO, xAckBigMapInfo, nPlayerID); } }
void NFCTeamModule::OnCreateTeamProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqAckCreateTeam); std::string strRoleName ; int nLevel = 0; int nJob = 0; int nDonation= 0; int nVIP= 0; NFGUID xTeam = CreateTeam(nPlayerID, NFINetModule::PBToNF(xMsg.team_id()), strRoleName, strRoleName, nLevel, nJob, nDonation, nVIP); if (!xTeam.IsNull()) { NFMsg::ReqAckCreateTeam xAck; *xAck.mutable_team_id() = NFINetModule::NFToPB(xTeam); NFMsg::TeamInfo xTeamInfo; if (!GetTeamInfo(nPlayerID, xTeam, xTeamInfo)) { xAck.mutable_xteaminfo()->CopyFrom(xTeamInfo); m_pNetModule->SendMsgPB(NFMsg::EGMI_ACK_CREATE_TEAM, xAck, nSockIndex, nPlayerID); return; } } NFMsg::ReqAckCreateTeam xAck; *xAck.mutable_team_id() = NFINetModule::NFToPB(xTeam); m_pNetModule->SendMsgPB(NFMsg::EGMI_ACK_CREATE_TEAM, xAck, nSockIndex, nPlayerID); }
void NFCEquipModule::OnTakeOffEquipMsg( const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen ) { CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::TakeOffEquip); const NFGUID self = NFINetModule::PBToNF((xMsg.selfid())); const NFGUID xEquipID = NFINetModule::PBToNF((xMsg.equipid())); const NFGUID xTarget = NFINetModule::PBToNF((xMsg.targetid())); TakeOffEquipForm(self, xTarget, xEquipID); }
void NFCHeroModule::OnSwitchFightHeroMsg(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqSwitchFightHero); const NFGUID xHero = NFINetModule::PBToNF(xMsg.heroid()); SwitchFightHero(nPlayerID, xHero); }
void NFCSLGBuildingModule::OnSLGClienCreateItem(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqCreateItem); const NFGUID& xBuilID = NFINetModule::PBToNF(xMsg.object_guid()); const std::string& strItemID = xMsg.config_id(); const int nCount = xMsg.count(); Produce(nPlayerID, xBuilID, strItemID, nCount); }
void NFCSLGShopModule::OnSLGClienBuyItem(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 strItemID = xMsg.config_id(); const float fX = xMsg.x(); const float fY = xMsg.y(); const float fZ = xMsg.z(); ReqBuyItem(nPlayerID, strItemID, fX, fY, fZ); }
void NFCMapModule::ReqGetMapAward(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqGetMapAward); if (!m_pElementModule->ExistElement(xMsg.map_title_id())) { return; } //get guild informatin and send mail to all members to send award item }
void NFCItemModule::OnClientUseItem(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqAckUseItem); const NFGUID& self = NFINetModule::PBToNF(xMsg.user()); const std::string& strItemID = xMsg.item().item_id(); const NFGUID xTargetID = NFINetModule::PBToNF(xMsg.targetid()); const int nCount = xMsg.item().item_count(); UseItem(nPlayerID, strItemID, xTargetID); }
void NFCSLGBuildingModule::OnSLGClienMoveObject(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqAckMoveBuildObject); const NFGUID xBuildID = NFINetModule::PBToNF(xMsg.object_guid()); const float fX = xMsg.x(); const float fY = xMsg.y(); const float fZ = xMsg.z(); Move(nPlayerID, xBuildID, fX, fY, fZ); }
void NFCMapModule::ReqLeaveMsgToMap(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqLeaveMapMsg); if (!m_pElementModule->ExistElement(xMsg.map_title_id())) { return; } m_pBigMapRedisModule->AddGridLeaveMsgInfo(xMsg.map_title_id(), xMsg.leave_msg()); }
void NFCGSSwichServerModule::OnAckSwichServer(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::AckSwitchServer); if (nPlayerID != NFINetModule::PBToNF((xMsg.selfid()))) { return; } m_pGameServerNet_ServerModule->RemovePlayerGateInfo(nPlayerID); m_pKernelModule->DestroyObject(nPlayerID); }
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); }
void NFGamePVPModule::OnReqSearchOpponentProcess(const NFSOCK nSockIndex, const int nMsgID, const char *msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqSearchOppnent); ResetPVPData(nPlayerID); int nHomeSceneID = 1;// m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::HomeSceneID()); xMsg.set_self_scene(nHomeSceneID); int nHasKey = nPlayerID.nData64; m_pNetClientModule->SendSuitByPB(NF_SERVER_TYPES::NF_ST_WORLD, nHasKey, nMsgID, xMsg, nPlayerID); }
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); } }
void NFGamePVPModule::OnReqSwapHomeSceneProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqAckHomeScene); //int nHomeSceneID = m_pKernelModule->GetPropertyInt32(nPlayerID, NFrame::Player::HomeSceneID()); int nSceneID = m_pKernelModule->GetPropertyInt32(nPlayerID, NFrame::Player::SceneID()); ResetPVPData(nPlayerID); //m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::PVPType(), NFMsg::EPVPType::PVP_HOME); m_pSceneProcessModule->RequestEnterScene(nPlayerID, 1, 0, NFDataList()); }
void NFCGSSwichServerModule::OnClientReqSwichServer(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( 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 this server", (int)xMsg.target_serverid(), __FUNCTION__, __LINE__); return; } ChangeServer(nPlayerID, xMsg.target_serverid(), xMsg.sceneid(), xMsg.groupid()); }
void NFCEquipModule::OnElementlevelToEquipMsg( const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen ) { CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqElementlevelToEquip); const NFGUID self = NFINetModule::PBToNF((xMsg.selfid())); const NFGUID xEquipID = NFINetModule::PBToNF((xMsg.equipid())); int nResult = ElementlevelToEquip(self, xEquipID, xMsg.eelementtype()); NFMsg::AckElementlevelToEquip xAck; *xAck.mutable_selfid() = xMsg.selfid(); *xAck.mutable_equipid() = xMsg.equipid(); xAck.set_result(nResult); m_pGameServerNet_ServerModule->SendMsgPBToGate(NFMsg::EGEC_ACK_ELEMENTLEVEL_TO_EQUIP, xAck, self); }
void NFCChatModule::OnClienChatProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqAckPlayerChat); switch (xMsg.chat_type()) { case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_WORLD: { NFINetModule* m_pNetModule = m_pGameServerNet_ServerModule->GetNetModule(); if (m_pNetModule) { m_pNetModule->SendMsgPBToAllClient(NFMsg::EGMI_ACK_CHAT, xMsg); } } break; case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_GUILD: { NFGUID xGuildID = m_pKernelModule->GetPropertyObject(nPlayerID, NFrame::Player::GuildID()); if (!xGuildID.IsNull()) { NFINetClientModule * pNetClientModule = m_pGameServerToWorldModule->GetClusterClientModule(); pNetClientModule->SendBySuit(xGuildID.nData64, nMsgID, msg); } } break; case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_PRIVATE: case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_TEAM: { if (xMsg.has_target_id()) { NFGUID xTargetID = NFINetModule::PBToNF(xMsg.target_id()); if (!xTargetID.IsNull()) { NFINetClientModule * pNetClientModule = m_pGameServerToWorldModule->GetClusterClientModule(); pNetClientModule->SendBySuit(nPlayerID.nData64, nMsgID, msg); } } } break; default: break;; } }
void NFCTeamModule::OnTeamEnterEctypeProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqTeamEnterEctype); NFGUID xTeam = NFINetModule::PBToNF(xMsg.team_id()); NFGUID xSelfID = NFINetModule::PBToNF(xMsg.self_id()); NF_SHARE_PTR<NFIPropertyManager> pPropertyManager = m_pCommonRedisModule->GetCachePropertyInfo(xTeam, NFrame::Team::ThisName()); if (pPropertyManager) { NFGUID xCaptain = pPropertyManager->GetPropertyObject(NFrame::Team::Captain()); if (xCaptain == xSelfID) { BroadcastMsgToTeam(nPlayerID, xTeam, NFMsg::EGMI_REQ_TEAM_ENTER_ECTYPE, xMsg); return; } } m_pNetModule->SendMsgPB(NFMsg::EGMI_ACK_TEAM_ENTER_ECTYPE, xMsg, nSockIndex, nPlayerID); }
void NFCGamePVPModule::OnReqEndPVPOpponentProcess(const NFSOCK nSockIndex, const int nMsgID, const char *msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqEndBattle); //get oppnent //calculate how many monster has been killed //calculate how many building has been destroyed //calculate how much experice and how many money //tell client the end information //set oppnent 0 int pvpType = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::PVPType()); if (pvpType == NFMsg::EPVPType::PVP_INDIVIDUAL) { EndTheBattle(nPlayerID); } }
void NFCEquipModule::OnInlaystoneToEquipMsg( const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen ) { CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqInlaystoneToEquip); const NFGUID self = NFINetModule::PBToNF((xMsg.selfid())); const NFGUID xEquipID = NFINetModule::PBToNF((xMsg.equipid())); const std::string& strStoneID = xMsg.stoneid(); const int nHoleIndex = xMsg.hole_index(); int nResult = InlaystoneToEquip(self, xEquipID, strStoneID, nHoleIndex); NFMsg::AckInlaystoneToEquip xAck; *xAck.mutable_selfid() = xMsg.selfid(); *xAck.mutable_equipid() = xMsg.equipid(); xAck.set_result(nResult); m_pGameServerNet_ServerModule->SendMsgPBToGate(NFMsg::EGEC_ACK_INLAYSTONE_TO_EQUIP, xAck, self); }
void NFGamePVPModule::OnReqEndPVPOpponentProcess(const NFSOCK nSockIndex, const int nMsgID, const char *msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqEndBattle); //get oppnent //calculate how many monster has been killed //calculate how many building has been destroyed //calculate how much experice and how many money //tell client the end information //set oppnent 0 const int nSceneID = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::SceneID()); E_SCENE_TYPE eSceneType = (E_SCENE_TYPE)m_pElementModule->GetPropertyInt32(std::to_string(nSceneID), NFrame::Scene::Type()); if (eSceneType == E_SCENE_TYPE::SCENE_TYPE_SINGLE_CLONE_SCENE || eSceneType == E_SCENE_TYPE::SCENE_TYPE_MULTI_CLONE_SCENE) { EndTheBattle(nPlayerID); } }
void NFCMapModule::ReqStation(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqHoldMapGrid); if (!m_pElementModule->ExistElement(xMsg.map_title_id())) { return; } NFGUID xGuildID = NFINetModule::PBToNF(xMsg.guild_id()); NF_SHARE_PTR<NFIPropertyManager> xPropertyManager = m_pGuildRedisModule->GetGuildCachePropertyInfo(xGuildID); if (!xPropertyManager) { return; } //remove form last grid int nResourece = xPropertyManager->GetPropertyInt(NFrame::Guild::KingWarResource()); m_pBigMapRedisModule->AddGridStationInfo(xMsg.map_title_id(), xGuildID, nResourece); }
void NFCMapModule::ReqMapKingWar(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqMapKingWar); if (!m_pElementModule->ExistElement(xMsg.map_title())) { return; } NFMsg::BigMapGridBaseInfo xGridBaseInfo; if (!m_pBigMapRedisModule->GetGridBaseInfo(xMsg.map_title(), xGridBaseInfo)) { return; } xGridBaseInfo.set_kingwar_time(pPluginManager->GetNowTime()); xGridBaseInfo.mutable_kingwarrer()->CopyFrom(NFINetModule::NFToPB(nPlayerID)); m_pBigMapRedisModule->SetGridBaseInfo(xMsg.map_title(), xGridBaseInfo); //show msgbox }
void NFCTeamModule::OnOprTeamMemberProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { CLIENT_MSG_PROCESS( nMsgID, msg, nLen, NFMsg::ReqAckOprTeamMember); NFMsg::ReqAckOprTeamMember::EGTeamMemberOprType eOprType = xMsg.type(); switch (eOprType) { case NFMsg::ReqAckOprTeamMember::EGAT_KICKOUT: KickTeamMmember(nPlayerID, NFINetModule::PBToNF(xMsg.team_id()), NFINetModule::PBToNF(xMsg.member_id())); break; default: break; } NFGUID xTeam = NFINetModule::PBToNF(xMsg.team_id()); NFMsg::TeamInfo xTeamInfo; if (!GetTeamInfo(nPlayerID, xTeam, xTeamInfo)) { xMsg.mutable_xteaminfo()->CopyFrom(xTeamInfo); } BroadcastMsgToTeam(nPlayerID, xTeam, NFMsg::EGMI_ACK_OPRMEMBER_TEAM, xMsg); }