isaacscript-common 8.6.0 → 8.7.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.
- package/dist/enums/ModCallbackCustom.d.ts +2 -2
- package/dist/features/playerInventory.d.ts.map +1 -1
- package/dist/features/playerInventory.lua +10 -8
- package/dist/functions/collectibles.d.ts +10 -1
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +17 -1
- package/dist/functions/trinkets.d.ts +14 -0
- package/dist/functions/trinkets.d.ts.map +1 -1
- package/dist/functions/trinkets.lua +26 -0
- package/dist/index.d.ts +29 -3
- package/package.json +1 -1
- package/src/enums/ModCallbackCustom.ts +2 -2
- package/src/features/playerInventory.ts +13 -4
- package/src/functions/collectibles.ts +25 -1
- package/src/functions/trinkets.ts +34 -0
|
@@ -892,7 +892,7 @@ export declare enum ModCallbackCustom {
|
|
|
892
892
|
POST_PLAYER_CHANGE_TYPE = 57,
|
|
893
893
|
/**
|
|
894
894
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is higher than
|
|
895
|
-
* what it was on the previous frame.
|
|
895
|
+
* what it was on the previous frame or when a new active collectible is acquired.
|
|
896
896
|
*
|
|
897
897
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
898
898
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -907,7 +907,7 @@ export declare enum ModCallbackCustom {
|
|
|
907
907
|
POST_PLAYER_COLLECTIBLE_ADDED = 58,
|
|
908
908
|
/**
|
|
909
909
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is lower than
|
|
910
|
-
* what it was on the previous frame.
|
|
910
|
+
* what it was on the previous frame or when an active collectible is no longer present.
|
|
911
911
|
*
|
|
912
912
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
913
913
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -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;AAsH5E;;;;;;;;;;;;;;;;;;;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,14 +33,16 @@ 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
|
-
|
|
36
|
+
if player:HasCollectible(collectibleType) then
|
|
37
|
+
local numCollectibles = player:GetCollectibleNum(collectibleType, true)
|
|
38
|
+
____repeat(
|
|
39
|
+
nil,
|
|
40
|
+
numCollectibles,
|
|
41
|
+
function()
|
|
42
|
+
inventory[#inventory + 1] = collectibleType
|
|
43
|
+
end
|
|
44
|
+
)
|
|
45
|
+
end
|
|
44
46
|
end
|
|
45
47
|
return inventory
|
|
46
48
|
end
|
|
@@ -19,8 +19,12 @@ export declare function getCollectibleDevilCoinPrice(collectibleType: Collectibl
|
|
|
19
19
|
*/
|
|
20
20
|
export declare function getCollectibleDevilHeartPrice(collectibleType: CollectibleType, player: EntityPlayer): PickupPrice;
|
|
21
21
|
/**
|
|
22
|
-
* Helper function to get the path to a collectible
|
|
22
|
+
* Helper function to get the path to a collectible PNG file. Returns the path to the question mark
|
|
23
23
|
* sprite (i.e. from Curse of the Blind) if the provided collectible type was not valid.
|
|
24
|
+
*
|
|
25
|
+
* Note that this does not return the file name, but the full path to the collectible's PNG file.
|
|
26
|
+
* The function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
27
|
+
* field.
|
|
24
28
|
*/
|
|
25
29
|
export declare function getCollectibleGfxFilename(collectibleType: CollectibleType): string;
|
|
26
30
|
/**
|
|
@@ -163,6 +167,11 @@ export declare function isPassiveCollectible(collectibleType: CollectibleType):
|
|
|
163
167
|
export declare function isSingleUseCollectible(collectibleType: CollectibleType): boolean;
|
|
164
168
|
export declare function isValidCollectibleType(collectibleType: CollectibleType): boolean;
|
|
165
169
|
export declare function isVanillaCollectibleType(collectibleType: CollectibleType): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
172
|
+
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
173
|
+
*/
|
|
174
|
+
export declare function newCollectibleSprite(collectibleType: CollectibleType): Sprite;
|
|
166
175
|
/**
|
|
167
176
|
* Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
|
|
168
177
|
* should remove an item.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,eAAe,EAEf,aAAa,EAEb,QAAQ,EACR,WAAW,EAGZ,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,eAAe,EAEf,aAAa,EAEb,QAAQ,EACR,WAAW,EAGZ,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,gBAAgB,EAAE,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CAuBtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAeN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,YAAY,EACzB,kBAAkB,EAAE,eAAe,GAClC,IAAI,CA2BN;AAED;;;GAGG;AACH,wBAAgB,qCAAqC,IAAI,IAAI,CAK5D"}
|
|
@@ -105,6 +105,7 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
105
105
|
true
|
|
106
106
|
)
|
|
107
107
|
end
|
|
108
|
+
local COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2"
|
|
108
109
|
COLLECTIBLE_SPRITE_LAYER = 1
|
|
109
110
|
COLLECTIBLE_SHADOW_LAYER = 4
|
|
110
111
|
local GLITCHED_ITEM_THRESHOLD = 4000000000
|
|
@@ -174,8 +175,12 @@ function ____exports.getCollectibleDevilHeartPrice(self, collectibleType, player
|
|
|
174
175
|
local twoHeartPrice = maxHearts == 2 and PickupPrice.ONE_HEART_AND_TWO_SOUL_HEARTS or PickupPrice.TWO_HEARTS
|
|
175
176
|
return itemConfigItem.DevilPrice == 2 and twoHeartPrice or PickupPrice.ONE_HEART
|
|
176
177
|
end
|
|
177
|
-
--- Helper function to get the path to a collectible
|
|
178
|
+
--- Helper function to get the path to a collectible PNG file. Returns the path to the question mark
|
|
178
179
|
-- sprite (i.e. from Curse of the Blind) if the provided collectible type was not valid.
|
|
180
|
+
--
|
|
181
|
+
-- Note that this does not return the file name, but the full path to the collectible's PNG file.
|
|
182
|
+
-- The function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
183
|
+
-- field.
|
|
179
184
|
function ____exports.getCollectibleGfxFilename(self, collectibleType)
|
|
180
185
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
181
186
|
if itemConfigItem == nil then
|
|
@@ -386,6 +391,17 @@ function ____exports.isValidCollectibleType(self, collectibleType)
|
|
|
386
391
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
387
392
|
return itemConfigItem ~= nil
|
|
388
393
|
end
|
|
394
|
+
--- Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
395
|
+
-- is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
396
|
+
function ____exports.newCollectibleSprite(self, collectibleType)
|
|
397
|
+
local sprite = Sprite()
|
|
398
|
+
sprite:Load(COLLECTIBLE_ANM2_PATH, false)
|
|
399
|
+
clearSprite(nil, sprite)
|
|
400
|
+
local gfxFileName = ____exports.getCollectibleGfxFilename(nil, collectibleType)
|
|
401
|
+
sprite:ReplaceSpritesheet(COLLECTIBLE_SPRITE_LAYER, gfxFileName)
|
|
402
|
+
sprite:LoadGraphics()
|
|
403
|
+
return sprite
|
|
404
|
+
end
|
|
389
405
|
--- Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
|
|
390
406
|
-- should remove an item.
|
|
391
407
|
--
|
|
@@ -26,6 +26,15 @@ export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefine
|
|
|
26
26
|
* trinket type was not valid.
|
|
27
27
|
*/
|
|
28
28
|
export declare function getTrinketDescription(trinketType: TrinketType): string;
|
|
29
|
+
/**
|
|
30
|
+
* Helper function to get the path to a trinket PNG file. Returns the path to the question mark
|
|
31
|
+
* sprite (i.e. from Curse of the Blind) if the provided trinket type was not valid.
|
|
32
|
+
*
|
|
33
|
+
* Note that this does not return the file name, but the full path to the trinket's PNG file. The
|
|
34
|
+
* function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
35
|
+
* field.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getTrinketGfxFilename(trinketType: TrinketType): string;
|
|
29
38
|
/**
|
|
30
39
|
* Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
|
|
31
40
|
* not valid.
|
|
@@ -51,6 +60,11 @@ export declare function hasOpenTrinketSlot(player: EntityPlayer): boolean;
|
|
|
51
60
|
export declare function isGoldenTrinketType(trinketType: TrinketType): boolean;
|
|
52
61
|
export declare function isModdedTrinketType(trinketType: TrinketType): boolean;
|
|
53
62
|
export declare function isVanillaTrinketType(trinketType: TrinketType): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
65
|
+
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
66
|
+
*/
|
|
67
|
+
export declare function newTrinketSprite(trinketType: TrinketType): Sprite;
|
|
54
68
|
/**
|
|
55
69
|
* Helper function to change the sprite of a trinket entity.
|
|
56
70
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACZ,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACZ,MAAM,8BAA8B,CAAC;AA+BtC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAE1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,GAAG,SAAS,CAkBxE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CActE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAOtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAc/D;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,IAAI,WAAW,EAAE,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAOhE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CASjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAeN"}
|
|
@@ -5,6 +5,8 @@ local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
|
5
5
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
6
6
|
local ____cachedClasses = require("core.cachedClasses")
|
|
7
7
|
local itemConfig = ____cachedClasses.itemConfig
|
|
8
|
+
local ____constants = require("core.constants")
|
|
9
|
+
local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
|
|
8
10
|
local ____constantsFirstLast = require("core.constantsFirstLast")
|
|
9
11
|
local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
|
|
10
12
|
local LAST_VANILLA_TRINKET_TYPE = ____constantsFirstLast.LAST_VANILLA_TRINKET_TYPE
|
|
@@ -35,6 +37,7 @@ end
|
|
|
35
37
|
--
|
|
36
38
|
-- 1 << 15
|
|
37
39
|
local GOLDEN_TRINKET_ADJUSTMENT = 32768
|
|
40
|
+
local TRINKET_ANM2_PATH = "gfx/005.350_trinket.anm2"
|
|
38
41
|
local TRINKET_SPRITE_LAYER = 0
|
|
39
42
|
--- Helper function to get the corresponding golden trinket type from a normal trinket type.
|
|
40
43
|
--
|
|
@@ -83,6 +86,19 @@ function ____exports.getTrinketDescription(self, trinketType)
|
|
|
83
86
|
end
|
|
84
87
|
return DEFAULT_TRINKET_DESCRIPTION
|
|
85
88
|
end
|
|
89
|
+
--- Helper function to get the path to a trinket PNG file. Returns the path to the question mark
|
|
90
|
+
-- sprite (i.e. from Curse of the Blind) if the provided trinket type was not valid.
|
|
91
|
+
--
|
|
92
|
+
-- Note that this does not return the file name, but the full path to the trinket's PNG file. The
|
|
93
|
+
-- function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
94
|
+
-- field.
|
|
95
|
+
function ____exports.getTrinketGfxFilename(self, trinketType)
|
|
96
|
+
local itemConfigItem = itemConfig:GetTrinket(trinketType)
|
|
97
|
+
if itemConfigItem == nil then
|
|
98
|
+
return BLIND_ITEM_PNG_PATH
|
|
99
|
+
end
|
|
100
|
+
return itemConfigItem.GfxFileName
|
|
101
|
+
end
|
|
86
102
|
--- Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
|
|
87
103
|
-- not valid.
|
|
88
104
|
--
|
|
@@ -125,6 +141,16 @@ end
|
|
|
125
141
|
function ____exports.isModdedTrinketType(self, trinketType)
|
|
126
142
|
return not ____exports.isVanillaTrinketType(nil, trinketType)
|
|
127
143
|
end
|
|
144
|
+
--- Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
145
|
+
-- is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
146
|
+
function ____exports.newTrinketSprite(self, trinketType)
|
|
147
|
+
local sprite = Sprite()
|
|
148
|
+
sprite:Load(TRINKET_ANM2_PATH, false)
|
|
149
|
+
local gfxFileName = ____exports.getTrinketGfxFilename(nil, trinketType)
|
|
150
|
+
sprite:ReplaceSpritesheet(TRINKET_SPRITE_LAYER, gfxFileName)
|
|
151
|
+
sprite:LoadGraphics()
|
|
152
|
+
return sprite
|
|
153
|
+
end
|
|
128
154
|
--- Helper function to change the sprite of a trinket entity.
|
|
129
155
|
--
|
|
130
156
|
-- For more information about removing the trinket sprite, see the documentation for the
|
package/dist/index.d.ts
CHANGED
|
@@ -2595,8 +2595,12 @@ export declare function getCollectibleDevilCoinPrice(collectibleType: Collectibl
|
|
|
2595
2595
|
export declare function getCollectibleDevilHeartPrice(collectibleType: CollectibleType, player: EntityPlayer): PickupPrice;
|
|
2596
2596
|
|
|
2597
2597
|
/**
|
|
2598
|
-
* Helper function to get the path to a collectible
|
|
2598
|
+
* Helper function to get the path to a collectible PNG file. Returns the path to the question mark
|
|
2599
2599
|
* sprite (i.e. from Curse of the Blind) if the provided collectible type was not valid.
|
|
2600
|
+
*
|
|
2601
|
+
* Note that this does not return the file name, but the full path to the collectible's PNG file.
|
|
2602
|
+
* The function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
2603
|
+
* field.
|
|
2600
2604
|
*/
|
|
2601
2605
|
export declare function getCollectibleGfxFilename(collectibleType: CollectibleType): string;
|
|
2602
2606
|
|
|
@@ -5028,6 +5032,16 @@ export declare function getTrinketArray(): readonly TrinketType[];
|
|
|
5028
5032
|
*/
|
|
5029
5033
|
export declare function getTrinketDescription(trinketType: TrinketType): string;
|
|
5030
5034
|
|
|
5035
|
+
/**
|
|
5036
|
+
* Helper function to get the path to a trinket PNG file. Returns the path to the question mark
|
|
5037
|
+
* sprite (i.e. from Curse of the Blind) if the provided trinket type was not valid.
|
|
5038
|
+
*
|
|
5039
|
+
* Note that this does not return the file name, but the full path to the trinket's PNG file. The
|
|
5040
|
+
* function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
5041
|
+
* field.
|
|
5042
|
+
*/
|
|
5043
|
+
export declare function getTrinketGfxFilename(trinketType: TrinketType): string;
|
|
5044
|
+
|
|
5031
5045
|
/**
|
|
5032
5046
|
* Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
|
|
5033
5047
|
* not valid.
|
|
@@ -7560,7 +7574,7 @@ export declare enum ModCallbackCustom {
|
|
|
7560
7574
|
POST_PLAYER_CHANGE_TYPE = 57,
|
|
7561
7575
|
/**
|
|
7562
7576
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is higher than
|
|
7563
|
-
* what it was on the previous frame.
|
|
7577
|
+
* what it was on the previous frame or when a new active collectible is acquired.
|
|
7564
7578
|
*
|
|
7565
7579
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7566
7580
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -7575,7 +7589,7 @@ export declare enum ModCallbackCustom {
|
|
|
7575
7589
|
POST_PLAYER_COLLECTIBLE_ADDED = 58,
|
|
7576
7590
|
/**
|
|
7577
7591
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is lower than
|
|
7578
|
-
* what it was on the previous frame.
|
|
7592
|
+
* what it was on the previous frame or when an active collectible is no longer present.
|
|
7579
7593
|
*
|
|
7580
7594
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
7581
7595
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -8131,6 +8145,12 @@ export declare const NEW_RUN_PLAYER_STARTING_POSITION: Vector;
|
|
|
8131
8145
|
*/
|
|
8132
8146
|
export declare function newChargeBarSprites(maxCharges: int): ChargeBarSprites;
|
|
8133
8147
|
|
|
8148
|
+
/**
|
|
8149
|
+
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
8150
|
+
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
8151
|
+
*/
|
|
8152
|
+
export declare function newCollectibleSprite(collectibleType: CollectibleType): Sprite;
|
|
8153
|
+
|
|
8134
8154
|
export declare function newPickingUpItem(): PickingUpItem;
|
|
8135
8155
|
|
|
8136
8156
|
/** Returns a `PlayerHealth` object with all zeros. */
|
|
@@ -8157,6 +8177,12 @@ export declare function newRNG(seed?: Seed): RNG;
|
|
|
8157
8177
|
*/
|
|
8158
8178
|
export declare function newRoom(): int | undefined;
|
|
8159
8179
|
|
|
8180
|
+
/**
|
|
8181
|
+
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
8182
|
+
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
8183
|
+
*/
|
|
8184
|
+
export declare function newTrinketSprite(trinketType: TrinketType): Sprite;
|
|
8185
|
+
|
|
8160
8186
|
/**
|
|
8161
8187
|
* Initializes a new TypeScriptToLua class in the situation where you do not know what kind of class
|
|
8162
8188
|
* it is. This function requires that you provide an instantiated class of the same type, as it will
|
package/package.json
CHANGED
|
@@ -959,7 +959,7 @@ export enum ModCallbackCustom {
|
|
|
959
959
|
|
|
960
960
|
/**
|
|
961
961
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is higher than
|
|
962
|
-
* what it was on the previous frame.
|
|
962
|
+
* what it was on the previous frame or when a new active collectible is acquired.
|
|
963
963
|
*
|
|
964
964
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
965
965
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -975,7 +975,7 @@ export enum ModCallbackCustom {
|
|
|
975
975
|
|
|
976
976
|
/**
|
|
977
977
|
* Fires from the `POST_PEFFECT_UPDATE` callback when a player's collectible count is lower than
|
|
978
|
-
* what it was on the previous frame.
|
|
978
|
+
* what it was on the previous frame or when an active collectible is no longer present.
|
|
979
979
|
*
|
|
980
980
|
* When registering the callback, takes an optional second argument that will make the callback
|
|
981
981
|
* only fire if the collectible matches the `CollectibleType` provided.
|
|
@@ -35,10 +35,16 @@ function newPlayerInventory(player: EntityPlayer) {
|
|
|
35
35
|
const inventory: CollectibleType[] = [];
|
|
36
36
|
|
|
37
37
|
for (const collectibleType of getCollectibleArray()) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
// We have to use the `EntityPlayer.HasCollectible` method in addition to the
|
|
39
|
+
// `EntityPlayer.GetCollectibleNum` method in order to mitigate situations like Lilith's Incubus
|
|
40
|
+
// counting as a collectible. (The former method will return false for her innate Incubus, but
|
|
41
|
+
// the latter method will return 1.)
|
|
42
|
+
if (player.HasCollectible(collectibleType)) {
|
|
43
|
+
const numCollectibles = player.GetCollectibleNum(collectibleType, true);
|
|
44
|
+
repeat(numCollectibles, () => {
|
|
45
|
+
inventory.push(collectibleType);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
return inventory;
|
|
@@ -72,6 +78,9 @@ function useItemD4(
|
|
|
72
78
|
_rng: RNG,
|
|
73
79
|
player: EntityPlayer,
|
|
74
80
|
): boolean | undefined {
|
|
81
|
+
// This function is also triggered when the player uses D100, D Infinity, a 1-pip dice room, or a
|
|
82
|
+
// 6-pip dice room. (Genesis should be automatically handled by the
|
|
83
|
+
// `POST_PLAYER_COLLECTIBLE_REMOVED` callback.)
|
|
75
84
|
resetInventory(player);
|
|
76
85
|
|
|
77
86
|
return undefined;
|
|
@@ -31,6 +31,7 @@ import { getRoomListIndex } from "./roomData";
|
|
|
31
31
|
import { clearSprite, spriteEquals } from "./sprites";
|
|
32
32
|
import { irange } from "./utils";
|
|
33
33
|
|
|
34
|
+
const COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2";
|
|
34
35
|
const COLLECTIBLE_SPRITE_LAYER = 1;
|
|
35
36
|
const COLLECTIBLE_SHADOW_LAYER = 4;
|
|
36
37
|
|
|
@@ -159,8 +160,12 @@ export function getCollectibleDevilHeartPrice(
|
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
/**
|
|
162
|
-
* Helper function to get the path to a collectible
|
|
163
|
+
* Helper function to get the path to a collectible PNG file. Returns the path to the question mark
|
|
163
164
|
* sprite (i.e. from Curse of the Blind) if the provided collectible type was not valid.
|
|
165
|
+
*
|
|
166
|
+
* Note that this does not return the file name, but the full path to the collectible's PNG file.
|
|
167
|
+
* The function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
168
|
+
* field.
|
|
164
169
|
*/
|
|
165
170
|
export function getCollectibleGfxFilename(
|
|
166
171
|
collectibleType: CollectibleType,
|
|
@@ -469,6 +474,25 @@ export function isVanillaCollectibleType(
|
|
|
469
474
|
return collectibleType <= LAST_VANILLA_COLLECTIBLE_TYPE;
|
|
470
475
|
}
|
|
471
476
|
|
|
477
|
+
/**
|
|
478
|
+
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
479
|
+
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
480
|
+
*/
|
|
481
|
+
export function newCollectibleSprite(collectibleType: CollectibleType): Sprite {
|
|
482
|
+
const sprite = Sprite();
|
|
483
|
+
sprite.Load(COLLECTIBLE_ANM2_PATH, false);
|
|
484
|
+
|
|
485
|
+
// We want to clear the pedestal layers so that the returned sprite only has the collectible
|
|
486
|
+
// image.
|
|
487
|
+
clearSprite(sprite);
|
|
488
|
+
|
|
489
|
+
const gfxFileName = getCollectibleGfxFilename(collectibleType);
|
|
490
|
+
sprite.ReplaceSpritesheet(COLLECTIBLE_SPRITE_LAYER, gfxFileName);
|
|
491
|
+
sprite.LoadGraphics();
|
|
492
|
+
|
|
493
|
+
return sprite;
|
|
494
|
+
}
|
|
495
|
+
|
|
472
496
|
/**
|
|
473
497
|
* Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
|
|
474
498
|
* should remove an item.
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
TrinketType,
|
|
5
5
|
} from "isaac-typescript-definitions";
|
|
6
6
|
import { itemConfig } from "../core/cachedClasses";
|
|
7
|
+
import { BLIND_ITEM_PNG_PATH } from "../core/constants";
|
|
7
8
|
import {
|
|
8
9
|
FIRST_TRINKET_TYPE,
|
|
9
10
|
LAST_VANILLA_TRINKET_TYPE,
|
|
@@ -29,6 +30,7 @@ import { irange } from "./utils";
|
|
|
29
30
|
*/
|
|
30
31
|
const GOLDEN_TRINKET_ADJUSTMENT = 32768;
|
|
31
32
|
|
|
33
|
+
const TRINKET_ANM2_PATH = "gfx/005.350_trinket.anm2";
|
|
32
34
|
const TRINKET_SPRITE_LAYER = 0;
|
|
33
35
|
|
|
34
36
|
/**
|
|
@@ -95,6 +97,23 @@ export function getTrinketDescription(trinketType: TrinketType): string {
|
|
|
95
97
|
return DEFAULT_TRINKET_DESCRIPTION;
|
|
96
98
|
}
|
|
97
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Helper function to get the path to a trinket PNG file. Returns the path to the question mark
|
|
102
|
+
* sprite (i.e. from Curse of the Blind) if the provided trinket type was not valid.
|
|
103
|
+
*
|
|
104
|
+
* Note that this does not return the file name, but the full path to the trinket's PNG file. The
|
|
105
|
+
* function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
106
|
+
* field.
|
|
107
|
+
*/
|
|
108
|
+
export function getTrinketGfxFilename(trinketType: TrinketType): string {
|
|
109
|
+
const itemConfigItem = itemConfig.GetTrinket(trinketType);
|
|
110
|
+
if (itemConfigItem === undefined) {
|
|
111
|
+
return BLIND_ITEM_PNG_PATH;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return itemConfigItem.GfxFileName;
|
|
115
|
+
}
|
|
116
|
+
|
|
98
117
|
/**
|
|
99
118
|
* Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
|
|
100
119
|
* not valid.
|
|
@@ -155,6 +174,21 @@ export function isVanillaTrinketType(trinketType: TrinketType): boolean {
|
|
|
155
174
|
return trinketType <= LAST_VANILLA_TRINKET_TYPE;
|
|
156
175
|
}
|
|
157
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
179
|
+
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
180
|
+
*/
|
|
181
|
+
export function newTrinketSprite(trinketType: TrinketType): Sprite {
|
|
182
|
+
const sprite = Sprite();
|
|
183
|
+
sprite.Load(TRINKET_ANM2_PATH, false);
|
|
184
|
+
|
|
185
|
+
const gfxFileName = getTrinketGfxFilename(trinketType);
|
|
186
|
+
sprite.ReplaceSpritesheet(TRINKET_SPRITE_LAYER, gfxFileName);
|
|
187
|
+
sprite.LoadGraphics();
|
|
188
|
+
|
|
189
|
+
return sprite;
|
|
190
|
+
}
|
|
191
|
+
|
|
158
192
|
/**
|
|
159
193
|
* Helper function to change the sprite of a trinket entity.
|
|
160
194
|
*
|