Example #1
0
 static void Postfix(Dialog_Trade __instance)
 {
     if (TradeSession.giftMode)
     {
         __instance.cachedCurrencyTradeable = null;
     }
 }
        public static void Postfix(Dialog_Trade __instance, ref List <Thing> ___playerCaravanAllPawnsAndItems)
        {
            List <Thing> newResult = new List <Thing>();

            if (___playerCaravanAllPawnsAndItems == null || ___playerCaravanAllPawnsAndItems.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < ___playerCaravanAllPawnsAndItems.Count; i++)
            {
                // used to point at thingdef
                if (___playerCaravanAllPawnsAndItems[i] as DropShipActive != null)
                {
                    newResult.Add(___playerCaravanAllPawnsAndItems[i]);
                }
            }
            ___playerCaravanAllPawnsAndItems = newResult;
        }
        public static void Postfix(Dialog_Trade __instance)
        {
            Traverse     traverse   = Traverse.Create((object)__instance);
            List <Thing> thingList1 = traverse.Field("playerCaravanAllPawnsAndItems").GetValue <List <Thing> >();
            List <Thing> thingList2 = new List <Thing>();

            if (thingList1 == null || thingList1.Count <= 0)
            {
                return;
            }
            for (int index = 0; index < thingList1.Count; ++index)
            {
                if (thingList1[index].def.defName != "Building_Helicopter")
                {
                    thingList2.Add(thingList1[index]);
                }
            }
            traverse.Field("playerCaravanAllPawnsAndItems").SetValue((object)thingList2);
        }
        public static void Postfix(Dialog_Trade __instance)
        {
            Traverse     traverse   = Traverse.Create((object)__instance);
            List <Thing> thingList1 = traverse.Field("playerCaravanAllPawnsAndItems").GetValue <List <Thing> >();
            List <Thing> thingList2 = new List <Thing>();

            if (thingList1 == null || thingList1.Count <= 0)
            {
                return;
            }
            for (int index = 0; index < thingList1.Count; index++)
            {
                if (thingList1[index].TryGetComp <CompLaunchableSRTS>() == null)
                {
                    thingList2.Add(thingList1[index]);
                }
            }
            traverse.Field("playerCaravanAllPawnsAndItems").SetValue((object)thingList2);
        }
Example #5
0
        private void RecreateDialog()
        {
            var session = Multiplayer.WorldComp.trading[selectedTab];

            MpTradeSession.SetTradeSession(session);

            dialog = MpUtil.NewObjectNoCtor <Dialog_Trade>();
            dialog.quickSearchWidget = new QuickSearchWidget();
            dialog.giftsOnly         = session.giftsOnly;
            dialog.sorter1           = TransferableSorterDefOf.Category;
            dialog.sorter2           = TransferableSorterDefOf.MarketValue;
            dialog.CacheTradeables();
            session.deal.uiShouldReset = UIShouldReset.None;

            removed.Clear();
            added.Clear();

            MpTradeSession.SetTradeSession(null);
        }
        public static void Postfix(Dialog_Trade __instance)
        {
            Traverse     tv        = Traverse.Create(__instance);
            List <Thing> contents  = tv.Field("playerCaravanAllPawnsAndItems").GetValue <List <Thing> >();
            List <Thing> newResult = new List <Thing>();

            if (contents == null || contents.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < contents.Count; i++)
            {
                if (contents[i].def != USCMDefOf.RRY_USCM_DropshipUD4L)
                {
                    newResult.Add(contents[i]);
                }
            }
            tv.Field("playerCaravanAllPawnsAndItems").SetValue(newResult);
        }
Example #7
0
        public static void Postfix(Dialog_Trade __instance)
        {
            Traverse     tv        = Traverse.Create(__instance);
            List <Thing> contents  = tv.Field("playerCaravanAllPawnsAndItems").GetValue <List <Thing> >();
            List <Thing> newResult = new List <Thing>();

            if (contents == null || contents.Count <= 0)
            {
                return;
            }

            for (int i = 0; i < contents.Count; i++)
            {
                if (contents[i].def.defName != "Building_Helicopter")
                {
                    newResult.Add(contents[i]);
                }
            }
            tv.Field("playerCaravanAllPawnsAndItems").SetValue(newResult);
        }
Example #8
0
        private void RecreateDialog()
        {
            var session = Multiplayer.WorldComp.trading[selectedTab];

            CancelDialogTradeCtor.cancel = true;
            MpTradeSession.SetTradeSession(session);

            dialog           = new Dialog_Trade(null, null);
            dialog.giftsOnly = session.giftsOnly;
            dialog.sorter1   = TransferableSorterDefOf.Category;
            dialog.sorter2   = TransferableSorterDefOf.MarketValue;
            dialog.CacheTradeables();
            session.deal.uiShouldReset = UIShouldReset.None;

            removed.Clear();
            added.Clear();

            MpTradeSession.SetTradeSession(null);
            CancelDialogTradeCtor.cancel = false;
        }
Example #9
0
        private static void PostOpen(Dialog_Trade __instance)
        {
            if (QOLTweaksPack.TradingStockpiles.Value == false)
            {
                return;
            }
            List <Tradeable> cachedTradeables = Reflection.GetFieldValue(__instance, "cachedTradeables") as List <Tradeable>;

            if (cachedTradeables == null)
            {
                Log.Warning("Could not grab cachedTradeables via reflection");
            }
            foreach (Tradeable tradeable in cachedTradeables)
            {
                foreach (Thing tradeableThing in tradeable.thingsColony)
                {
                    if (tradeableThing.holdingOwner != null)
                    {
                        SlotGroup storage = StoreUtility.GetSlotGroup(tradeableThing);
                        if (storage == null || storage.parent == null)
                        {
                            continue;
                        }
                        if (storage.parent is Zone_Stockpile)
                        {
                            if (QOLTweaksPack.savedData.StockpileIsTradeStockpile(storage.parent as Zone_Stockpile))
                            {
                                if (tradeable.CanAdjustBy(-tradeableThing.stackCount).Accepted)
                                {
                                    tradeable.AdjustBy(-tradeableThing.stackCount);
                                }
                            }
                        }
                    }
                }
            }
        }
        public static void Postfix(Dialog_Trade __instance, ref List<Thing> ___playerCaravanAllPawnsAndItems)
        {
            if (___playerCaravanAllPawnsAndItems == null || ___playerCaravanAllPawnsAndItems.Count <= 0) return;

            ___playerCaravanAllPawnsAndItems.RemoveAll(x=> x is DropShipActive);
        }