public async Task HandOverItems()
        {
            var slots = InventoryManager.FilledSlots.Where(i => i.RawItemId == TurnInItemId).OrderByDescending(i => i.HqFlag);

            foreach (var slot in slots)
            {
                if (slot != null)
                {
                    AgentHandIn.Instance.HandIn(slot);
                    //await Coroutine.Sleep(500);
                    await Coroutine.Wait(5000, () => InputNumeric.IsOpen);

                    if (InputNumeric.IsOpen)
                    {
                        InputNumeric.Ok((uint)InputNumeric.Field.CurrentValue);
                    }
                    await Coroutine.Sleep(700);
                }
            }

            await Coroutine.Sleep(500);

            Deliver();

            await Coroutine.Wait(5000, () => Talk.DialogOpen);

            while (Talk.DialogOpen)
            {
                Talk.Next();
                await Coroutine.Sleep(1000);
            }
        }
Example #2
0
        private static async Task WaitForInputNumeric(uint qty)
        {
            await Coroutine.Wait(5000, () => InputNumeric.IsOpen);

            await Coroutine.Sleep(200);

            if (InputNumeric.IsOpen)
            {
                InputNumeric.Ok(qty);
            }
            else
            {
                LogCritical("InputNumeric never opened!");
            }
        }
Example #3
0
        private async Task <bool> Run()
        {
            TradeQueue.Clear();
            BattleCharacter target = GameObjectManager.Target as BattleCharacter;

            if (target == null)
            {
                Log("No target found to trade to.");
                return(false);
            }
            if (target.IsMe)
            {
                Log("We can't trade with ourselves.");
                return(false);
            }
            if (target.Type != GameObjectType.Pc)
            {
                Log("We can't trade with an NPC.");
                return(false);
            }
            if (!target.IsWithinInteractRange)
            {
                Log("Target is too far away to interact with.");
                return(false);
            }

            Log($"Starting to trade with {target.Name}.");

            await QueueTradeItems(AutoTradeSettings.ItemsToTrade);

            await TradeItems(TradeQueue, target);

            if (FailedTradeCount >= 5)
            {
                LogCritical("Too many failed trades, exiting.");
            }
            else if (!TradeQueue.Any())
            {
                LogSuccess("Done trading!");
            }
            else
            {
                LogCritical("We're done trading, but didn't trip FailedTradeCount and have items still in the queue?");
            }

            if (InputNumeric.IsOpen)
            {
                InputNumeric.Close();
                await Coroutine.Wait(5000, () => !InputNumeric.IsOpen);
            }

            if (Trade.IsOpen)
            {
                Trade.Close();
                await Coroutine.Wait(5000, () => !Trade.IsOpen);
            }

            TradeQueue.TrimExcess();

            TreeRoot.Stop("Finished trading.");
            return(true);
        }