BattlenetRpcErrorCode HandleLogon(LogonRequest logonRequest, NoData response) { if (logonRequest.Program != "WoW") { Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in with game other than WoW (using {logonRequest.Program})!"); return(BattlenetRpcErrorCode.BadProgram); } if (logonRequest.Platform != "Win" && logonRequest.Platform != "Wn64" && logonRequest.Platform != "Mc64") { Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in from an unsupported platform (using {logonRequest.Platform})!"); return(BattlenetRpcErrorCode.BadPlatform); } if (!SharedConst.IsValidLocale(logonRequest.Locale.ToEnum <Locale>())) { Log.outDebug(LogFilter.Session, $"Battlenet.LogonRequest: {GetClientInfo()} attempted to log in with unsupported locale (using {logonRequest.Locale})!"); return(BattlenetRpcErrorCode.BadLocale); } locale = logonRequest.Locale; os = logonRequest.Platform; build = (uint)logonRequest.ApplicationVersion; var endpoint = Global.LoginServiceMgr.GetAddressForClient(GetRemoteIpEndPoint().Address); ChallengeExternalRequest externalChallenge = new ChallengeExternalRequest(); externalChallenge.PayloadType = "web_auth_url"; externalChallenge.Payload = ByteString.CopyFromUtf8($"https://{endpoint.Address}:{endpoint.Port}/bnetserver/login/"); SendRequest((uint)OriginalHash.ChallengeListener, 3, externalChallenge); return(BattlenetRpcErrorCode.Ok); }
public void LoadCreatureTextLocales() { uint oldMSTime = Time.GetMSTime(); mLocaleTextMap.Clear(); // for reload case SQLResult result = DB.World.Query("SELECT CreatureId, GroupId, ID, Locale, Text FROM creature_text_locale"); if (result.IsEmpty()) return; do { uint creatureId = result.Read<uint>(0); uint groupId = result.Read<byte>(1); uint id = result.Read<byte>(2); string localeName = result.Read<string>(3); Locale locale = localeName.ToEnum<Locale>(); if (!SharedConst.IsValidLocale(locale) || locale == Locale.enUS) continue; var key = new CreatureTextId(creatureId, groupId, id); if (!mLocaleTextMap.ContainsKey(key)) mLocaleTextMap[key] = new CreatureTextLocale(); CreatureTextLocale data = mLocaleTextMap[key]; ObjectManager.AddLocaleString(result.Read<string>(4), locale, data.Text); } while (result.NextRow()); Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creature localized texts in {1} ms", mLocaleTextMap.Count, Time.GetMSTimeDiffToNow(oldMSTime)); }