From 596ad217d78883856dce0786585892f1e5345a7a Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 30 Sep 2016 10:21:44 -0500 Subject: [PATCH] and another one gone --- .../src/shared/LoginServerConnection.cpp | 477 ++++++++++-------- 1 file changed, 253 insertions(+), 224 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/LoginServerConnection.cpp b/engine/server/application/CentralServer/src/shared/LoginServerConnection.cpp index bd0821b9..d68d470a 100755 --- a/engine/server/application/CentralServer/src/shared/LoginServerConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/LoginServerConnection.cpp @@ -36,6 +36,8 @@ #include "sharedNetworkMessages/ConsoleChannelMessages.h" #include "sharedNetworkMessages/GenericValueTypeMessage.h" +#include "sharedFoundation/CrcConstexpr.hpp" + //----------------------------------------------------------------------- LoginServerConnection::LoginServerConnection(const std::string & a, const unsigned short p) : @@ -87,238 +89,265 @@ void LoginServerConnection::onReceive(const Archive::ByteStream & message) GameNetworkMessage m(ri); ri = message.begin(); - if(m.isType("TransferReplyCharacterList")) - { - // if this is not a free CTS galaxy, immediately forward the message to the TransferServer, - // else if this is a free CTS galaxy, forward the message to a game server so that characters - // in the list that qualifies for free CTS are removed from the list; characters that qualify - // for free CTS should/must use the in-game free CTS to transfer the character; - TransferReplyCharacterList reply(ri); - if (!FreeCtsDataTable::isFreeCtsSourceCluster(ConfigCentralServer::getClusterName())) - CentralServer::getInstance().sendToTransferServer(reply); - else - IGNORE_RETURN(CentralServer::getInstance().sendToRandomGameServer(reply)); - } - else if(m.isType("TransferReplyCharacterDataFromLoginServer")) - { - GenericValueTypeMessage reply(ri); - // see if we need to send to transfer or connection server. - if(reply.getValue().getCSToolId() > 0) + const uint32 messageType = message.getType(); + + switch (messageType) { + case constcrc("TransferReplyCharacterList") : { - // for CS admin login. send to DB. This just shortcuts what would normally - // happen at the transfer server. - GenericValueTypeMessage login("TransferGetLoginLocationData", reply.getValue()); - CentralServer::getInstance().sendToDBProcess(login, true); - } - else if (reply.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) - { - // for CTS. Send to transfer. - CentralServer::getInstance().sendToTransferServer(reply); - } - } - else if(m.isType("TransferReplyMoveValidation")) - { - TransferReplyMoveValidation const reply(ri); - - if (reply.getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) - { - LOG("CustomerService", ("CharacterTransfer: Received TransferReplyMoveValidation for %s on %s to %s on %s from LoginServer. Forwarding reply to TransferServer.", reply.getSourceCharacter().c_str(), reply.getSourceGalaxy().c_str(), reply.getDestinationCharacter().c_str(), reply.getDestinationGalaxy().c_str())); - CentralServer::getInstance().sendToTransferServer(reply); - } - else if (reply.getResult() != TransferReplyMoveValidation::TRMVR_can_create_regular_character) - { - LOG("CustomerService", ("CharacterTransfer: Received ***FAILED*** TransferReplyMoveValidation for [%u, %s, %s (%s)] to [%u, %s, %s] from LoginServer. Forwarding ***FAILED*** reply to GameServer (%u).", reply.getSourceStationId(), reply.getSourceGalaxy().c_str(), reply.getSourceCharacter().c_str(), reply.getSourceCharacterId().getValueString().c_str(), reply.getDestinationStationId(), reply.getDestinationGalaxy().c_str(), reply.getDestinationCharacter().c_str(), reply.getTrack())); - GameServerConnection * gs = CentralServer::getInstance().getGameServer(reply.getTrack()); - if (!gs) - gs = CentralServer::getInstance().getRandomGameServer(); - - if (gs) - gs->send(reply, true); - } - else - { - LOG("CustomerService", ("CharacterTransfer: Received ***SUCCESS*** TransferReplyMoveValidation for [%u, %s, %s (%s)] to [%u, %s, %s] from LoginServer. Sending TransferRequestNameValidation to a random game server.", reply.getSourceStationId(), reply.getSourceGalaxy().c_str(), reply.getSourceCharacter().c_str(), reply.getSourceCharacterId().getValueString().c_str(), reply.getDestinationStationId(), reply.getDestinationGalaxy().c_str(), reply.getDestinationCharacter().c_str())); - - TransferCharacterData requestData(reply.getTransferRequestSource()); - requestData.setTrack(reply.getTrack()); - requestData.setCustomerLocalizedLanguage(reply.getCustomerLocalizedLanguage()); - requestData.setSourceGalaxy(reply.getSourceGalaxy()); - requestData.setDestinationGalaxy(reply.getDestinationGalaxy()); - requestData.setSourceCharacterName(reply.getSourceCharacter()); - requestData.setCharacterId(reply.getSourceCharacterId()); - requestData.setObjectTemplateCrc(reply.getSourceCharacterTemplateId()); - requestData.setDestinationCharacterName(reply.getDestinationCharacter()); - requestData.setSourceStationId(reply.getSourceStationId()); - requestData.setDestinationStationId(reply.getDestinationStationId()); - const GenericValueTypeMessage requestNameValidation("TransferRequestNameValidation", requestData); - IGNORE_RETURN(CentralServer::getInstance().sendToRandomGameServer(requestNameValidation)); - } - } - else if(m.isType("TransferReplyNameValidation")) - { - GenericValueTypeMessage > const replyNameValidation(ri); - if (!replyNameValidation.getValue().second.getIsValidName() || (replyNameValidation.getValue().second.getTransferRequestSource() == TransferRequestMoveValidation::TRS_ingame_freects_command_validate) || (replyNameValidation.getValue().second.getTransferRequestSource() == TransferRequestMoveValidation::TRS_ingame_cts_command_validate)) - { - if (!replyNameValidation.getValue().second.getIsValidName()) - LOG("CustomerService", ("CharacterTransfer: Received ***FAILED*** TransferReplyNameValidation from target galaxy CentralServer : (%s) %s", replyNameValidation.getValue().first.c_str(), replyNameValidation.getValue().second.toString().c_str())); + // if this is not a free CTS galaxy, immediately forward the message to the TransferServer, + // else if this is a free CTS galaxy, forward the message to a game server so that characters + // in the list that qualifies for free CTS are removed from the list; characters that qualify + // for free CTS should/must use the in-game free CTS to transfer the character; + TransferReplyCharacterList reply(ri); + if (!FreeCtsDataTable::isFreeCtsSourceCluster(ConfigCentralServer::getClusterName())) + CentralServer::getInstance().sendToTransferServer(reply); else - LOG("CustomerService", ("CharacterTransfer: Received ***SUCCESS*** TransferReplyNameValidation from target galaxy CentralServer. Forwarding reply to GameServer (%u). %s", replyNameValidation.getValue().second.getTrack(), replyNameValidation.getValue().second.toString().c_str())); - - GameServerConnection * gs = CentralServer::getInstance().getGameServer(replyNameValidation.getValue().second.getTrack()); - if (!gs) - gs = CentralServer::getInstance().getRandomGameServer(); - - if (gs) - gs->send(replyNameValidation, true); + IGNORE_RETURN(CentralServer::getInstance().sendToRandomGameServer(reply)); + + break; } - else + case constcrc("TransferReplyCharacterDataFromLoginServer") : { - LOG("CustomerService", ("CharacterTransfer: Received ***SUCCESS*** TransferReplyNameValidation from target galaxy CentralServer. Starting transfer process : %s", replyNameValidation.getValue().second.toString().c_str())); - - // disconnect any clients with a connection to SWG services on this (the source) galaxy - GenericValueTypeMessage kickSource("TransferKickConnectedClients", replyNameValidation.getValue().second.getSourceStationId()); - GenericValueTypeMessage kickDestination("TransferKickConnectedClients", replyNameValidation.getValue().second.getDestinationStationId()); - CentralServer::getInstance().sendToAllLoginServers(kickSource); - CentralServer::getInstance().sendToAllLoginServers(kickDestination); - CentralServer::getInstance().sendToAllConnectionServers(kickSource, true); - CentralServer::getInstance().sendToAllConnectionServers(kickDestination, true); - - TransferCharacterData characterData(replyNameValidation.getValue().second); - characterData.setIsMoveRequest(true); - characterData.setWithItems(true); - characterData.setAllowOverride(true); - - LOG("CustomerService", ("CharacterTransfer: Sending TransferGetLoginLocationData for %s\n", characterData.getSourceCharacterName().c_str())); - - const GenericValueTypeMessage getLoginLocation("TransferGetLoginLocationData", characterData); - CentralServer::getInstance().sendToDBProcess(getLoginLocation, true); - } - } - else if(m.isType("TransferLoginCharacterToDestinationServer")) - { - GenericValueTypeMessage const loginCharacter(ri); - LOG("CustomerService", ("CharacterTransfer: ***CentralServer: Received TransferLoginCharacterToDestinationServer request from Login Server for %s\n", loginCharacter.getValue().toString().c_str())); - ConnectionServerConnection * connectionServer = CentralServer::getInstance().getAnyConnectionServer(); - if(connectionServer) - { - connectionServer->send(loginCharacter, true); - } - } - else if(m.isType("TransferClosePseudoClientConnection")) - { - GenericValueTypeMessage const closeRequest(ri); - CentralServer::getInstance().sendToAllConnectionServers(closeRequest, true); - } - else if(m.isType("TransferCloseClientConnection")) - { - GenericValueTypeMessage const closeRequest(ri); - - GenericValueTypeMessage const kick("TransferKickConnectedClients", closeRequest.getValue()); - CentralServer::getInstance().sendToAllLoginServers(kick); - CentralServer::getInstance().sendToAllConnectionServers(kick, true); - } - else if(m.isType("CtsCompletedForcharacter")) - { - GenericValueTypeMessage > const msg(ri); - IGNORE_RETURN(CentralServer::getInstance().sendToRandomGameServer(msg)); - } - else if(m.isType("TransferRenameCharacterReplyFromLoginServer")) - { - GenericValueTypeMessage replyFromLoginServer(ri); - LOG("CustomerService", ("CharacterTransfer: Received TransferRenameCharacterReplyFromLoginServer : %s", replyFromLoginServer.getValue().toString().c_str())); - - GenericValueTypeMessage reply("TransferRenameCharacterReply", replyFromLoginServer.getValue()); - CentralServer::getInstance().sendToTransferServer(reply); - } - else if(m.isType("TransferAccountRequestCentralDatabase")) - { - // got message back from loginServer - have to transfer to DBProcess to update the game database - GenericValueTypeMessage accountTransferRequest(ri); - LOG("CustomerService", ("CharacterTransfer: Received TransferAccountRequestCentralDatabase from station ID %d to station ID %d", accountTransferRequest.getValue().getSourceStationId(), accountTransferRequest.getValue().getDestinationStationId())); - CentralServer::getInstance().sendToDBProcess(accountTransferRequest, true); - } - else if(m.isType("TransferAccountReplySuccessTransferServer")) - { - // got reply back from login server - fwd to transfer server - GenericValueTypeMessage replyToTransferServer(ri); - LOG("CustomerService", ("CharacterTransfer: Received TransferAccountReplySuccessTransferServer from station ID %d to station ID %d", replyToTransferServer.getValue().getSourceStationId(), replyToTransferServer.getValue().getDestinationStationId())); - IGNORE_RETURN(CentralServer::getInstance().sendToTransferServer(replyToTransferServer)); - } - else if(m.isType("TransferAccountFailedToUpdateGameDatabase")) - { - // got failure message back from login server - fwd to transfer server - GenericValueTypeMessage replyToTransferServer(ri); - LOG("CustomerService", ("CharacterTransfer: Received TransferAccountFailedToUpdateGameDatabase for transfer from station ID %d to station ID %d", replyToTransferServer.getValue().getSourceStationId(), replyToTransferServer.getValue().getDestinationStationId())); - IGNORE_RETURN(CentralServer::getInstance().sendToTransferServer(replyToTransferServer)); - } - else if(m.isType("TransferAccountFailedDestinationNotEmpty")) - { - // got failure message back from login server - fwd to transfer server - GenericValueTypeMessage replyToTransferServer(ri); - LOG("CustomerService", ("CharacterTransfer: Received TransferAccountFailedDestinationNotEmpty for transfer from station ID %d to station ID %d", replyToTransferServer.getValue().getSourceStationId(), replyToTransferServer.getValue().getDestinationStationId())); - IGNORE_RETURN(CentralServer::getInstance().sendToTransferServer(replyToTransferServer)); - } - else if(m.isType("CSToolRequest")) - { - // for now, just parse the command through the command queue. - // TODO: implement command processor for this, specifically. Or, at least, make sure we're - // specifying access levels. - CSToolRequest const req(ri); - - // Doesn't appear to be too much that we can really do with the Central Server. - // So, for now, we'll just implement a 'central' command here and spam the GameServers with - // the original message otherwise. - - unsigned pos = req.getCommandString().find( " " ); - pos = pos == std::string::npos ? req.getCommandString().length() : pos; - - CentralCSHandler::getInstance().handle( req, getProcessId() ); - - - } - else if(m.isType("ConGenericMessage")) - { - ConGenericMessage con(ri); - ConsoleConnection::onCommandComplete(con.getMsg(), static_cast(con.getMsgId())); - } - else if(m.isType("AllCluserGlobalChannel")) - { - //TODO: Route to connection server directly if there is no channel? - typedef std::pair, bool> PayloadType; - GenericValueTypeMessage msg(ri); - - PayloadType const & payload = msg.getValue(); - std::string const & channelName = payload.first.first; - std::string const & messageText = payload.first.second; - bool const & isRemove = payload.second; - - LOG("CustomerService", ("BroadcastVoiceChannel: CentralServer got AllCluserGlobalChannel from LoginServer, sending to all ChatServers chan(%s) text(%s) remove(%d)", - channelName.c_str(), messageText.c_str(), (isRemove?1:0) )); - - CentralServer::getInstance().broadcastToChatServers(msg); - } - else if(m.isType("GcwScoreStatRaw")) - { - GenericValueTypeMessage >, std::map > > > > const msg(ri); - if (_stricmp(msg.getValue().first.c_str(), ConfigCentralServer::getClusterName())) - { - GameServerConnection * universeGameServerConnection = CentralServer::getInstance().getGameServer(UniverseManager::getInstance().getUniverseProcess()); - if (universeGameServerConnection) + GenericValueTypeMessage reply(ri); + // see if we need to send to transfer or connection server. + if(reply.getValue().getCSToolId() > 0) { - universeGameServerConnection->send(msg, true); + // for CS admin login. send to DB. This just shortcuts what would normally + // happen at the transfer server. + GenericValueTypeMessage login("TransferGetLoginLocationData", reply.getValue()); + CentralServer::getInstance().sendToDBProcess(login, true); } - } - } - else if(m.isType("GcwScoreStatPct")) - { - GenericValueTypeMessage, std::map > > > const msg(ri); - if (_stricmp(msg.getValue().first.c_str(), ConfigCentralServer::getClusterName())) - { - GameServerConnection * universeGameServerConnection = CentralServer::getInstance().getGameServer(UniverseManager::getInstance().getUniverseProcess()); - if (universeGameServerConnection) + else if (reply.getValue().getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) { - universeGameServerConnection->send(msg, true); + // for CTS. Send to transfer. + CentralServer::getInstance().sendToTransferServer(reply); } + break; + } + case constcrc("TransferReplyMoveValidation") : + { + TransferReplyMoveValidation const reply(ri); + + if (reply.getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server) + { + LOG("CustomerService", ("CharacterTransfer: Received TransferReplyMoveValidation for %s on %s to %s on %s from LoginServer. Forwarding reply to TransferServer.", reply.getSourceCharacter().c_str(), reply.getSourceGalaxy().c_str(), reply.getDestinationCharacter().c_str(), reply.getDestinationGalaxy().c_str())); + CentralServer::getInstance().sendToTransferServer(reply); + } + else if (reply.getResult() != TransferReplyMoveValidation::TRMVR_can_create_regular_character) + { + LOG("CustomerService", ("CharacterTransfer: Received ***FAILED*** TransferReplyMoveValidation for [%u, %s, %s (%s)] to [%u, %s, %s] from LoginServer. Forwarding ***FAILED*** reply to GameServer (%u).", reply.getSourceStationId(), reply.getSourceGalaxy().c_str(), reply.getSourceCharacter().c_str(), reply.getSourceCharacterId().getValueString().c_str(), reply.getDestinationStationId(), reply.getDestinationGalaxy().c_str(), reply.getDestinationCharacter().c_str(), reply.getTrack())); + GameServerConnection * gs = CentralServer::getInstance().getGameServer(reply.getTrack()); + if (!gs) + gs = CentralServer::getInstance().getRandomGameServer(); + + if (gs) + gs->send(reply, true); + } + else + { + LOG("CustomerService", ("CharacterTransfer: Received ***SUCCESS*** TransferReplyMoveValidation for [%u, %s, %s (%s)] to [%u, %s, %s] from LoginServer. Sending TransferRequestNameValidation to a random game server.", reply.getSourceStationId(), reply.getSourceGalaxy().c_str(), reply.getSourceCharacter().c_str(), reply.getSourceCharacterId().getValueString().c_str(), reply.getDestinationStationId(), reply.getDestinationGalaxy().c_str(), reply.getDestinationCharacter().c_str())); + + TransferCharacterData requestData(reply.getTransferRequestSource()); + requestData.setTrack(reply.getTrack()); + requestData.setCustomerLocalizedLanguage(reply.getCustomerLocalizedLanguage()); + requestData.setSourceGalaxy(reply.getSourceGalaxy()); + requestData.setDestinationGalaxy(reply.getDestinationGalaxy()); + requestData.setSourceCharacterName(reply.getSourceCharacter()); + requestData.setCharacterId(reply.getSourceCharacterId()); + requestData.setObjectTemplateCrc(reply.getSourceCharacterTemplateId()); + requestData.setDestinationCharacterName(reply.getDestinationCharacter()); + requestData.setSourceStationId(reply.getSourceStationId()); + requestData.setDestinationStationId(reply.getDestinationStationId()); + const GenericValueTypeMessage requestNameValidation("TransferRequestNameValidation", requestData); + IGNORE_RETURN(CentralServer::getInstance().sendToRandomGameServer(requestNameValidation)); + } + + break; + } + case constcrc("TransferReplyNameValidation") : + { + GenericValueTypeMessage > const replyNameValidation(ri); + if (!replyNameValidation.getValue().second.getIsValidName() || (replyNameValidation.getValue().second.getTransferRequestSource() == TransferRequestMoveValidation::TRS_ingame_freects_command_validate) || (replyNameValidation.getValue().second.getTransferRequestSource() == TransferRequestMoveValidation::TRS_ingame_cts_command_validate)) + { + if (!replyNameValidation.getValue().second.getIsValidName()) + LOG("CustomerService", ("CharacterTransfer: Received ***FAILED*** TransferReplyNameValidation from target galaxy CentralServer : (%s) %s", replyNameValidation.getValue().first.c_str(), replyNameValidation.getValue().second.toString().c_str())); + else + LOG("CustomerService", ("CharacterTransfer: Received ***SUCCESS*** TransferReplyNameValidation from target galaxy CentralServer. Forwarding reply to GameServer (%u). %s", replyNameValidation.getValue().second.getTrack(), replyNameValidation.getValue().second.toString().c_str())); + + GameServerConnection * gs = CentralServer::getInstance().getGameServer(replyNameValidation.getValue().second.getTrack()); + if (!gs) + gs = CentralServer::getInstance().getRandomGameServer(); + + if (gs) + gs->send(replyNameValidation, true); + } + else + { + LOG("CustomerService", ("CharacterTransfer: Received ***SUCCESS*** TransferReplyNameValidation from target galaxy CentralServer. Starting transfer process : %s", replyNameValidation.getValue().second.toString().c_str())); + + // disconnect any clients with a connection to SWG services on this (the source) galaxy + GenericValueTypeMessage kickSource("TransferKickConnectedClients", replyNameValidation.getValue().second.getSourceStationId()); + GenericValueTypeMessage kickDestination("TransferKickConnectedClients", replyNameValidation.getValue().second.getDestinationStationId()); + CentralServer::getInstance().sendToAllLoginServers(kickSource); + CentralServer::getInstance().sendToAllLoginServers(kickDestination); + CentralServer::getInstance().sendToAllConnectionServers(kickSource, true); + CentralServer::getInstance().sendToAllConnectionServers(kickDestination, true); + + TransferCharacterData characterData(replyNameValidation.getValue().second); + characterData.setIsMoveRequest(true); + characterData.setWithItems(true); + characterData.setAllowOverride(true); + + LOG("CustomerService", ("CharacterTransfer: Sending TransferGetLoginLocationData for %s\n", characterData.getSourceCharacterName().c_str())); + + const GenericValueTypeMessage getLoginLocation("TransferGetLoginLocationData", characterData); + CentralServer::getInstance().sendToDBProcess(getLoginLocation, true); + } + break; + } + case constcrc("TransferLoginCharacterToDestinationServer") : + { + GenericValueTypeMessage const loginCharacter(ri); + LOG("CustomerService", ("CharacterTransfer: ***CentralServer: Received TransferLoginCharacterToDestinationServer request from Login Server for %s\n", loginCharacter.getValue().toString().c_str())); + ConnectionServerConnection * connectionServer = CentralServer::getInstance().getAnyConnectionServer(); + if(connectionServer) + { + connectionServer->send(loginCharacter, true); + } + break; + } + case constcrc("TransferClosePseudoClientConnection") : + { + GenericValueTypeMessage const closeRequest(ri); + CentralServer::getInstance().sendToAllConnectionServers(closeRequest, true); + break; + } + case constcrc("TransferCloseClientConnection") : + { + GenericValueTypeMessage const closeRequest(ri); + + GenericValueTypeMessage const kick("TransferKickConnectedClients", closeRequest.getValue()); + CentralServer::getInstance().sendToAllLoginServers(kick); + CentralServer::getInstance().sendToAllConnectionServers(kick, true); + break; + } + case constcrc("CtsCompletedForcharacter") : + { + GenericValueTypeMessage > const msg(ri); + IGNORE_RETURN(CentralServer::getInstance().sendToRandomGameServer(msg)); + break; + } + case constcrc("TransferRenameCharacterReplyFromLoginServer") : + { + GenericValueTypeMessage replyFromLoginServer(ri); + LOG("CustomerService", ("CharacterTransfer: Received TransferRenameCharacterReplyFromLoginServer : %s", replyFromLoginServer.getValue().toString().c_str())); + + GenericValueTypeMessage reply("TransferRenameCharacterReply", replyFromLoginServer.getValue()); + CentralServer::getInstance().sendToTransferServer(reply); + + break; + } + case constcrc("TransferAccountRequestCentralDatabase") : + { + // got message back from loginServer - have to transfer to DBProcess to update the game database + GenericValueTypeMessage accountTransferRequest(ri); + LOG("CustomerService", ("CharacterTransfer: Received TransferAccountRequestCentralDatabase from station ID %d to station ID %d", accountTransferRequest.getValue().getSourceStationId(), accountTransferRequest.getValue().getDestinationStationId())); + CentralServer::getInstance().sendToDBProcess(accountTransferRequest, true); + break; + } + case constcrc("TransferAccountReplySuccessTransferServer") : + { + // got reply back from login server - fwd to transfer server + GenericValueTypeMessage replyToTransferServer(ri); + LOG("CustomerService", ("CharacterTransfer: Received TransferAccountReplySuccessTransferServer from station ID %d to station ID %d", replyToTransferServer.getValue().getSourceStationId(), replyToTransferServer.getValue().getDestinationStationId())); + IGNORE_RETURN(CentralServer::getInstance().sendToTransferServer(replyToTransferServer)); + + break; + } + case constcrc("TransferAccountFailedToUpdateGameDatabase") : + { + // got failure message back from login server - fwd to transfer server + GenericValueTypeMessage replyToTransferServer(ri); + LOG("CustomerService", ("CharacterTransfer: Received TransferAccountFailedToUpdateGameDatabase for transfer from station ID %d to station ID %d", replyToTransferServer.getValue().getSourceStationId(), replyToTransferServer.getValue().getDestinationStationId())); + IGNORE_RETURN(CentralServer::getInstance().sendToTransferServer(replyToTransferServer)); + break; + } + case constcrc("TransferAccountFailedDestinationNotEmpty") : + { + // got failure message back from login server - fwd to transfer server + GenericValueTypeMessage replyToTransferServer(ri); + LOG("CustomerService", ("CharacterTransfer: Received TransferAccountFailedDestinationNotEmpty for transfer from station ID %d to station ID %d", replyToTransferServer.getValue().getSourceStationId(), replyToTransferServer.getValue().getDestinationStationId())); + IGNORE_RETURN(CentralServer::getInstance().sendToTransferServer(replyToTransferServer)); + break; + } + case constcrc("CSToolRequest") : + { + // for now, just parse the command through the command queue. + // TODO: implement command processor for this, specifically. Or, at least, make sure we're + // specifying access levels. + CSToolRequest const req(ri); + + // Doesn't appear to be too much that we can really do with the Central Server. + // So, for now, we'll just implement a 'central' command here and spam the GameServers with + // the original message otherwise. + + unsigned pos = req.getCommandString().find( " " ); + pos = pos == std::string::npos ? req.getCommandString().length() : pos; + + CentralCSHandler::getInstance().handle( req, getProcessId() ); + + break; + } + case constcrc("ConGenericMessage") : + { + ConGenericMessage con(ri); + ConsoleConnection::onCommandComplete(con.getMsg(), static_cast(con.getMsgId())); + + break; + } + case constcrc("AllCluserGlobalChannel") : + { + //TODO: Route to connection server directly if there is no channel? + typedef std::pair, bool> PayloadType; + GenericValueTypeMessage msg(ri); + + PayloadType const & payload = msg.getValue(); + std::string const & channelName = payload.first.first; + std::string const & messageText = payload.first.second; + bool const & isRemove = payload.second; + + LOG("CustomerService", ("BroadcastVoiceChannel: CentralServer got AllCluserGlobalChannel from LoginServer, sending to all ChatServers chan(%s) text(%s) remove(%d)", + channelName.c_str(), messageText.c_str(), (isRemove?1:0) )); + + CentralServer::getInstance().broadcastToChatServers(msg); + + break; + } + case constcrc("GcwScoreStatRaw") : + { + GenericValueTypeMessage >, std::map > > > > const msg(ri); + if (_stricmp(msg.getValue().first.c_str(), ConfigCentralServer::getClusterName())) + { + GameServerConnection * universeGameServerConnection = CentralServer::getInstance().getGameServer(UniverseManager::getInstance().getUniverseProcess()); + if (universeGameServerConnection) + { + universeGameServerConnection->send(msg, true); + } + } + break; + } + case constcrc("GcwScoreStatPct") : + { + GenericValueTypeMessage, std::map > > > const msg(ri); + if (_stricmp(msg.getValue().first.c_str(), ConfigCentralServer::getClusterName())) + { + GameServerConnection * universeGameServerConnection = CentralServer::getInstance().getGameServer(UniverseManager::getInstance().getUniverseProcess()); + if (universeGameServerConnection) + { + universeGameServerConnection->send(msg, true); + } + } + break; } }