void ProtocolGame::parsePlayerLogin(InputMessage& msg) { uint playerId = msg.getU32(); int serverBeat = msg.getU16(); int playerCanReportBugs = msg.getU8(); m_localPlayer = LocalPlayerPtr(new LocalPlayer); m_localPlayer->setId(playerId); m_localPlayer->setCanReportBugs(playerCanReportBugs); g_game.processLogin(m_localPlayer, serverBeat); }
void Game::loginWorld(const std::string& account, const std::string& password, const std::string& worldName, const std::string& worldHost, int worldPort, const std::string& characterName) { if(m_protocolGame || isOnline()) stdext::throw_exception("Unable to login into a world while already online or logging."); if(m_clientVersion == 0) stdext::throw_exception("Must set a valid game protocol version before logging."); // reset the new game state resetGameStates(); m_localPlayer = LocalPlayerPtr(new LocalPlayer); m_localPlayer->setName(characterName); m_protocolGame = ProtocolGamePtr(new ProtocolGame); m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName); m_characterName = characterName; m_worldName = worldName; }