int NFCMasterNet_ServerModule::OnRefreshWorldInfoProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { NFGUID nPlayerID; NFMsg::ServerInfoReportList xMsg; if (!RecivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID)) { return 0; } for (int i = 0; i < xMsg.server_list_size(); ++i) { const NFMsg::ServerInfoReport& xData = xMsg.server_list(i); NF_SHARE_PTR<ServerData> pServerData = mWorldMap.GetElement(xData.server_id()); if (!pServerData.get()) { pServerData = NF_SHARE_PTR<ServerData>(NF_NEW ServerData()); mWorldMap.AddElement(xData.server_id(), pServerData); } pServerData->nFD = nSockIndex; *(pServerData->pData) = xData; m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, xData.server_id()), xData.server_name(), "RefreshWorldInfo"); } SynWorldToLogin(); return 0; }
int NFCLoginNet_ServerModule::OnSelectWorldProcess( const NFIPacket& msg ) { NFIDENTID nPlayerID; NFMsg::ReqConnectWorld xMsg; if (!RecivePB(msg, xMsg, nPlayerID)) { return 0; } NetObject* pNetObject = GetNet()->GetNetObject(msg.GetFd()); if (!pNetObject) { return 0; } //没登录过 if (pNetObject->GetConnectKeyState() <= 0) { return 0; } NFCDataList val; val << xMsg.world_id() << pNetObject->GetClientID() << pPluginManager->AppID() << pNetObject->GetAccount(); m_pEventProcessModule->DoEvent(NFIDENTID(), NFED_ON_CLIENT_SELECT_SERVER, val); return 0; }
int NFCWorldNet_ServerModule::OnGameServerRegisteredProcess(const NFIPacket& msg) { NFIDENTID nPlayerID; NFMsg::ServerInfoReportList xMsg; if (!RecivePB(msg, xMsg, nPlayerID)) { return 0; } for (int i = 0; i < xMsg.server_list_size(); ++i) { NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i); NF_SHARE_PTR<ServerData> pServerData = mGameMap.GetElement(pData->server_id()); if (!pServerData.get()) { pServerData = NF_SHARE_PTR<ServerData>(NF_NEW ServerData()); mGameMap.AddElement(pData->server_id(), pServerData); } pServerData->nFD = msg.GetFd(); *(pServerData->pData) = *pData; m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, pData->server_id()), pData->server_name(), "GameServerRegistered"); } SynGameToProxy(); return 0; }
int NFCLoginNet_ServerModule::OnViewWorldProcess( const NFIPacket& msg ) { NFIDENTID nPlayerID; NFMsg::ReqServerList xMsg; if (!RecivePB(msg, xMsg, nPlayerID)) { return 0; } if (xMsg.type() == NFMsg::RSLT_WORLD_SERVER) { SynWorldToClient(msg.GetFd()); } return 0; }
int NFCWorldNet_ServerModule::OnGameServerUnRegisteredProcess(const NFIPacket& msg) { NFIDENTID nPlayerID; NFMsg::ServerInfoReportList xMsg; if (!RecivePB(msg, xMsg, nPlayerID)) { return 0; } for (int i = 0; i < xMsg.server_list_size(); ++i) { NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i); mGameMap.RemoveElement(pData->server_id()); m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, pData->server_id()), pData->server_name(), "GameServerRegistered"); } return 0; }
int NFCMasterNet_ServerModule::OnSelectServerResultProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { NFGUID nPlayerID; NFMsg::AckConnectWorldResult xMsg; if (!RecivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID)) { return 0; } NF_SHARE_PTR<ServerData> pServerData = mLoginMap.GetElement(xMsg.login_id()); if (!pServerData.get()) { return 0; } //转发送到登录服务器 SendMsgPB(NFMsg::EGameMsgID::EGMI_ACK_CONNECT_WORLD, xMsg, pServerData->nFD); return 0; }
int NFCMasterNet_ServerModule::OnLoginUnRegisteredProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen) { NFGUID nPlayerID; NFMsg::ServerInfoReportList xMsg; if (!RecivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID)) { return 0; } for (int i = 0; i < xMsg.server_list_size(); ++i) { NFMsg::ServerInfoReport* pData = xMsg.mutable_server_list(i); mLoginMap.RemoveElement(pData->server_id()); m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFGUID(0, pData->server_id()), pData->server_name(), "LoginUnRegistered"); } return 0; }
int NFCLoginNet_ServerModule::OnLoginProcess( const NFIPacket& msg ) { NFIDENTID nPlayerID; NFMsg::ReqAccountLogin xMsg; if (!RecivePB(msg, xMsg, nPlayerID)) { return 0; } NetObject* pNetObject = GetNet()->GetNetObject(msg.GetFd()); if (pNetObject) { //还没有登录过 if (pNetObject->GetConnectKeyState() == 0) { NFCDataList val; val << pNetObject->GetClientID()<< xMsg.account() << xMsg.password(); m_pEventProcessModule->DoEvent(NFIDENTID(), NFED_ON_CLIENT_LOGIN, val); } } return 0; }