isaacscript-common 38.0.1 → 39.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12655,6 +12655,9 @@ declare class ModdedElementDetection extends Feature {
12655
12655
  * Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles, like
12656
12656
  * 666. We subtract one to account for `CollectibleType.NULL`.)
12657
12657
  *
12658
+ * If there are no mods present that add any custom items, this function will return
12659
+ * `CollectibleType.MOMS_RING` (732).
12660
+ *
12658
12661
  * This function can only be called if at least one callback has been executed. This is because
12659
12662
  * not all collectibles will necessarily be present when a mod first loads (due to mod load
12660
12663
  * order).
@@ -12664,7 +12667,7 @@ declare class ModdedElementDetection extends Feature {
12664
12667
  */
12665
12668
  getLastCollectibleType(): CollectibleType;
12666
12669
  /**
12667
- * Helper function to get an array that represents the all modded collectible types.
12670
+ * Helper function to get an array that represents every modded collectible type.
12668
12671
  *
12669
12672
  * Returns an empty array if there are no modded collectible types.
12670
12673
  *
@@ -12685,6 +12688,10 @@ declare class ModdedElementDetection extends Feature {
12685
12688
  */
12686
12689
  getModdedCollectibleTypes(): CollectibleType[];
12687
12690
  /**
12691
+ * Returns the total number of collectibles in the item config, including both vanilla and modded
12692
+ * items. If you just need the number of vanilla collectible types, use the
12693
+ * `NUM_VANILLA_COLLECTIBLE_TYPES` constant.
12694
+ *
12688
12695
  * This function can only be called if at least one callback has been executed. This is because
12689
12696
  * not all collectibles will necessarily be present when a mod first loads (due to mod load
12690
12697
  * order).
@@ -12717,8 +12724,11 @@ declare class ModdedElementDetection extends Feature {
12717
12724
  /**
12718
12725
  * Will change depending on how many modded trinkets there are.
12719
12726
  *
12720
- * This is equal to the number of trinket types, since all trinket types are contiguous (unlike
12721
- * collectibles).
12727
+ * Equal to `itemConfig.GetTrinkets().Size - 1`. (`Size` includes invalid trinkets, like 47. We
12728
+ * subtract one to account for `TrinketType.NULL`.)
12729
+ *
12730
+ * If there are no mods present that add any custom trinkets, this function will return
12731
+ * `TrinketType.SIGIL_OF_BAPHOMET` (189).
12722
12732
  *
12723
12733
  * This function can only be called if at least one callback has been executed. This is because
12724
12734
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -12732,9 +12742,11 @@ declare class ModdedElementDetection extends Feature {
12732
12742
  *
12733
12743
  * Returns an empty array if there are no modded trinket types.
12734
12744
  *
12735
- * This function is only useful when building collectible type objects. For most purposes, you
12736
- * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function
12737
- * instead.
12745
+ * This function is only useful when building trinket type objects. For most purposes, you should
12746
+ * use the `getModdedTrinketArray` or `getModdedTrinketSet` helper function instead.
12747
+ *
12748
+ * (This function is named differently from the `getVanillaTrinketTypeRange` function because all
12749
+ * modded trinket types are contiguous. Thus, each value represents a real `TrinketType`.)
12738
12750
  *
12739
12751
  * This function can only be called if at least one callback has been executed. This is because
12740
12752
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -12744,10 +12756,9 @@ declare class ModdedElementDetection extends Feature {
12744
12756
  */
12745
12757
  getModdedTrinketTypes(): TrinketType[];
12746
12758
  /**
12747
- * Will change depending on how many modded trinkets there are.
12748
- *
12749
- * Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
12750
- * `TrinketType.NULL`.)
12759
+ * Returns the total number of trinkets in the item config, including both vanilla and modded
12760
+ * items. If you just need the number of vanilla trinket types, use the
12761
+ * `NUM_VANILLA_TRINKET_TYPES` constant.
12751
12762
  *
12752
12763
  * This function can only be called if at least one callback has been executed. This is because
12753
12764
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -12757,15 +12768,7 @@ declare class ModdedElementDetection extends Feature {
12757
12768
  */
12758
12769
  getNumTrinketTypes(): int;
12759
12770
  /**
12760
- * This function can only be called if at least one callback has been executed. This is because
12761
- * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
12762
- *
12763
- * In order to use this function, you must upgrade your mod with
12764
- * `ISCFeature.MODDED_ELEMENT_DETECTION`.
12765
- */
12766
- getNumModdedTrinketTypes(): int;
12767
- /**
12768
- * Helper function to get an array that contains every trinket type.
12771
+ * Unlike vanilla trinket types, modded trinket types are always contiguous.
12769
12772
  *
12770
12773
  * This function can only be called if at least one callback has been executed. This is because
12771
12774
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -12773,7 +12776,7 @@ declare class ModdedElementDetection extends Feature {
12773
12776
  * In order to use this function, you must upgrade your mod with
12774
12777
  * `ISCFeature.MODDED_ELEMENT_DETECTION`.
12775
12778
  */
12776
- getTrinketTypes(): TrinketType[];
12779
+ getNumModdedTrinketTypes(): int;
12777
12780
  /**
12778
12781
  * Helper function to get an array with every valid card sub-type. This includes modded cards.
12779
12782
  *
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 38.0.1
3
+ isaacscript-common 39.0.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -38327,7 +38327,6 @@ local itemConfig = ____cachedClasses.itemConfig
38327
38327
  local ____constantsFirstLast = require("src.core.constantsFirstLast")
38328
38328
  local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
38329
38329
  local FIRST_PILL_EFFECT = ____constantsFirstLast.FIRST_PILL_EFFECT
38330
- local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
38331
38330
  local LAST_VANILLA_CARD_TYPE = ____constantsFirstLast.LAST_VANILLA_CARD_TYPE
38332
38331
  local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsFirstLast.LAST_VANILLA_COLLECTIBLE_TYPE
38333
38332
  local LAST_VANILLA_PILL_EFFECT = ____constantsFirstLast.LAST_VANILLA_PILL_EFFECT
@@ -38426,8 +38425,7 @@ end
38426
38425
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getFirstModdedTrinketType", true)
38427
38426
  function ModdedElementDetection.prototype.getLastTrinketType(self)
38428
38427
  self:errorIfNoCallbacksFired("trinket")
38429
- local numTrinketTypes = self:getNumTrinketTypes()
38430
- return asTrinketType(nil, numTrinketTypes)
38428
+ return itemConfig:GetTrinkets().Size - 1
38431
38429
  end
38432
38430
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastTrinketType", true)
38433
38431
  function ModdedElementDetection.prototype.getModdedTrinketTypes(self)
@@ -38442,21 +38440,16 @@ end
38442
38440
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getModdedTrinketTypes", true)
38443
38441
  function ModdedElementDetection.prototype.getNumTrinketTypes(self)
38444
38442
  self:errorIfNoCallbacksFired("trinket")
38445
- return itemConfig:GetTrinkets().Size - 1
38443
+ local numModdedTrinketTypes = self:getNumModdedTrinketTypes()
38444
+ return NUM_VANILLA_TRINKET_TYPES + numModdedTrinketTypes
38446
38445
  end
38447
38446
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumTrinketTypes", true)
38448
38447
  function ModdedElementDetection.prototype.getNumModdedTrinketTypes(self)
38449
- self:errorIfNoCallbacksFired("trinket")
38450
- local numTrinketTypes = self:getNumTrinketTypes()
38451
- return numTrinketTypes - NUM_VANILLA_TRINKET_TYPES
38452
- end
38453
- __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedTrinketTypes", true)
38454
- function ModdedElementDetection.prototype.getTrinketTypes(self)
38455
38448
  self:errorIfNoCallbacksFired("trinket")
38456
38449
  local lastTrinketType = self:getLastTrinketType()
38457
- return iRange(nil, FIRST_TRINKET_TYPE, lastTrinketType)
38450
+ return lastTrinketType - LAST_VANILLA_TRINKET_TYPE
38458
38451
  end
38459
- __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getTrinketTypes", true)
38452
+ __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedTrinketTypes", true)
38460
38453
  function ModdedElementDetection.prototype.getAllCardTypes(self)
38461
38454
  self:errorIfNoCallbacksFired("card")
38462
38455
  local lastCardType = self:getLastCardType()
@@ -38831,7 +38824,7 @@ function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
38831
38824
  end
38832
38825
  for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
38833
38826
  local trinketsSet = __TS__New(Set)
38834
- for ____, trinketType in ipairs(self.moddedElementDetection:getTrinketTypes()) do
38827
+ for ____, trinketType in ipairs(self:getTrinketArray()) do
38835
38828
  if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
38836
38829
  trinketsSet:add(trinketType)
38837
38830
  end
@@ -31,6 +31,9 @@ export declare class ModdedElementDetection extends Feature {
31
31
  * Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles, like
32
32
  * 666. We subtract one to account for `CollectibleType.NULL`.)
33
33
  *
34
+ * If there are no mods present that add any custom items, this function will return
35
+ * `CollectibleType.MOMS_RING` (732).
36
+ *
34
37
  * This function can only be called if at least one callback has been executed. This is because
35
38
  * not all collectibles will necessarily be present when a mod first loads (due to mod load
36
39
  * order).
@@ -40,7 +43,7 @@ export declare class ModdedElementDetection extends Feature {
40
43
  */
41
44
  getLastCollectibleType(): CollectibleType;
42
45
  /**
43
- * Helper function to get an array that represents the all modded collectible types.
46
+ * Helper function to get an array that represents every modded collectible type.
44
47
  *
45
48
  * Returns an empty array if there are no modded collectible types.
46
49
  *
@@ -61,6 +64,10 @@ export declare class ModdedElementDetection extends Feature {
61
64
  */
62
65
  getModdedCollectibleTypes(): CollectibleType[];
63
66
  /**
67
+ * Returns the total number of collectibles in the item config, including both vanilla and modded
68
+ * items. If you just need the number of vanilla collectible types, use the
69
+ * `NUM_VANILLA_COLLECTIBLE_TYPES` constant.
70
+ *
64
71
  * This function can only be called if at least one callback has been executed. This is because
65
72
  * not all collectibles will necessarily be present when a mod first loads (due to mod load
66
73
  * order).
@@ -93,8 +100,11 @@ export declare class ModdedElementDetection extends Feature {
93
100
  /**
94
101
  * Will change depending on how many modded trinkets there are.
95
102
  *
96
- * This is equal to the number of trinket types, since all trinket types are contiguous (unlike
97
- * collectibles).
103
+ * Equal to `itemConfig.GetTrinkets().Size - 1`. (`Size` includes invalid trinkets, like 47. We
104
+ * subtract one to account for `TrinketType.NULL`.)
105
+ *
106
+ * If there are no mods present that add any custom trinkets, this function will return
107
+ * `TrinketType.SIGIL_OF_BAPHOMET` (189).
98
108
  *
99
109
  * This function can only be called if at least one callback has been executed. This is because
100
110
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -108,9 +118,11 @@ export declare class ModdedElementDetection extends Feature {
108
118
  *
109
119
  * Returns an empty array if there are no modded trinket types.
110
120
  *
111
- * This function is only useful when building collectible type objects. For most purposes, you
112
- * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function
113
- * instead.
121
+ * This function is only useful when building trinket type objects. For most purposes, you should
122
+ * use the `getModdedTrinketArray` or `getModdedTrinketSet` helper function instead.
123
+ *
124
+ * (This function is named differently from the `getVanillaTrinketTypeRange` function because all
125
+ * modded trinket types are contiguous. Thus, each value represents a real `TrinketType`.)
114
126
  *
115
127
  * This function can only be called if at least one callback has been executed. This is because
116
128
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -120,10 +132,9 @@ export declare class ModdedElementDetection extends Feature {
120
132
  */
121
133
  getModdedTrinketTypes(): TrinketType[];
122
134
  /**
123
- * Will change depending on how many modded trinkets there are.
124
- *
125
- * Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
126
- * `TrinketType.NULL`.)
135
+ * Returns the total number of trinkets in the item config, including both vanilla and modded
136
+ * items. If you just need the number of vanilla trinket types, use the
137
+ * `NUM_VANILLA_TRINKET_TYPES` constant.
127
138
  *
128
139
  * This function can only be called if at least one callback has been executed. This is because
129
140
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -133,15 +144,7 @@ export declare class ModdedElementDetection extends Feature {
133
144
  */
134
145
  getNumTrinketTypes(): int;
135
146
  /**
136
- * This function can only be called if at least one callback has been executed. This is because
137
- * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
138
- *
139
- * In order to use this function, you must upgrade your mod with
140
- * `ISCFeature.MODDED_ELEMENT_DETECTION`.
141
- */
142
- getNumModdedTrinketTypes(): int;
143
- /**
144
- * Helper function to get an array that contains every trinket type.
147
+ * Unlike vanilla trinket types, modded trinket types are always contiguous.
145
148
  *
146
149
  * This function can only be called if at least one callback has been executed. This is because
147
150
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -149,7 +152,7 @@ export declare class ModdedElementDetection extends Feature {
149
152
  * In order to use this function, you must upgrade your mod with
150
153
  * `ISCFeature.MODDED_ELEMENT_DETECTION`.
151
154
  */
152
- getTrinketTypes(): TrinketType[];
155
+ getNumModdedTrinketTypes(): int;
153
156
  /**
154
157
  * Helper function to get an array with every valid card sub-type. This includes modded cards.
155
158
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ModdedElementDetection.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ModdedElementDetection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAyBtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;;;;;;;;GASG;AACH,qBAAa,sBAAuB,SAAQ,OAAO;IACjD,OAAO,CAAC,uBAAuB,CAAS;IAaxC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;IAEF,OAAO,CAAC,uBAAuB;IAY/B;;;;;;;;;OASG;IAEI,6BAA6B,IAAI,eAAe,GAAG,SAAS;IAcnE;;;;;;;;;;;;OAYG;IAEI,sBAAsB,IAAI,eAAe;IAMhD;;;;;;;;;;;;;;;;;;;OAmBG;IAEI,yBAAyB,IAAI,eAAe,EAAE;IAYrD;;;;;;;OAOG;IAEI,sBAAsB,IAAI,GAAG;IAOpC;;;;;;;;;OASG;IAEI,4BAA4B,IAAI,GAAG;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AAI,UAAU,EAAE;IAY3C;;;;;;;;;;;;OAYG;IAEI,iBAAiB,IAAI,GAAG;IAM/B;;;;;;;OAOG;IAEI,uBAAuB,IAAI,GAAG;CAMtC"}
@@ -10,7 +10,6 @@ local itemConfig = ____cachedClasses.itemConfig
10
10
  local ____constantsFirstLast = require("src.core.constantsFirstLast")
11
11
  local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
12
12
  local FIRST_PILL_EFFECT = ____constantsFirstLast.FIRST_PILL_EFFECT
13
- local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
14
13
  local LAST_VANILLA_CARD_TYPE = ____constantsFirstLast.LAST_VANILLA_CARD_TYPE
15
14
  local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsFirstLast.LAST_VANILLA_COLLECTIBLE_TYPE
16
15
  local LAST_VANILLA_PILL_EFFECT = ____constantsFirstLast.LAST_VANILLA_PILL_EFFECT
@@ -117,8 +116,7 @@ end
117
116
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getFirstModdedTrinketType", true)
118
117
  function ModdedElementDetection.prototype.getLastTrinketType(self)
119
118
  self:errorIfNoCallbacksFired("trinket")
120
- local numTrinketTypes = self:getNumTrinketTypes()
121
- return asTrinketType(nil, numTrinketTypes)
119
+ return itemConfig:GetTrinkets().Size - 1
122
120
  end
123
121
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastTrinketType", true)
124
122
  function ModdedElementDetection.prototype.getModdedTrinketTypes(self)
@@ -133,21 +131,16 @@ end
133
131
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getModdedTrinketTypes", true)
134
132
  function ModdedElementDetection.prototype.getNumTrinketTypes(self)
135
133
  self:errorIfNoCallbacksFired("trinket")
136
- return itemConfig:GetTrinkets().Size - 1
134
+ local numModdedTrinketTypes = self:getNumModdedTrinketTypes()
135
+ return NUM_VANILLA_TRINKET_TYPES + numModdedTrinketTypes
137
136
  end
138
137
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumTrinketTypes", true)
139
138
  function ModdedElementDetection.prototype.getNumModdedTrinketTypes(self)
140
- self:errorIfNoCallbacksFired("trinket")
141
- local numTrinketTypes = self:getNumTrinketTypes()
142
- return numTrinketTypes - NUM_VANILLA_TRINKET_TYPES
143
- end
144
- __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedTrinketTypes", true)
145
- function ModdedElementDetection.prototype.getTrinketTypes(self)
146
139
  self:errorIfNoCallbacksFired("trinket")
147
140
  local lastTrinketType = self:getLastTrinketType()
148
- return iRange(nil, FIRST_TRINKET_TYPE, lastTrinketType)
141
+ return lastTrinketType - LAST_VANILLA_TRINKET_TYPE
149
142
  end
150
- __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getTrinketTypes", true)
143
+ __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedTrinketTypes", true)
151
144
  function ModdedElementDetection.prototype.getAllCardTypes(self)
152
145
  self:errorIfNoCallbacksFired("card")
153
146
  local lastCardType = self:getLastCardType()
@@ -271,7 +271,7 @@ function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
271
271
  end
272
272
  for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
273
273
  local trinketsSet = __TS__New(Set)
274
- for ____, trinketType in ipairs(self.moddedElementDetection:getTrinketTypes()) do
274
+ for ____, trinketType in ipairs(self:getTrinketArray()) do
275
275
  if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
276
276
  trinketsSet:add(trinketType)
277
277
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "38.0.1",
3
+ "version": "39.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -9,7 +9,6 @@ import { itemConfig } from "../../../core/cachedClasses";
9
9
  import {
10
10
  FIRST_CARD_TYPE,
11
11
  FIRST_PILL_EFFECT,
12
- FIRST_TRINKET_TYPE,
13
12
  LAST_VANILLA_CARD_TYPE,
14
13
  LAST_VANILLA_COLLECTIBLE_TYPE,
15
14
  LAST_VANILLA_PILL_EFFECT,
@@ -101,6 +100,9 @@ export class ModdedElementDetection extends Feature {
101
100
  * Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles, like
102
101
  * 666. We subtract one to account for `CollectibleType.NULL`.)
103
102
  *
103
+ * If there are no mods present that add any custom items, this function will return
104
+ * `CollectibleType.MOMS_RING` (732).
105
+ *
104
106
  * This function can only be called if at least one callback has been executed. This is because
105
107
  * not all collectibles will necessarily be present when a mod first loads (due to mod load
106
108
  * order).
@@ -116,7 +118,7 @@ export class ModdedElementDetection extends Feature {
116
118
  }
117
119
 
118
120
  /**
119
- * Helper function to get an array that represents the all modded collectible types.
121
+ * Helper function to get an array that represents every modded collectible type.
120
122
  *
121
123
  * Returns an empty array if there are no modded collectible types.
122
124
  *
@@ -149,6 +151,10 @@ export class ModdedElementDetection extends Feature {
149
151
  }
150
152
 
151
153
  /**
154
+ * Returns the total number of collectibles in the item config, including both vanilla and modded
155
+ * items. If you just need the number of vanilla collectible types, use the
156
+ * `NUM_VANILLA_COLLECTIBLE_TYPES` constant.
157
+ *
152
158
  * This function can only be called if at least one callback has been executed. This is because
153
159
  * not all collectibles will necessarily be present when a mod first loads (due to mod load
154
160
  * order).
@@ -209,8 +215,11 @@ export class ModdedElementDetection extends Feature {
209
215
  /**
210
216
  * Will change depending on how many modded trinkets there are.
211
217
  *
212
- * This is equal to the number of trinket types, since all trinket types are contiguous (unlike
213
- * collectibles).
218
+ * Equal to `itemConfig.GetTrinkets().Size - 1`. (`Size` includes invalid trinkets, like 47. We
219
+ * subtract one to account for `TrinketType.NULL`.)
220
+ *
221
+ * If there are no mods present that add any custom trinkets, this function will return
222
+ * `TrinketType.SIGIL_OF_BAPHOMET` (189).
214
223
  *
215
224
  * This function can only be called if at least one callback has been executed. This is because
216
225
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -222,8 +231,7 @@ export class ModdedElementDetection extends Feature {
222
231
  public getLastTrinketType(): TrinketType {
223
232
  this.errorIfNoCallbacksFired("trinket");
224
233
 
225
- const numTrinketTypes = this.getNumTrinketTypes();
226
- return asTrinketType(numTrinketTypes);
234
+ return itemConfig.GetTrinkets().Size - 1;
227
235
  }
228
236
 
229
237
  /**
@@ -231,9 +239,11 @@ export class ModdedElementDetection extends Feature {
231
239
  *
232
240
  * Returns an empty array if there are no modded trinket types.
233
241
  *
234
- * This function is only useful when building collectible type objects. For most purposes, you
235
- * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function
236
- * instead.
242
+ * This function is only useful when building trinket type objects. For most purposes, you should
243
+ * use the `getModdedTrinketArray` or `getModdedTrinketSet` helper function instead.
244
+ *
245
+ * (This function is named differently from the `getVanillaTrinketTypeRange` function because all
246
+ * modded trinket types are contiguous. Thus, each value represents a real `TrinketType`.)
237
247
  *
238
248
  * This function can only be called if at least one callback has been executed. This is because
239
249
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -255,10 +265,9 @@ export class ModdedElementDetection extends Feature {
255
265
  }
256
266
 
257
267
  /**
258
- * Will change depending on how many modded trinkets there are.
259
- *
260
- * Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
261
- * `TrinketType.NULL`.)
268
+ * Returns the total number of trinkets in the item config, including both vanilla and modded
269
+ * items. If you just need the number of vanilla trinket types, use the
270
+ * `NUM_VANILLA_TRINKET_TYPES` constant.
262
271
  *
263
272
  * This function can only be called if at least one callback has been executed. This is because
264
273
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -270,26 +279,12 @@ export class ModdedElementDetection extends Feature {
270
279
  public getNumTrinketTypes(): int {
271
280
  this.errorIfNoCallbacksFired("trinket");
272
281
 
273
- return itemConfig.GetTrinkets().Size - 1;
274
- }
275
-
276
- /**
277
- * This function can only be called if at least one callback has been executed. This is because
278
- * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
279
- *
280
- * In order to use this function, you must upgrade your mod with
281
- * `ISCFeature.MODDED_ELEMENT_DETECTION`.
282
- */
283
- @Exported
284
- public getNumModdedTrinketTypes(): int {
285
- this.errorIfNoCallbacksFired("trinket");
286
-
287
- const numTrinketTypes = this.getNumTrinketTypes();
288
- return numTrinketTypes - NUM_VANILLA_TRINKET_TYPES;
282
+ const numModdedTrinketTypes = this.getNumModdedTrinketTypes();
283
+ return NUM_VANILLA_TRINKET_TYPES + numModdedTrinketTypes;
289
284
  }
290
285
 
291
286
  /**
292
- * Helper function to get an array that contains every trinket type.
287
+ * Unlike vanilla trinket types, modded trinket types are always contiguous.
293
288
  *
294
289
  * This function can only be called if at least one callback has been executed. This is because
295
290
  * not all trinkets will necessarily be present when a mod first loads (due to mod load order).
@@ -298,11 +293,11 @@ export class ModdedElementDetection extends Feature {
298
293
  * `ISCFeature.MODDED_ELEMENT_DETECTION`.
299
294
  */
300
295
  @Exported
301
- public getTrinketTypes(): TrinketType[] {
296
+ public getNumModdedTrinketTypes(): int {
302
297
  this.errorIfNoCallbacksFired("trinket");
303
298
 
304
299
  const lastTrinketType = this.getLastTrinketType();
305
- return iRange(FIRST_TRINKET_TYPE, lastTrinketType);
300
+ return lastTrinketType - LAST_VANILLA_TRINKET_TYPE;
306
301
  }
307
302
 
308
303
  // -----
@@ -333,7 +333,7 @@ export class ModdedElementSets extends Feature {
333
333
  for (const cacheFlag of CACHE_FLAG_VALUES) {
334
334
  const trinketsSet = new Set<TrinketType>();
335
335
 
336
- for (const trinketType of this.moddedElementDetection.getTrinketTypes()) {
336
+ for (const trinketType of this.getTrinketArray()) {
337
337
  if (trinketHasCacheFlag(trinketType, cacheFlag)) {
338
338
  trinketsSet.add(trinketType);
339
339
  }