コード例 #1
0
    public byte[] GetRealmEntryJSON(RealmHandle id, uint build)
    {
        byte[] compressed = new byte[0];
        Realm  realm      = GetRealm(id);

        if (realm != null)
        {
            if (!realm.Flags.HasAnyFlag(RealmFlags.Offline) && realm.Build == build)
            {
                var realmEntry = new RealmEntry();
                realmEntry.WowRealmAddress = (int)realm.Id.GetAddress();
                realmEntry.CfgTimezonesID  = 1;
                realmEntry.PopulationState = Math.Max((int)realm.PopulationLevel, 1);
                realmEntry.CfgCategoriesID = realm.Timezone;

                ClientVersion  version   = new ClientVersion();
                RealmBuildInfo buildInfo = GetBuildInfo(realm.Build);
                if (buildInfo != null)
                {
                    version.Major    = (int)buildInfo.MajorVersion;
                    version.Minor    = (int)buildInfo.MinorVersion;
                    version.Revision = (int)buildInfo.BugfixVersion;
                    version.Build    = (int)buildInfo.Build;
                }
                else
                {
                    version.Major    = 6;
                    version.Minor    = 2;
                    version.Revision = 4;
                    version.Build    = (int)realm.Build;
                }
                realmEntry.Version = version;

                realmEntry.CfgRealmsID    = (int)realm.Id.Realm;
                realmEntry.Flags          = (int)realm.Flags;
                realmEntry.Name           = realm.Name;
                realmEntry.CfgConfigsID   = (int)realm.GetConfigId();
                realmEntry.CfgLanguagesID = 1;

                compressed = Json.Deflate("JamJSONRealmEntry", realmEntry);
            }
        }

        return(compressed);
    }