static public void UpdateDropTableTierOdds(SpawnCard spawnCard, string interactableName)
 {
     if (InteractableCalculator.dropTableInteractables.Contains(interactableName))
     {
         BasicPickupDropTable dropTable = spawnCard.prefab.GetComponent <RouletteChestController>().dropTable as BasicPickupDropTable;
         if (!ItemDropAPIFixes.playerInteractables.dropTableTierOdds.ContainsKey(interactableName))
         {
             ItemDropAPIFixes.playerInteractables.dropTableTierOdds.Add(interactableName, new List <float>());
             ItemDropAPIFixes.playerInteractables.dropTableTierOdds[interactableName].Add(dropTable.tier1Weight);
             ItemDropAPIFixes.playerInteractables.dropTableTierOdds[interactableName].Add(dropTable.tier2Weight);
             ItemDropAPIFixes.playerInteractables.dropTableTierOdds[interactableName].Add(dropTable.tier3Weight);
             ItemDropAPIFixes.playerInteractables.dropTableTierOdds[interactableName].Add(dropTable.equipmentWeight);
         }
         if (ItemDropAPIFixes.playerInteractables.dropTableTierOdds.ContainsKey(interactableName))
         {
             dropTable.tier1Weight     = ItemDropAPIFixes.playerInteractables.dropTableTierOdds[interactableName][0];
             dropTable.tier2Weight     = ItemDropAPIFixes.playerInteractables.dropTableTierOdds[interactableName][1];
             dropTable.tier3Weight     = ItemDropAPIFixes.playerInteractables.dropTableTierOdds[interactableName][2];
             dropTable.equipmentWeight = ItemDropAPIFixes.playerInteractables.dropTableTierOdds[interactableName][3];
         }
         if (!ItemDropAPIFixes.playerInteractables.tiersPresent["tier1"])
         {
             dropTable.tier1Weight = 0;
         }
         if (!ItemDropAPIFixes.playerInteractables.tiersPresent["tier2"])
         {
             dropTable.tier2Weight = 0;
         }
         if (!ItemDropAPIFixes.playerInteractables.tiersPresent["tier3"])
         {
             dropTable.tier3Weight = 0;
         }
         if (!ItemDropAPIFixes.playerInteractables.tiersPresent["equipment"])
         {
             dropTable.equipmentWeight = 0;
         }
         System.Type type = typeof(RoR2.BasicPickupDropTable);
         System.Reflection.MethodInfo method = type.GetMethod("GenerateWeightedSelection", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
         method.Invoke(dropTable, new object[] { Run.instance });
     }
 }
Beispiel #2
0
        /*
         *  This will update the subset odds for the interactables that utilize RouletteChestController.
         */
        public static void UpdateDropTableTierOdds(SpawnCard spawnCard, string interactableName)
        {
            if (DropTableInteractables.Contains(interactableName))
            {
                BasicPickupDropTable dropTable = spawnCard.prefab.GetComponent <RouletteChestController>().dropTable as BasicPickupDropTable;
                if (!DropTableTierOdds.ContainsKey(interactableName))
                {
                    DropTableTierOdds.Add(interactableName, new List <float>());
                    DropTableTierOdds[interactableName].Add(dropTable.tier1Weight);
                    DropTableTierOdds[interactableName].Add(dropTable.tier2Weight);
                    DropTableTierOdds[interactableName].Add(dropTable.tier3Weight);
                    DropTableTierOdds[interactableName].Add(dropTable.equipmentWeight);
                }
                if (DropTableTierOdds.ContainsKey(interactableName))
                {
                    dropTable.tier1Weight     = DropTableTierOdds[interactableName][0];
                    dropTable.tier2Weight     = DropTableTierOdds[interactableName][1];
                    dropTable.tier3Weight     = DropTableTierOdds[interactableName][2];
                    dropTable.equipmentWeight = DropTableTierOdds[interactableName][3];
                }
                if (!ItemDropAPI.PlayerInteractables.TiersPresent[InteractableCalculator.DropType.tier1])
                {
                    dropTable.tier1Weight = 0;
                }
                if (!ItemDropAPI.PlayerInteractables.TiersPresent[InteractableCalculator.DropType.tier2])
                {
                    dropTable.tier2Weight = 0;
                }
                if (!ItemDropAPI.PlayerInteractables.TiersPresent[InteractableCalculator.DropType.tier3])
                {
                    dropTable.tier3Weight = 0;
                }
                if (!ItemDropAPI.PlayerInteractables.TiersPresent[InteractableCalculator.DropType.equipment])
                {
                    dropTable.equipmentWeight = 0;
                }

                dropTable.GenerateWeightedSelection(Run.instance);
            }
        }