Example #1
0
        // TODO: Implement loading existing realms.
        // TODO: Implement existing character counts.
        static async Task HandleRealmListRequest(ClientRequest clientRequest, BnetSession session)
        {
            var realmJoinRequest = clientRequest.GetVariant("Command_RealmListRequest_v1_b9")?.StringValue;
            var realmListTicket  = clientRequest.GetVariant("Param_RealmListTicket")?.BlobValue.ToByteArray();

            if (session.RealmListTicket.Compare(realmListTicket))
            {
                var realmListResponse = new ClientResponse();
                var realmlist         = new RealmListUpdates();

                realmListResponse.Attribute.Add(new Bgs.Protocol.Attribute
                {
                    Name  = "Param_RealmList",
                    Value = new Variant
                    {
                        BlobValue = ByteString.CopyFrom(Deflate("JSONRealmListUpdates", realmlist))
                    }
                });

                var realmCharacterCountList = new RealmCharacterCountList();

                realmListResponse.Attribute.Add(new Bgs.Protocol.Attribute
                {
                    Name  = "Param_CharacterCountList",
                    Value = new Variant
                    {
                        BlobValue = ByteString.CopyFrom(Deflate("JSONRealmCharacterCountList", realmCharacterCountList))
                    }
                });

                await session.Send(realmListResponse);
            }
        }
