Пример #1
0
 /// <summary>
 /// Adds a new tier to Ox and Cadence's breach shop
 /// </summary>
 /// <param name="tier">Tier to add</param>
 /// <param name="index">The index to insert the tier at. If null, defaults to the last index in the list</param>
 public static void AddBaseMetaShopTier(MetaShopTier tier, int?index = null)
 {
     if (BaseMetaShopController == null)
     {
         DoSetup();
     }
     if (index == null)
     {
         BaseMetaShopController.metaShopTiers.Add(tier);
     }
     else
     {
         if (index.Value < 0)
         {
             BaseMetaShopController.metaShopTiers.Add(tier);
         }
         else
         {
             BaseMetaShopController.metaShopTiers.Insert(index.Value, tier);
         }
     }
     if (metaShopAddedTiers == null)
     {
         metaShopAddedTiers = new List <MetaShopTier>();
     }
     metaShopAddedTiers.Add(tier);
     ReloadInstanceMetaShopTiers();
 }
Пример #2
0
 /// <summary>
 /// Disposes all breach shop hooks, removes all added items from shop tables and nulls shop tables
 /// </summary>
 public static void Unload()
 {
     if (!m_loaded)
     {
         return;
     }
     if (baseShopAddedItems != null)
     {
         for (int i = 0; i < baseShopAddedItems.Keys.Count; i++)
         {
             WeightedGameObjectCollection collection = baseShopAddedItems.Keys.ToList()[i];
             if (collection != null && baseShopAddedItems[collection] != null)
             {
                 for (int j = 0; j < baseShopAddedItems[collection].Count; j++)
                 {
                     WeightedGameObject wgo = baseShopAddedItems[collection][j];
                     if (wgo != null && collection.elements.Contains(wgo))
                     {
                         collection.elements.Remove(wgo);
                     }
                 }
             }
         }
         baseShopAddedItems.Clear();
         baseShopAddedItems = null;
     }
     if (metaShopAddedTiers != null)
     {
         for (int i = 0; i < metaShopAddedTiers.Count; i++)
         {
             MetaShopTier tier = metaShopAddedTiers[i];
             if (tier != null && BaseMetaShopController.metaShopTiers.Contains(tier))
             {
                 BaseMetaShopController.metaShopTiers.Remove(tier);
             }
         }
         metaShopAddedTiers.Clear();
         metaShopAddedTiers = null;
     }
     BaseMetaShopController = null;
     TrorcMetaShopItems     = null;
     GooptonMetaShopItems   = null;
     DougMetaShopItems      = null;
     pickupObjectEncounterableHook?.Dispose();
     baseShopSetupHook?.Dispose();
     metaShopSetupHook?.Dispose();
     metaShopCurrentTierHook?.Dispose();
     metaShopProximateTierHook?.Dispose();
     m_loaded = false;
 }
Пример #3
0
        public static MetaShopTier MetaShopProximateTierHook(Func <MetaShopController, MetaShopTier> orig, MetaShopController self)
        {
            MetaShopTier advancedResult = null;

            for (int i = 0; i < self.metaShopTiers.Count - 1; i++)
            {
                if (!GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId1) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId2) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId3))
                {
                    advancedResult = self.metaShopTiers[i + 1];
                    break;
                }
            }
            List <MetaShopTier> origTiers = self.metaShopTiers;
            List <MetaShopTier> tempTiers = new List <MetaShopTier>();

            for (int i = 0; i < origTiers.Count; i++)
            {
                if (origTiers[i] != null)
                {
                    if (!ItemConditionsFulfilled(origTiers[i].itemId1) || !ItemConditionsFulfilled(origTiers[i].itemId2) || !ItemConditionsFulfilled(origTiers[i].itemId3))
                    {
                        tempTiers.Add(origTiers[i]);
                    }
                }
            }
            self.metaShopTiers = tempTiers;
            MetaShopTier result = orig(self);

            self.metaShopTiers = origTiers;
            if (advancedResult == null)
            {
                return(result);
            }
            else if (result == null)
            {
                return(advancedResult);
            }
            else
            {
                return(self.metaShopTiers.IndexOf(advancedResult) < self.metaShopTiers.IndexOf(result) ? advancedResult : result);
            }
        }
Пример #4
0
 /// <summary>
 /// Creates a new <see cref="DoubleMetaShopTier"/> and assigns the first tier to <paramref name="topTier"/> and the second tier to <paramref name="bottomTier"/>
 /// </summary>
 /// <param name="topTier"></param>
 /// <param name="bottomTier"></param>
 public DoubleMetaShopTier(MetaShopTier topTier, MetaShopTier bottomTier)
 {
     this.m_topTier    = topTier;
     this.m_bottomTier = bottomTier;
 }