isaacscript-common 8.9.0 → 9.0.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/callbacks/postPlayerCollectible.d.ts.map +1 -1
- package/dist/callbacks/postPlayerCollectible.lua +78 -9
- package/dist/core/constantsFirstLast.d.ts +4 -4
- package/dist/core/constantsFirstLast.d.ts.map +1 -1
- package/dist/core/constantsFirstLast.lua +4 -4
- package/dist/features/extraConsoleCommands/listCommands.lua +14 -14
- package/dist/features/firstLast.d.ts +9 -9
- package/dist/features/firstLast.d.ts.map +1 -1
- package/dist/features/firstLast.lua +26 -26
- package/dist/features/playerInventory.d.ts.map +1 -1
- package/dist/features/playerInventory.lua +8 -10
- package/dist/features/preventCollectibleRotation.lua +2 -2
- package/dist/functions/cards.d.ts +27 -36
- package/dist/functions/cards.d.ts.map +1 -1
- package/dist/functions/cards.lua +70 -79
- package/dist/functions/collectibleCacheFlag.d.ts +4 -1
- package/dist/functions/collectibleCacheFlag.d.ts.map +1 -1
- package/dist/functions/collectibleCacheFlag.lua +5 -2
- package/dist/functions/collectibles.d.ts +1 -6
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +1 -6
- package/dist/functions/familiars.d.ts.map +1 -1
- package/dist/functions/itemPool.lua +9 -11
- package/dist/functions/pickupsSpecific.d.ts +9 -9
- package/dist/functions/pickupsSpecific.d.ts.map +1 -1
- package/dist/functions/pickupsSpecific.lua +16 -16
- package/dist/functions/pills.d.ts +1 -6
- package/dist/functions/pills.d.ts.map +1 -1
- package/dist/functions/pills.lua +1 -6
- package/dist/functions/players.d.ts +6 -0
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/players.lua +7 -1
- package/dist/functions/pocketItems.lua +4 -4
- package/dist/functions/rockAlt.lua +2 -2
- package/dist/functions/trinkets.d.ts +1 -6
- package/dist/functions/trinkets.d.ts.map +1 -1
- package/dist/functions/trinkets.lua +1 -6
- package/dist/functions/types.d.ts +3 -3
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/functions/types.lua +2 -2
- package/dist/index.d.ts +63 -78
- package/dist/maps/cardMap.d.ts +2 -2
- package/dist/maps/cardMap.d.ts.map +1 -1
- package/dist/maps/cardMap.lua +203 -203
- package/dist/objects/cardDescriptions.d.ts +2 -2
- package/dist/objects/cardDescriptions.d.ts.map +1 -1
- package/dist/objects/cardDescriptions.lua +99 -99
- package/dist/objects/cardNames.d.ts +2 -2
- package/dist/objects/cardNames.d.ts.map +1 -1
- package/dist/objects/cardNames.lua +99 -99
- package/dist/objects/cardTypeToItemConfigCardType.d.ts +6 -0
- package/dist/objects/cardTypeToItemConfigCardType.d.ts.map +1 -0
- package/dist/objects/cardTypeToItemConfigCardType.lua +106 -0
- package/package.json +2 -2
- package/src/callbacks/postPlayerCollectible.ts +89 -10
- package/src/core/constantsFirstLast.ts +4 -4
- package/src/features/extraConsoleCommands/listCommands.ts +16 -16
- package/src/features/firstLast.ts +26 -26
- package/src/features/playerInventory.ts +6 -10
- package/src/features/preventCollectibleRotation.ts +2 -2
- package/src/functions/cards.ts +102 -86
- package/src/functions/collectibleCacheFlag.ts +6 -2
- package/src/functions/collectibles.ts +1 -6
- package/src/functions/familiars.ts +1 -0
- package/src/functions/itemPool.ts +6 -7
- package/src/functions/pickupsSpecific.ts +16 -13
- package/src/functions/pills.ts +1 -6
- package/src/functions/players.ts +14 -1
- package/src/functions/pocketItems.ts +4 -4
- package/src/functions/rockAlt.ts +2 -2
- package/src/functions/trinkets.ts +1 -6
- package/src/functions/types.ts +3 -3
- package/src/maps/cardMap.ts +204 -204
- package/src/objects/cardDescriptions.ts +100 -100
- package/src/objects/cardNames.ts +100 -100
- package/src/objects/cardTypeToItemConfigCardType.ts +106 -0
- package/dist/objects/cardTypes.d.ts +0 -6
- package/dist/objects/cardTypes.d.ts.map +0 -1
- package/dist/objects/cardTypes.lua +0 -106
- package/src/objects/cardTypes.ts +0 -104
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postPlayerCollectible.d.ts","sourceRoot":"","sources":["../../src/callbacks/postPlayerCollectible.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"postPlayerCollectible.d.ts","sourceRoot":"","sources":["../../src/callbacks/postPlayerCollectible.ts"],"names":[],"mappings":";AA4CA,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAIjE"}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local Map = ____lualib.Map
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local Set = ____lualib.Set
|
|
4
5
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
5
6
|
local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
|
|
6
7
|
local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
|
|
7
8
|
local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
|
|
9
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
10
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
9
11
|
local ____exports = {}
|
|
10
|
-
local hasSubscriptions, postPEffectUpdate, collectibleCountChanged, v
|
|
12
|
+
local hasSubscriptions, postPEffectUpdate, collectibleCountChanged, checkActiveItemsChanged, activeItemsChanged, v
|
|
11
13
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
14
|
+
local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
|
|
15
|
+
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
12
16
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
13
17
|
local ____DefaultMap = require("classes.DefaultMap")
|
|
14
18
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
15
19
|
local ____exports = require("features.saveDataManager.exports")
|
|
16
20
|
local saveDataManager = ____exports.saveDataManager
|
|
21
|
+
local ____array = require("functions.array")
|
|
22
|
+
local arrayEquals = ____array.arrayEquals
|
|
23
|
+
local ____enums = require("functions.enums")
|
|
24
|
+
local getEnumValues = ____enums.getEnumValues
|
|
17
25
|
local ____playerDataStructures = require("functions.playerDataStructures")
|
|
18
26
|
local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
|
|
19
27
|
local mapGetPlayer = ____playerDataStructures.mapGetPlayer
|
|
@@ -43,30 +51,37 @@ function postPEffectUpdate(self, player)
|
|
|
43
51
|
end
|
|
44
52
|
local difference = newCollectibleCount - oldCollectibleCount
|
|
45
53
|
if difference > 0 then
|
|
46
|
-
collectibleCountChanged(nil, player, difference
|
|
54
|
+
collectibleCountChanged(nil, player, difference)
|
|
47
55
|
elseif difference < 0 then
|
|
48
|
-
collectibleCountChanged(nil, player, difference * -1
|
|
56
|
+
collectibleCountChanged(nil, player, difference * -1)
|
|
57
|
+
elseif difference == 0 then
|
|
58
|
+
checkActiveItemsChanged(nil, player)
|
|
49
59
|
end
|
|
50
60
|
end
|
|
51
|
-
function collectibleCountChanged(self, player, numCollectiblesChanged
|
|
61
|
+
function collectibleCountChanged(self, player, numCollectiblesChanged)
|
|
52
62
|
local oldCollectibleMap = defaultMapGetPlayer(nil, v.run.playersCollectibleMap, player)
|
|
53
63
|
local newCollectibleMap = getPlayerCollectibleMap(nil, player)
|
|
54
64
|
mapSetPlayer(nil, v.run.playersCollectibleMap, player, newCollectibleMap)
|
|
65
|
+
local ____Set_1 = Set
|
|
55
66
|
local ____array_0 = __TS__SparseArrayNew(__TS__Spread(oldCollectibleMap:keys()))
|
|
56
67
|
__TS__SparseArrayPush(
|
|
57
68
|
____array_0,
|
|
58
69
|
__TS__Spread(newCollectibleMap:keys())
|
|
59
70
|
)
|
|
60
|
-
local
|
|
61
|
-
|
|
71
|
+
local collectibleTypeSet = __TS__New(
|
|
72
|
+
____Set_1,
|
|
73
|
+
{__TS__SparseArraySpread(____array_0)}
|
|
74
|
+
)
|
|
62
75
|
local numFired = 0
|
|
63
|
-
for ____, collectibleType in
|
|
76
|
+
for ____, collectibleType in __TS__Iterator(collectibleTypeSet:values()) do
|
|
64
77
|
local oldNum = oldCollectibleMap:get(collectibleType) or 0
|
|
65
78
|
local newNum = newCollectibleMap:get(collectibleType) or 0
|
|
66
|
-
local difference =
|
|
79
|
+
local difference = newNum - oldNum
|
|
80
|
+
local increased = difference > 0
|
|
81
|
+
local absoluteDifference = math.abs(difference)
|
|
67
82
|
____repeat(
|
|
68
83
|
nil,
|
|
69
|
-
|
|
84
|
+
absoluteDifference,
|
|
70
85
|
function()
|
|
71
86
|
if increased then
|
|
72
87
|
postPlayerCollectibleAddedFire(nil, player, collectibleType)
|
|
@@ -81,11 +96,65 @@ function collectibleCountChanged(self, player, numCollectiblesChanged, increased
|
|
|
81
96
|
end
|
|
82
97
|
end
|
|
83
98
|
end
|
|
99
|
+
function checkActiveItemsChanged(self, player)
|
|
100
|
+
local activeItemMap = defaultMapGetPlayer(nil, v.run.playersActiveItemMap, player)
|
|
101
|
+
local oldCollectibleTypes = {}
|
|
102
|
+
local newCollectibleTypes = {}
|
|
103
|
+
for ____, activeSlot in ipairs(getEnumValues(nil, ActiveSlot)) do
|
|
104
|
+
local oldCollectibleType = activeItemMap:get(activeSlot) or CollectibleType.NULL
|
|
105
|
+
local newCollectibleType = player:GetActiveItem(activeSlot)
|
|
106
|
+
activeItemMap:set(activeSlot, newCollectibleType)
|
|
107
|
+
oldCollectibleTypes[#oldCollectibleTypes + 1] = oldCollectibleType
|
|
108
|
+
newCollectibleTypes[#newCollectibleTypes + 1] = newCollectibleType
|
|
109
|
+
end
|
|
110
|
+
__TS__ArraySort(oldCollectibleTypes)
|
|
111
|
+
__TS__ArraySort(newCollectibleTypes)
|
|
112
|
+
if not arrayEquals(nil, oldCollectibleTypes, newCollectibleTypes) then
|
|
113
|
+
local ____Set_3 = Set
|
|
114
|
+
local ____array_2 = __TS__SparseArrayNew(table.unpack(oldCollectibleTypes))
|
|
115
|
+
__TS__SparseArrayPush(
|
|
116
|
+
____array_2,
|
|
117
|
+
table.unpack(newCollectibleTypes)
|
|
118
|
+
)
|
|
119
|
+
local collectibleTypeSet = __TS__New(
|
|
120
|
+
____Set_3,
|
|
121
|
+
{__TS__SparseArraySpread(____array_2)}
|
|
122
|
+
)
|
|
123
|
+
activeItemsChanged(nil, player, collectibleTypeSet)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
function activeItemsChanged(self, player, collectibleTypesSet)
|
|
127
|
+
local oldCollectibleMap = defaultMapGetPlayer(nil, v.run.playersCollectibleMap, player)
|
|
128
|
+
local newCollectibleMap = getPlayerCollectibleMap(nil, player)
|
|
129
|
+
mapSetPlayer(nil, v.run.playersCollectibleMap, player, newCollectibleMap)
|
|
130
|
+
for ____, collectibleType in __TS__Iterator(collectibleTypesSet:values()) do
|
|
131
|
+
local oldNum = oldCollectibleMap:get(collectibleType) or 0
|
|
132
|
+
local newNum = newCollectibleMap:get(collectibleType) or 0
|
|
133
|
+
local difference = newNum - oldNum
|
|
134
|
+
local increased = difference > 0
|
|
135
|
+
local absoluteDifference = math.abs(difference)
|
|
136
|
+
____repeat(
|
|
137
|
+
nil,
|
|
138
|
+
absoluteDifference,
|
|
139
|
+
function()
|
|
140
|
+
if increased then
|
|
141
|
+
postPlayerCollectibleAddedFire(nil, player, collectibleType)
|
|
142
|
+
else
|
|
143
|
+
postPlayerCollectibleRemovedFire(nil, player, collectibleType)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
)
|
|
147
|
+
end
|
|
148
|
+
end
|
|
84
149
|
v = {run = {
|
|
85
150
|
playersCollectibleCount = __TS__New(Map),
|
|
86
151
|
playersCollectibleMap = __TS__New(
|
|
87
152
|
DefaultMap,
|
|
88
153
|
function() return __TS__New(Map) end
|
|
154
|
+
),
|
|
155
|
+
playersActiveItemMap = __TS__New(
|
|
156
|
+
DefaultMap,
|
|
157
|
+
function() return __TS__New(Map) end
|
|
89
158
|
)
|
|
90
159
|
}}
|
|
91
160
|
function ____exports.postPlayerCollectibleCallbacksInit(self, mod)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CardType, CollectibleType, LevelStage, PillColor, PillEffect, PlayerType, RoomType, TrinketType } from "isaac-typescript-definitions";
|
|
2
2
|
/** Equal to `CollectibleType.SAD_ONION`. */
|
|
3
3
|
export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
|
|
4
4
|
/**
|
|
@@ -17,11 +17,11 @@ export declare const LAST_VANILLA_TRINKET_TYPE: TrinketType;
|
|
|
17
17
|
/** Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.) */
|
|
18
18
|
export declare const NUM_VANILLA_TRINKET_TYPES: number;
|
|
19
19
|
/** Equal to `Card.FOOL`. */
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const FIRST_CARD_TYPE = CardType.FOOL;
|
|
21
21
|
/** Calculated from the `Card` enum. */
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const LAST_VANILLA_CARD_TYPE: CardType;
|
|
23
23
|
/** Calculated from the `Card` enum. `Card.NULL` is not included. */
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const NUM_VANILLA_CARD_TYPES: number;
|
|
25
25
|
/** Equal to `PillEffect.BAD_GAS`. */
|
|
26
26
|
export declare const FIRST_PILL_EFFECT = PillEffect.BAD_GAS;
|
|
27
27
|
/** Calculated from the `PillEffect` enum. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constantsFirstLast.d.ts","sourceRoot":"","sources":["../../src/core/constantsFirstLast.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"constantsFirstLast.d.ts","sourceRoot":"","sources":["../../src/core/constantsFirstLast.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EAC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AA+B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
|
-
local
|
|
3
|
+
local CardType = ____isaac_2Dtypescript_2Ddefinitions.CardType
|
|
4
4
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
5
5
|
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
|
|
6
6
|
local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
|
|
@@ -27,11 +27,11 @@ ____exports.LAST_VANILLA_TRINKET_TYPE = getLastEnumValue(nil, TrinketType)
|
|
|
27
27
|
--- Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.)
|
|
28
28
|
____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
|
|
29
29
|
--- Equal to `Card.FOOL`.
|
|
30
|
-
____exports.
|
|
30
|
+
____exports.FIRST_CARD_TYPE = CardType.FOOL
|
|
31
31
|
--- Calculated from the `Card` enum.
|
|
32
|
-
____exports.
|
|
32
|
+
____exports.LAST_VANILLA_CARD_TYPE = getLastEnumValue(nil, CardType)
|
|
33
33
|
--- Calculated from the `Card` enum. `Card.NULL` is not included.
|
|
34
|
-
____exports.
|
|
34
|
+
____exports.NUM_VANILLA_CARD_TYPES = getEnumLength(nil, CardType) - 1
|
|
35
35
|
--- Equal to `PillEffect.BAD_GAS`.
|
|
36
36
|
____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
|
|
37
37
|
--- Calculated from the `PillEffect` enum.
|
|
@@ -23,7 +23,7 @@ local sfxManager = ____cachedClasses.sfxManager
|
|
|
23
23
|
local ____constants = require("core.constants")
|
|
24
24
|
local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
|
|
25
25
|
local ____constantsFirstLast = require("core.constantsFirstLast")
|
|
26
|
-
local
|
|
26
|
+
local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
|
|
27
27
|
local FIRST_CHARACTER = ____constantsFirstLast.FIRST_CHARACTER
|
|
28
28
|
local FIRST_PILL_EFFECT = ____constantsFirstLast.FIRST_PILL_EFFECT
|
|
29
29
|
local FIRST_ROOM_TYPE = ____constantsFirstLast.FIRST_ROOM_TYPE
|
|
@@ -86,7 +86,7 @@ local setUnseeded = ____run.setUnseeded
|
|
|
86
86
|
local ____trinkets = require("functions.trinkets")
|
|
87
87
|
local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
|
|
88
88
|
local ____types = require("functions.types")
|
|
89
|
-
local
|
|
89
|
+
local asCardType = ____types.asCardType
|
|
90
90
|
local ____utils = require("functions.utils")
|
|
91
91
|
local irange = ____utils.irange
|
|
92
92
|
local printConsole = ____utils.printConsole
|
|
@@ -100,7 +100,7 @@ local PILL_EFFECT_MAP = ____pillEffectMap.PILL_EFFECT_MAP
|
|
|
100
100
|
local ____roomTypeMap = require("maps.roomTypeMap")
|
|
101
101
|
local ROOM_TYPE_MAP = ____roomTypeMap.ROOM_TYPE_MAP
|
|
102
102
|
local ____firstLast = require("features.firstLast")
|
|
103
|
-
local
|
|
103
|
+
local getLastCardType = ____firstLast.getLastCardType
|
|
104
104
|
local getLastPillEffect = ____firstLast.getLastPillEffect
|
|
105
105
|
local ____commandsSubroutines = require("features.extraConsoleCommands.commandsSubroutines")
|
|
106
106
|
local addHeart = ____commandsSubroutines.addHeart
|
|
@@ -356,7 +356,7 @@ function ____exports.card(self, params)
|
|
|
356
356
|
printConsole(nil, "You must specify a card name or number.")
|
|
357
357
|
return
|
|
358
358
|
end
|
|
359
|
-
local
|
|
359
|
+
local cardType
|
|
360
360
|
local num = tonumber(params)
|
|
361
361
|
if num == nil then
|
|
362
362
|
local match = getMapPartialMatch(nil, params, CARD_MAP)
|
|
@@ -364,28 +364,28 @@ function ____exports.card(self, params)
|
|
|
364
364
|
printConsole(nil, "Unknown card: " .. params)
|
|
365
365
|
return
|
|
366
366
|
end
|
|
367
|
-
|
|
367
|
+
cardType = match[2]
|
|
368
368
|
else
|
|
369
|
-
local
|
|
370
|
-
if num <
|
|
369
|
+
local lastCardType = getLastCardType(nil)
|
|
370
|
+
if num < FIRST_CARD_TYPE or num > lastCardType then
|
|
371
371
|
printConsole(
|
|
372
372
|
nil,
|
|
373
373
|
"Invalid card sub-type: " .. tostring(num)
|
|
374
374
|
)
|
|
375
375
|
return
|
|
376
376
|
end
|
|
377
|
-
|
|
377
|
+
cardType = num
|
|
378
378
|
end
|
|
379
|
-
local cardName = getCardName(nil,
|
|
380
|
-
Isaac.ExecuteCommand("g k" .. tostring(
|
|
379
|
+
local cardName = getCardName(nil, cardType)
|
|
380
|
+
Isaac.ExecuteCommand("g k" .. tostring(cardType))
|
|
381
381
|
printConsole(
|
|
382
382
|
nil,
|
|
383
|
-
((("Gave card: " .. cardName) .. " (") .. tostring(
|
|
383
|
+
((("Gave card: " .. cardName) .. " (") .. tostring(cardType)) .. ")"
|
|
384
384
|
)
|
|
385
385
|
end
|
|
386
386
|
--- Spawns every card on the ground, starting at the top-left-most tile.
|
|
387
387
|
function ____exports.cards(self)
|
|
388
|
-
local
|
|
388
|
+
local lastCardType = getLastCardType(nil)
|
|
389
389
|
local cardType = 1
|
|
390
390
|
do
|
|
391
391
|
local y = 0
|
|
@@ -393,13 +393,13 @@ function ____exports.cards(self)
|
|
|
393
393
|
do
|
|
394
394
|
local x = 0
|
|
395
395
|
while x <= 12 do
|
|
396
|
-
if
|
|
396
|
+
if asCardType(nil, cardType) == lastCardType then
|
|
397
397
|
return
|
|
398
398
|
end
|
|
399
399
|
local position = gridCoordinatesToWorldPosition(nil, x, y)
|
|
400
400
|
spawnCard(
|
|
401
401
|
nil,
|
|
402
|
-
|
|
402
|
+
asCardType(nil, cardType),
|
|
403
403
|
position
|
|
404
404
|
)
|
|
405
405
|
cardType = cardType + 1
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CardType, CollectibleType, PillEffect, TrinketType } from "isaac-typescript-definitions";
|
|
2
2
|
/**
|
|
3
3
|
* Returns the first modded collectible type, or undefined if there are no modded collectibles.
|
|
4
4
|
*
|
|
@@ -52,7 +52,7 @@ export declare function getNumModdedCollectibleTypes(): int;
|
|
|
52
52
|
*/
|
|
53
53
|
export declare function getFirstModdedTrinketType(): TrinketType | undefined;
|
|
54
54
|
/**
|
|
55
|
-
* Will change depending on how many modded
|
|
55
|
+
* Will change depending on how many modded trinkets there are.
|
|
56
56
|
*
|
|
57
57
|
* This is equal to the number of trinket types, since all trinket types are contiguous (unlike
|
|
58
58
|
* collectibles).
|
|
@@ -74,7 +74,7 @@ export declare function getLastTrinketType(): TrinketType;
|
|
|
74
74
|
*/
|
|
75
75
|
export declare function getModdedTrinketTypes(): TrinketType[];
|
|
76
76
|
/**
|
|
77
|
-
* Will change depending on how many modded
|
|
77
|
+
* Will change depending on how many modded trinkets there are.
|
|
78
78
|
*
|
|
79
79
|
* Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
|
|
80
80
|
* `TrinketType.NULL`.)
|
|
@@ -101,14 +101,14 @@ export declare function getTrinketTypes(): TrinketType[];
|
|
|
101
101
|
* This function can only be called if at least one callback has been executed. This is because not
|
|
102
102
|
* all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
103
103
|
*/
|
|
104
|
-
export declare function
|
|
104
|
+
export declare function getAllCardTypes(): CardType[];
|
|
105
105
|
/**
|
|
106
106
|
* Returns the first modded card sub-type, or undefined if there are no modded cards.
|
|
107
107
|
*
|
|
108
108
|
* This function can only be called if at least one callback has been executed. This is because not
|
|
109
109
|
* all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
110
110
|
*/
|
|
111
|
-
export declare function
|
|
111
|
+
export declare function getFirstModdedCardType(): CardType | undefined;
|
|
112
112
|
/**
|
|
113
113
|
* Will change depending on how many modded cards there are.
|
|
114
114
|
*
|
|
@@ -118,7 +118,7 @@ export declare function getFirstModdedCard(): Card | undefined;
|
|
|
118
118
|
* This function can only be called if at least one callback has been executed. This is because not
|
|
119
119
|
* all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
120
120
|
*/
|
|
121
|
-
export declare function
|
|
121
|
+
export declare function getLastCardType(): CardType;
|
|
122
122
|
/**
|
|
123
123
|
* Helper function to get an array with every modded card sub-type.
|
|
124
124
|
*
|
|
@@ -127,7 +127,7 @@ export declare function getLastCard(): Card;
|
|
|
127
127
|
* This function can only be called if at least one callback has been executed. This is because not
|
|
128
128
|
* all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
129
129
|
*/
|
|
130
|
-
export declare function
|
|
130
|
+
export declare function getModdedCardTypes(): CardType[];
|
|
131
131
|
/**
|
|
132
132
|
* Will change depending on how many modded cards there are.
|
|
133
133
|
*
|
|
@@ -136,12 +136,12 @@ export declare function getModdedCards(): Card[];
|
|
|
136
136
|
* This function can only be called if at least one callback has been executed. This is because not
|
|
137
137
|
* all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
138
138
|
*/
|
|
139
|
-
export declare function
|
|
139
|
+
export declare function getNumCardTypes(): int;
|
|
140
140
|
/**
|
|
141
141
|
* This function can only be called if at least one callback has been executed. This is because not
|
|
142
142
|
* all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
143
143
|
*/
|
|
144
|
-
export declare function
|
|
144
|
+
export declare function getNumModdedCardTypes(): int;
|
|
145
145
|
/**
|
|
146
146
|
* Helper function to get an array with every valid pill effect. This includes modded pill effects.
|
|
147
147
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstLast.d.ts","sourceRoot":"","sources":["../../src/features/firstLast.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"firstLast.d.ts","sourceRoot":"","sources":["../../src/features/firstLast.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CA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,IAAI,UAAU,CAM9C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,EAAE,CAQnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CAKvC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,GAAG,CAM7C"}
|
|
@@ -3,14 +3,14 @@ local postNewRoomEarly, errorIfNoCallbacksFired, FEATURE_NAME, atLeastOneCallbac
|
|
|
3
3
|
local ____cachedClasses = require("core.cachedClasses")
|
|
4
4
|
local itemConfig = ____cachedClasses.itemConfig
|
|
5
5
|
local ____constantsFirstLast = require("core.constantsFirstLast")
|
|
6
|
-
local
|
|
6
|
+
local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
|
|
7
7
|
local FIRST_PILL_EFFECT = ____constantsFirstLast.FIRST_PILL_EFFECT
|
|
8
8
|
local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
|
|
9
|
-
local
|
|
9
|
+
local LAST_VANILLA_CARD_TYPE = ____constantsFirstLast.LAST_VANILLA_CARD_TYPE
|
|
10
10
|
local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsFirstLast.LAST_VANILLA_COLLECTIBLE_TYPE
|
|
11
11
|
local LAST_VANILLA_PILL_EFFECT = ____constantsFirstLast.LAST_VANILLA_PILL_EFFECT
|
|
12
12
|
local LAST_VANILLA_TRINKET_TYPE = ____constantsFirstLast.LAST_VANILLA_TRINKET_TYPE
|
|
13
|
-
local
|
|
13
|
+
local NUM_VANILLA_CARD_TYPES = ____constantsFirstLast.NUM_VANILLA_CARD_TYPES
|
|
14
14
|
local NUM_VANILLA_COLLECTIBLE_TYPES = ____constantsFirstLast.NUM_VANILLA_COLLECTIBLE_TYPES
|
|
15
15
|
local NUM_VANILLA_PILL_EFFECTS = ____constantsFirstLast.NUM_VANILLA_PILL_EFFECTS
|
|
16
16
|
local NUM_VANILLA_TRINKET_TYPES = ____constantsFirstLast.NUM_VANILLA_TRINKET_TYPES
|
|
@@ -19,7 +19,7 @@ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
|
19
19
|
local ____featuresInitialized = require("featuresInitialized")
|
|
20
20
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
21
21
|
local ____types = require("functions.types")
|
|
22
|
-
local
|
|
22
|
+
local asCardType = ____types.asCardType
|
|
23
23
|
local asCollectibleType = ____types.asCollectibleType
|
|
24
24
|
local asNumber = ____types.asNumber
|
|
25
25
|
local asPillEffect = ____types.asPillEffect
|
|
@@ -56,7 +56,7 @@ function ____exports.getNumModdedCollectibleTypes(self)
|
|
|
56
56
|
local lastCollectibleType = ____exports.getLastCollectibleType(nil)
|
|
57
57
|
return lastCollectibleType - LAST_VANILLA_COLLECTIBLE_TYPE
|
|
58
58
|
end
|
|
59
|
-
--- Will change depending on how many modded
|
|
59
|
+
--- Will change depending on how many modded trinkets there are.
|
|
60
60
|
--
|
|
61
61
|
-- Equal to `itemConfig.GetTrinkets().Size - 1`. (We subtract one to account for
|
|
62
62
|
-- `TrinketType.NULL`.)
|
|
@@ -75,11 +75,11 @@ end
|
|
|
75
75
|
--
|
|
76
76
|
-- This function can only be called if at least one callback has been executed. This is because not
|
|
77
77
|
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
78
|
-
function ____exports.
|
|
78
|
+
function ____exports.getLastCardType(self)
|
|
79
79
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
80
80
|
errorIfNoCallbacksFired(nil, "card")
|
|
81
|
-
local numCards = ____exports.
|
|
82
|
-
return
|
|
81
|
+
local numCards = ____exports.getNumCardTypes(nil)
|
|
82
|
+
return asCardType(nil, numCards)
|
|
83
83
|
end
|
|
84
84
|
--- Will change depending on how many modded cards there are.
|
|
85
85
|
--
|
|
@@ -87,7 +87,7 @@ end
|
|
|
87
87
|
--
|
|
88
88
|
-- This function can only be called if at least one callback has been executed. This is because not
|
|
89
89
|
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
90
|
-
function ____exports.
|
|
90
|
+
function ____exports.getNumCardTypes(self)
|
|
91
91
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
92
92
|
errorIfNoCallbacksFired(nil, "card")
|
|
93
93
|
return itemConfig:GetCards().Size - 1
|
|
@@ -195,7 +195,7 @@ function ____exports.getFirstModdedTrinketType(self)
|
|
|
195
195
|
end
|
|
196
196
|
return ____temp_1
|
|
197
197
|
end
|
|
198
|
-
--- Will change depending on how many modded
|
|
198
|
+
--- Will change depending on how many modded trinkets there are.
|
|
199
199
|
--
|
|
200
200
|
-- This is equal to the number of trinket types, since all trinket types are contiguous (unlike
|
|
201
201
|
-- collectibles).
|
|
@@ -245,27 +245,27 @@ end
|
|
|
245
245
|
--
|
|
246
246
|
-- This function can only be called if at least one callback has been executed. This is because not
|
|
247
247
|
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
248
|
-
function ____exports.
|
|
249
|
-
local
|
|
250
|
-
return irange(nil,
|
|
248
|
+
function ____exports.getAllCardTypes(self)
|
|
249
|
+
local lastCardType = ____exports.getLastCardType(nil)
|
|
250
|
+
return irange(nil, FIRST_CARD_TYPE, lastCardType)
|
|
251
251
|
end
|
|
252
252
|
--- Returns the first modded card sub-type, or undefined if there are no modded cards.
|
|
253
253
|
--
|
|
254
254
|
-- This function can only be called if at least one callback has been executed. This is because not
|
|
255
255
|
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
256
|
-
function ____exports.
|
|
256
|
+
function ____exports.getFirstModdedCardType(self)
|
|
257
257
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
258
258
|
errorIfNoCallbacksFired(nil, "card")
|
|
259
|
-
local
|
|
259
|
+
local firstModdedCardType = asCardType(
|
|
260
260
|
nil,
|
|
261
|
-
asNumber(nil,
|
|
261
|
+
asNumber(nil, LAST_VANILLA_CARD_TYPE) + 1
|
|
262
262
|
)
|
|
263
|
-
local itemConfigCard = itemConfig:GetCard(
|
|
263
|
+
local itemConfigCard = itemConfig:GetCard(firstModdedCardType)
|
|
264
264
|
local ____temp_2
|
|
265
265
|
if itemConfigCard == nil then
|
|
266
266
|
____temp_2 = nil
|
|
267
267
|
else
|
|
268
|
-
____temp_2 =
|
|
268
|
+
____temp_2 = firstModdedCardType
|
|
269
269
|
end
|
|
270
270
|
return ____temp_2
|
|
271
271
|
end
|
|
@@ -275,21 +275,21 @@ end
|
|
|
275
275
|
--
|
|
276
276
|
-- This function can only be called if at least one callback has been executed. This is because not
|
|
277
277
|
-- all cards will necessarily be present when a mod first loads (due to mod load order).
|
|
278
|
-
function ____exports.
|
|
279
|
-
local
|
|
280
|
-
if
|
|
278
|
+
function ____exports.getModdedCardTypes(self)
|
|
279
|
+
local firstModdedCardType = ____exports.getFirstModdedCardType(nil)
|
|
280
|
+
if firstModdedCardType == nil then
|
|
281
281
|
return {}
|
|
282
282
|
end
|
|
283
|
-
local
|
|
284
|
-
return irange(nil,
|
|
283
|
+
local lastCardType = ____exports.getLastCardType(nil)
|
|
284
|
+
return irange(nil, firstModdedCardType, lastCardType)
|
|
285
285
|
end
|
|
286
286
|
--- This function can only be called if at least one callback has been executed. This is because not
|
|
287
287
|
-- all trinkets will necessarily be present when a mod first loads (due to mod load order).
|
|
288
|
-
function ____exports.
|
|
288
|
+
function ____exports.getNumModdedCardTypes(self)
|
|
289
289
|
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
290
290
|
errorIfNoCallbacksFired(nil, "card")
|
|
291
|
-
local
|
|
292
|
-
return
|
|
291
|
+
local numCardTypes = ____exports.getNumCardTypes(nil)
|
|
292
|
+
return numCardTypes - NUM_VANILLA_CARD_TYPES
|
|
293
293
|
end
|
|
294
294
|
--- Helper function to get an array with every valid pill effect. This includes modded pill effects.
|
|
295
295
|
--
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerInventory.d.ts","sourceRoot":"","sources":["../../src/features/playerInventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"playerInventory.d.ts","sourceRoot":"","sources":["../../src/features/playerInventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,MAAM,8BAA8B,CAAC;AAkH5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,yBAAyB,UAAO,GAC/B,eAAe,EAAE,CAanB;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,YAAY,GACnB,eAAe,GAAG,SAAS,CAK7B"}
|
|
@@ -33,16 +33,14 @@ local saveDataManager = ____exports.saveDataManager
|
|
|
33
33
|
function newPlayerInventory(self, player)
|
|
34
34
|
local inventory = {}
|
|
35
35
|
for ____, collectibleType in ipairs(getCollectibleArray(nil)) do
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
end
|
|
36
|
+
local numCollectibles = player:GetCollectibleNum(collectibleType, true)
|
|
37
|
+
____repeat(
|
|
38
|
+
nil,
|
|
39
|
+
numCollectibles,
|
|
40
|
+
function()
|
|
41
|
+
inventory[#inventory + 1] = collectibleType
|
|
42
|
+
end
|
|
43
|
+
)
|
|
46
44
|
end
|
|
47
45
|
return inventory
|
|
48
46
|
end
|
|
@@ -4,7 +4,7 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local useCardSoulOfIsaac, postPickupUpdateCollectible, getMapIndex, v
|
|
6
6
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
7
|
-
local
|
|
7
|
+
local CardType = ____isaac_2Dtypescript_2Ddefinitions.CardType
|
|
8
8
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
9
9
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
10
10
|
local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
|
|
@@ -45,7 +45,7 @@ v = {room = {trackedCollectibles = __TS__New(Map)}}
|
|
|
45
45
|
-- @internal
|
|
46
46
|
function ____exports.preventCollectibleRotationInit(self, mod)
|
|
47
47
|
saveDataManager(nil, FEATURE_NAME, v)
|
|
48
|
-
mod:AddCallback(ModCallback.POST_USE_CARD, useCardSoulOfIsaac,
|
|
48
|
+
mod:AddCallback(ModCallback.POST_USE_CARD, useCardSoulOfIsaac, CardType.SOUL_ISAAC)
|
|
49
49
|
mod:AddCallback(ModCallback.POST_PICKUP_UPDATE, postPickupUpdateCollectible, PickupVariant.COLLECTIBLE)
|
|
50
50
|
end
|
|
51
51
|
--- Helper function to prevent a collectible from being affected by Tainted Isaac's rotation
|