Example #2
0
    public byte[] GetRealmList(uint build, string subRegion)
    {
        var realmList = new RealmListUpdates();

        foreach (var realm in _realms)
        {
            if (realm.Value.Id.GetSubRegionAddress() != subRegion)
            {
                continue;
            }

            RealmFlags flag = realm.Value.Flags;
            if (realm.Value.Build != build)
            {
                flag |= RealmFlags.VersionMismatch;
            }

            RealmListUpdate realmListUpdate = new RealmListUpdate();
            realmListUpdate.Update.WowRealmAddress = (int)realm.Value.Id.GetAddress();
            realmListUpdate.Update.CfgTimezonesID  = 1;
            realmListUpdate.Update.PopulationState = (realm.Value.Flags.HasAnyFlag(RealmFlags.Offline) ? 0 : Math.Max((int)realm.Value.PopulationLevel, 1));
            realmListUpdate.Update.CfgCategoriesID = realm.Value.Timezone;

            RealmBuildInfo buildInfo = GetBuildInfo(realm.Value.Build);
            if (buildInfo != null)
            {
                realmListUpdate.Update.Version.Major    = (int)buildInfo.MajorVersion;
                realmListUpdate.Update.Version.Minor    = (int)buildInfo.MinorVersion;
                realmListUpdate.Update.Version.Revision = (int)buildInfo.BugfixVersion;
                realmListUpdate.Update.Version.Build    = (int)buildInfo.Build;
            }
            else
            {
                realmListUpdate.Update.Version.Major    = 7;
                realmListUpdate.Update.Version.Minor    = 1;
                realmListUpdate.Update.Version.Revision = 0;
                realmListUpdate.Update.Version.Build    = (int)realm.Value.Build;
            }

            realmListUpdate.Update.CfgRealmsID    = (int)realm.Value.Id.Realm;
            realmListUpdate.Update.Flags          = (int)flag;
            realmListUpdate.Update.Name           = realm.Value.Name;
            realmListUpdate.Update.CfgConfigsID   = (int)realm.Value.GetConfigId();
            realmListUpdate.Update.CfgLanguagesID = 1;

            realmListUpdate.Deleting = false;

            realmList.Updates.Add(realmListUpdate);
        }

        return(Json.Deflate("JSONRealmListUpdates", realmList));
    }
        public static void HandleClientRequest(AuthSession session, ClientRequest clientRequest)
        {
            string         name;
            ClientResponse clientResponse;

            if (GameUtilitiesService.smethod_0(clientRequest.Attribute[0].Name, Module.smethod_37 <string>(1549087768u)))
            {
                IEnumerator <Bgs.Protocol.Attribute> enumerator = clientRequest.Attribute.GetEnumerator();
                try
                {
                    while (true)
                    {
IL_156:
                        uint arg_11E_0 = GameUtilitiesService.smethod_2(enumerator) ? 707215618u : 982195081u;
                        while (true)
                        {
                            uint num;
                            switch ((num = (arg_11E_0 ^ 1820510042u)) % 7u)
                            {
                            case 0u:
                                arg_11E_0 = 707215618u;
                                continue;

                            case 1u:
                                goto IL_156;

                            case 2u:
                            {
                                Bgs.Protocol.Attribute current = enumerator.Current;
                                arg_11E_0 = (GameUtilitiesService.smethod_0(current.Name, Module.smethod_35 <string>(2108436570u)) ? 1292263614u : 39044470u);
                                continue;
                            }

                            case 3u:
                            {
                                Bgs.Protocol.Attribute current;
                                IEnumerable <int>      arg_C7_0 = Json.CreateObject <RealmListTicketClientInformation>(GameUtilitiesService.smethod_1(current.Value.BlobValue.ToStringUtf8(), Module.smethod_34 <string>(607107096u), "")).Info.Secret;
                                Func <int, byte>       arg_C7_1;
                                if ((arg_C7_1 = GameUtilitiesService.__c.__9__0_0) == null)
                                {
                                    arg_C7_1 = (GameUtilitiesService.__c.__9__0_0 = new Func <int, byte>(GameUtilitiesService.__c.__9.HandleClientRequestb__0_0));
                                }
                                Globals.Secret = arg_C7_0.Select(arg_C7_1).ToArray <byte>();
                                arg_11E_0      = 1388634718u;
                                continue;
                            }

                            case 4u:
                                arg_11E_0 = (num * 3357184604u ^ 1408942728u);
                                continue;

                            case 6u:
                            {
                                Bgs.Protocol.Attribute current;
                                GameUtilitiesService.smethod_0(current.Name, "");
                                arg_11E_0 = 390289400u;
                                continue;
                            }
                            }
                            goto Block_10;
                        }
                    }
                    Block_10 :;
                }
                finally
                {
                    if (enumerator != null)
                    {
                        while (true)
                        {
                            IL_19C :
                            uint arg_183_0 = 1000108845u;
                            while (true)
                            {
                                uint num;
                                switch ((num = (arg_183_0 ^ 1820510042u)) % 3u)
                                {
                                case 0u:
                                    goto IL_19C;

                                case 2u:
                                    GameUtilitiesService.smethod_3(enumerator);
                                    arg_183_0 = (num * 2856457603u ^ 3035350054u);
                                    continue;
                                }
                                goto Block_14;
                            }
                        }
                        Block_14 :;
                    }
                }
                name           = Module.smethod_35 <string>(1450915626u);
                clientResponse = new ClientResponse();
                goto IL_205;
            }
            goto IL_6F3;
            uint arg_682_0;

            while (true)
            {
IL_67D:
                uint num;
                switch ((num = (arg_682_0 ^ 1820510042u)) % 21u)
                {
                case 0u:
                {
                    ClientResponse message = new ClientResponse();
                    arg_682_0 = (num * 1960178030u ^ 3375314732u);
                    continue;
                }

                case 1u:
                    clientResponse.Attribute.Add(new Bgs.Protocol.Attribute
                    {
                        Name  = name,
                        Value = new Variant
                        {
                            BlobValue = ByteString.CopyFromUtf8(Module.smethod_36 <string>(2871343933u))
                        }
                    });
                    session.Send(clientResponse);
                    arg_682_0 = (num * 2849486171u ^ 3438062413u);
                    continue;

                case 2u:
                {
                    ClientResponse clientResponse2 = new ClientResponse();
                    arg_682_0 = (num * 1708365464u ^ 846537027u);
                    continue;
                }

                case 3u:
                {
                    ClientResponse clientResponse3;
                    clientResponse3.Attribute.Add(new Bgs.Protocol.Attribute
                        {
                            Name  = Module.smethod_35 <string>(1814716925u),
                            Value = new Variant
                            {
                                BlobValue = ByteString.CopyFromUtf8(Module.smethod_34 <string>(904052351u))
                            }
                        });
                    RealmListServerIPAddresses realmListServerIPAddresses = new RealmListServerIPAddresses();
                    arg_682_0 = (num * 1691718091u ^ 3467647916u);
                    continue;
                }

                case 4u:
                {
                    RealmListServerIPAddresses realmListServerIPAddresses;
                    realmListServerIPAddresses.Families.Add(new Family
                        {
                            Id        = 2,
                            Addresses = new List <AuthServer.AuthServer.JsonObjects.Address>()
                        });
                    arg_682_0 = (num * 78695267u ^ 2554691107u);
                    continue;
                }

                case 5u:
                    arg_682_0 = (GameUtilitiesService.smethod_0(clientRequest.Attribute[0].Name, Module.smethod_33 <string>(3445444445u)) ? 1552249222u : 2080562207u);
                    continue;

                case 6u:
                    return;

                case 7u:
                {
                    ClientResponse             clientResponse3;
                    RealmListServerIPAddresses realmListServerIPAddresses;
                    clientResponse3.Attribute.Add(new Bgs.Protocol.Attribute
                        {
                            Name  = Module.smethod_35 <string>(2074000899u),
                            Value = new Variant
                            {
                                BlobValue = ByteString.CopyFrom(GameUtilitiesService.GetCompressedData(Module.smethod_35 <string>(2339801210u), Json.CreateString <RealmListServerIPAddresses>(realmListServerIPAddresses)))
                            }
                        });
                    clientResponse3.Attribute.Add(new Bgs.Protocol.Attribute
                        {
                            Name  = Module.smethod_33 <string>(2686709168u),
                            Value = new Variant
                            {
                                BlobValue = ByteString.CopyFrom(Globals.JoinSecret)
                            }
                        });
                    session.Send(clientResponse3);
                    arg_682_0 = (num * 1149426949u ^ 1180628059u);
                    continue;
                }

                case 8u:
                {
                    ClientResponse clientResponse2;
                    session.Send(clientResponse2);
                    arg_682_0 = (num * 3033014184u ^ 922385703u);
                    continue;
                }

                case 9u:
                    return;

                case 10u:
                {
                    RealmListServerIPAddresses realmListServerIPAddresses;
                    realmListServerIPAddresses.Families = new List <Family>();
                    arg_682_0 = (num * 3674508602u ^ 631681376u);
                    continue;
                }

                case 11u:
                {
                    ClientResponse   clientResponse2;
                    RealmListUpdates realmListUpdates;
                    clientResponse2.Attribute.Add(new Bgs.Protocol.Attribute
                        {
                            Name  = Module.smethod_33 <string>(2409987499u),
                            Value = new Variant
                            {
                                BlobValue = ByteString.CopyFrom(GameUtilitiesService.GetCompressedData(Module.smethod_36 <string>(966958691u), Json.CreateString <RealmListUpdates>(realmListUpdates)))
                            }
                        });
                    RealmCharacterCountList dataObject = new RealmCharacterCountList();
                    clientResponse2.Attribute.Add(new Bgs.Protocol.Attribute
                        {
                            Name  = Module.smethod_36 <string>(4040564189u),
                            Value = new Variant
                            {
                                BlobValue = ByteString.CopyFrom(GameUtilitiesService.GetCompressedData(Module.smethod_33 <string>(2576241685u), Json.CreateString <RealmCharacterCountList>(dataObject)))
                            }
                        });
                    arg_682_0 = (num * 716287039u ^ 3546797012u);
                    continue;
                }

                case 12u:
                {
                    RealmListUpdates realmListUpdates = new RealmListUpdates();
                    realmListUpdates.Updates = new List <RealmListUpdate>
                    {
                        new RealmListUpdate
                        {
                            WowRealmAddress = 1u,
                            Update          = new Update
                            {
                                WowRealmAddress = 1,
                                CfgTimezonesID  = 2,
                                PopulationState = 1,
                                CfgCategoriesID = 1,
                                Version         = new ClientVersion
                                {
                                    Major    = 7,
                                    Minor    = 1,
                                    Revision = 0,
                                    Build    = 22996
                                },
                                CfgRealmsID    = 1,
                                Flags          = 4,
                                CfgConfigsID   = 1,
                                CfgLanguagesID = 1,
                                Name           = Module.smethod_36 <string>(4208195762u)
                            }
                        }
                    };
                    arg_682_0 = (num * 2759149309u ^ 1324415408u);
                    continue;
                }

                case 13u:
                {
                    RealmListServerIPAddresses realmListServerIPAddresses;
                    realmListServerIPAddresses.Families.Add(new Family
                        {
                            Id        = 1,
                            Addresses = new List <AuthServer.AuthServer.JsonObjects.Address>
                            {
                                new AuthServer.AuthServer.JsonObjects.Address
                                {
                                    Ip   = Module.smethod_33 <string>(1362828071u),
                                    Port = 8085
                                }
                            }
                        });
                    arg_682_0 = (num * 2455873529u ^ 3627955475u);
                    continue;
                }

                case 14u:
                {
                    ClientResponse message;
                    session.Send(message);
                    arg_682_0 = (num * 1672891969u ^ 1215791913u);
                    continue;
                }

                case 16u:
                {
                    Globals.JoinSecret = new byte[0].GenerateRandomKey(32);
                    SHA256Managed expr_226 = GameUtilitiesService.smethod_4();
                    GameUtilitiesService.smethod_5(expr_226, Globals.Secret, 0, Globals.Secret.Length, Globals.Secret, 0);
                    GameUtilitiesService.smethod_6(expr_226, Globals.JoinSecret, 0, Globals.JoinSecret.Length);
                    Globals.SessionKey = GameUtilitiesService.smethod_7(expr_226);
                    ClientResponse clientResponse3 = new ClientResponse();
                    arg_682_0 = (num * 181368554u ^ 2569788186u);
                    continue;
                }

                case 17u:
                    goto IL_205;

                case 18u:
                    return;

                case 19u:
                    arg_682_0 = ((!GameUtilitiesService.smethod_0(clientRequest.Attribute[0].Name, Module.smethod_36 <string>(2188320489u))) ? 1384141042u : 1913633765u);
                    continue;

                case 20u:
                    goto IL_6F3;
                }
                break;
            }
            return;

IL_205:
            arg_682_0 = 513478610u;
            goto IL_67D;
IL_6F3:
            arg_682_0 = ((!GameUtilitiesService.smethod_0(clientRequest.Attribute[0].Name, Module.smethod_35 <string>(2192477891u))) ? 1776235731u : 1794780940u);
            goto IL_67D;
        }