isaacscript-common 51.9.2 → 51.11.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/index.rollup.d.ts +39 -2
- package/dist/isaacscript-common.lua +172 -91
- package/dist/src/classes/features/other/ModdedElementSets.d.ts +25 -2
- package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
- package/dist/src/classes/features/other/ModdedElementSets.lua +49 -6
- package/dist/src/core/constants.d.ts +5 -0
- package/dist/src/core/constants.d.ts.map +1 -1
- package/dist/src/core/constants.lua +9 -0
- package/dist/src/functions/collectibles.d.ts +7 -0
- package/dist/src/functions/collectibles.d.ts.map +1 -1
- package/dist/src/functions/collectibles.lua +57 -20
- package/package.json +2 -2
- package/src/classes/features/other/ModdedElementSets.ts +102 -9
- package/src/core/constants.ts +7 -0
- package/src/functions/bitwise.ts +1 -1
- package/src/functions/collectibles.ts +51 -6
package/dist/index.rollup.d.ts
CHANGED
|
@@ -7781,6 +7781,14 @@ export declare function getUnusedDoorSlots(): DoorSlot[];
|
|
|
7781
7781
|
*/
|
|
7782
7782
|
export declare function getUsableActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): ActiveSlot[];
|
|
7783
7783
|
|
|
7784
|
+
/**
|
|
7785
|
+
* Returns a set containing every vanilla collectible type with the given quality.
|
|
7786
|
+
*
|
|
7787
|
+
* Note that this function will only return vanilla collectible types. To handle modded collectible
|
|
7788
|
+
* types, use the `getCollectibleTypesOfQuality` helper function instead.
|
|
7789
|
+
*/
|
|
7790
|
+
export declare function getVanillaCollectibleTypesOfQuality(quality: Quality): ReadonlySet<CollectibleType>;
|
|
7791
|
+
|
|
7784
7792
|
/**
|
|
7785
7793
|
* Helper function to get the set of grid indexes that represent where the walls are supposed to be
|
|
7786
7794
|
* in a given room shape.
|
|
@@ -13287,6 +13295,7 @@ declare class ModdedElementSets extends Feature {
|
|
|
13287
13295
|
private readonly tagToCollectibleTypesMap;
|
|
13288
13296
|
private readonly edenActiveCollectibleTypesSet;
|
|
13289
13297
|
private readonly edenPassiveCollectibleTypesSet;
|
|
13298
|
+
private readonly qualityToCollectibleTypesMap;
|
|
13290
13299
|
private readonly itemConfigCardTypeToCardTypeMap;
|
|
13291
13300
|
/**
|
|
13292
13301
|
* The set of card types that are not:
|
|
@@ -13307,6 +13316,7 @@ declare class ModdedElementSets extends Feature {
|
|
|
13307
13316
|
private lazyInitFlyingCollectibleTypesSet;
|
|
13308
13317
|
private lazyInitFlyingTrinketTypesSet;
|
|
13309
13318
|
private lazyInitEdenCollectibleTypesSet;
|
|
13319
|
+
private lazyInitQualityToCollectibleTypesMap;
|
|
13310
13320
|
private lazyInitCardTypes;
|
|
13311
13321
|
/**
|
|
13312
13322
|
* Returns an array containing every valid collectible type in the game, including modded
|
|
@@ -13640,7 +13650,7 @@ declare class ModdedElementSets extends Feature {
|
|
|
13640
13650
|
*/
|
|
13641
13651
|
getCollectibleTypesWithTag(itemConfigTag: ItemConfigTag): ReadonlySet<CollectibleType>;
|
|
13642
13652
|
/**
|
|
13643
|
-
* Returns
|
|
13653
|
+
* Returns an array of collectible types that a player has with a particular tag.
|
|
13644
13654
|
*
|
|
13645
13655
|
* This function can only be called if at least one callback has been executed. This is because
|
|
13646
13656
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
@@ -13667,7 +13677,8 @@ declare class ModdedElementSets extends Feature {
|
|
|
13667
13677
|
*/
|
|
13668
13678
|
getCollectibleTypesForTransformation(playerForm: PlayerForm): ReadonlySet<CollectibleType>;
|
|
13669
13679
|
/**
|
|
13670
|
-
* Returns
|
|
13680
|
+
* Returns an array of collectible types that a player has that count towards a particular
|
|
13681
|
+
* transformation.
|
|
13671
13682
|
*
|
|
13672
13683
|
* This function can only be called if at least one callback has been executed. This is because
|
|
13673
13684
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
@@ -13731,6 +13742,26 @@ declare class ModdedElementSets extends Feature {
|
|
|
13731
13742
|
* @param exceptions Optional. An array of runes to not select.
|
|
13732
13743
|
*/
|
|
13733
13744
|
getRandomEdenPassiveCollectibleType(seedOrRNG?: Seed | RNG, exceptions?: CollectibleType[] | readonly CollectibleType[]): CollectibleType;
|
|
13745
|
+
/**
|
|
13746
|
+
* Returns a set containing every collectible type with the given quality.
|
|
13747
|
+
*
|
|
13748
|
+
* This function can only be called if at least one callback has been executed. This is because
|
|
13749
|
+
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
13750
|
+
* order).
|
|
13751
|
+
*
|
|
13752
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
13753
|
+
*/
|
|
13754
|
+
getCollectibleTypesOfQuality(quality: Quality): ReadonlySet<CollectibleType>;
|
|
13755
|
+
/**
|
|
13756
|
+
* Returns an array of collectible types that a player has that are of a particular quality.
|
|
13757
|
+
*
|
|
13758
|
+
* This function can only be called if at least one callback has been executed. This is because
|
|
13759
|
+
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
13760
|
+
* order).
|
|
13761
|
+
*
|
|
13762
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
13763
|
+
*/
|
|
13764
|
+
getPlayerCollectiblesOfQuality(player: EntityPlayer, quality: Quality): CollectibleType[];
|
|
13734
13765
|
/**
|
|
13735
13766
|
* Helper function to get a set of card types matching the `ItemConfigCardType`.
|
|
13736
13767
|
*
|
|
@@ -15081,6 +15112,12 @@ export declare function PriorityCallbackCustom<T extends ModCallbackCustom>(modC
|
|
|
15081
15112
|
/** Helper type to extract only the public interface of a class. */
|
|
15082
15113
|
export declare type PublicInterface<T> = Pick<T, keyof T>;
|
|
15083
15114
|
|
|
15115
|
+
/**
|
|
15116
|
+
* An array representing every valid collectible type quality. Specifically, this is `[0, 1, 2, 3,
|
|
15117
|
+
* 4]`.
|
|
15118
|
+
*/
|
|
15119
|
+
export declare const QUALITIES: readonly Quality[];
|
|
15120
|
+
|
|
15084
15121
|
declare interface QueueElement {
|
|
15085
15122
|
playerIndex: PlayerIndex;
|
|
15086
15123
|
renderOffset: Vector;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 51.
|
|
3
|
+
isaacscript-common 51.11.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -18089,6 +18089,13 @@ ____exports.NUM_DIMENSIONS = getEnumLength(nil, Dimension) - 1
|
|
|
18089
18089
|
____exports.DIMENSIONS = eRange(nil, ____exports.NUM_DIMENSIONS)
|
|
18090
18090
|
____exports.NUM_PILL_COLORS_IN_POOL = NUM_NORMAL_PILL_COLORS
|
|
18091
18091
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
18092
|
+
____exports.QUALITIES = {
|
|
18093
|
+
0,
|
|
18094
|
+
1,
|
|
18095
|
+
2,
|
|
18096
|
+
3,
|
|
18097
|
+
4
|
|
18098
|
+
}
|
|
18092
18099
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
18093
18100
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
18094
18101
|
____exports.RESOLUTION_FULL_SCREEN = Vector(480, 270)
|
|
@@ -23047,6 +23054,73 @@ function PostHolyMantleRemoved.prototype.____constructor(self)
|
|
|
23047
23054
|
end
|
|
23048
23055
|
self.customCallbacksUsed = {{ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED, self.postPEffectUpdateReordered}}
|
|
23049
23056
|
end
|
|
23057
|
+
return ____exports
|
|
23058
|
+
end,
|
|
23059
|
+
["src.core.constantsVanilla"] = function(...)
|
|
23060
|
+
local ____lualib = require("lualib_bundle")
|
|
23061
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
23062
|
+
local __TS__New = ____lualib.__TS__New
|
|
23063
|
+
local ____exports = {}
|
|
23064
|
+
local ____types = require("src.functions.types")
|
|
23065
|
+
local asCardType = ____types.asCardType
|
|
23066
|
+
local asCollectibleType = ____types.asCollectibleType
|
|
23067
|
+
local asPillEffect = ____types.asPillEffect
|
|
23068
|
+
local asTrinketType = ____types.asTrinketType
|
|
23069
|
+
local ____utils = require("src.functions.utils")
|
|
23070
|
+
local iRange = ____utils.iRange
|
|
23071
|
+
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
23072
|
+
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
23073
|
+
local ____cachedClasses = require("src.core.cachedClasses")
|
|
23074
|
+
local itemConfig = ____cachedClasses.itemConfig
|
|
23075
|
+
local ____constantsFirstLast = require("src.core.constantsFirstLast")
|
|
23076
|
+
local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
|
|
23077
|
+
local FIRST_COLLECTIBLE_TYPE = ____constantsFirstLast.FIRST_COLLECTIBLE_TYPE
|
|
23078
|
+
local FIRST_PILL_EFFECT = ____constantsFirstLast.FIRST_PILL_EFFECT
|
|
23079
|
+
local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
|
|
23080
|
+
local LAST_VANILLA_CARD_TYPE = ____constantsFirstLast.LAST_VANILLA_CARD_TYPE
|
|
23081
|
+
local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsFirstLast.LAST_VANILLA_COLLECTIBLE_TYPE
|
|
23082
|
+
local LAST_VANILLA_PILL_EFFECT = ____constantsFirstLast.LAST_VANILLA_PILL_EFFECT
|
|
23083
|
+
local LAST_VANILLA_TRINKET_TYPE = ____constantsFirstLast.LAST_VANILLA_TRINKET_TYPE
|
|
23084
|
+
____exports.VANILLA_COLLECTIBLE_TYPE_RANGE = iRange(nil, FIRST_COLLECTIBLE_TYPE, LAST_VANILLA_COLLECTIBLE_TYPE)
|
|
23085
|
+
____exports.VANILLA_COLLECTIBLE_TYPES = __TS__ArrayFilter(
|
|
23086
|
+
____exports.VANILLA_COLLECTIBLE_TYPE_RANGE,
|
|
23087
|
+
function(____, potentialCollectibleType)
|
|
23088
|
+
local collectibleType = asCollectibleType(nil, potentialCollectibleType)
|
|
23089
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
23090
|
+
return itemConfigItem ~= nil
|
|
23091
|
+
end
|
|
23092
|
+
)
|
|
23093
|
+
____exports.VANILLA_COLLECTIBLE_TYPES_SET = __TS__New(ReadonlySet, ____exports.VANILLA_COLLECTIBLE_TYPES)
|
|
23094
|
+
____exports.VANILLA_TRINKET_TYPE_RANGE = iRange(nil, FIRST_TRINKET_TYPE, LAST_VANILLA_TRINKET_TYPE)
|
|
23095
|
+
____exports.VANILLA_TRINKET_TYPES = __TS__ArrayFilter(
|
|
23096
|
+
____exports.VANILLA_TRINKET_TYPE_RANGE,
|
|
23097
|
+
function(____, potentialTrinketType)
|
|
23098
|
+
local trinketType = asTrinketType(nil, potentialTrinketType)
|
|
23099
|
+
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
23100
|
+
return itemConfigTrinket ~= nil
|
|
23101
|
+
end
|
|
23102
|
+
)
|
|
23103
|
+
____exports.VANILLA_TRINKET_TYPES_SET = __TS__New(ReadonlySet, ____exports.VANILLA_TRINKET_TYPES)
|
|
23104
|
+
____exports.VANILLA_CARD_TYPE_RANGE = iRange(nil, FIRST_CARD_TYPE, LAST_VANILLA_CARD_TYPE)
|
|
23105
|
+
____exports.VANILLA_CARD_TYPES = __TS__ArrayFilter(
|
|
23106
|
+
____exports.VANILLA_CARD_TYPE_RANGE,
|
|
23107
|
+
function(____, potentialCardType)
|
|
23108
|
+
local cardType = asCardType(nil, potentialCardType)
|
|
23109
|
+
local itemConfigCard = itemConfig:GetCard(cardType)
|
|
23110
|
+
return itemConfigCard ~= nil
|
|
23111
|
+
end
|
|
23112
|
+
)
|
|
23113
|
+
____exports.VANILLA_CARD_TYPES_SET = __TS__New(ReadonlySet, ____exports.VANILLA_CARD_TYPES)
|
|
23114
|
+
____exports.VANILLA_PILL_EFFECT_RANGE = iRange(nil, FIRST_PILL_EFFECT, LAST_VANILLA_PILL_EFFECT)
|
|
23115
|
+
____exports.VANILLA_PILL_EFFECTS = __TS__ArrayFilter(
|
|
23116
|
+
____exports.VANILLA_PILL_EFFECT_RANGE,
|
|
23117
|
+
function(____, potentialPillEffect)
|
|
23118
|
+
local pillEffect = asPillEffect(nil, potentialPillEffect)
|
|
23119
|
+
local itemConfigPillEffect = itemConfig:GetPillEffect(pillEffect)
|
|
23120
|
+
return itemConfigPillEffect ~= nil
|
|
23121
|
+
end
|
|
23122
|
+
)
|
|
23123
|
+
____exports.VANILLA_PILL_EFFECTS_SET = __TS__New(ReadonlySet, ____exports.VANILLA_PILL_EFFECTS)
|
|
23050
23124
|
return ____exports
|
|
23051
23125
|
end,
|
|
23052
23126
|
["src.types.ReadonlyMap"] = function(...)
|
|
@@ -24579,8 +24653,12 @@ end
|
|
|
24579
24653
|
return ____exports
|
|
24580
24654
|
end,
|
|
24581
24655
|
["src.functions.collectibles"] = function(...)
|
|
24656
|
+
local ____lualib = require("lualib_bundle")
|
|
24657
|
+
local Map = ____lualib.Map
|
|
24658
|
+
local __TS__New = ____lualib.__TS__New
|
|
24659
|
+
local Set = ____lualib.Set
|
|
24582
24660
|
local ____exports = {}
|
|
24583
|
-
local
|
|
24661
|
+
local getCollectibleTypeFromArg
|
|
24584
24662
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
24585
24663
|
local CollectibleSpriteLayer = ____isaac_2Dtypescript_2Ddefinitions.CollectibleSpriteLayer
|
|
24586
24664
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
@@ -24597,8 +24675,11 @@ local itemConfig = ____cachedClasses.itemConfig
|
|
|
24597
24675
|
local ____constants = require("src.core.constants")
|
|
24598
24676
|
local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
|
|
24599
24677
|
local DEFAULT_ITEM_POOL_TYPE = ____constants.DEFAULT_ITEM_POOL_TYPE
|
|
24678
|
+
local QUALITIES = ____constants.QUALITIES
|
|
24600
24679
|
local ____constantsFirstLast = require("src.core.constantsFirstLast")
|
|
24601
24680
|
local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsFirstLast.LAST_VANILLA_COLLECTIBLE_TYPE
|
|
24681
|
+
local ____constantsVanilla = require("src.core.constantsVanilla")
|
|
24682
|
+
local VANILLA_COLLECTIBLE_TYPES = ____constantsVanilla.VANILLA_COLLECTIBLE_TYPES
|
|
24602
24683
|
local ____collectibleDescriptionMap = require("src.maps.collectibleDescriptionMap")
|
|
24603
24684
|
local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
|
|
24604
24685
|
local DEFAULT_COLLECTIBLE_DESCRIPTION = ____collectibleDescriptionMap.DEFAULT_COLLECTIBLE_DESCRIPTION
|
|
@@ -24618,13 +24699,8 @@ local clearSprite = ____sprites.clearSprite
|
|
|
24618
24699
|
local spriteEquals = ____sprites.spriteEquals
|
|
24619
24700
|
local ____types = require("src.functions.types")
|
|
24620
24701
|
local isInteger = ____types.isInteger
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
sprite:Load("gfx/005.100_collectible.anm2", false)
|
|
24624
|
-
sprite:ReplaceSpritesheet(1, "gfx/items/collectibles/questionmark.png")
|
|
24625
|
-
sprite:LoadGraphics()
|
|
24626
|
-
return sprite
|
|
24627
|
-
end
|
|
24702
|
+
local ____utils = require("src.functions.utils")
|
|
24703
|
+
local assertDefined = ____utils.assertDefined
|
|
24628
24704
|
function ____exports.clearCollectibleSprite(self, collectible)
|
|
24629
24705
|
if not isCollectible(nil, collectible) then
|
|
24630
24706
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -24632,6 +24708,14 @@ function ____exports.clearCollectibleSprite(self, collectible)
|
|
|
24632
24708
|
end
|
|
24633
24709
|
____exports.setCollectibleSprite(nil, collectible, nil)
|
|
24634
24710
|
end
|
|
24711
|
+
function ____exports.getCollectibleQuality(self, collectibleOrCollectibleType)
|
|
24712
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleQuality")
|
|
24713
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
24714
|
+
if itemConfigItem == nil then
|
|
24715
|
+
return 0
|
|
24716
|
+
end
|
|
24717
|
+
return itemConfigItem.Quality
|
|
24718
|
+
end
|
|
24635
24719
|
function ____exports.isVanillaCollectibleType(self, collectibleType)
|
|
24636
24720
|
return collectibleType <= LAST_VANILLA_COLLECTIBLE_TYPE
|
|
24637
24721
|
end
|
|
@@ -24688,7 +24772,27 @@ end
|
|
|
24688
24772
|
local COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2"
|
|
24689
24773
|
local DEFAULT_COLLECTIBLE_PRICE = 15
|
|
24690
24774
|
local GLITCHED_ITEM_THRESHOLD = 4000000000
|
|
24691
|
-
local
|
|
24775
|
+
local QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP = (function()
|
|
24776
|
+
local qualityToCollectibleTypesMap = __TS__New(Map)
|
|
24777
|
+
for ____, quality in ipairs(QUALITIES) do
|
|
24778
|
+
local collectibleTypesSet = __TS__New(Set)
|
|
24779
|
+
for ____, collectibleType in ipairs(VANILLA_COLLECTIBLE_TYPES) do
|
|
24780
|
+
local collectibleTypeQuality = ____exports.getCollectibleQuality(nil, collectibleType)
|
|
24781
|
+
if collectibleTypeQuality == quality then
|
|
24782
|
+
collectibleTypesSet:add(collectibleType)
|
|
24783
|
+
end
|
|
24784
|
+
end
|
|
24785
|
+
qualityToCollectibleTypesMap:set(quality, collectibleTypesSet)
|
|
24786
|
+
end
|
|
24787
|
+
return qualityToCollectibleTypesMap
|
|
24788
|
+
end)(nil)
|
|
24789
|
+
local questionMarkSprite = (function()
|
|
24790
|
+
local sprite = Sprite()
|
|
24791
|
+
sprite:Load("gfx/005.100_collectible.anm2", false)
|
|
24792
|
+
sprite:ReplaceSpritesheet(1, "gfx/items/collectibles/questionmark.png")
|
|
24793
|
+
sprite:LoadGraphics()
|
|
24794
|
+
return sprite
|
|
24795
|
+
end)(nil)
|
|
24692
24796
|
function ____exports.collectibleHasCacheFlag(self, collectibleOrCollectibleType, cacheFlag)
|
|
24693
24797
|
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "collectibleHasCacheFlag")
|
|
24694
24798
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
@@ -24820,19 +24924,20 @@ function ____exports.getCollectiblePedestalType(self, collectible)
|
|
|
24820
24924
|
local sprite = collectible:GetSprite()
|
|
24821
24925
|
return sprite:GetOverlayFrame()
|
|
24822
24926
|
end
|
|
24823
|
-
function ____exports.getCollectibleQuality(self, collectibleOrCollectibleType)
|
|
24824
|
-
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleQuality")
|
|
24825
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
24826
|
-
if itemConfigItem == nil then
|
|
24827
|
-
return 0
|
|
24828
|
-
end
|
|
24829
|
-
return itemConfigItem.Quality
|
|
24830
|
-
end
|
|
24831
24927
|
function ____exports.getCollectibleTags(self, collectibleOrCollectibleType)
|
|
24832
24928
|
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleTags")
|
|
24833
24929
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
24834
24930
|
return itemConfigItem == nil and ItemConfigTagZero or itemConfigItem.Tags
|
|
24835
24931
|
end
|
|
24932
|
+
function ____exports.getVanillaCollectibleTypesOfQuality(self, quality)
|
|
24933
|
+
local collectibleTypes = QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP:get(quality)
|
|
24934
|
+
assertDefined(
|
|
24935
|
+
nil,
|
|
24936
|
+
collectibleTypes,
|
|
24937
|
+
"Failed to find the vanilla collectible types corresponding to quality: " .. tostring(quality)
|
|
24938
|
+
)
|
|
24939
|
+
return collectibleTypes
|
|
24940
|
+
end
|
|
24836
24941
|
function ____exports.isActiveCollectible(self, collectibleType)
|
|
24837
24942
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
24838
24943
|
return itemType == ItemType.ACTIVE
|
|
@@ -38266,73 +38371,6 @@ function PickupChangeDetection.prototype.____constructor(self, postPickupChanged
|
|
|
38266
38371
|
self.postPickupChanged = postPickupChanged
|
|
38267
38372
|
self.pickupIndexCreation = pickupIndexCreation
|
|
38268
38373
|
end
|
|
38269
|
-
return ____exports
|
|
38270
|
-
end,
|
|
38271
|
-
["src.core.constantsVanilla"] = function(...)
|
|
38272
|
-
local ____lualib = require("lualib_bundle")
|
|
38273
|
-
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
38274
|
-
local __TS__New = ____lualib.__TS__New
|
|
38275
|
-
local ____exports = {}
|
|
38276
|
-
local ____types = require("src.functions.types")
|
|
38277
|
-
local asCardType = ____types.asCardType
|
|
38278
|
-
local asCollectibleType = ____types.asCollectibleType
|
|
38279
|
-
local asPillEffect = ____types.asPillEffect
|
|
38280
|
-
local asTrinketType = ____types.asTrinketType
|
|
38281
|
-
local ____utils = require("src.functions.utils")
|
|
38282
|
-
local iRange = ____utils.iRange
|
|
38283
|
-
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
38284
|
-
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
38285
|
-
local ____cachedClasses = require("src.core.cachedClasses")
|
|
38286
|
-
local itemConfig = ____cachedClasses.itemConfig
|
|
38287
|
-
local ____constantsFirstLast = require("src.core.constantsFirstLast")
|
|
38288
|
-
local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
|
|
38289
|
-
local FIRST_COLLECTIBLE_TYPE = ____constantsFirstLast.FIRST_COLLECTIBLE_TYPE
|
|
38290
|
-
local FIRST_PILL_EFFECT = ____constantsFirstLast.FIRST_PILL_EFFECT
|
|
38291
|
-
local FIRST_TRINKET_TYPE = ____constantsFirstLast.FIRST_TRINKET_TYPE
|
|
38292
|
-
local LAST_VANILLA_CARD_TYPE = ____constantsFirstLast.LAST_VANILLA_CARD_TYPE
|
|
38293
|
-
local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsFirstLast.LAST_VANILLA_COLLECTIBLE_TYPE
|
|
38294
|
-
local LAST_VANILLA_PILL_EFFECT = ____constantsFirstLast.LAST_VANILLA_PILL_EFFECT
|
|
38295
|
-
local LAST_VANILLA_TRINKET_TYPE = ____constantsFirstLast.LAST_VANILLA_TRINKET_TYPE
|
|
38296
|
-
____exports.VANILLA_COLLECTIBLE_TYPE_RANGE = iRange(nil, FIRST_COLLECTIBLE_TYPE, LAST_VANILLA_COLLECTIBLE_TYPE)
|
|
38297
|
-
____exports.VANILLA_COLLECTIBLE_TYPES = __TS__ArrayFilter(
|
|
38298
|
-
____exports.VANILLA_COLLECTIBLE_TYPE_RANGE,
|
|
38299
|
-
function(____, potentialCollectibleType)
|
|
38300
|
-
local collectibleType = asCollectibleType(nil, potentialCollectibleType)
|
|
38301
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
38302
|
-
return itemConfigItem ~= nil
|
|
38303
|
-
end
|
|
38304
|
-
)
|
|
38305
|
-
____exports.VANILLA_COLLECTIBLE_TYPES_SET = __TS__New(ReadonlySet, ____exports.VANILLA_COLLECTIBLE_TYPES)
|
|
38306
|
-
____exports.VANILLA_TRINKET_TYPE_RANGE = iRange(nil, FIRST_TRINKET_TYPE, LAST_VANILLA_TRINKET_TYPE)
|
|
38307
|
-
____exports.VANILLA_TRINKET_TYPES = __TS__ArrayFilter(
|
|
38308
|
-
____exports.VANILLA_TRINKET_TYPE_RANGE,
|
|
38309
|
-
function(____, potentialTrinketType)
|
|
38310
|
-
local trinketType = asTrinketType(nil, potentialTrinketType)
|
|
38311
|
-
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
38312
|
-
return itemConfigTrinket ~= nil
|
|
38313
|
-
end
|
|
38314
|
-
)
|
|
38315
|
-
____exports.VANILLA_TRINKET_TYPES_SET = __TS__New(ReadonlySet, ____exports.VANILLA_TRINKET_TYPES)
|
|
38316
|
-
____exports.VANILLA_CARD_TYPE_RANGE = iRange(nil, FIRST_CARD_TYPE, LAST_VANILLA_CARD_TYPE)
|
|
38317
|
-
____exports.VANILLA_CARD_TYPES = __TS__ArrayFilter(
|
|
38318
|
-
____exports.VANILLA_CARD_TYPE_RANGE,
|
|
38319
|
-
function(____, potentialCardType)
|
|
38320
|
-
local cardType = asCardType(nil, potentialCardType)
|
|
38321
|
-
local itemConfigCard = itemConfig:GetCard(cardType)
|
|
38322
|
-
return itemConfigCard ~= nil
|
|
38323
|
-
end
|
|
38324
|
-
)
|
|
38325
|
-
____exports.VANILLA_CARD_TYPES_SET = __TS__New(ReadonlySet, ____exports.VANILLA_CARD_TYPES)
|
|
38326
|
-
____exports.VANILLA_PILL_EFFECT_RANGE = iRange(nil, FIRST_PILL_EFFECT, LAST_VANILLA_PILL_EFFECT)
|
|
38327
|
-
____exports.VANILLA_PILL_EFFECTS = __TS__ArrayFilter(
|
|
38328
|
-
____exports.VANILLA_PILL_EFFECT_RANGE,
|
|
38329
|
-
function(____, potentialPillEffect)
|
|
38330
|
-
local pillEffect = asPillEffect(nil, potentialPillEffect)
|
|
38331
|
-
local itemConfigPillEffect = itemConfig:GetPillEffect(pillEffect)
|
|
38332
|
-
return itemConfigPillEffect ~= nil
|
|
38333
|
-
end
|
|
38334
|
-
)
|
|
38335
|
-
____exports.VANILLA_PILL_EFFECTS_SET = __TS__New(ReadonlySet, ____exports.VANILLA_PILL_EFFECTS)
|
|
38336
38374
|
return ____exports
|
|
38337
38375
|
end,
|
|
38338
38376
|
["src.objects.cardDescriptions"] = function(...)
|
|
@@ -38876,6 +38914,7 @@ local ____cachedClasses = require("src.core.cachedClasses")
|
|
|
38876
38914
|
local itemConfig = ____cachedClasses.itemConfig
|
|
38877
38915
|
local ____constants = require("src.core.constants")
|
|
38878
38916
|
local FIRST_GLITCHED_COLLECTIBLE_TYPE = ____constants.FIRST_GLITCHED_COLLECTIBLE_TYPE
|
|
38917
|
+
local QUALITIES = ____constants.QUALITIES
|
|
38879
38918
|
local ____constantsVanilla = require("src.core.constantsVanilla")
|
|
38880
38919
|
local VANILLA_CARD_TYPES = ____constantsVanilla.VANILLA_CARD_TYPES
|
|
38881
38920
|
local VANILLA_COLLECTIBLE_TYPES = ____constantsVanilla.VANILLA_COLLECTIBLE_TYPES
|
|
@@ -38891,6 +38930,7 @@ local ____collectibleTag = require("src.functions.collectibleTag")
|
|
|
38891
38930
|
local collectibleHasTag = ____collectibleTag.collectibleHasTag
|
|
38892
38931
|
local ____collectibles = require("src.functions.collectibles")
|
|
38893
38932
|
local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
38933
|
+
local getCollectibleQuality = ____collectibles.getCollectibleQuality
|
|
38894
38934
|
local isActiveCollectible = ____collectibles.isActiveCollectible
|
|
38895
38935
|
local isHiddenCollectible = ____collectibles.isHiddenCollectible
|
|
38896
38936
|
local isPassiveOrFamiliarCollectible = ____collectibles.isPassiveOrFamiliarCollectible
|
|
@@ -38968,6 +39008,7 @@ function ModdedElementSets.prototype.____constructor(self, moddedElementDetectio
|
|
|
38968
39008
|
self.tagToCollectibleTypesMap = __TS__New(Map)
|
|
38969
39009
|
self.edenActiveCollectibleTypesSet = __TS__New(Set)
|
|
38970
39010
|
self.edenPassiveCollectibleTypesSet = __TS__New(Set)
|
|
39011
|
+
self.qualityToCollectibleTypesMap = __TS__New(Map)
|
|
38971
39012
|
self.itemConfigCardTypeToCardTypeMap = __TS__New(Map)
|
|
38972
39013
|
self.cardSet = __TS__New(Set)
|
|
38973
39014
|
self.featuresUsed = {ISCFeature.MODDED_ELEMENT_DETECTION}
|
|
@@ -38988,6 +39029,7 @@ function ModdedElementSets.prototype.lazyInit(self)
|
|
|
38988
39029
|
self:lazyInitFlyingCollectibleTypesSet()
|
|
38989
39030
|
self:lazyInitFlyingTrinketTypesSet()
|
|
38990
39031
|
self:lazyInitEdenCollectibleTypesSet()
|
|
39032
|
+
self:lazyInitQualityToCollectibleTypesMap()
|
|
38991
39033
|
self:lazyInitCardTypes()
|
|
38992
39034
|
end
|
|
38993
39035
|
function ModdedElementSets.prototype.lazyInitModdedCollectibleTypes(self)
|
|
@@ -39116,24 +39158,24 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
|
|
|
39116
39158
|
end
|
|
39117
39159
|
function ModdedElementSets.prototype.lazyInitCacheFlagToCollectibleTypesMap(self)
|
|
39118
39160
|
for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
|
|
39119
|
-
local
|
|
39161
|
+
local collectibleTypeSet = __TS__New(Set)
|
|
39120
39162
|
for ____, collectibleType in ipairs(self:getCollectibleTypes()) do
|
|
39121
39163
|
if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
|
|
39122
|
-
|
|
39164
|
+
collectibleTypeSet:add(collectibleType)
|
|
39123
39165
|
end
|
|
39124
39166
|
end
|
|
39125
|
-
self.cacheFlagToCollectibleTypesMap:set(cacheFlag,
|
|
39167
|
+
self.cacheFlagToCollectibleTypesMap:set(cacheFlag, collectibleTypeSet)
|
|
39126
39168
|
end
|
|
39127
39169
|
end
|
|
39128
39170
|
function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
|
|
39129
39171
|
for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
|
|
39130
|
-
local
|
|
39172
|
+
local trinketTypesSet = __TS__New(Set)
|
|
39131
39173
|
for ____, trinketType in ipairs(self:getTrinketTypes()) do
|
|
39132
39174
|
if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
|
|
39133
|
-
|
|
39175
|
+
trinketTypesSet:add(trinketType)
|
|
39134
39176
|
end
|
|
39135
39177
|
end
|
|
39136
|
-
self.cacheFlagToTrinketTypesMap:set(cacheFlag,
|
|
39178
|
+
self.cacheFlagToTrinketTypesMap:set(cacheFlag, trinketTypesSet)
|
|
39137
39179
|
end
|
|
39138
39180
|
end
|
|
39139
39181
|
function ModdedElementSets.prototype.lazyInitFlyingCollectibleTypesSet(self)
|
|
@@ -39179,6 +39221,18 @@ function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
|
|
|
39179
39221
|
::__continue61::
|
|
39180
39222
|
end
|
|
39181
39223
|
end
|
|
39224
|
+
function ModdedElementSets.prototype.lazyInitQualityToCollectibleTypesMap(self)
|
|
39225
|
+
for ____, quality in ipairs(QUALITIES) do
|
|
39226
|
+
local collectibleTypesSet = __TS__New(Set)
|
|
39227
|
+
for ____, collectibleType in ipairs(self:getCollectibleTypes()) do
|
|
39228
|
+
local collectibleTypeQuality = getCollectibleQuality(nil, collectibleType)
|
|
39229
|
+
if collectibleTypeQuality == quality then
|
|
39230
|
+
collectibleTypesSet:add(collectibleType)
|
|
39231
|
+
end
|
|
39232
|
+
end
|
|
39233
|
+
self.qualityToCollectibleTypesMap:set(quality, collectibleTypesSet)
|
|
39234
|
+
end
|
|
39235
|
+
end
|
|
39182
39236
|
function ModdedElementSets.prototype.lazyInitCardTypes(self)
|
|
39183
39237
|
for ____, itemConfigCardType in ipairs(ITEM_CONFIG_CARD_TYPE_VALUES) do
|
|
39184
39238
|
self.itemConfigCardTypeToCardTypeMap:set(
|
|
@@ -39451,6 +39505,33 @@ function ModdedElementSets.prototype.getRandomEdenPassiveCollectibleType(self, s
|
|
|
39451
39505
|
return getRandomSetElement(nil, self.edenPassiveCollectibleTypesSet, seedOrRNG, exceptions)
|
|
39452
39506
|
end
|
|
39453
39507
|
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomEdenPassiveCollectibleType", true)
|
|
39508
|
+
function ModdedElementSets.prototype.getCollectibleTypesOfQuality(self, quality)
|
|
39509
|
+
self:lazyInit()
|
|
39510
|
+
local collectibleTypes = self.qualityToCollectibleTypesMap:get(quality)
|
|
39511
|
+
assertDefined(
|
|
39512
|
+
nil,
|
|
39513
|
+
collectibleTypes,
|
|
39514
|
+
("The quality of " .. tostring(quality)) .. " is not a valid quality."
|
|
39515
|
+
)
|
|
39516
|
+
return collectibleTypes
|
|
39517
|
+
end
|
|
39518
|
+
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleTypesOfQuality", true)
|
|
39519
|
+
function ModdedElementSets.prototype.getPlayerCollectiblesOfQuality(self, player, quality)
|
|
39520
|
+
local collectibleTypesOfQuality = self:getCollectibleTypesOfQuality(quality)
|
|
39521
|
+
local playerCollectibles = {}
|
|
39522
|
+
for ____, collectibleType in ipairs(getSortedSetValues(nil, collectibleTypesOfQuality)) do
|
|
39523
|
+
local numCollectibles = player:GetCollectibleNum(collectibleType, true)
|
|
39524
|
+
____repeat(
|
|
39525
|
+
nil,
|
|
39526
|
+
numCollectibles,
|
|
39527
|
+
function()
|
|
39528
|
+
playerCollectibles[#playerCollectibles + 1] = collectibleType
|
|
39529
|
+
end
|
|
39530
|
+
)
|
|
39531
|
+
end
|
|
39532
|
+
return playerCollectibles
|
|
39533
|
+
end
|
|
39534
|
+
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getPlayerCollectiblesOfQuality", true)
|
|
39454
39535
|
function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
|
|
39455
39536
|
local itemConfigCardTypes = {...}
|
|
39456
39537
|
self:lazyInit()
|
|
@@ -35,6 +35,7 @@ export declare class ModdedElementSets extends Feature {
|
|
|
35
35
|
private readonly tagToCollectibleTypesMap;
|
|
36
36
|
private readonly edenActiveCollectibleTypesSet;
|
|
37
37
|
private readonly edenPassiveCollectibleTypesSet;
|
|
38
|
+
private readonly qualityToCollectibleTypesMap;
|
|
38
39
|
private readonly itemConfigCardTypeToCardTypeMap;
|
|
39
40
|
/**
|
|
40
41
|
* The set of card types that are not:
|
|
@@ -55,6 +56,7 @@ export declare class ModdedElementSets extends Feature {
|
|
|
55
56
|
private lazyInitFlyingCollectibleTypesSet;
|
|
56
57
|
private lazyInitFlyingTrinketTypesSet;
|
|
57
58
|
private lazyInitEdenCollectibleTypesSet;
|
|
59
|
+
private lazyInitQualityToCollectibleTypesMap;
|
|
58
60
|
private lazyInitCardTypes;
|
|
59
61
|
/**
|
|
60
62
|
* Returns an array containing every valid collectible type in the game, including modded
|
|
@@ -388,7 +390,7 @@ export declare class ModdedElementSets extends Feature {
|
|
|
388
390
|
*/
|
|
389
391
|
getCollectibleTypesWithTag(itemConfigTag: ItemConfigTag): ReadonlySet<CollectibleType>;
|
|
390
392
|
/**
|
|
391
|
-
* Returns
|
|
393
|
+
* Returns an array of collectible types that a player has with a particular tag.
|
|
392
394
|
*
|
|
393
395
|
* This function can only be called if at least one callback has been executed. This is because
|
|
394
396
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
@@ -415,7 +417,8 @@ export declare class ModdedElementSets extends Feature {
|
|
|
415
417
|
*/
|
|
416
418
|
getCollectibleTypesForTransformation(playerForm: PlayerForm): ReadonlySet<CollectibleType>;
|
|
417
419
|
/**
|
|
418
|
-
* Returns
|
|
420
|
+
* Returns an array of collectible types that a player has that count towards a particular
|
|
421
|
+
* transformation.
|
|
419
422
|
*
|
|
420
423
|
* This function can only be called if at least one callback has been executed. This is because
|
|
421
424
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
@@ -479,6 +482,26 @@ export declare class ModdedElementSets extends Feature {
|
|
|
479
482
|
* @param exceptions Optional. An array of runes to not select.
|
|
480
483
|
*/
|
|
481
484
|
getRandomEdenPassiveCollectibleType(seedOrRNG?: Seed | RNG, exceptions?: CollectibleType[] | readonly CollectibleType[]): CollectibleType;
|
|
485
|
+
/**
|
|
486
|
+
* Returns a set containing every collectible type with the given quality.
|
|
487
|
+
*
|
|
488
|
+
* This function can only be called if at least one callback has been executed. This is because
|
|
489
|
+
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
490
|
+
* order).
|
|
491
|
+
*
|
|
492
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
493
|
+
*/
|
|
494
|
+
getCollectibleTypesOfQuality(quality: Quality): ReadonlySet<CollectibleType>;
|
|
495
|
+
/**
|
|
496
|
+
* Returns an array of collectible types that a player has that are of a particular quality.
|
|
497
|
+
*
|
|
498
|
+
* This function can only be called if at least one callback has been executed. This is because
|
|
499
|
+
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
500
|
+
* order).
|
|
501
|
+
*
|
|
502
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
503
|
+
*/
|
|
504
|
+
getPlayerCollectiblesOfQuality(player: EntityPlayer, quality: Quality): CollectibleType[];
|
|
482
505
|
/**
|
|
483
506
|
* Helper function to get a set of card types matching the `ItemConfigCardType`.
|
|
484
507
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModdedElementSets.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ModdedElementSets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"ModdedElementSets.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ModdedElementSets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AA+CtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA2BhD;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,OAAO,CAAC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OAYG;IAEI,aAAa,CAClB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,UAAU,GAAE,QAAQ,EAAO,GAC1B,QAAQ;CAKZ"}
|
|
@@ -23,6 +23,7 @@ local ____cachedClasses = require("src.core.cachedClasses")
|
|
|
23
23
|
local itemConfig = ____cachedClasses.itemConfig
|
|
24
24
|
local ____constants = require("src.core.constants")
|
|
25
25
|
local FIRST_GLITCHED_COLLECTIBLE_TYPE = ____constants.FIRST_GLITCHED_COLLECTIBLE_TYPE
|
|
26
|
+
local QUALITIES = ____constants.QUALITIES
|
|
26
27
|
local ____constantsVanilla = require("src.core.constantsVanilla")
|
|
27
28
|
local VANILLA_CARD_TYPES = ____constantsVanilla.VANILLA_CARD_TYPES
|
|
28
29
|
local VANILLA_COLLECTIBLE_TYPES = ____constantsVanilla.VANILLA_COLLECTIBLE_TYPES
|
|
@@ -38,6 +39,7 @@ local ____collectibleTag = require("src.functions.collectibleTag")
|
|
|
38
39
|
local collectibleHasTag = ____collectibleTag.collectibleHasTag
|
|
39
40
|
local ____collectibles = require("src.functions.collectibles")
|
|
40
41
|
local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
42
|
+
local getCollectibleQuality = ____collectibles.getCollectibleQuality
|
|
41
43
|
local isActiveCollectible = ____collectibles.isActiveCollectible
|
|
42
44
|
local isHiddenCollectible = ____collectibles.isHiddenCollectible
|
|
43
45
|
local isPassiveOrFamiliarCollectible = ____collectibles.isPassiveOrFamiliarCollectible
|
|
@@ -121,6 +123,7 @@ function ModdedElementSets.prototype.____constructor(self, moddedElementDetectio
|
|
|
121
123
|
self.tagToCollectibleTypesMap = __TS__New(Map)
|
|
122
124
|
self.edenActiveCollectibleTypesSet = __TS__New(Set)
|
|
123
125
|
self.edenPassiveCollectibleTypesSet = __TS__New(Set)
|
|
126
|
+
self.qualityToCollectibleTypesMap = __TS__New(Map)
|
|
124
127
|
self.itemConfigCardTypeToCardTypeMap = __TS__New(Map)
|
|
125
128
|
self.cardSet = __TS__New(Set)
|
|
126
129
|
self.featuresUsed = {ISCFeature.MODDED_ELEMENT_DETECTION}
|
|
@@ -141,6 +144,7 @@ function ModdedElementSets.prototype.lazyInit(self)
|
|
|
141
144
|
self:lazyInitFlyingCollectibleTypesSet()
|
|
142
145
|
self:lazyInitFlyingTrinketTypesSet()
|
|
143
146
|
self:lazyInitEdenCollectibleTypesSet()
|
|
147
|
+
self:lazyInitQualityToCollectibleTypesMap()
|
|
144
148
|
self:lazyInitCardTypes()
|
|
145
149
|
end
|
|
146
150
|
function ModdedElementSets.prototype.lazyInitModdedCollectibleTypes(self)
|
|
@@ -269,24 +273,24 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
|
|
|
269
273
|
end
|
|
270
274
|
function ModdedElementSets.prototype.lazyInitCacheFlagToCollectibleTypesMap(self)
|
|
271
275
|
for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
|
|
272
|
-
local
|
|
276
|
+
local collectibleTypeSet = __TS__New(Set)
|
|
273
277
|
for ____, collectibleType in ipairs(self:getCollectibleTypes()) do
|
|
274
278
|
if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
|
|
275
|
-
|
|
279
|
+
collectibleTypeSet:add(collectibleType)
|
|
276
280
|
end
|
|
277
281
|
end
|
|
278
|
-
self.cacheFlagToCollectibleTypesMap:set(cacheFlag,
|
|
282
|
+
self.cacheFlagToCollectibleTypesMap:set(cacheFlag, collectibleTypeSet)
|
|
279
283
|
end
|
|
280
284
|
end
|
|
281
285
|
function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
|
|
282
286
|
for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
|
|
283
|
-
local
|
|
287
|
+
local trinketTypesSet = __TS__New(Set)
|
|
284
288
|
for ____, trinketType in ipairs(self:getTrinketTypes()) do
|
|
285
289
|
if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
|
|
286
|
-
|
|
290
|
+
trinketTypesSet:add(trinketType)
|
|
287
291
|
end
|
|
288
292
|
end
|
|
289
|
-
self.cacheFlagToTrinketTypesMap:set(cacheFlag,
|
|
293
|
+
self.cacheFlagToTrinketTypesMap:set(cacheFlag, trinketTypesSet)
|
|
290
294
|
end
|
|
291
295
|
end
|
|
292
296
|
function ModdedElementSets.prototype.lazyInitFlyingCollectibleTypesSet(self)
|
|
@@ -332,6 +336,18 @@ function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
|
|
|
332
336
|
::__continue61::
|
|
333
337
|
end
|
|
334
338
|
end
|
|
339
|
+
function ModdedElementSets.prototype.lazyInitQualityToCollectibleTypesMap(self)
|
|
340
|
+
for ____, quality in ipairs(QUALITIES) do
|
|
341
|
+
local collectibleTypesSet = __TS__New(Set)
|
|
342
|
+
for ____, collectibleType in ipairs(self:getCollectibleTypes()) do
|
|
343
|
+
local collectibleTypeQuality = getCollectibleQuality(nil, collectibleType)
|
|
344
|
+
if collectibleTypeQuality == quality then
|
|
345
|
+
collectibleTypesSet:add(collectibleType)
|
|
346
|
+
end
|
|
347
|
+
end
|
|
348
|
+
self.qualityToCollectibleTypesMap:set(quality, collectibleTypesSet)
|
|
349
|
+
end
|
|
350
|
+
end
|
|
335
351
|
function ModdedElementSets.prototype.lazyInitCardTypes(self)
|
|
336
352
|
for ____, itemConfigCardType in ipairs(ITEM_CONFIG_CARD_TYPE_VALUES) do
|
|
337
353
|
self.itemConfigCardTypeToCardTypeMap:set(
|
|
@@ -604,6 +620,33 @@ function ModdedElementSets.prototype.getRandomEdenPassiveCollectibleType(self, s
|
|
|
604
620
|
return getRandomSetElement(nil, self.edenPassiveCollectibleTypesSet, seedOrRNG, exceptions)
|
|
605
621
|
end
|
|
606
622
|
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomEdenPassiveCollectibleType", true)
|
|
623
|
+
function ModdedElementSets.prototype.getCollectibleTypesOfQuality(self, quality)
|
|
624
|
+
self:lazyInit()
|
|
625
|
+
local collectibleTypes = self.qualityToCollectibleTypesMap:get(quality)
|
|
626
|
+
assertDefined(
|
|
627
|
+
nil,
|
|
628
|
+
collectibleTypes,
|
|
629
|
+
("The quality of " .. tostring(quality)) .. " is not a valid quality."
|
|
630
|
+
)
|
|
631
|
+
return collectibleTypes
|
|
632
|
+
end
|
|
633
|
+
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleTypesOfQuality", true)
|
|
634
|
+
function ModdedElementSets.prototype.getPlayerCollectiblesOfQuality(self, player, quality)
|
|
635
|
+
local collectibleTypesOfQuality = self:getCollectibleTypesOfQuality(quality)
|
|
636
|
+
local playerCollectibles = {}
|
|
637
|
+
for ____, collectibleType in ipairs(getSortedSetValues(nil, collectibleTypesOfQuality)) do
|
|
638
|
+
local numCollectibles = player:GetCollectibleNum(collectibleType, true)
|
|
639
|
+
____repeat(
|
|
640
|
+
nil,
|
|
641
|
+
numCollectibles,
|
|
642
|
+
function()
|
|
643
|
+
playerCollectibles[#playerCollectibles + 1] = collectibleType
|
|
644
|
+
end
|
|
645
|
+
)
|
|
646
|
+
end
|
|
647
|
+
return playerCollectibles
|
|
648
|
+
end
|
|
649
|
+
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getPlayerCollectiblesOfQuality", true)
|
|
607
650
|
function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
|
|
608
651
|
local itemConfigCardTypes = {...}
|
|
609
652
|
self:lazyInit()
|
|
@@ -151,6 +151,11 @@ export declare const DIMENSIONS: readonly Dimension[];
|
|
|
151
151
|
*/
|
|
152
152
|
export declare const NUM_PILL_COLORS_IN_POOL: number;
|
|
153
153
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
154
|
+
/**
|
|
155
|
+
* An array representing every valid collectible type quality. Specifically, this is `[0, 1, 2, 3,
|
|
156
|
+
* 4]`.
|
|
157
|
+
*/
|
|
158
|
+
export declare const QUALITIES: readonly Quality[];
|
|
154
159
|
export declare const SECOND_IN_MILLISECONDS = 1000;
|
|
155
160
|
export declare const MINUTE_IN_MILLISECONDS: number;
|
|
156
161
|
/** This is equivalent to the bottom-right screen position when the game is in full screen mode. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EAET,YAAY,EACZ,aAAa,EACb,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAatC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;EAI7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,SAAS,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,4CAA4C,CAAC;AAE7E,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,qBAAqB,yUAaxB,CAAC;AAEX,eAAO,MAAM,yBAAyB,4BAErC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAE5D,gGAAgG;AAChG,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAE7C;;;;;;GAMG;AAEH,eAAO,MAAM,+BAA+B,iBAAmC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,iBAAiB,4HAOpB,CAAC;AAEX,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,QAA8B,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,eAAe,qrBAmClB,CAAC;AAEX,8EAA8E;AAC9E,eAAO,MA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BAAgC,CAAC"}
|
|
@@ -201,6 +201,15 @@ ____exports.DIMENSIONS = eRange(nil, ____exports.NUM_DIMENSIONS)
|
|
|
201
201
|
-- horse pills.)
|
|
202
202
|
____exports.NUM_PILL_COLORS_IN_POOL = NUM_NORMAL_PILL_COLORS
|
|
203
203
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
204
|
+
--- An array representing every valid collectible type quality. Specifically, this is `[0, 1, 2, 3,
|
|
205
|
+
-- 4]`.
|
|
206
|
+
____exports.QUALITIES = {
|
|
207
|
+
0,
|
|
208
|
+
1,
|
|
209
|
+
2,
|
|
210
|
+
3,
|
|
211
|
+
4
|
|
212
|
+
}
|
|
204
213
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
205
214
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
206
215
|
--- This is equivalent to the bottom-right screen position when the game is in full screen mode.
|
|
@@ -85,6 +85,13 @@ export declare function getCollectibleQuality(collectibleOrCollectibleType: Enti
|
|
|
85
85
|
* ```
|
|
86
86
|
*/
|
|
87
87
|
export declare function getCollectibleTags(collectibleOrCollectibleType: EntityPickup | CollectibleType): BitFlags<ItemConfigTag>;
|
|
88
|
+
/**
|
|
89
|
+
* Returns a set containing every vanilla collectible type with the given quality.
|
|
90
|
+
*
|
|
91
|
+
* Note that this function will only return vanilla collectible types. To handle modded collectible
|
|
92
|
+
* types, use the `getCollectibleTypesOfQuality` helper function instead.
|
|
93
|
+
*/
|
|
94
|
+
export declare function getVanillaCollectibleTypesOfQuality(quality: Quality): ReadonlySet<CollectibleType>;
|
|
88
95
|
/** Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`. */
|
|
89
96
|
export declare function isActiveCollectible(collectibleType: CollectibleType): boolean;
|
|
90
97
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,aAAa,EACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,eAAe,EAEf,oBAAoB,EAEpB,QAAQ,EACR,WAAW,EAGZ,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,aAAa,EACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,eAAe,EAEf,oBAAoB,EAEpB,QAAQ,EACR,WAAW,EAGZ,MAAM,8BAA8B,CAAC;AAgEtC,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAStE;AAED,iGAAiG;AACjG,wBAAgB,uBAAuB,CACrC,4BAA4B,EAAE,YAAY,GAAG,eAAe,EAC5D,SAAS,EAAE,SAAS,GACnB,OAAO,CAYT;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAsBT;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,oBAAoB,CAYtB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,MAAM,CAoBR;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,GAAG,CAgBL;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,4BAA4B,EAAE,YAAY,GAAG,eAAe,EAC5D,MAAM,EAAE,YAAY,GACnB,WAAW,CA6Bb;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAAG,CAAC,CAAC,GAChE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_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local Set = ____lualib.Set
|
|
1
5
|
local ____exports = {}
|
|
2
|
-
local
|
|
6
|
+
local getCollectibleTypeFromArg
|
|
3
7
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
8
|
local CollectibleSpriteLayer = ____isaac_2Dtypescript_2Ddefinitions.CollectibleSpriteLayer
|
|
5
9
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
@@ -16,8 +20,11 @@ local itemConfig = ____cachedClasses.itemConfig
|
|
|
16
20
|
local ____constants = require("src.core.constants")
|
|
17
21
|
local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
|
|
18
22
|
local DEFAULT_ITEM_POOL_TYPE = ____constants.DEFAULT_ITEM_POOL_TYPE
|
|
23
|
+
local QUALITIES = ____constants.QUALITIES
|
|
19
24
|
local ____constantsFirstLast = require("src.core.constantsFirstLast")
|
|
20
25
|
local LAST_VANILLA_COLLECTIBLE_TYPE = ____constantsFirstLast.LAST_VANILLA_COLLECTIBLE_TYPE
|
|
26
|
+
local ____constantsVanilla = require("src.core.constantsVanilla")
|
|
27
|
+
local VANILLA_COLLECTIBLE_TYPES = ____constantsVanilla.VANILLA_COLLECTIBLE_TYPES
|
|
21
28
|
local ____collectibleDescriptionMap = require("src.maps.collectibleDescriptionMap")
|
|
22
29
|
local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
|
|
23
30
|
local DEFAULT_COLLECTIBLE_DESCRIPTION = ____collectibleDescriptionMap.DEFAULT_COLLECTIBLE_DESCRIPTION
|
|
@@ -37,13 +44,8 @@ local clearSprite = ____sprites.clearSprite
|
|
|
37
44
|
local spriteEquals = ____sprites.spriteEquals
|
|
38
45
|
local ____types = require("src.functions.types")
|
|
39
46
|
local isInteger = ____types.isInteger
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
sprite:Load("gfx/005.100_collectible.anm2", false)
|
|
43
|
-
sprite:ReplaceSpritesheet(1, "gfx/items/collectibles/questionmark.png")
|
|
44
|
-
sprite:LoadGraphics()
|
|
45
|
-
return sprite
|
|
46
|
-
end
|
|
47
|
+
local ____utils = require("src.functions.utils")
|
|
48
|
+
local assertDefined = ____utils.assertDefined
|
|
47
49
|
function ____exports.clearCollectibleSprite(self, collectible)
|
|
48
50
|
if not isCollectible(nil, collectible) then
|
|
49
51
|
local entityID = getEntityID(nil, collectible)
|
|
@@ -51,6 +53,17 @@ function ____exports.clearCollectibleSprite(self, collectible)
|
|
|
51
53
|
end
|
|
52
54
|
____exports.setCollectibleSprite(nil, collectible, nil)
|
|
53
55
|
end
|
|
56
|
+
--- Helper function to get a collectible's quality, which ranges from 0 to 4 (inclusive). For
|
|
57
|
+
-- example, Mom's Knife has a quality of 4. Returns 0 if the provided collectible type was not
|
|
58
|
+
-- valid.
|
|
59
|
+
function ____exports.getCollectibleQuality(self, collectibleOrCollectibleType)
|
|
60
|
+
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleQuality")
|
|
61
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
62
|
+
if itemConfigItem == nil then
|
|
63
|
+
return 0
|
|
64
|
+
end
|
|
65
|
+
return itemConfigItem.Quality
|
|
66
|
+
end
|
|
54
67
|
function ____exports.isVanillaCollectibleType(self, collectibleType)
|
|
55
68
|
return collectibleType <= LAST_VANILLA_COLLECTIBLE_TYPE
|
|
56
69
|
end
|
|
@@ -123,8 +136,30 @@ function getCollectibleTypeFromArg(self, collectibleOrCollectibleType, functionN
|
|
|
123
136
|
end
|
|
124
137
|
local COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2"
|
|
125
138
|
local DEFAULT_COLLECTIBLE_PRICE = 15
|
|
139
|
+
--- Glitched items start at id 4294967295 (the final 32-bit integer) and increment backwards.
|
|
126
140
|
local GLITCHED_ITEM_THRESHOLD = 4000000000
|
|
127
|
-
local
|
|
141
|
+
local QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP = (function()
|
|
142
|
+
local qualityToCollectibleTypesMap = __TS__New(Map)
|
|
143
|
+
for ____, quality in ipairs(QUALITIES) do
|
|
144
|
+
local collectibleTypesSet = __TS__New(Set)
|
|
145
|
+
for ____, collectibleType in ipairs(VANILLA_COLLECTIBLE_TYPES) do
|
|
146
|
+
local collectibleTypeQuality = ____exports.getCollectibleQuality(nil, collectibleType)
|
|
147
|
+
if collectibleTypeQuality == quality then
|
|
148
|
+
collectibleTypesSet:add(collectibleType)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
qualityToCollectibleTypesMap:set(quality, collectibleTypesSet)
|
|
152
|
+
end
|
|
153
|
+
return qualityToCollectibleTypesMap
|
|
154
|
+
end)(nil)
|
|
155
|
+
--- The `isBlindCollectible` function needs a reference sprite to work properly.
|
|
156
|
+
local questionMarkSprite = (function()
|
|
157
|
+
local sprite = Sprite()
|
|
158
|
+
sprite:Load("gfx/005.100_collectible.anm2", false)
|
|
159
|
+
sprite:ReplaceSpritesheet(1, "gfx/items/collectibles/questionmark.png")
|
|
160
|
+
sprite:LoadGraphics()
|
|
161
|
+
return sprite
|
|
162
|
+
end)(nil)
|
|
128
163
|
--- Helper function to check in the item config if a given collectible has a given cache flag.
|
|
129
164
|
function ____exports.collectibleHasCacheFlag(self, collectibleOrCollectibleType, cacheFlag)
|
|
130
165
|
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "collectibleHasCacheFlag")
|
|
@@ -290,17 +325,6 @@ function ____exports.getCollectiblePedestalType(self, collectible)
|
|
|
290
325
|
local sprite = collectible:GetSprite()
|
|
291
326
|
return sprite:GetOverlayFrame()
|
|
292
327
|
end
|
|
293
|
-
--- Helper function to get a collectible's quality, which ranges from 0 to 4 (inclusive). For
|
|
294
|
-
-- example, Mom's Knife has a quality of 4. Returns 0 if the provided collectible type was not
|
|
295
|
-
-- valid.
|
|
296
|
-
function ____exports.getCollectibleQuality(self, collectibleOrCollectibleType)
|
|
297
|
-
local collectibleType = getCollectibleTypeFromArg(nil, collectibleOrCollectibleType, "getCollectibleQuality")
|
|
298
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
299
|
-
if itemConfigItem == nil then
|
|
300
|
-
return 0
|
|
301
|
-
end
|
|
302
|
-
return itemConfigItem.Quality
|
|
303
|
-
end
|
|
304
328
|
--- Helper function to get the tags of a collectible (which is the composition of zero or more
|
|
305
329
|
-- `ItemConfigTag`). Returns 0 if the provided collectible type is not valid.
|
|
306
330
|
--
|
|
@@ -315,6 +339,19 @@ function ____exports.getCollectibleTags(self, collectibleOrCollectibleType)
|
|
|
315
339
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
316
340
|
return itemConfigItem == nil and ItemConfigTagZero or itemConfigItem.Tags
|
|
317
341
|
end
|
|
342
|
+
--- Returns a set containing every vanilla collectible type with the given quality.
|
|
343
|
+
--
|
|
344
|
+
-- Note that this function will only return vanilla collectible types. To handle modded collectible
|
|
345
|
+
-- types, use the `getCollectibleTypesOfQuality` helper function instead.
|
|
346
|
+
function ____exports.getVanillaCollectibleTypesOfQuality(self, quality)
|
|
347
|
+
local collectibleTypes = QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP:get(quality)
|
|
348
|
+
assertDefined(
|
|
349
|
+
nil,
|
|
350
|
+
collectibleTypes,
|
|
351
|
+
"Failed to find the vanilla collectible types corresponding to quality: " .. tostring(quality)
|
|
352
|
+
)
|
|
353
|
+
return collectibleTypes
|
|
354
|
+
end
|
|
318
355
|
--- Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`.
|
|
319
356
|
function ____exports.isActiveCollectible(self, collectibleType)
|
|
320
357
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "51.
|
|
3
|
+
"version": "51.11.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"main": "dist/src/index",
|
|
26
26
|
"types": "dist/index.rollup.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^21.0
|
|
28
|
+
"isaac-typescript-definitions": "^21.1.0"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
ITEM_CONFIG_TAG_VALUES,
|
|
15
15
|
} from "../../../arrays/cachedEnumValues";
|
|
16
16
|
import { itemConfig } from "../../../core/cachedClasses";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
FIRST_GLITCHED_COLLECTIBLE_TYPE,
|
|
19
|
+
QUALITIES,
|
|
20
|
+
} from "../../../core/constants";
|
|
18
21
|
import {
|
|
19
22
|
VANILLA_CARD_TYPES,
|
|
20
23
|
VANILLA_COLLECTIBLE_TYPES,
|
|
@@ -27,6 +30,7 @@ import { getItemConfigCardType } from "../../../functions/cards";
|
|
|
27
30
|
import { collectibleHasTag } from "../../../functions/collectibleTag";
|
|
28
31
|
import {
|
|
29
32
|
collectibleHasCacheFlag,
|
|
33
|
+
getCollectibleQuality,
|
|
30
34
|
isActiveCollectible,
|
|
31
35
|
isHiddenCollectible,
|
|
32
36
|
isPassiveOrFamiliarCollectible,
|
|
@@ -88,6 +92,10 @@ const TRANSFORMATION_TO_TAG_MAP = new ReadonlyMap<PlayerForm, ItemConfigTag>([
|
|
|
88
92
|
export class ModdedElementSets extends Feature {
|
|
89
93
|
private arraysInitialized = false;
|
|
90
94
|
|
|
95
|
+
// ----------------
|
|
96
|
+
// Main collections
|
|
97
|
+
// ----------------
|
|
98
|
+
|
|
91
99
|
private readonly allCollectibleTypesArray: CollectibleType[] = [];
|
|
92
100
|
private readonly allCollectibleTypesSet = new Set<CollectibleType>();
|
|
93
101
|
|
|
@@ -112,6 +120,10 @@ export class ModdedElementSets extends Feature {
|
|
|
112
120
|
private readonly moddedPillEffectsArray: PillEffect[] = [];
|
|
113
121
|
private readonly moddedPillEffectsSet = new Set<PillEffect>();
|
|
114
122
|
|
|
123
|
+
// -----------------
|
|
124
|
+
// Other collections
|
|
125
|
+
// -----------------
|
|
126
|
+
|
|
115
127
|
private readonly cacheFlagToCollectibleTypesMap = new Map<
|
|
116
128
|
CacheFlag,
|
|
117
129
|
Set<CollectibleType>
|
|
@@ -136,6 +148,11 @@ export class ModdedElementSets extends Feature {
|
|
|
136
148
|
private readonly edenActiveCollectibleTypesSet = new Set<CollectibleType>();
|
|
137
149
|
private readonly edenPassiveCollectibleTypesSet = new Set<CollectibleType>();
|
|
138
150
|
|
|
151
|
+
private readonly qualityToCollectibleTypesMap = new Map<
|
|
152
|
+
Quality,
|
|
153
|
+
Set<CollectibleType>
|
|
154
|
+
>();
|
|
155
|
+
|
|
139
156
|
private readonly itemConfigCardTypeToCardTypeMap = new Map<
|
|
140
157
|
ItemConfigCardType,
|
|
141
158
|
Set<CardType>
|
|
@@ -176,6 +193,7 @@ export class ModdedElementSets extends Feature {
|
|
|
176
193
|
this.lazyInitFlyingCollectibleTypesSet();
|
|
177
194
|
this.lazyInitFlyingTrinketTypesSet();
|
|
178
195
|
this.lazyInitEdenCollectibleTypesSet();
|
|
196
|
+
this.lazyInitQualityToCollectibleTypesMap();
|
|
179
197
|
this.lazyInitCardTypes();
|
|
180
198
|
}
|
|
181
199
|
|
|
@@ -327,29 +345,29 @@ export class ModdedElementSets extends Feature {
|
|
|
327
345
|
|
|
328
346
|
private lazyInitCacheFlagToCollectibleTypesMap() {
|
|
329
347
|
for (const cacheFlag of CACHE_FLAG_VALUES) {
|
|
330
|
-
const
|
|
348
|
+
const collectibleTypeSet = new Set<CollectibleType>();
|
|
331
349
|
|
|
332
350
|
for (const collectibleType of this.getCollectibleTypes()) {
|
|
333
351
|
if (collectibleHasCacheFlag(collectibleType, cacheFlag)) {
|
|
334
|
-
|
|
352
|
+
collectibleTypeSet.add(collectibleType);
|
|
335
353
|
}
|
|
336
354
|
}
|
|
337
355
|
|
|
338
|
-
this.cacheFlagToCollectibleTypesMap.set(cacheFlag,
|
|
356
|
+
this.cacheFlagToCollectibleTypesMap.set(cacheFlag, collectibleTypeSet);
|
|
339
357
|
}
|
|
340
358
|
}
|
|
341
359
|
|
|
342
360
|
private lazyInitCacheFlagToTrinketTypesMap() {
|
|
343
361
|
for (const cacheFlag of CACHE_FLAG_VALUES) {
|
|
344
|
-
const
|
|
362
|
+
const trinketTypesSet = new Set<TrinketType>();
|
|
345
363
|
|
|
346
364
|
for (const trinketType of this.getTrinketTypes()) {
|
|
347
365
|
if (trinketHasCacheFlag(trinketType, cacheFlag)) {
|
|
348
|
-
|
|
366
|
+
trinketTypesSet.add(trinketType);
|
|
349
367
|
}
|
|
350
368
|
}
|
|
351
369
|
|
|
352
|
-
this.cacheFlagToTrinketTypesMap.set(cacheFlag,
|
|
370
|
+
this.cacheFlagToTrinketTypesMap.set(cacheFlag, trinketTypesSet);
|
|
353
371
|
}
|
|
354
372
|
}
|
|
355
373
|
|
|
@@ -419,6 +437,21 @@ export class ModdedElementSets extends Feature {
|
|
|
419
437
|
}
|
|
420
438
|
}
|
|
421
439
|
|
|
440
|
+
private lazyInitQualityToCollectibleTypesMap() {
|
|
441
|
+
for (const quality of QUALITIES) {
|
|
442
|
+
const collectibleTypesSet = new Set<CollectibleType>();
|
|
443
|
+
|
|
444
|
+
for (const collectibleType of this.getCollectibleTypes()) {
|
|
445
|
+
const collectibleTypeQuality = getCollectibleQuality(collectibleType);
|
|
446
|
+
if (collectibleTypeQuality === quality) {
|
|
447
|
+
collectibleTypesSet.add(collectibleType);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
this.qualityToCollectibleTypesMap.set(quality, collectibleTypesSet);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
422
455
|
private lazyInitCardTypes() {
|
|
423
456
|
// The card type to cards map should be valid for every card type, so we initialize it with
|
|
424
457
|
// empty sets.
|
|
@@ -1016,7 +1049,7 @@ export class ModdedElementSets extends Feature {
|
|
|
1016
1049
|
}
|
|
1017
1050
|
|
|
1018
1051
|
/**
|
|
1019
|
-
* Returns
|
|
1052
|
+
* Returns an array of collectible types that a player has with a particular tag.
|
|
1020
1053
|
*
|
|
1021
1054
|
* This function can only be called if at least one callback has been executed. This is because
|
|
1022
1055
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
@@ -1074,7 +1107,8 @@ export class ModdedElementSets extends Feature {
|
|
|
1074
1107
|
}
|
|
1075
1108
|
|
|
1076
1109
|
/**
|
|
1077
|
-
* Returns
|
|
1110
|
+
* Returns an array of collectible types that a player has that count towards a particular
|
|
1111
|
+
* transformation.
|
|
1078
1112
|
*
|
|
1079
1113
|
* This function can only be called if at least one callback has been executed. This is because
|
|
1080
1114
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
@@ -1193,6 +1227,65 @@ export class ModdedElementSets extends Feature {
|
|
|
1193
1227
|
);
|
|
1194
1228
|
}
|
|
1195
1229
|
|
|
1230
|
+
// -------------------
|
|
1231
|
+
// Collectible Quality
|
|
1232
|
+
// -------------------
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Returns a set containing every collectible type with the given quality.
|
|
1236
|
+
*
|
|
1237
|
+
* This function can only be called if at least one callback has been executed. This is because
|
|
1238
|
+
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
1239
|
+
* order).
|
|
1240
|
+
*
|
|
1241
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1242
|
+
*/
|
|
1243
|
+
@Exported
|
|
1244
|
+
public getCollectibleTypesOfQuality(
|
|
1245
|
+
quality: Quality,
|
|
1246
|
+
): ReadonlySet<CollectibleType> {
|
|
1247
|
+
this.lazyInit();
|
|
1248
|
+
|
|
1249
|
+
const collectibleTypes = this.qualityToCollectibleTypesMap.get(quality);
|
|
1250
|
+
assertDefined(
|
|
1251
|
+
collectibleTypes,
|
|
1252
|
+
`The quality of ${quality} is not a valid quality.`,
|
|
1253
|
+
);
|
|
1254
|
+
|
|
1255
|
+
return collectibleTypes;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Returns an array of collectible types that a player has that are of a particular quality.
|
|
1260
|
+
*
|
|
1261
|
+
* This function can only be called if at least one callback has been executed. This is because
|
|
1262
|
+
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
1263
|
+
* order).
|
|
1264
|
+
*
|
|
1265
|
+
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1266
|
+
*/
|
|
1267
|
+
@Exported
|
|
1268
|
+
public getPlayerCollectiblesOfQuality(
|
|
1269
|
+
player: EntityPlayer,
|
|
1270
|
+
quality: Quality,
|
|
1271
|
+
): CollectibleType[] {
|
|
1272
|
+
const collectibleTypesOfQuality =
|
|
1273
|
+
this.getCollectibleTypesOfQuality(quality);
|
|
1274
|
+
|
|
1275
|
+
const playerCollectibles: CollectibleType[] = [];
|
|
1276
|
+
for (const collectibleType of getSortedSetValues(
|
|
1277
|
+
collectibleTypesOfQuality,
|
|
1278
|
+
)) {
|
|
1279
|
+
// We specify "true" as the second argument to filter out things like Lilith's Incubus.
|
|
1280
|
+
const numCollectibles = player.GetCollectibleNum(collectibleType, true);
|
|
1281
|
+
repeat(numCollectibles, () => {
|
|
1282
|
+
playerCollectibles.push(collectibleType);
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
return playerCollectibles;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1196
1289
|
// ----------------------
|
|
1197
1290
|
// Item Config Card Types
|
|
1198
1291
|
// ----------------------
|
package/src/core/constants.ts
CHANGED
|
@@ -291,6 +291,13 @@ export const NUM_PILL_COLORS_IN_POOL = NUM_NORMAL_PILL_COLORS;
|
|
|
291
291
|
|
|
292
292
|
export const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
293
293
|
|
|
294
|
+
/**
|
|
295
|
+
* An array representing every valid collectible type quality. Specifically, this is `[0, 1, 2, 3,
|
|
296
|
+
* 4]`.
|
|
297
|
+
*/
|
|
298
|
+
// eslint-disable-next-line isaacscript/require-capital-const-assertions
|
|
299
|
+
export const QUALITIES: readonly Quality[] = [0, 1, 2, 3, 4];
|
|
300
|
+
|
|
294
301
|
export const SECOND_IN_MILLISECONDS = 1000;
|
|
295
302
|
export const MINUTE_IN_MILLISECONDS = 60 * SECOND_IN_MILLISECONDS;
|
|
296
303
|
|
package/src/functions/bitwise.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function arrayToBitFlags<T extends BitFlag | BitFlag128>(
|
|
|
16
16
|
/** Helper function to convert an array of bits to the resulting decimal number. */
|
|
17
17
|
export function convertBinaryToDecimal(bits: int[]): number {
|
|
18
18
|
const bitsString = bits.join("");
|
|
19
|
-
return parseInt(bitsString, 2);
|
|
19
|
+
return Number.parseInt(bitsString, 2);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -15,8 +15,13 @@ import {
|
|
|
15
15
|
RenderMode,
|
|
16
16
|
} from "isaac-typescript-definitions";
|
|
17
17
|
import { game, itemConfig } from "../core/cachedClasses";
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
BLIND_ITEM_PNG_PATH,
|
|
20
|
+
DEFAULT_ITEM_POOL_TYPE,
|
|
21
|
+
QUALITIES,
|
|
22
|
+
} from "../core/constants";
|
|
19
23
|
import { LAST_VANILLA_COLLECTIBLE_TYPE } from "../core/constantsFirstLast";
|
|
24
|
+
import { VANILLA_COLLECTIBLE_TYPES } from "../core/constantsVanilla";
|
|
20
25
|
import {
|
|
21
26
|
COLLECTIBLE_DESCRIPTION_MAP,
|
|
22
27
|
DEFAULT_COLLECTIBLE_DESCRIPTION,
|
|
@@ -31,25 +36,46 @@ import { hasFlag } from "./flag";
|
|
|
31
36
|
import { isCollectible } from "./pickupVariants";
|
|
32
37
|
import { clearSprite, spriteEquals } from "./sprites";
|
|
33
38
|
import { isInteger } from "./types";
|
|
39
|
+
import { assertDefined } from "./utils";
|
|
34
40
|
|
|
35
41
|
const COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2";
|
|
36
42
|
|
|
37
43
|
const DEFAULT_COLLECTIBLE_PRICE = 15;
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
/** Glitched items start at id 4294967295 (the final 32-bit integer) and increment backwards. */
|
|
40
46
|
const GLITCHED_ITEM_THRESHOLD = 4_000_000_000;
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
const QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP: ReadonlyMap<
|
|
49
|
+
Quality,
|
|
50
|
+
Set<CollectibleType>
|
|
51
|
+
> = (() => {
|
|
52
|
+
const qualityToCollectibleTypesMap = new Map<Quality, Set<CollectibleType>>();
|
|
53
|
+
|
|
54
|
+
for (const quality of QUALITIES) {
|
|
55
|
+
const collectibleTypesSet = new Set<CollectibleType>();
|
|
44
56
|
|
|
45
|
-
|
|
57
|
+
for (const collectibleType of VANILLA_COLLECTIBLE_TYPES) {
|
|
58
|
+
const collectibleTypeQuality = getCollectibleQuality(collectibleType);
|
|
59
|
+
if (collectibleTypeQuality === quality) {
|
|
60
|
+
collectibleTypesSet.add(collectibleType);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
qualityToCollectibleTypesMap.set(quality, collectibleTypesSet);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return qualityToCollectibleTypesMap;
|
|
68
|
+
})();
|
|
69
|
+
|
|
70
|
+
/** The `isBlindCollectible` function needs a reference sprite to work properly. */
|
|
71
|
+
const questionMarkSprite = (() => {
|
|
46
72
|
const sprite = Sprite();
|
|
47
73
|
sprite.Load("gfx/005.100_collectible.anm2", false);
|
|
48
74
|
sprite.ReplaceSpritesheet(1, "gfx/items/collectibles/questionmark.png");
|
|
49
75
|
sprite.LoadGraphics();
|
|
50
76
|
|
|
51
77
|
return sprite;
|
|
52
|
-
}
|
|
78
|
+
})();
|
|
53
79
|
|
|
54
80
|
export function clearCollectibleSprite(collectible: EntityPickup): void {
|
|
55
81
|
if (!isCollectible(collectible)) {
|
|
@@ -403,6 +429,25 @@ export function getCollectibleTags(
|
|
|
403
429
|
return itemConfigItem === undefined ? ItemConfigTagZero : itemConfigItem.Tags;
|
|
404
430
|
}
|
|
405
431
|
|
|
432
|
+
/**
|
|
433
|
+
* Returns a set containing every vanilla collectible type with the given quality.
|
|
434
|
+
*
|
|
435
|
+
* Note that this function will only return vanilla collectible types. To handle modded collectible
|
|
436
|
+
* types, use the `getCollectibleTypesOfQuality` helper function instead.
|
|
437
|
+
*/
|
|
438
|
+
export function getVanillaCollectibleTypesOfQuality(
|
|
439
|
+
quality: Quality,
|
|
440
|
+
): ReadonlySet<CollectibleType> {
|
|
441
|
+
const collectibleTypes =
|
|
442
|
+
QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP.get(quality);
|
|
443
|
+
assertDefined(
|
|
444
|
+
collectibleTypes,
|
|
445
|
+
`Failed to find the vanilla collectible types corresponding to quality: ${quality}`,
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
return collectibleTypes;
|
|
449
|
+
}
|
|
450
|
+
|
|
406
451
|
/** Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`. */
|
|
407
452
|
export function isActiveCollectible(collectibleType: CollectibleType): boolean {
|
|
408
453
|
const itemType = getCollectibleItemType(collectibleType);
|