示例#1
0
        public override void ListFactories(IRpcController controller, bnet.protocol.game_master.ListFactoriesRequest request, Action <bnet.protocol.game_master.ListFactoriesResponse> done)
        {
            Logger.Trace("ListFactories() {0}", this.Client);

            var statsBucket = bnet.protocol.game_master.GameStatsBucket.CreateBuilder()
                              .SetBucketMin(0)
                              .SetBucketMax(4267296)
                              .SetWaitMilliseconds(1354)
                              .SetGamesPerHour(0)
                              .SetActiveGames(69)
                              .SetActivePlayers(75)
                              .SetFormingGames(5)
                              .SetWaitingPlayers(0).Build();

            var factoryDescriptions = new bnet.protocol.game_master.GameFactoryDescription[4];

            for (var i = 0; i < factoryDescriptions.Length; i++)
            {
                var factoryAttributes = new bnet.protocol.attribute.Attribute[]
                {
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("min_players").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(2)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("max_players").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(4)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("num_teams").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("version").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetStringValue("0.7.0")).Build(), //This should be a static string so all versions are the same -Egris
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("PlayerGroup").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(0)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("PlayerGroup").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("PlayerGroup").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(2)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("Game.CurrentQuest").SetValue(bnet.protocol.attribute.Variant.CreateBuilder()).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("DifficultyLevel").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(i)).Build(),
                };
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                                         .AddRangeAttribute(factoryAttributes)
                                         .SetId(14249086168335147635 + (ulong)i)
                                         .AddStatsBucket(statsBucket)
                                         .Build();
            }

            var builder = bnet.protocol.game_master.ListFactoriesResponse.CreateBuilder().AddRangeDescription(factoryDescriptions).SetTotalResults((uint)factoryDescriptions.Length);

            done(builder.Build());
        }
示例#2
0
        public override void ListFactories(IRpcController controller, bnet.protocol.game_master.ListFactoriesRequest request, Action<bnet.protocol.game_master.ListFactoriesResponse> done)
        {
            Logger.Trace("ListFactories() {0}", this.Client);

            var statsBucket = bnet.protocol.game_master.GameStatsBucket.CreateBuilder()
               .SetBucketMin(0)
               .SetBucketMax(4267296)
               .SetWaitMilliseconds(1354)
               .SetGamesPerHour(0)
               .SetActiveGames(69)
               .SetActivePlayers(75)
               .SetFormingGames(5)
               .SetWaitingPlayers(0).Build();

            var factoryDescriptions = new bnet.protocol.game_master.GameFactoryDescription[4];
            for (var i = 0; i < factoryDescriptions.Length; i++)
            {
                var factoryAttributes = new bnet.protocol.attribute.Attribute[]
                {
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("min_players").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(2)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("max_players").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(4)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("num_teams").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("version").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetStringValue("0.7.0")).Build(), //This should be a static string so all versions are the same -Egris
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("PlayerGroup").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(0)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("PlayerGroup").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("PlayerGroup").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(2)).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("Game.CurrentQuest").SetValue(bnet.protocol.attribute.Variant.CreateBuilder()).Build(),
                    bnet.protocol.attribute.Attribute.CreateBuilder().SetName("DifficultyLevel").SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(i)).Build(),
                };
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                    .AddRangeAttribute(factoryAttributes)
                    .SetId(14249086168335147635 + (ulong)i)
                    .AddStatsBucket(statsBucket)
                    .Build();
            }

            var builder = bnet.protocol.game_master.ListFactoriesResponse.CreateBuilder().AddRangeDescription(factoryDescriptions).SetTotalResults((uint)factoryDescriptions.Length);
            done(builder.Build());
        }
