Пример #1
0
        private static bool DisplayTradeStats(StatRequest req)
        {
            ThingDef thingDef;

            if ((thingDef = req.Def as ThingDef) == null)
            {
                return(false);
            }
            if (req.HasThing && EquipmentUtility.IsBiocoded(req.Thing))
            {
                return(false);
            }
            if (thingDef.category == ThingCategory.Building && thingDef.Minifiable)
            {
                return(true);
            }
            if (TradeUtility.EverPlayerSellable(thingDef))
            {
                return(true);
            }
            if (thingDef.tradeability.TraderCanSell() && (thingDef.category == ThingCategory.Item || thingDef.category == ThingCategory.Pawn))
            {
                return(true);
            }
            return(false);
        }
Пример #2
0
        public static bool PlayerSellableNow(Thing t)
        {
            t = t.GetInnerIfMinified();
            if (!TradeUtility.EverPlayerSellable(t.def))
            {
                return(false);
            }
            if (t.IsNotFresh())
            {
                return(false);
            }
            Apparel apparel = t as Apparel;

            return(apparel == null || !apparel.WornByCorpse);
        }
Пример #3
0
        public override bool ShouldShowFor(StatRequest req)
        {
            ThingDef thingDef = req.Def as ThingDef;

            if (thingDef == null)
            {
                return(false);
            }
            if (thingDef.category == ThingCategory.Building)
            {
                return(true);
            }
            if (TradeUtility.EverPlayerSellable(thingDef))
            {
                return(true);
            }
            if (thingDef.tradeability.TraderCanSell() && (thingDef.category == ThingCategory.Item || thingDef.category == ThingCategory.Pawn))
            {
                return(true);
            }
            return(false);
        }
Пример #4
0
        private void CalculateSellableItems(TraderKindDef trader)
        {
            sellableItems.Clear();
            cachedSellableItemsByCategory.Clear();
            cachedSellablePawns = null;
            List <ThingDef> allDefsListForReading = DefDatabase <ThingDef> .AllDefsListForReading;

            for (int i = 0; i < allDefsListForReading.Count; i++)
            {
                if (allDefsListForReading[i].PlayerAcquirable && !allDefsListForReading[i].IsCorpse && !typeof(MinifiedThing).IsAssignableFrom(allDefsListForReading[i].thingClass) && trader.WillTrade(allDefsListForReading[i]) && TradeUtility.EverPlayerSellable(allDefsListForReading[i]))
                {
                    sellableItems.Add(allDefsListForReading[i]);
                }
            }
            sellableItems.SortBy((ThingDef x) => x.label);
        }
Пример #5
0
        public override bool ShouldShowFor(StatRequest req)
        {
            ThingDef thingDef = req.Def as ThingDef;

            return(thingDef != null && (thingDef.category == ThingCategory.Building || TradeUtility.EverPlayerSellable(thingDef) || (thingDef.tradeability.TraderCanSell() && (thingDef.category == ThingCategory.Item || thingDef.category == ThingCategory.Pawn))));
        }