예제 #1
0
        public override async Task <bool> ResolveEvent(EventHall eventHall, GameContext context, CancellationToken cancellationToken)
        {
            await Activate(context, cancellationToken);

            await context.ClickAt(DialogButton1, cancellationToken);

            var battle = new PrepareBattle(context);
            var ct     = new CancellationTokenSource(TimeSpan.FromSeconds(3));

            try {
                await battle.Activation(CancellationTokenSource.CreateLinkedTokenSource(ct.Token, cancellationToken).Token);
            } catch (TaskCanceledException) {
                //F**k, we've mistaken, it is a boss event!
                await context.ClickAt(600, 430, cancellationToken);

                var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3));
                try {
                    await battle.Activation(CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, cts.Token).Token);
                } catch (TaskCanceledException) {
                    await TryClose(context, cancellationToken);

                    return(false);
                }
            }

            await battle.Engage(cancellationToken);

            await WaitCombatEnd(context, cancellationToken);

            return(true);
        }
예제 #2
0
파일: Event.cs 프로젝트: killwort/idb-bot
        protected async Task Dismiss(GameContext context, CancellationToken cancellationToken)
        {
            await context.ClickAt(DialogDeleteButton, cancellationToken);

            await Task.Delay(200, cancellationToken);

            await context.ClickAt(DialogDeleteOkButton, cancellationToken);

            await Task.Delay(200, cancellationToken);
        }
예제 #3
0
        public override async Task <bool> ResolveEvent(EventHall eventHall, GameContext context, CancellationToken cancellationToken)
        {
            await Activate(context, cancellationToken);

            await context.ClickAt(DialogButton1, cancellationToken);

            return(true);
        }
예제 #4
0
파일: Event.cs 프로젝트: killwort/idb-bot
 protected Task TryClose(GameContext context, CancellationToken cancellationToken) => context.ClickAt(905, 106, cancellationToken);
예제 #5
0
파일: Event.cs 프로젝트: killwort/idb-bot
        protected async Task Activate(GameContext context, CancellationToken cancellationToken)
        {
            await context.ClickAt(ClickBox.Left + ClickBox.Width / 2, ClickBox.Top + ClickBox.Height / 2, cancellationToken);

            await Task.Delay(200, cancellationToken);
        }