Exemplo n.º 1
0
        private void ClearWardrobe(Wardrobe wardrobe)
        {
            if (wardrobe.EmptySlotsCount >= AppCore.BotvaSettings.Wardrobe.MinEmptySlots)
            {
                return;
            }

            var smallTicketAction = AppCore.MinerSettings.GetTicketAction(Ticket.Small);
            var bigTicketAction   = AppCore.MinerSettings.GetTicketAction(Ticket.Big);

            var bigTicketUrl   = automaton.Controller.ItemBuilder.GetItemSmallImageUrl(Ticket.Big);
            var smallTicketUrl = automaton.Controller.ItemBuilder.GetItemSmallImageUrl(Ticket.Small);

            //Use tickets
            if (smallTicketAction.ActionType == TicketActionType.Use)
            {
                UseTicket(true);
            }

            if (bigTicketAction.ActionType == TicketActionType.Use)
            {
                UseTicket(false);
            }

            //Move tickets to bag
            automaton.Controller.ClearWardrobe(delegate(string url)
            {
                if (smallTicketAction.ActionType != TicketActionType.Use)
                {
                    return(string.Compare(url, smallTicketUrl, true) == 0);
                }
                if (bigTicketAction.ActionType != TicketActionType.Use)
                {
                    return(string.Compare(url, bigTicketUrl, true) == 0);
                }
                return(false);
            });
            //Sell tickets
            if (smallTicketAction.ActionType == TicketActionType.Sale)
            {
                automaton.Controller.Sell(Ticket.Small, Price.Crystals(smallTicketAction.Price));
            }

            if (bigTicketAction.ActionType == TicketActionType.Sale)
            {
                automaton.Controller.Sell(Ticket.Big, Price.Crystals(bigTicketAction.Price));
            }



            automaton.Player.UpdateItems();

            if (!automaton.Player.WardrobeHasEmtySlots)
            {
                AppCore.LogFights.Suggestion("Освободите одевалку.",
                                             "При полной одевалке бот не ходит в дозоры и неинвестирует в шмот.");
            }
        }