Ejemplo n.º 1
0
 private void AddAllTradeables()
 {
     foreach (Thing item in TradeSession.trader.ColonyThingsWillingToBuy(TradeSession.playerNegotiator))
     {
         if (TradeUtility.PlayerSellableNow(item))
         {
             if (!TradeSession.playerNegotiator.IsWorldPawn() && !InSellablePosition(item, out string reason))
             {
                 if (reason != null && !cannotSellReasons.Contains(reason))
                 {
                     cannotSellReasons.Add(reason);
                 }
             }
             else
             {
                 AddToTradeables(item, Transactor.Colony);
             }
         }
     }
     if (!TradeSession.giftMode)
     {
         foreach (Thing good in TradeSession.trader.Goods)
         {
             AddToTradeables(good, Transactor.Trader);
         }
     }
     if (!TradeSession.giftMode && tradeables.Find((Tradeable x) => x.IsCurrency) == null)
     {
         Thing thing = ThingMaker.MakeThing(ThingDefOf.Silver);
         thing.stackCount = 0;
         AddToTradeables(thing, Transactor.Trader);
     }
 }
Ejemplo n.º 2
0
        public static IEnumerable <Thing> AllLaunchableThingsForTrade(Map map)
        {
            HashSet <Thing> yieldedThings = new HashSet <Thing>();

            foreach (Building_OrbitalTradeBeacon beacon in Building_OrbitalTradeBeacon.AllPowered(map))
            {
                foreach (IntVec3 c in beacon.TradeableCells)
                {
                    List <Thing> thingList = c.GetThingList(map);
                    for (int i = 0; i < thingList.Count; i++)
                    {
                        Thing t = thingList[i];
                        if (t.def.category == ThingCategory.Item && TradeUtility.PlayerSellableNow(t) && !yieldedThings.Contains(t))
                        {
                            yieldedThings.Add(t);
                            yield return(t);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void AddAllTradeables()
 {
     foreach (Thing t in TradeSession.trader.ColonyThingsWillingToBuy(TradeSession.playerNegotiator))
     {
         if (TradeUtility.PlayerSellableNow(t))
         {
             string text;
             if (!TradeSession.playerNegotiator.IsWorldPawn() && !this.InSellablePosition(t, out text))
             {
                 if (text != null && !this.cannotSellReasons.Contains(text))
                 {
                     this.cannotSellReasons.Add(text);
                 }
             }
             else
             {
                 this.AddToTradeables(t, Transactor.Colony);
             }
         }
     }
     if (!TradeSession.giftMode)
     {
         foreach (Thing t2 in TradeSession.trader.Goods)
         {
             this.AddToTradeables(t2, Transactor.Trader);
         }
     }
     if (!TradeSession.giftMode)
     {
         if (this.tradeables.Find((Tradeable x) => x.IsCurrency) == null)
         {
             Thing thing = ThingMaker.MakeThing(ThingDefOf.Silver, null);
             thing.stackCount = 0;
             this.AddToTradeables(thing, Transactor.Trader);
         }
     }
 }
        public IEnumerable <Thing> ColonyThingsWillingToBuy(Pawn playerNegotiator)
        {
            IEnumerable <Thing> items = from x in this.pawn.Map.listerThings.AllThings
                                        where x.def.category == ThingCategory.Item && TradeUtility.PlayerSellableNow(x) && !x.Position.Fogged(x.Map) && (this.pawn.Map.areaManager.Home[x.Position] || x.IsInAnyStorage()) && this.ReachableForTrade(x)
                                        select x;

            foreach (Thing t in items)
            {
                yield return(t);
            }
            bool hasLord = this.pawn.GetLord() != null;

            if (hasLord)
            {
                foreach (Pawn p in from x in TradeUtility.AllSellableColonyPawns(this.pawn.Map)
                         where !x.Downed && this.ReachableForTrade(x)
                         select x)
                {
                    yield return(p);
                }
            }
            yield break;
        }
Ejemplo n.º 5
0
        public IEnumerable <Thing> ColonyThingsWillingToBuy(Pawn playerNegotiator)
        {
            IEnumerable <Thing> items = from x in pawn.Map.listerThings.AllThings
                                        where x.def.category == ThingCategory.Item && TradeUtility.PlayerSellableNow(x) && !x.Position.Fogged(x.Map) && (((_003CColonyThingsWillingToBuy_003Ec__Iterator1) /*Error near IL_0042: stateMachine*/)._0024this.pawn.Map.areaManager.Home[x.Position] || x.IsInAnyStorage()) && ((_003CColonyThingsWillingToBuy_003Ec__Iterator1) /*Error near IL_0042: stateMachine*/)._0024this.ReachableForTrade(x)
                                        select x;

            using (IEnumerator <Thing> enumerator = items.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Thing t = enumerator.Current;
                    yield return(t);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (pawn.GetLord() != null)
            {
                using (IEnumerator <Pawn> enumerator2 = (from x in TradeUtility.AllSellableColonyPawns(pawn.Map)
                                                         where !x.Downed && ((_003CColonyThingsWillingToBuy_003Ec__Iterator1) /*Error near IL_011d: stateMachine*/)._0024this.ReachableForTrade(x)
                                                         select x).GetEnumerator())
                {
                    if (enumerator2.MoveNext())
                    {
                        Pawn p = enumerator2.Current;
                        yield return((Thing)p);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
            }
            yield break;
IL_01b8:
            /*Error near IL_01b9: Unexpected return in MoveNext()*/;
        }
        public IEnumerable <Thing> ColonyThingsWillingToBuy(Pawn playerNegotiator)
        {
            IEnumerable <Thing> enumerable = pawn.Map.listerThings.AllThings.Where((Thing x) => x.def.category == ThingCategory.Item && TradeUtility.PlayerSellableNow(x, pawn) && !x.Position.Fogged(x.Map) && (pawn.Map.areaManager.Home[x.Position] || x.IsInAnyStorage()) && ReachableForTrade(x));

            foreach (Thing item in enumerable)
            {
                yield return(item);
            }
            if (pawn.GetLord() == null)
            {
                yield break;
            }
            foreach (Pawn item2 in from x in TradeUtility.AllSellableColonyPawns(pawn.Map)
                     where !x.Downed && ReachableForTrade(x)
                     select x)
            {
                yield return(item2);
            }
        }