isaacscript-common 80.1.0 → 80.2.1
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.
- package/dist/classes/callbacks/PostItemDischarge.d.ts.map +1 -1
- package/dist/classes/callbacks/PostItemDischarge.lua +1 -3
- package/dist/classes/features/other/CustomPickups.d.ts.map +1 -1
- package/dist/classes/features/other/CustomPickups.lua +1 -3
- package/dist/classes/features/other/CustomStages.d.ts.map +1 -1
- package/dist/classes/features/other/CustomStages.lua +1 -3
- package/dist/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
- package/dist/classes/features/other/DeployJSONRoom.lua +4 -4
- package/dist/classes/features/other/ModdedElementDetection.d.ts +31 -20
- package/dist/classes/features/other/ModdedElementDetection.d.ts.map +1 -1
- package/dist/classes/features/other/ModdedElementDetection.lua +23 -49
- package/dist/classes/features/other/StageHistory.d.ts.map +1 -1
- package/dist/classes/features/other/StageHistory.lua +1 -3
- package/dist/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
- package/dist/classes/features/other/extraConsoleCommands/commands.lua +1 -6
- package/dist/core/constantsFirstLast.d.ts +29 -6
- package/dist/core/constantsFirstLast.d.ts.map +1 -1
- package/dist/core/constantsFirstLast.lua +18 -3
- package/dist/functions/bosses.d.ts.map +1 -1
- package/dist/functions/bosses.lua +1 -3
- package/dist/functions/doors.d.ts.map +1 -1
- package/dist/functions/doors.lua +5 -7
- package/dist/functions/gridEntities.lua +1 -2
- package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -1
- package/dist/functions/gridEntitiesSpecific.lua +5 -7
- package/dist/functions/nextStage.d.ts.map +1 -1
- package/dist/functions/nextStage.lua +4 -6
- package/dist/functions/npcs.d.ts.map +1 -1
- package/dist/functions/npcs.lua +3 -5
- package/dist/functions/pills.d.ts.map +1 -1
- package/dist/functions/pills.lua +8 -16
- package/dist/functions/pocketItems.d.ts.map +1 -1
- package/dist/functions/pocketItems.lua +1 -3
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +13 -15
- package/dist/functions/set.d.ts +37 -1
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/set.lua +56 -11
- package/dist/functions/stage.lua +2 -6
- package/dist/functions/trinkets.lua +2 -2
- package/dist/functions/types.d.ts +29 -0
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/index.rollup.d.ts +97 -27
- package/dist/isaacscript-common.lua +152 -158
- package/package.json +2 -2
- package/src/classes/callbacks/PostItemDischarge.ts +1 -2
- package/src/classes/features/other/CustomPickups.ts +1 -2
- package/src/classes/features/other/CustomStages.ts +1 -4
- package/src/classes/features/other/DeployJSONRoom.ts +5 -9
- package/src/classes/features/other/ModdedElementDetection.ts +61 -77
- package/src/classes/features/other/StageHistory.ts +1 -2
- package/src/classes/features/other/extraConsoleCommands/commands.ts +2 -6
- package/src/core/constantsFirstLast.ts +29 -6
- package/src/functions/bosses.ts +1 -2
- package/src/functions/doors.ts +5 -6
- package/src/functions/gridEntities.ts +2 -2
- package/src/functions/gridEntitiesSpecific.ts +5 -6
- package/src/functions/nextStage.ts +4 -5
- package/src/functions/npcs.ts +3 -4
- package/src/functions/pills.ts +4 -6
- package/src/functions/pocketItems.ts +1 -2
- package/src/functions/rooms.ts +15 -17
- package/src/functions/set.ts +79 -11
- package/src/functions/stage.ts +3 -3
- package/src/functions/trinkets.ts +2 -2
- package/src/functions/types.ts +30 -0
package/dist/functions/set.lua
CHANGED
|
@@ -5,6 +5,8 @@ local __TS__New = ____lualib.__TS__New
|
|
|
5
5
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
6
6
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
7
7
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
8
|
+
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
9
|
+
local __TS__ObjectValues = ____lualib.__TS__ObjectValues
|
|
8
10
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
9
11
|
local ____exports = {}
|
|
10
12
|
local ____ReadonlySet = require("types.ReadonlySet")
|
|
@@ -17,20 +19,45 @@ local ____types = require("functions.types")
|
|
|
17
19
|
local isPrimitive = ____types.isPrimitive
|
|
18
20
|
--- Helper function to get a sorted array based on the contents of a set.
|
|
19
21
|
--
|
|
20
|
-
-- Normally, set values are returned in
|
|
22
|
+
-- Normally, set values are returned in insertion order, so use this function when the ordering of
|
|
21
23
|
-- the contents is important.
|
|
22
24
|
function ____exports.getSortedSetValues(self, set)
|
|
23
|
-
local values = set
|
|
24
|
-
local
|
|
25
|
-
local firstElement = array[1]
|
|
25
|
+
local values = {__TS__Spread(set)}
|
|
26
|
+
local firstElement = values[1]
|
|
26
27
|
if firstElement ~= nil then
|
|
27
28
|
local arrayType = type(firstElement)
|
|
28
29
|
if not isPrimitive(nil, arrayType) then
|
|
29
30
|
error(("Failed to get the sorted set values because the provided set was of type \"" .. tostring(arrayType)) .. "\". Having sets with non-primitive types doesn't make much sense in general, so you might need to rethink what you are doing.")
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
|
-
__TS__ArraySort(
|
|
33
|
-
return
|
|
33
|
+
__TS__ArraySort(values)
|
|
34
|
+
return values
|
|
35
|
+
end
|
|
36
|
+
--- Helper function to convert the keys of an object to a set.
|
|
37
|
+
--
|
|
38
|
+
-- Note that the set values will be inserted in a random order, due to how `pairs` works under the
|
|
39
|
+
-- hood.
|
|
40
|
+
--
|
|
41
|
+
-- Also see the `objectKeysToReadonlySet` function.
|
|
42
|
+
function ____exports.objectKeysToSet(self, object)
|
|
43
|
+
local set = __TS__New(Set)
|
|
44
|
+
for ____, key in ipairs(__TS__ObjectKeys(object)) do
|
|
45
|
+
set:add(key)
|
|
46
|
+
end
|
|
47
|
+
return set
|
|
48
|
+
end
|
|
49
|
+
--- Helper function to convert the values of an object to a set.
|
|
50
|
+
--
|
|
51
|
+
-- Note that the set values will be inserted in a random order, due to how `pairs` works under the
|
|
52
|
+
-- hood.
|
|
53
|
+
--
|
|
54
|
+
-- Also see the `objectValuesToReadonlySet` function.
|
|
55
|
+
function ____exports.objectValuesToSet(self, object)
|
|
56
|
+
local set = __TS__New(Set)
|
|
57
|
+
for ____, key in ipairs(__TS__ObjectValues(object)) do
|
|
58
|
+
set:add(key)
|
|
59
|
+
end
|
|
60
|
+
return set
|
|
34
61
|
end
|
|
35
62
|
--- Helper function to add all of the values in one set to another set. The first set passed will be
|
|
36
63
|
-- modified in place.
|
|
@@ -39,7 +66,7 @@ end
|
|
|
39
66
|
function ____exports.addSetsToSet(self, mainSet, ...)
|
|
40
67
|
local setsToAdd = {...}
|
|
41
68
|
for ____, set in ipairs(setsToAdd) do
|
|
42
|
-
for ____, value in __TS__Iterator(set
|
|
69
|
+
for ____, value in __TS__Iterator(set) do
|
|
43
70
|
mainSet:add(value)
|
|
44
71
|
end
|
|
45
72
|
end
|
|
@@ -51,7 +78,7 @@ function ____exports.combineSets(self, ...)
|
|
|
51
78
|
local sets = {...}
|
|
52
79
|
local newSet = __TS__New(Set)
|
|
53
80
|
for ____, set in ipairs(sets) do
|
|
54
|
-
for ____, value in __TS__Iterator(set
|
|
81
|
+
for ____, value in __TS__Iterator(set) do
|
|
55
82
|
newSet:add(value)
|
|
56
83
|
end
|
|
57
84
|
end
|
|
@@ -60,7 +87,7 @@ end
|
|
|
60
87
|
--- Helper function to copy a set. (You can also use a Set constructor to accomplish this task.)
|
|
61
88
|
function ____exports.copySet(self, oldSet)
|
|
62
89
|
local newSet = __TS__New(Set)
|
|
63
|
-
for ____, value in __TS__Iterator(oldSet
|
|
90
|
+
for ____, value in __TS__Iterator(oldSet) do
|
|
64
91
|
newSet:add(value)
|
|
65
92
|
end
|
|
66
93
|
return newSet
|
|
@@ -72,7 +99,7 @@ end
|
|
|
72
99
|
function ____exports.deleteSetsFromSet(self, mainSet, ...)
|
|
73
100
|
local setsToRemove = {...}
|
|
74
101
|
for ____, set in ipairs(setsToRemove) do
|
|
75
|
-
for ____, value in __TS__Iterator(set
|
|
102
|
+
for ____, value in __TS__Iterator(set) do
|
|
76
103
|
mainSet:delete(value)
|
|
77
104
|
end
|
|
78
105
|
end
|
|
@@ -119,6 +146,24 @@ function ____exports.getSetCombinations(self, set, includeEmptyArray)
|
|
|
119
146
|
function(____, array) return __TS__New(ReadonlySet, array) end
|
|
120
147
|
)
|
|
121
148
|
end
|
|
149
|
+
--- Helper function to convert the keys of an object to a read-only set.
|
|
150
|
+
--
|
|
151
|
+
-- Note that the set values will be inserted in a random order, due to how `pairs` works under the
|
|
152
|
+
-- hood.
|
|
153
|
+
--
|
|
154
|
+
-- Also see the `objectKeysToSet` function.
|
|
155
|
+
function ____exports.objectKeysToReadonlySet(self, object)
|
|
156
|
+
return ____exports.objectKeysToSet(nil, object)
|
|
157
|
+
end
|
|
158
|
+
--- Helper function to convert the values of an object to a read-only set.
|
|
159
|
+
--
|
|
160
|
+
-- Note that the set values will be inserted in a random order, due to how `pairs` works under the
|
|
161
|
+
-- hood.
|
|
162
|
+
--
|
|
163
|
+
-- Also see the `objectValuesToSet` function.
|
|
164
|
+
function ____exports.objectValuesToReadonlySet(self, object)
|
|
165
|
+
return ____exports.objectValuesToSet(nil, object)
|
|
166
|
+
end
|
|
122
167
|
--- Helper function to add one or more elements to a set at once without having to repeatedly call
|
|
123
168
|
-- the `Set.add` method.
|
|
124
169
|
--
|
|
@@ -143,7 +188,7 @@ function ____exports.setHas(self, set, ...)
|
|
|
143
188
|
end
|
|
144
189
|
--- Helper function to sum every value in a set together.
|
|
145
190
|
function ____exports.sumSet(self, set)
|
|
146
|
-
local values = {__TS__Spread(set
|
|
191
|
+
local values = {__TS__Spread(set)}
|
|
147
192
|
return sumArray(nil, values)
|
|
148
193
|
end
|
|
149
194
|
return ____exports
|
package/dist/functions/stage.lua
CHANGED
|
@@ -20,7 +20,6 @@ local ____log = require("functions.log")
|
|
|
20
20
|
local log = ____log.log
|
|
21
21
|
local ____types = require("functions.types")
|
|
22
22
|
local asLevelStage = ____types.asLevelStage
|
|
23
|
-
local asNumber = ____types.asNumber
|
|
24
23
|
local ____utils = require("functions.utils")
|
|
25
24
|
local inRange = ____utils.inRange
|
|
26
25
|
--- Helper function to check if the provided stage type is equal to `StageType.REPENTANCE` or
|
|
@@ -62,10 +61,7 @@ function ____exports.calculateStageTypeRepentance(self, stage)
|
|
|
62
61
|
return StageType.REPENTANCE
|
|
63
62
|
end
|
|
64
63
|
local seeds = game:GetSeeds()
|
|
65
|
-
local adjustedStage = asLevelStage(
|
|
66
|
-
nil,
|
|
67
|
-
asNumber(nil, stage) + 1
|
|
68
|
-
)
|
|
64
|
+
local adjustedStage = asLevelStage(nil, stage + 1)
|
|
69
65
|
local stageSeed = seeds:GetStageSeed(adjustedStage)
|
|
70
66
|
local halfStageSeed = math.floor(stageSeed / 2)
|
|
71
67
|
if halfStageSeed % 2 == 0 then
|
|
@@ -80,7 +76,7 @@ function ____exports.getEffectiveStage(self)
|
|
|
80
76
|
local level = game:GetLevel()
|
|
81
77
|
local stage = level:GetStage()
|
|
82
78
|
if ____exports.onRepentanceStage(nil) then
|
|
83
|
-
return
|
|
79
|
+
return stage + 1
|
|
84
80
|
end
|
|
85
81
|
return stage
|
|
86
82
|
end
|
|
@@ -46,7 +46,7 @@ local TRINKET_SPRITE_LAYER = 0
|
|
|
46
46
|
-- For example, passing `TrinketType.SWALLOWED_PENNY` would result in 32769, which is the value that
|
|
47
47
|
-- corresponds to the golden trinket sub-type for Swallowed Penny.
|
|
48
48
|
function ____exports.getGoldenTrinketType(self, trinketType)
|
|
49
|
-
return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType or
|
|
49
|
+
return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType or trinketType + GOLDEN_TRINKET_ADJUSTMENT
|
|
50
50
|
end
|
|
51
51
|
--- Helper function to get the current effect that the Mysterious Paper trinket is providing to the
|
|
52
52
|
-- player. Returns undefined if the player does not have the Mysterious Paper trinket.
|
|
@@ -80,7 +80,7 @@ end
|
|
|
80
80
|
-- If the provided trinket type is already a normal trinket type, then the trinket type will be
|
|
81
81
|
-- returned unmodified.
|
|
82
82
|
function ____exports.getNormalTrinketType(self, trinketType)
|
|
83
|
-
return ____exports.isGoldenTrinketType(nil, trinketType) and
|
|
83
|
+
return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType - GOLDEN_TRINKET_ADJUSTMENT or trinketType
|
|
84
84
|
end
|
|
85
85
|
--- Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
86
86
|
-- trinket type was not valid.
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consider the following code that uses a number enum:
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* enum MyEnum {
|
|
6
|
+
* Value1,
|
|
7
|
+
* }
|
|
8
|
+
*
|
|
9
|
+
* function asMyEnum(num: number): MyEnum {}
|
|
10
|
+
*
|
|
11
|
+
* declare const something: unknown;
|
|
12
|
+
*
|
|
13
|
+
* const foo = something as MyEnum; // no error
|
|
14
|
+
* const bar: MyEnum = something; // error
|
|
15
|
+
* const baz = asMyEnum(something); // error
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Here, using `as` does not give an error because TypeScript allows you to assert a type to a
|
|
19
|
+
* supertype or a subtype. Thus, using `as` to perform a type assertion is not as safe as using a
|
|
20
|
+
* variable declaration or a helper function. However, if we use a variable declaration, then the
|
|
21
|
+
* `isaacscript/strict-enums` rule is triggered, which requires suppressing the lint rule with a `//
|
|
22
|
+
* eslint-disable-next-line`. Thus, the safest and more concise way to do a type assertion is to use
|
|
23
|
+
* a helper function.
|
|
24
|
+
*
|
|
25
|
+
* This file contains helper functions for various number enums that might require type assertions.
|
|
26
|
+
* It also contains helper functions for run-time type checks.
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
*/
|
|
1
30
|
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
2
31
|
/// <reference types="lua-types/5.3" />
|
|
3
32
|
import type { CardType, CollectibleType, LevelStage, NPCState, PillColor, PillEffect, PlayerType, RoomType, TrinketType } from "isaac-typescript-definitions";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/functions/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/functions/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAEtC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAEjD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAEnD;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,OAAO,CAEhE;AAGD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAElE;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,GAAG,CAM5D;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CACzB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,OAAO,GAAG,MAAM,GAAG,MAAM,CAOvC;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAExC;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,WAAW,CAErE"}
|
package/dist/index.rollup.d.ts
CHANGED
|
@@ -7874,7 +7874,7 @@ export declare function getSlots(slotVariant?: SlotVariant | -1, subType?: numbe
|
|
|
7874
7874
|
/**
|
|
7875
7875
|
* Helper function to get a sorted array based on the contents of a set.
|
|
7876
7876
|
*
|
|
7877
|
-
* Normally, set values are returned in
|
|
7877
|
+
* Normally, set values are returned in insertion order, so use this function when the ordering of
|
|
7878
7878
|
* the contents is important.
|
|
7879
7879
|
*/
|
|
7880
7880
|
export declare function getSortedSetValues<T>(set: Set<T> | ReadonlySet<T>): T[];
|
|
@@ -10583,24 +10583,47 @@ export declare const LAST_ROOM_TYPE: RoomType;
|
|
|
10583
10583
|
|
|
10584
10584
|
export declare const LAST_STAGE: LevelStage;
|
|
10585
10585
|
|
|
10586
|
-
/**
|
|
10586
|
+
/**
|
|
10587
|
+
* Calculated from the `CardType` enum.
|
|
10588
|
+
*
|
|
10589
|
+
* Note that this could be calculated from the length of the enum, because card types are
|
|
10590
|
+
* contiguous. However, we instead get the highest enum value to be safer and to make the code more
|
|
10591
|
+
* consistent with collectibles and trinkets.
|
|
10592
|
+
*/
|
|
10587
10593
|
export declare const LAST_VANILLA_CARD_TYPE: CardType;
|
|
10588
10594
|
|
|
10589
|
-
/**
|
|
10595
|
+
/**
|
|
10596
|
+
* Calculated from the `PlayerType` enum.
|
|
10597
|
+
*
|
|
10598
|
+
* Note that this could be calculated from the length of the enum, because characters are
|
|
10599
|
+
* contiguous. However, we instead get the highest enum value to be safer and to make the code more
|
|
10600
|
+
* consistent with collectibles and trinkets.
|
|
10601
|
+
*/
|
|
10590
10602
|
export declare const LAST_VANILLA_CHARACTER: PlayerType;
|
|
10591
10603
|
|
|
10592
10604
|
/**
|
|
10593
10605
|
* Calculated from the `CollectibleType` enum.
|
|
10594
10606
|
*
|
|
10595
|
-
* Note that this cannot be calculated from the length of the enum, because
|
|
10596
|
-
*
|
|
10607
|
+
* Note that this cannot be calculated from the length of the enum, because collectible types are
|
|
10608
|
+
* not contiguous.
|
|
10597
10609
|
*/
|
|
10598
10610
|
export declare const LAST_VANILLA_COLLECTIBLE_TYPE: CollectibleType;
|
|
10599
10611
|
|
|
10600
|
-
/**
|
|
10612
|
+
/**
|
|
10613
|
+
* Calculated from the `PillEffect` enum.
|
|
10614
|
+
*
|
|
10615
|
+
* Note that this could be calculated from the length of the enum, because pill effects are
|
|
10616
|
+
* contiguous. However, we instead get the highest enum value to be safer and to make the code more
|
|
10617
|
+
* consistent with collectibles and trinkets.
|
|
10618
|
+
*/
|
|
10601
10619
|
export declare const LAST_VANILLA_PILL_EFFECT: PillEffect;
|
|
10602
10620
|
|
|
10603
|
-
/**
|
|
10621
|
+
/**
|
|
10622
|
+
* Calculated from the `TrinketType` enum.
|
|
10623
|
+
*
|
|
10624
|
+
* Note that this cannot be calculated from the length of the enum, because trinket types are not
|
|
10625
|
+
* contiguous.
|
|
10626
|
+
*/
|
|
10604
10627
|
export declare const LAST_VANILLA_TRINKET_TYPE: TrinketType;
|
|
10605
10628
|
|
|
10606
10629
|
declare type Length<T extends unknown[]> = T extends {
|
|
@@ -13623,7 +13646,7 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13623
13646
|
* Equal to `itemConfig.GetCollectibles().Size - 1`. (`Size` includes invalid collectibles, like
|
|
13624
13647
|
* 666. We subtract one to account for `CollectibleType.NULL`.)
|
|
13625
13648
|
*
|
|
13626
|
-
* If there are no mods present that add any custom
|
|
13649
|
+
* If there are no mods present that add any custom collectibles, this function will return
|
|
13627
13650
|
* `CollectibleType.MOMS_RING` (732).
|
|
13628
13651
|
*
|
|
13629
13652
|
* This function can only be called if at least one callback has been executed. This is because
|
|
@@ -13638,7 +13661,7 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13638
13661
|
getLastCollectibleType(): CollectibleType;
|
|
13639
13662
|
/**
|
|
13640
13663
|
* Returns the total number of collectibles in the item config, including both vanilla and modded
|
|
13641
|
-
*
|
|
13664
|
+
* collectibles. If you just need the number of vanilla collectible types, use the
|
|
13642
13665
|
* `NUM_VANILLA_COLLECTIBLE_TYPES` constant.
|
|
13643
13666
|
*
|
|
13644
13667
|
* This function can only be called if at least one callback has been executed. This is because
|
|
@@ -13696,7 +13719,7 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13696
13719
|
getLastTrinketType(): TrinketType;
|
|
13697
13720
|
/**
|
|
13698
13721
|
* Returns the total number of trinkets in the item config, including both vanilla and modded
|
|
13699
|
-
*
|
|
13722
|
+
* trinkets. If you just need the number of vanilla trinket types, use the
|
|
13700
13723
|
* `NUM_VANILLA_TRINKET_TYPES` constant.
|
|
13701
13724
|
*
|
|
13702
13725
|
* This function can only be called if at least one callback has been executed. This is because
|
|
@@ -13735,11 +13758,14 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13735
13758
|
/**
|
|
13736
13759
|
* Will change depending on how many modded cards there are.
|
|
13737
13760
|
*
|
|
13738
|
-
*
|
|
13739
|
-
*
|
|
13761
|
+
* Equal to `itemConfig.GetCards().Size - 1`. (`Size` includes invalid cards, but since cards are
|
|
13762
|
+
* contiguous, there are no invalid cards. We subtract one to account for `CardType.NULL`.)
|
|
13763
|
+
*
|
|
13764
|
+
* If there are no mods present that add any custom cards, this function will return
|
|
13765
|
+
* `CardType.SOUL_OF_JACOB_AND_ESAU` (97).
|
|
13740
13766
|
*
|
|
13741
13767
|
* This function can only be called if at least one callback has been executed. This is because
|
|
13742
|
-
* not all
|
|
13768
|
+
* not all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
13743
13769
|
*
|
|
13744
13770
|
* In order to use this function, you must upgrade your mod with
|
|
13745
13771
|
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
|
|
@@ -13748,9 +13774,8 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13748
13774
|
*/
|
|
13749
13775
|
getLastCardType(): CardType;
|
|
13750
13776
|
/**
|
|
13751
|
-
*
|
|
13752
|
-
*
|
|
13753
|
-
* Equal to `itemConfig.GetCards().Size - 1`. (We subtract one to account for `Card.NULL`.)
|
|
13777
|
+
* Returns the total number of cards in the item config, including both vanilla and modded cards.
|
|
13778
|
+
* If you just need the number of vanilla card types, use the `NUM_VANILLA_CARD_TYPES` constant.
|
|
13754
13779
|
*
|
|
13755
13780
|
* This function can only be called if at least one callback has been executed. This is because
|
|
13756
13781
|
* not all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
@@ -13762,8 +13787,10 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13762
13787
|
*/
|
|
13763
13788
|
getNumCardTypes(): int;
|
|
13764
13789
|
/**
|
|
13790
|
+
* Like vanilla card types, modded card types are always contiguous.
|
|
13791
|
+
*
|
|
13765
13792
|
* This function can only be called if at least one callback has been executed. This is because
|
|
13766
|
-
* not all
|
|
13793
|
+
* not all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
13767
13794
|
*
|
|
13768
13795
|
* In order to use this function, you must upgrade your mod with
|
|
13769
13796
|
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
|
|
@@ -13787,8 +13814,12 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13787
13814
|
/**
|
|
13788
13815
|
* Will change depending on how many modded pill effects there are.
|
|
13789
13816
|
*
|
|
13790
|
-
*
|
|
13791
|
-
*
|
|
13817
|
+
* Equal to `itemConfig.GetPillEffects().Size - 1`. (`Size` includes invalid pill effects, but
|
|
13818
|
+
* since pill effects are contiguous, there are no invalid pill effects. We subtract one to
|
|
13819
|
+
* account for the enum starting at 0 instead of 1.)
|
|
13820
|
+
*
|
|
13821
|
+
* If there are no mods present that add any custom pill effects, this function will return
|
|
13822
|
+
* `PillEffect.EXPERIMENTAL` (49).
|
|
13792
13823
|
*
|
|
13793
13824
|
* This function can only be called if at least one callback has been executed. This is because
|
|
13794
13825
|
* not all pill effects will necessarily be present when a mod first loads (due to mod load
|
|
@@ -13801,14 +13832,12 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13801
13832
|
*/
|
|
13802
13833
|
getLastPillEffect(): PillEffect;
|
|
13803
13834
|
/**
|
|
13804
|
-
*
|
|
13805
|
-
*
|
|
13806
|
-
*
|
|
13807
|
-
* pill effect has an ID of 0 and there is no `PillEffect.NULL`.)
|
|
13835
|
+
* Returns the total number of pill effects in the item config, including both vanilla and modded
|
|
13836
|
+
* pill effects. If you just need the number of vanilla pill effects, use the
|
|
13837
|
+
* `NUM_VANILLA_PILL_EFFECTS` constant.
|
|
13808
13838
|
*
|
|
13809
13839
|
* This function can only be called if at least one callback has been executed. This is because
|
|
13810
|
-
* not all
|
|
13811
|
-
* order).
|
|
13840
|
+
* not all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
13812
13841
|
*
|
|
13813
13842
|
* In order to use this function, you must upgrade your mod with
|
|
13814
13843
|
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
|
|
@@ -13817,9 +13846,10 @@ declare class ModdedElementDetection extends Feature {
|
|
|
13817
13846
|
*/
|
|
13818
13847
|
getNumPillEffects(): int;
|
|
13819
13848
|
/**
|
|
13849
|
+
* Like vanilla pill effects, modded pill effects are always contiguous.
|
|
13850
|
+
*
|
|
13820
13851
|
* This function can only be called if at least one callback has been executed. This is because
|
|
13821
|
-
* not all
|
|
13822
|
-
* order).
|
|
13852
|
+
* not all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
13823
13853
|
*
|
|
13824
13854
|
* In order to use this function, you must upgrade your mod with
|
|
13825
13855
|
* `ISCFeature.MODDED_ELEMENT_DETECTION`.
|
|
@@ -14889,6 +14919,26 @@ export declare const NUM_VANILLA_PILL_EFFECTS: int;
|
|
|
14889
14919
|
/** Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.) */
|
|
14890
14920
|
export declare const NUM_VANILLA_TRINKET_TYPES: number;
|
|
14891
14921
|
|
|
14922
|
+
/**
|
|
14923
|
+
* Helper function to convert the keys of an object to a read-only set.
|
|
14924
|
+
*
|
|
14925
|
+
* Note that the set values will be inserted in a random order, due to how `pairs` works under the
|
|
14926
|
+
* hood.
|
|
14927
|
+
*
|
|
14928
|
+
* Also see the `objectKeysToSet` function.
|
|
14929
|
+
*/
|
|
14930
|
+
export declare function objectKeysToReadonlySet<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlySet<K>;
|
|
14931
|
+
|
|
14932
|
+
/**
|
|
14933
|
+
* Helper function to convert the keys of an object to a set.
|
|
14934
|
+
*
|
|
14935
|
+
* Note that the set values will be inserted in a random order, due to how `pairs` works under the
|
|
14936
|
+
* hood.
|
|
14937
|
+
*
|
|
14938
|
+
* Also see the `objectKeysToReadonlySet` function.
|
|
14939
|
+
*/
|
|
14940
|
+
export declare function objectKeysToSet<K extends string | number | symbol, V>(object: Record<K, V>): Set<K>;
|
|
14941
|
+
|
|
14892
14942
|
/**
|
|
14893
14943
|
* Helper function to convert an object to a map.
|
|
14894
14944
|
*
|
|
@@ -14919,6 +14969,26 @@ export declare function objectToMap<K extends string | number | symbol, V>(objec
|
|
|
14919
14969
|
*/
|
|
14920
14970
|
export declare function objectToReadonlyMap<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlyMap<K, V>;
|
|
14921
14971
|
|
|
14972
|
+
/**
|
|
14973
|
+
* Helper function to convert the values of an object to a read-only set.
|
|
14974
|
+
*
|
|
14975
|
+
* Note that the set values will be inserted in a random order, due to how `pairs` works under the
|
|
14976
|
+
* hood.
|
|
14977
|
+
*
|
|
14978
|
+
* Also see the `objectValuesToSet` function.
|
|
14979
|
+
*/
|
|
14980
|
+
export declare function objectValuesToReadonlySet<K extends string | number | symbol, V>(object: Record<K, V>): ReadonlySet<V>;
|
|
14981
|
+
|
|
14982
|
+
/**
|
|
14983
|
+
* Helper function to convert the values of an object to a set.
|
|
14984
|
+
*
|
|
14985
|
+
* Note that the set values will be inserted in a random order, due to how `pairs` works under the
|
|
14986
|
+
* hood.
|
|
14987
|
+
*
|
|
14988
|
+
* Also see the `objectValuesToReadonlySet` function.
|
|
14989
|
+
*/
|
|
14990
|
+
export declare function objectValuesToSet<K extends string | number | symbol, V>(object: Record<K, V>): Set<V>;
|
|
14991
|
+
|
|
14922
14992
|
/** Helper function to see if the player is playing any challenge. */
|
|
14923
14993
|
export declare function onAnyChallenge(): boolean;
|
|
14924
14994
|
|