Пример #1
0
        public override async void Process()
        {
            var home     = Device.Player.Home;
            var alliance = await Resources.Alliances.GetAllianceAsync(home.AllianceInfo.Id);

            if (!(alliance?.Stream.Find(e => e.Id == EntryId && e.StreamEntryType == 10) is ChallengeStreamEntry entry)
                )
            {
                return;
            }

            alliance.RemoveEntry(entry);

            var enemy = await Resources.Players.GetPlayerAsync(entry.SenderId);

            if (enemy.Device != null)
            {
                var battle = new LogicBattle(true, entry.Arena)
                {
                    Device.Player, enemy
                };

                Resources.Battles.Add(battle);

                Device.Player.Battle = battle;
                enemy.Battle         = battle;

                battle.Start();
            }

            alliance.Save();

            // TODO: Update Entry + Battle Result + Card levels
        }
Пример #2
0
        public override async void Process()
        {
            if (Is2V2)
            {
                await new MatchmakeFailedMessage(Device).SendAsync();
                await new CancelMatchmakeDoneMessage(Device).SendAsync();
            }
            else
            {
                var enemy = Resources.Battles.Dequeue;
                if (enemy != null)
                {
                    var battle = new LogicBattle(true, enemy.Home.Arena.CurrentArena + 1)
                    {
                        Device.Player, enemy
                    };

                    Resources.Battles.Add(battle);

                    Device.Player.Battle = battle;
                    enemy.Battle         = battle;

                    battle.Start();
                }
                else
                {
                    Resources.Battles.Enqueue(Device.Player);
                }
            }
        }
        public override void Process()
        {
            if (Is2V2)
            {
                //await new MatchmakeFailedMessage(Device).SendAsync();
                //await new CancelMatchmakeDoneMessage(Device).SendAsync();

                var players = Resources.DuoBattles.Dequeue;
                if (players != null)
                {
                    players.Add(Device.Player);

                    var battle = new LogicBattle(false, Device.Player.Home.Arena.CurrentArena + 1, players);

                    Resources.DuoBattles.Add(battle);

                    foreach (var player in players)
                    {
                        player.Battle = battle;
                    }

                    battle.Start();
                }
                else
                {
                    Resources.DuoBattles.Enqueue(Device.Player);
                }
            }
            else
            {
                var enemy = Resources.Battles.Dequeue;
                if (enemy != null)
                {
                    var battle = new LogicBattle(false, enemy.Home.Arena.CurrentArena + 1)
                    {
                        Device.Player, enemy
                    };

                    Resources.Battles.Add(battle);

                    Device.Player.Battle = battle;
                    enemy.Battle         = battle;

                    battle.Start();
                }
                else
                {
                    Resources.Battles.Enqueue(Device.Player);
                }
            }
        }
Пример #4
0
        internal override void Execute()
        {
            LogicClientAvatar opponent = Waiting.Dequeue();

            if (opponent != null)
            {
                LogicBattle battle = new LogicBattle(this.Connection.Avatar, opponent)
                {
                    PvPTier = this.Quest
                };

                Battles.Add(battle);

                this.Connection.Avatar.Battle = battle;
                opponent.Battle = battle;

                battle.Start();
            }
            else
            {
                new PvpMatchmakeNotificationMessage(this.Connection).Send();
                Waiting.Enqueue(this.Connection.Avatar);
            }
        }