public static void OnComplete(ref ItemCollectionDef def, Dictionary <string, List <KeyValuePair <ItemCollectionDef.Entry, string> > > ____pendingGenerateRequests)
        {
            if (def != null)
            {
                Control.LogDebug(DInfo.ItemGeneration, $"Retrieved  {def.ID}");
            }
            else
            {
                String error = "Retrived empty collection! Pending Collections:\n";

                if (____pendingGenerateRequests != null)
                {
                    foreach (var pair in ____pendingGenerateRequests)
                    {
                        error += "- " + pair.Key + "\n";
                        foreach (var pair2 in pair.Value)
                        {
                            error += "- " + pair2.Key.ID + "\n";
                        }
                    }
                }
                else
                {
                    error += "- cannot get pending requests\n";
                }
                //error += "replacing with DUMMY";
                //def = Control.State.Sim.DataManager.ItemCollectionDefs.Get("ItemCollection_DUMMY");
                Control.LogError(error);
            }
        }
Example #2
0
        public override void Render()
        {
            List <object> parameters = this.parameters;

            this.manager.Sim.StopPlayMode();
            ItemCollectionDef def = parameters[0] as ItemCollectionDef;

            RewardsPopup.Show(this.manager.Sim, def, this.choices, new Action(this.Complete));
        }
Example #3
0
            public static bool Prefix(Shop __instance, ItemCollectionDef def)
            {
                if (def == null)
                {
                    LogDebug($"{__instance.system.Name} has invalid ItemCollectionDef.");
                }

                return(def != null);
            }
 public static void OnICGenerated(ItemCollectionDef collection, ItemCollectionResult __result)
 {
     if (__result != null)
     {
         Control.LogDebug(DInfo.ItemGeneration, $"Generated {collection?.ID}. Completed");
     }
     else
     {
         Control.LogDebug(DInfo.ItemGeneration, $"Generated {collection?.ID}. Gather Dependences");
     }
 }
 public static void OnICGenerate(ItemCollectionDef collection, int count, string parentGUID)
 {
     if (parentGUID == null)
     {
         Control.LogDebug(DInfo.ItemGeneration, $"Generate {count} items of {collection?.ID} - root");
     }
     else
     {
         Control.LogDebug(DInfo.ItemGeneration, $"Generate {count} items of {collection?.ID} - {parentGUID}");
     }
 }
 public static void Postfix(ItemCollectionDef __instance)
 {
     foreach (ItemCollectionDef.Entry i in __instance.Entries)
     {
         if (Main.Sett.ReplaceInItemCollections.TryGetValue(i.ID, out ItemCollectionReplace ne))
         {
             i.ID = ne.ID;
             if (Enum.TryParse(ne.Type, out ShopItemType t))
             {
                 i.Type = t;
             }
         }
     }
 }
        public static ItemCollectionDef FilterItemCollectionDef(ItemCollectionDef itemCollectionDef,
                                                                SimGameState simGame)
        {
            if (itemCollectionDef == null ||
                !itemCollectionDef.Entries.Any(e => ShopItemRequirements.ContainsKey(e.ID)))
            {
                return(itemCollectionDef);
            }

            var filtered = new ItemCollectionDef();

            var fTraverse = Traverse.Create(filtered);

            fTraverse.Field("ID").SetValue(itemCollectionDef.ID);
            fTraverse.Field("CollectionType").SetValue(itemCollectionDef.CollectionType);
            fTraverse.Field("Description").SetValue(itemCollectionDef.Description);

            filtered.Entries.AddRange(itemCollectionDef.Entries.Where(e =>
                                                                      !ShopItemRequirements.ContainsKey(e.ID) || simGame.MeetsRequirements(ShopItemRequirements[e.ID])));

            Main.HBSLog.Log($"Filtered {itemCollectionDef.ID} with {itemCollectionDef.Entries.Count} entries to {filtered.Entries.Count} entries");

            return(filtered);
        }
        public static void Prefix(ref ItemCollectionDef collection)
        {
            var simGame = UnityGameInstance.BattleTechGame.Simulation;

            collection = ItemCollectionRequirements.FilterItemCollectionDef(collection, simGame);
        }
Example #9
0
 public FactionRewardPopup(ItemCollectionDef itemCollection)
 {
     this.type = SimGameInterruptManager.InterruptType.RewardsPopup;
     this.parameters.Add((object)itemCollection);
     this.choices = itemCollection.Entries.Count();
 }