示例#3
0
        public override void ListFactories(IRpcController controller, bnet.protocol.game_master.ListFactoriesRequest request, Action <bnet.protocol.game_master.ListFactoriesResponse> done)
        {
            Logger.Trace("ListFactories() {0}", this.Client);

            var statsBucket = bnet.protocol.game_master.GameStatsBucket.CreateBuilder()
                              .SetBucketMin(0)
                              .SetBucketMax(4267296)
                              .SetWaitMilliseconds(1354)
                              .SetGamesPerHour(0)
                              .SetActiveGames(69)
                              .SetActivePlayers(75)
                              .SetFormingGames(5)
                              .SetWaitingPlayers(0).Build();

            var factoryDescriptions = new bnet.protocol.game_master.GameFactoryDescription[9];

            for (var i = 0; i < 4; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 0,
                    currentquest: "",
                    difficultylevel: i
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                                         .AddRangeAttribute(factoryAttributes)
                                         .SetId(14249086168335147635 + (ulong)i)
                                         .AddStatsBucket(statsBucket)
                                         .Build();
            }
            for (var i = 4; i < 8; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 1,
                    currentquest: "",
                    difficultylevel: i - 4
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                                         .AddRangeAttribute(factoryAttributes)
                                         .SetId(14249086168335147635 + (ulong)i)
                                         .AddStatsBucket(statsBucket)
                                         .Build();
            }
            for (int i = 8; i < 9; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 2,
                    currentquest: "",
                    difficultylevel: 0
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                                         .AddRangeAttribute(factoryAttributes)
                                         .SetId(14249086168335147635 + (ulong)i)
                                         .AddStatsBucket(statsBucket)
                                         .Build();
            }

            var builder = bnet.protocol.game_master.ListFactoriesResponse.CreateBuilder().AddRangeDescription(factoryDescriptions).SetTotalResults((uint)factoryDescriptions.Length);

            done(builder.Build());
        }
示例#4
0
        public override void ListFactories(IRpcController controller, bnet.protocol.game_master.ListFactoriesRequest request, Action<bnet.protocol.game_master.ListFactoriesResponse> done)
        {
            Logger.Trace("ListFactories() {0}", this.Client);

            var statsBucket = bnet.protocol.game_master.GameStatsBucket.CreateBuilder()
               .SetBucketMin(0)
               .SetBucketMax(4267296)
               .SetWaitMilliseconds(1354)
               .SetGamesPerHour(0)
               .SetActiveGames(69)
               .SetActivePlayers(75)
               .SetFormingGames(5)
               .SetWaitingPlayers(0).Build();

            var factoryDescriptions = new bnet.protocol.game_master.GameFactoryDescription[9];
            for (var i = 0; i < 4; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 0,
                    currentquest: "",
                    difficultylevel: i
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                    .AddRangeAttribute(factoryAttributes)
                    .SetId(14249086168335147635 + (ulong)i)
                    .AddStatsBucket(statsBucket)
                    .Build();
            }
            for (var i = 4; i < 8; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 1,
                    currentquest: "",
                    difficultylevel: i - 4
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                    .AddRangeAttribute(factoryAttributes)
                    .SetId(14249086168335147635 + (ulong)i)
                    .AddStatsBucket(statsBucket)
                    .Build();
            }
            for (int i = 8; i < 9; i++)
            {
                var factoryAttributes = GetFactoryAttributes(
                    min_players: 2,
                    max_players: 4,
                    num_teams: 1,
                    version: Mooege.Common.Versions.VersionInfo.Ingame.MajorVersion,
                    playergroup: 2,
                    currentquest: "",
                    difficultylevel: 0
                    );
                factoryDescriptions[i] = bnet.protocol.game_master.GameFactoryDescription.CreateBuilder()
                    .AddRangeAttribute(factoryAttributes)
                    .SetId(14249086168335147635 + (ulong)i)
                    .AddStatsBucket(statsBucket)
                    .Build();
            }

            var builder = bnet.protocol.game_master.ListFactoriesResponse.CreateBuilder().AddRangeDescription(factoryDescriptions).SetTotalResults((uint)factoryDescriptions.Length);
            done(builder.Build());
        }