Пример #1
0
        /// <summary>
        /// Overrided shopping dialogue
        /// </summary>
        /// <param name="sim"></param>
        /// <param name="register"></param>
        /// <returns></returns>
        public static bool ShowCustomShoppingDialog(Sim sim, ShoppingRegister register, Dictionary <string, List <StoreItem> > itemDictionary)
        {
            float num = 1f;

            if ((sim != null) && sim.HasTrait(TraitNames.Haggler))
            {
                num *= 1f - (TraitTuning.HagglerSalePercentAdd / 100f);
            }
            num = (1f - num) * 100f;

            if (itemDictionary.Count == 0)
            {
                return(false);
            }


            ShoppingModel.CurrentStore = register;
            ShoppingRabbitHole.StartShopping(sim, itemDictionary, register.PercentModifier, (float)((int)num), 0, null, sim.Inventory, null, new ShoppingRabbitHole.ShoppingFinished(FinishedCallBack), new ShoppingRabbitHole.CreateSellableCallback(register.CreateSellableObjectsList), register.GetRegisterType != RegisterType.General);
            return(true);
        }
Пример #2
0
        protected static bool ShowShoppingDialog(ShoppingRegister ths, Sim sim)
        {
            float num = (1f - ths.GetSalePercentage(sim)) * 100f;

            Dictionary <object, IList> objectsForSale = Consignments.Cleanup(null);

            Dictionary <string, List <StoreItem> > itemDictionary = ths.ItemDictionary(sim);

            // ItemDictionary will remove objects from the Consignment list, but not delete them, correct for that now
            Consignments.ValidateObjectForSale(objectsForSale);

            if (itemDictionary.Count == 0x0)
            {
                return(false);
            }

            ShoppingRabbitHole.CreateSellableCallback createSellableCallback = ths.CreateSellableObjectsList;

            if (ths is ConsignmentRegister)
            {
                createSellableCallback = CreateConsignmentObjectsList;
            }
            else if (ths is PotionShopConsignmentRegister)
            {
                createSellableCallback = CreatePotionObjectsList;
            }
            else if (ths is BotShopRegister)
            {
                createSellableCallback = CreateFutureObjectsList;
            }
            else if (ths is PetstoreRegister)
            {
                createSellableCallback = CreatePetObjectsList;
            }

            ShoppingModel.CurrentStore = ths;
            ShoppingRabbitHole.StartShopping(sim, itemDictionary, ths.PercentModifier, (float)((int)num), 0x0, null, sim.Inventory, null, ths.FinishedCallBack, createSellableCallback, ths.GetRegisterType != RegisterType.General);
            return(true);
        }