isaacscript-common 84.0.1 → 84.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arrays/cachedEnumValues.js +33 -0
- package/dist/callbackClasses.js +289 -0
- package/dist/callbacks.js +181 -0
- package/dist/classes/DefaultMap.js +171 -0
- package/dist/classes/ModFeature.js +244 -0
- package/dist/classes/ModUpgraded.js +324 -0
- package/dist/classes/callbacks/EntityTakeDmgFilter.js +19 -0
- package/dist/classes/callbacks/EntityTakeDmgPlayer.js +29 -0
- package/dist/classes/callbacks/InputActionFilter.js +24 -0
- package/dist/classes/callbacks/InputActionPlayer.js +37 -0
- package/dist/classes/callbacks/PostAmbushFinished.js +40 -0
- package/dist/classes/callbacks/PostAmbushStarted.js +40 -0
- package/dist/classes/callbacks/PostBombExploded.js +24 -0
- package/dist/classes/callbacks/PostBombInitFilter.js +21 -0
- package/dist/classes/callbacks/PostBombInitLate.js +31 -0
- package/dist/classes/callbacks/PostBombRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostBombUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostBoneSwing.js +53 -0
- package/dist/classes/callbacks/PostCollectibleEmpty.js +50 -0
- package/dist/classes/callbacks/PostCursedTeleport.js +119 -0
- package/dist/classes/callbacks/PostCustomRevive.js +17 -0
- package/dist/classes/callbacks/PostDiceRoomActivated.js +50 -0
- package/dist/classes/callbacks/PostDoorRender.js +24 -0
- package/dist/classes/callbacks/PostDoorUpdate.js +24 -0
- package/dist/classes/callbacks/PostEffectInitFilter.js +21 -0
- package/dist/classes/callbacks/PostEffectInitLate.js +31 -0
- package/dist/classes/callbacks/PostEffectRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostEffectStateChanged.js +34 -0
- package/dist/classes/callbacks/PostEffectUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostEntityKillFilter.js +21 -0
- package/dist/classes/callbacks/PostEsauJr.js +12 -0
- package/dist/classes/callbacks/PostFamiliarInitFilter.js +21 -0
- package/dist/classes/callbacks/PostFamiliarInitLate.js +31 -0
- package/dist/classes/callbacks/PostFamiliarRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostFamiliarStateChanged.js +34 -0
- package/dist/classes/callbacks/PostFamiliarUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostFirstEsauJr.js +12 -0
- package/dist/classes/callbacks/PostFirstFlip.js +12 -0
- package/dist/classes/callbacks/PostFlip.js +12 -0
- package/dist/classes/callbacks/PostGameEndFilter.js +21 -0
- package/dist/classes/callbacks/PostGameStartedReordered.js +14 -0
- package/dist/classes/callbacks/PostGameStartedReorderedLast.js +14 -0
- package/dist/classes/callbacks/PostGreedModeWave.js +35 -0
- package/dist/classes/callbacks/PostGridEntityBroken.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCollision.js +28 -0
- package/dist/classes/callbacks/PostGridEntityCustomBroken.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomCollision.js +24 -0
- package/dist/classes/callbacks/PostGridEntityCustomInit.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomRemove.js +18 -0
- package/dist/classes/callbacks/PostGridEntityCustomRender.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomStateChanged.js +14 -0
- package/dist/classes/callbacks/PostGridEntityCustomUpdate.js +14 -0
- package/dist/classes/callbacks/PostGridEntityInit.js +14 -0
- package/dist/classes/callbacks/PostGridEntityRemove.js +19 -0
- package/dist/classes/callbacks/PostGridEntityRender.js +14 -0
- package/dist/classes/callbacks/PostGridEntityStateChanged.js +14 -0
- package/dist/classes/callbacks/PostGridEntityUpdate.js +14 -0
- package/dist/classes/callbacks/PostHolyMantleRemoved.js +43 -0
- package/dist/classes/callbacks/PostItemDischarge.js +122 -0
- package/dist/classes/callbacks/PostItemPickup.js +14 -0
- package/dist/classes/callbacks/PostKeyboardChanged.js +46 -0
- package/dist/classes/callbacks/PostKnifeInitFilter.js +21 -0
- package/dist/classes/callbacks/PostKnifeInitLate.js +31 -0
- package/dist/classes/callbacks/PostKnifeRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostKnifeUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserInitFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserInitLate.js +31 -0
- package/dist/classes/callbacks/PostLaserRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostLaserUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCDeathFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCInitFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCInitLate.js +31 -0
- package/dist/classes/callbacks/PostNPCRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostNPCStateChanged.js +34 -0
- package/dist/classes/callbacks/PostNPCUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostNewLevelReordered.js +14 -0
- package/dist/classes/callbacks/PostNewRoomEarly.js +74 -0
- package/dist/classes/callbacks/PostNewRoomReordered.js +14 -0
- package/dist/classes/callbacks/PostPEffectUpdateReordered.js +14 -0
- package/dist/classes/callbacks/PostPickupChanged.js +14 -0
- package/dist/classes/callbacks/PostPickupCollect.js +38 -0
- package/dist/classes/callbacks/PostPickupInitFilter.js +21 -0
- package/dist/classes/callbacks/PostPickupInitFirst.js +33 -0
- package/dist/classes/callbacks/PostPickupInitLate.js +31 -0
- package/dist/classes/callbacks/PostPickupRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostPickupSelectionFilter.js +29 -0
- package/dist/classes/callbacks/PostPickupStateChanged.js +34 -0
- package/dist/classes/callbacks/PostPickupUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostPitRender.js +24 -0
- package/dist/classes/callbacks/PostPitUpdate.js +24 -0
- package/dist/classes/callbacks/PostPlayerChangeHealth.js +47 -0
- package/dist/classes/callbacks/PostPlayerChangeStat.js +79 -0
- package/dist/classes/callbacks/PostPlayerChangeType.js +36 -0
- package/dist/classes/callbacks/PostPlayerCollectibleAdded.js +14 -0
- package/dist/classes/callbacks/PostPlayerCollectibleRemoved.js +14 -0
- package/dist/classes/callbacks/PostPlayerFatalDamage.js +83 -0
- package/dist/classes/callbacks/PostPlayerInitFirst.js +41 -0
- package/dist/classes/callbacks/PostPlayerInitLate.js +33 -0
- package/dist/classes/callbacks/PostPlayerRenderReordered.js +14 -0
- package/dist/classes/callbacks/PostPlayerUpdateReordered.js +14 -0
- package/dist/classes/callbacks/PostPoopRender.js +24 -0
- package/dist/classes/callbacks/PostPoopUpdate.js +24 -0
- package/dist/classes/callbacks/PostPressurePlateRender.js +24 -0
- package/dist/classes/callbacks/PostPressurePlateUpdate.js +24 -0
- package/dist/classes/callbacks/PostProjectileInitFilter.js +21 -0
- package/dist/classes/callbacks/PostProjectileInitLate.js +31 -0
- package/dist/classes/callbacks/PostProjectileKill.js +52 -0
- package/dist/classes/callbacks/PostProjectileRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostProjectileUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostPurchase.js +90 -0
- package/dist/classes/callbacks/PostRockRender.js +24 -0
- package/dist/classes/callbacks/PostRockUpdate.js +24 -0
- package/dist/classes/callbacks/PostRoomClearChanged.js +46 -0
- package/dist/classes/callbacks/PostSacrifice.js +36 -0
- package/dist/classes/callbacks/PostSlotAnimationChanged.js +14 -0
- package/dist/classes/callbacks/PostSlotCollision.js +25 -0
- package/dist/classes/callbacks/PostSlotDestroyed.js +14 -0
- package/dist/classes/callbacks/PostSlotInit.js +14 -0
- package/dist/classes/callbacks/PostSlotRender.js +14 -0
- package/dist/classes/callbacks/PostSlotUpdate.js +14 -0
- package/dist/classes/callbacks/PostSpikesRender.js +24 -0
- package/dist/classes/callbacks/PostSpikesUpdate.js +24 -0
- package/dist/classes/callbacks/PostTNTRender.js +24 -0
- package/dist/classes/callbacks/PostTNTUpdate.js +24 -0
- package/dist/classes/callbacks/PostTearInitFilter.js +21 -0
- package/dist/classes/callbacks/PostTearInitLate.js +31 -0
- package/dist/classes/callbacks/PostTearInitVeryLate.js +35 -0
- package/dist/classes/callbacks/PostTearKill.js +52 -0
- package/dist/classes/callbacks/PostTearRenderFilter.js +21 -0
- package/dist/classes/callbacks/PostTearUpdateFilter.js +21 -0
- package/dist/classes/callbacks/PostTransformation.js +47 -0
- package/dist/classes/callbacks/PostTrinketBreak.js +70 -0
- package/dist/classes/callbacks/PostUsePillFilter.js +76 -0
- package/dist/classes/callbacks/PreBerserkDeath.js +41 -0
- package/dist/classes/callbacks/PreBombCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreCustomRevive.js +14 -0
- package/dist/classes/callbacks/PreEntitySpawnFilter.js +24 -0
- package/dist/classes/callbacks/PreFamiliarCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreGetPedestal.js +46 -0
- package/dist/classes/callbacks/PreItemPickup.js +14 -0
- package/dist/classes/callbacks/PreKnifeCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreNPCCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreNPCUpdateFilter.js +19 -0
- package/dist/classes/callbacks/PreNewLevel.js +51 -0
- package/dist/classes/callbacks/PreProjectileCollisionFilter.js +19 -0
- package/dist/classes/callbacks/PreRoomEntitySpawnFilter.js +26 -0
- package/dist/classes/callbacks/PreTearCollisionFilter.js +19 -0
- package/dist/classes/features/callbackLogic/CustomGridEntities.js +359 -0
- package/dist/classes/features/callbackLogic/CustomRevive.js +170 -0
- package/dist/classes/features/callbackLogic/EsauJrDetection.js +70 -0
- package/dist/classes/features/callbackLogic/FlipDetection.js +61 -0
- package/dist/classes/features/callbackLogic/GameReorderedCallbacks.js +220 -0
- package/dist/classes/features/callbackLogic/GridEntityCollisionDetection.js +62 -0
- package/dist/classes/features/callbackLogic/GridEntityRenderDetection.js +35 -0
- package/dist/classes/features/callbackLogic/GridEntityUpdateDetection.js +147 -0
- package/dist/classes/features/callbackLogic/ItemPickupDetection.js +68 -0
- package/dist/classes/features/callbackLogic/PickupChangeDetection.js +43 -0
- package/dist/classes/features/callbackLogic/PlayerCollectibleDetection.js +193 -0
- package/dist/classes/features/callbackLogic/PlayerReorderedCallbacks.js +109 -0
- package/dist/classes/features/callbackLogic/SlotDestroyedDetection.js +95 -0
- package/dist/classes/features/callbackLogic/SlotRenderDetection.js +48 -0
- package/dist/classes/features/callbackLogic/SlotUpdateDetection.js +52 -0
- package/dist/classes/features/other/CharacterHealthConversion.js +112 -0
- package/dist/classes/features/other/CharacterStats.js +68 -0
- package/dist/classes/features/other/CollectibleItemPoolType.js +75 -0
- package/dist/classes/features/other/CustomHotkeys.js +144 -0
- package/dist/classes/features/other/CustomItemPools.js +128 -0
- package/dist/classes/features/other/CustomPickups.js +118 -0
- package/dist/classes/features/other/CustomStages.js +471 -0
- package/dist/classes/features/other/CustomTrapdoors.js +596 -0
- package/dist/classes/features/other/DebugDisplay.js +699 -0
- package/dist/classes/features/other/DeployJSONRoom.js +301 -0
- package/dist/classes/features/other/DisableAllSound.js +90 -0
- package/dist/classes/features/other/DisableInputs.js +249 -0
- package/dist/classes/features/other/EdenStartingStatsHealth.js +197 -0
- package/dist/classes/features/other/ExtraConsoleCommands.js +292 -0
- package/dist/classes/features/other/FadeInRemover.js +67 -0
- package/dist/classes/features/other/FastReset.js +88 -0
- package/dist/classes/features/other/FlyingDetection.js +64 -0
- package/dist/classes/features/other/ForgottenSwitch.js +43 -0
- package/dist/classes/features/other/ItemPoolDetection.js +187 -0
- package/dist/classes/features/other/ModdedElementDetection.js +399 -0
- package/dist/classes/features/other/ModdedElementSets.js +1251 -0
- package/dist/classes/features/other/NoSirenSteal.js +88 -0
- package/dist/classes/features/other/Pause.js +197 -0
- package/dist/classes/features/other/PersistentEntities.js +168 -0
- package/dist/classes/features/other/PickupIndexCreation.js +229 -0
- package/dist/classes/features/other/PlayerCollectibleTracking.js +102 -0
- package/dist/classes/features/other/PonyDetection.js +86 -0
- package/dist/classes/features/other/PressInput.js +71 -0
- package/dist/classes/features/other/PreventChildEntities.js +60 -0
- package/dist/classes/features/other/PreventGridEntityRespawn.js +159 -0
- package/dist/classes/features/other/RerunDetection.js +69 -0
- package/dist/classes/features/other/RoomClearFrame.js +94 -0
- package/dist/classes/features/other/RoomHistory.js +196 -0
- package/dist/classes/features/other/RunInNFrames.js +323 -0
- package/dist/classes/features/other/RunNextRoom.js +53 -0
- package/dist/classes/features/other/RunNextRun.js +60 -0
- package/dist/classes/features/other/SaveDataManager.js +383 -0
- package/dist/classes/features/other/SpawnRockAltRewards.js +469 -0
- package/dist/classes/features/other/StageHistory.js +244 -0
- package/dist/classes/features/other/StartAmbush.js +62 -0
- package/dist/classes/features/other/TaintedLazarusPlayers.js +115 -0
- package/dist/classes/features/other/UnlockAchievementsDetection.js +60 -0
- package/dist/classes/features/other/customStages/backdrop.js +195 -0
- package/dist/classes/features/other/customStages/constants.js +19 -0
- package/dist/classes/features/other/customStages/gridEntities.js +177 -0
- package/dist/classes/features/other/customStages/shadows.js +67 -0
- package/dist/classes/features/other/customStages/streakText.js +222 -0
- package/dist/classes/features/other/customStages/utils.js +65 -0
- package/dist/classes/features/other/customStages/v.js +27 -0
- package/dist/classes/features/other/customStages/versusScreen.js +227 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayBomb.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayDoor.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayEffect.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayFamiliar.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayKnife.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayLaser.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayNPC.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPickup.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPit.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPlayer.js +25 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPoop.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayPressurePlate.js +25 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayProjectile.js +23 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayRock.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplaySlot.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplaySpikes.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayTNT.js +22 -0
- package/dist/classes/features/other/debugDisplay/DebugDisplayTear.js +23 -0
- package/dist/classes/features/other/debugDisplay/utils.js +13 -0
- package/dist/classes/features/other/extraConsoleCommands/commands.js +1598 -0
- package/dist/classes/features/other/extraConsoleCommands/subroutines.js +135 -0
- package/dist/classes/features/other/extraConsoleCommands/v.js +30 -0
- package/dist/classes/features/other/saveDataManager/constants.js +4 -0
- package/dist/classes/features/other/saveDataManager/glowingHourGlass.js +106 -0
- package/dist/classes/features/other/saveDataManager/loadFromDisk.js +69 -0
- package/dist/classes/features/other/saveDataManager/restoreDefaults.js +69 -0
- package/dist/classes/features/other/saveDataManager/saveToDisk.js +46 -0
- package/dist/classes/private/CustomCallback.js +59 -0
- package/dist/classes/private/Feature.js +39 -0
- package/dist/core/cachedClasses.js +61 -0
- package/dist/core/constants.js +289 -0
- package/dist/core/constantsFirstLast.js +98 -0
- package/dist/core/constantsVanilla.js +131 -0
- package/dist/core/upgradeMod.js +71 -0
- package/dist/customStageMetadata.json +1 -0
- package/dist/data/itempools.json +16625 -0
- package/dist/decorators.js +21 -0
- package/dist/enums/AmbushType.js +9 -0
- package/dist/enums/CornerType.js +11 -0
- package/dist/enums/HealthType.js +20 -0
- package/dist/enums/ISCFeature.js +65 -0
- package/dist/enums/LadderSubTypeCustom.js +20 -0
- package/dist/enums/ModCallbackCustom.js +2477 -0
- package/dist/enums/MysteriousPaperEffect.js +16 -0
- package/dist/enums/PlayerStat.js +37 -0
- package/dist/enums/PocketItemType.js +13 -0
- package/dist/enums/RockAltType.js +23 -0
- package/dist/enums/SaveDataKey.js +14 -0
- package/dist/enums/SerializationType.js +10 -0
- package/dist/enums/SlotDestructionType.js +22 -0
- package/dist/enums/private/GridEntityTypeCustom.js +10 -0
- package/dist/enums/private/SerializationBrand.js +42 -0
- package/dist/enums/private/StageTravelState.js +13 -0
- package/dist/enums/private/TrapdoorAnimation.js +9 -0
- package/dist/enums/private/UIStreakAnimation.js +10 -0
- package/dist/features.js +150 -0
- package/dist/functions/ambush.js +26 -0
- package/dist/functions/array.js +586 -0
- package/dist/functions/arrayLua.js +81 -0
- package/dist/functions/benchmark.js +36 -0
- package/dist/functions/bitSet128.js +64 -0
- package/dist/functions/bitwise.js +82 -0
- package/dist/functions/bombs.js +14 -0
- package/dist/functions/bosses.js +238 -0
- package/dist/functions/cards.js +164 -0
- package/dist/functions/challenges.js +117 -0
- package/dist/functions/characters.js +182 -0
- package/dist/functions/charge.js +251 -0
- package/dist/functions/chargeBar.js +54 -0
- package/dist/functions/collectibleTag.js +24 -0
- package/dist/functions/collectibles.js +581 -0
- package/dist/functions/color.js +88 -0
- package/dist/functions/console.js +18 -0
- package/dist/functions/curses.js +37 -0
- package/dist/functions/debugFunctions.js +108 -0
- package/dist/functions/decorators.js +113 -0
- package/dist/functions/deepCopy.js +406 -0
- package/dist/functions/deepCopyTests.js +361 -0
- package/dist/functions/dimensions.js +30 -0
- package/dist/functions/direction.js +78 -0
- package/dist/functions/doors.js +524 -0
- package/dist/functions/easing.js +327 -0
- package/dist/functions/effects.js +14 -0
- package/dist/functions/emptyRoom.js +79 -0
- package/dist/functions/entities.js +529 -0
- package/dist/functions/entitiesSpecific.js +582 -0
- package/dist/functions/entityTypes.js +9 -0
- package/dist/functions/enums.js +244 -0
- package/dist/functions/external.js +59 -0
- package/dist/functions/familiars.js +136 -0
- package/dist/functions/flag.js +146 -0
- package/dist/functions/frames.js +166 -0
- package/dist/functions/globals.js +291 -0
- package/dist/functions/gridEntities.js +990 -0
- package/dist/functions/gridEntitiesSpecific.js +456 -0
- package/dist/functions/gridIndex.js +35 -0
- package/dist/functions/hash.js +75 -0
- package/dist/functions/hex.js +57 -0
- package/dist/functions/input.js +185 -0
- package/dist/functions/isaacAPIClass.js +157 -0
- package/dist/functions/itemPool.js +118 -0
- package/dist/functions/jsonHelpers.js +73 -0
- package/dist/functions/jsonRoom.js +184 -0
- package/dist/functions/kColor.js +89 -0
- package/dist/functions/language.js +16 -0
- package/dist/functions/level.js +66 -0
- package/dist/functions/levelGrid.js +497 -0
- package/dist/functions/log.js +86 -0
- package/dist/functions/logEntities.js +308 -0
- package/dist/functions/logMisc.js +510 -0
- package/dist/functions/map.js +121 -0
- package/dist/functions/math.js +149 -0
- package/dist/functions/merge.js +159 -0
- package/dist/functions/mergeTests.js +313 -0
- package/dist/functions/minimap.js +204 -0
- package/dist/functions/modFeatures.js +39 -0
- package/dist/functions/newArray.js +30 -0
- package/dist/functions/nextStage.js +169 -0
- package/dist/functions/npcDataStructures.js +146 -0
- package/dist/functions/npcs.js +132 -0
- package/dist/functions/pickupVariants.js +63 -0
- package/dist/functions/pickups.js +168 -0
- package/dist/functions/pickupsSpecific.js +376 -0
- package/dist/functions/pills.js +200 -0
- package/dist/functions/playerCenter.js +53 -0
- package/dist/functions/playerCollectibles.js +300 -0
- package/dist/functions/playerDataStructures.js +145 -0
- package/dist/functions/playerEffects.js +63 -0
- package/dist/functions/playerHealth.js +604 -0
- package/dist/functions/playerIndex.js +186 -0
- package/dist/functions/playerTrinkets.js +149 -0
- package/dist/functions/players.js +471 -0
- package/dist/functions/pocketItems.js +165 -0
- package/dist/functions/positionVelocity.js +158 -0
- package/dist/functions/pressurePlate.js +26 -0
- package/dist/functions/projectiles.js +57 -0
- package/dist/functions/random.js +90 -0
- package/dist/functions/readOnly.js +33 -0
- package/dist/functions/render.js +36 -0
- package/dist/functions/revive.js +151 -0
- package/dist/functions/rng.js +140 -0
- package/dist/functions/rockAlt.js +50 -0
- package/dist/functions/roomData.js +155 -0
- package/dist/functions/roomGrid.js +97 -0
- package/dist/functions/roomShape.js +143 -0
- package/dist/functions/roomShapeWalls.js +187 -0
- package/dist/functions/roomTransition.js +43 -0
- package/dist/functions/rooms.js +782 -0
- package/dist/functions/run.js +121 -0
- package/dist/functions/seeds.js +22 -0
- package/dist/functions/serialization.js +98 -0
- package/dist/functions/set.js +215 -0
- package/dist/functions/slots.js +41 -0
- package/dist/functions/sort.js +158 -0
- package/dist/functions/sound.js +45 -0
- package/dist/functions/spawnCollectible.js +112 -0
- package/dist/functions/sprites.js +130 -0
- package/dist/functions/stage.js +540 -0
- package/dist/functions/stats.js +104 -0
- package/dist/functions/storyBosses.js +63 -0
- package/dist/functions/string.js +194 -0
- package/dist/functions/table.js +162 -0
- package/dist/functions/tears.js +128 -0
- package/dist/functions/transformations.js +89 -0
- package/dist/functions/trinketGive.js +145 -0
- package/dist/functions/trinkets.js +213 -0
- package/dist/functions/tstlClass.js +97 -0
- package/dist/functions/types.js +225 -0
- package/dist/functions/ui.js +148 -0
- package/dist/functions/utils.d.ts +2 -0
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +195 -0
- package/dist/functions/utils.lua +4 -1
- package/dist/functions/vector.js +150 -0
- package/dist/functions/versusScreen.js +58 -0
- package/dist/functions/weighted.js +57 -0
- package/dist/index.js +219 -0
- package/dist/index.rollup.d.ts +2 -0
- package/dist/indexLua.js +220 -0
- package/dist/interfaces/ChargeBarSprites.js +2 -0
- package/dist/interfaces/Corner.js +2 -0
- package/dist/interfaces/CustomStageTSConfig.js +2 -0
- package/dist/interfaces/GridEntityCustomData.js +2 -0
- package/dist/interfaces/JSONRoomsFile.js +2 -0
- package/dist/interfaces/PlayerHealth.js +2 -0
- package/dist/interfaces/PlayerStats.js +4 -0
- package/dist/interfaces/PocketItemDescription.js +2 -0
- package/dist/interfaces/RoomDescription.js +2 -0
- package/dist/interfaces/SaveData.js +98 -0
- package/dist/interfaces/StageHistoryEntry.js +2 -0
- package/dist/interfaces/TSTLClassMetatable.js +2 -0
- package/dist/interfaces/TrinketSituation.js +2 -0
- package/dist/interfaces/private/AddCallbackParametersCustom.js +4 -0
- package/dist/interfaces/private/CustomStage.js +2 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.js +2 -0
- package/dist/interfaces/private/ModUpgradedInterface.js +2 -0
- package/dist/isaacscript-common.lua +5 -2
- package/dist/maps/PHDPillConversionsMap.js +23 -0
- package/dist/maps/cardNameToTypeMap.js +211 -0
- package/dist/maps/characterNameToTypeMap.js +91 -0
- package/dist/maps/collectibleNameToTypeMap.js +19 -0
- package/dist/maps/defaultPlayerStatMap.js +17 -0
- package/dist/maps/entityTypeVariantToBossIDMap.js +11 -0
- package/dist/maps/falsePHDPillConversionsMap.js +37 -0
- package/dist/maps/gridEntityTypeToBrokenStateMap.js +32 -0
- package/dist/maps/gridEntityXMLMap.js +133 -0
- package/dist/maps/itemPoolTypeToItemPoolName.js +38 -0
- package/dist/maps/keyboardToStringMap.js +71 -0
- package/dist/maps/pillNameToEffectMap.js +91 -0
- package/dist/maps/roomNameToTypeMap.js +43 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.js +17 -0
- package/dist/maps/transformationNameToPlayerFormMap.js +35 -0
- package/dist/maps/trinketNameToTypeMap.js +19 -0
- package/dist/objects/LRoomShapeToRectangles.js +43 -0
- package/dist/objects/backdropTypeToRockAltType.js +68 -0
- package/dist/objects/batteryNames.js +13 -0
- package/dist/objects/bombNames.js +17 -0
- package/dist/objects/bossIDToEntityTypeVariant.js +228 -0
- package/dist/objects/bossNamePNGFileNames.js +120 -0
- package/dist/objects/bossNames.js +119 -0
- package/dist/objects/bossPortraitPNGFileNames.js +123 -0
- package/dist/objects/cardDescriptions.js +106 -0
- package/dist/objects/cardNames.js +106 -0
- package/dist/objects/challengeBosses.js +60 -0
- package/dist/objects/challengeCharacters.js +58 -0
- package/dist/objects/challengeCollectibleTypes.js +255 -0
- package/dist/objects/challengeNames.js +54 -0
- package/dist/objects/challengeTrinketType.js +58 -0
- package/dist/objects/characterDamageMultipliers.js +49 -0
- package/dist/objects/characterNames.js +48 -0
- package/dist/objects/characterSpritePNGFileNames.js +50 -0
- package/dist/objects/characterStartingCollectibleTypes.js +105 -0
- package/dist/objects/characterStartingTrinketTypes.js +90 -0
- package/dist/objects/chestNames.js +20 -0
- package/dist/objects/coinNames.js +16 -0
- package/dist/objects/coinSubTypeToValue.js +15 -0
- package/dist/objects/collectibleDescriptions.js +742 -0
- package/dist/objects/collectibleNames.js +745 -0
- package/dist/objects/colors.js +26 -0
- package/dist/objects/directionNames.js +11 -0
- package/dist/objects/directionToDegrees.js +11 -0
- package/dist/objects/directionToMoveAction.js +11 -0
- package/dist/objects/directionToShootAction.js +11 -0
- package/dist/objects/directionToVector.js +13 -0
- package/dist/objects/doorSlotFlagToDoorSlot.js +15 -0
- package/dist/objects/doorSlotToDirection.js +15 -0
- package/dist/objects/doorSlotToDoorSlotFlag.js +15 -0
- package/dist/objects/gridEntityTypeToANM2Name.js +37 -0
- package/dist/objects/heartNames.js +21 -0
- package/dist/objects/isaacAPIClassTypeToBrand.js +12 -0
- package/dist/objects/isaacAPIClassTypeToFunctions.js +46 -0
- package/dist/objects/itemPoolTypeToCollectibleTypesSet.js +57 -0
- package/dist/objects/kColors.js +27 -0
- package/dist/objects/keyNames.js +13 -0
- package/dist/objects/languageNames.js +13 -0
- package/dist/objects/oppositeDoorSlots.js +15 -0
- package/dist/objects/pillEffectClasses.js +57 -0
- package/dist/objects/pillEffectNames.js +57 -0
- package/dist/objects/pillEffectTypeToPillEffects.js +23 -0
- package/dist/objects/pillEffectTypes.js +57 -0
- package/dist/objects/playerNamePNGFileNames.js +57 -0
- package/dist/objects/playerPortraitPNGFileNames.js +54 -0
- package/dist/objects/roomShapeBounds.js +48 -0
- package/dist/objects/roomShapeCorners.js +330 -0
- package/dist/objects/roomShapeLayoutSizes.js +41 -0
- package/dist/objects/roomShapeToBottomRightPosition.js +25 -0
- package/dist/objects/roomShapeToDoorSlotCoordinates.js +111 -0
- package/dist/objects/roomShapeToDoorSlots.js +72 -0
- package/dist/objects/roomShapeToDoorSlotsToGridIndexDelta.js +118 -0
- package/dist/objects/roomShapeToGridWidth.js +20 -0
- package/dist/objects/roomShapeToTopLeftPosition.js +26 -0
- package/dist/objects/roomShapeVolumes.js +32 -0
- package/dist/objects/roomTypeNames.js +35 -0
- package/dist/objects/roomTypeSpecialGotoPrefixes.js +35 -0
- package/dist/objects/sackNames.js +11 -0
- package/dist/objects/slotNames.js +26 -0
- package/dist/objects/stageIDNames.js +43 -0
- package/dist/objects/stageToMusic.js +91 -0
- package/dist/objects/stageToStageID.js +117 -0
- package/dist/objects/stageTypeSuffixes.js +14 -0
- package/dist/objects/transformationNames.js +20 -0
- package/dist/objects/trinketDescriptions.js +199 -0
- package/dist/objects/trinketNames.js +202 -0
- package/dist/objects/versusScreenBackgroundColors.js +46 -0
- package/dist/objects/versusScreenDirtSpotColors.js +46 -0
- package/dist/patchErrorFunctions.js +65 -0
- package/dist/serialization.js +21 -0
- package/dist/sets/LRoomShapesSet.js +11 -0
- package/dist/sets/bigRoomShapesSet.js +14 -0
- package/dist/sets/bossSets.js +465 -0
- package/dist/sets/charactersThatStartWithAnActiveItemSet.js +18 -0
- package/dist/sets/charactersWithBlackHeartFromEternalHeartSet.js +9 -0
- package/dist/sets/charactersWithFreeDevilDealsSet.js +6 -0
- package/dist/sets/charactersWithNoRedHeartsSet.js +19 -0
- package/dist/sets/charactersWithNoSoulHeartsSet.js +16 -0
- package/dist/sets/consoleCommandsSet.js +64 -0
- package/dist/sets/entitiesWithArmorSet.js +59 -0
- package/dist/sets/familiarsThatShootPlayerTearsSet.js +15 -0
- package/dist/sets/itemConfigCardTypesForCards.js +14 -0
- package/dist/sets/lostStyleCharactersSet.js +16 -0
- package/dist/sets/mineShaftRoomSubTypesSet.js +12 -0
- package/dist/sets/narrowRoomShapesSet.js +11 -0
- package/dist/sets/poopGridEntityXMLTypesSet.js +16 -0
- package/dist/sets/redHeartSubTypesSet.js +10 -0
- package/dist/sets/repentanceBossIDsSet.js +30 -0
- package/dist/sets/sinEntityTypesSet.js +14 -0
- package/dist/sets/singleUseActiveCollectibleTypesSet.js +15 -0
- package/dist/shaderCrashFix.js +24 -0
- package/dist/shouldFire.js +226 -0
- package/dist/types/AddSubtract.js +2 -0
- package/dist/types/AllButFirst.js +2 -0
- package/dist/types/AllButLast.js +2 -0
- package/dist/types/AnyClass.js +2 -0
- package/dist/types/AnyEntity.js +2 -0
- package/dist/types/AnyFunction.js +2 -0
- package/dist/types/AnyGridEntity.js +2 -0
- package/dist/types/CompositionTypeSatisfiesEnum.js +11 -0
- package/dist/types/ConversionHeartSubType.js +2 -0
- package/dist/types/Decrement.js +2 -0
- package/dist/types/ERange.js +2 -0
- package/dist/types/EntityID.js +2 -0
- package/dist/types/FunctionTuple.js +2 -0
- package/dist/types/GridEntityID.js +2 -0
- package/dist/types/HasFunction.js +2 -0
- package/dist/types/IRange.js +2 -0
- package/dist/types/Immutable.js +2 -0
- package/dist/types/Increment.js +2 -0
- package/dist/types/LowercaseKeys.js +2 -0
- package/dist/types/NaturalNumbersLessThan.js +2 -0
- package/dist/types/NaturalNumbersLessThanOrEqualTo.js +2 -0
- package/dist/types/PickingUpItem.js +44 -0
- package/dist/types/PickupIndex.js +2 -0
- package/dist/types/PlayerIndex.js +2 -0
- package/dist/types/PossibleStatType.js +2 -0
- package/dist/types/PublicInterface.js +2 -0
- package/dist/types/ReadonlyMap.js +6 -0
- package/dist/types/ReadonlyRecord.js +2 -0
- package/dist/types/ReadonlySet.js +6 -0
- package/dist/types/StartsWithLowercase.js +2 -0
- package/dist/types/StartsWithUppercase.js +2 -0
- package/dist/types/TSTLClass.js +2 -0
- package/dist/types/Tuple.js +2 -0
- package/dist/types/TupleKeys.js +2 -0
- package/dist/types/TupleToIntersection.js +2 -0
- package/dist/types/TupleToUnion.js +2 -0
- package/dist/types/TupleWithLengthBetween.js +22 -0
- package/dist/types/TupleWithMaxLength.js +27 -0
- package/dist/types/UnionToIntersection.js +2 -0
- package/dist/types/UppercaseKeys.js +2 -0
- package/dist/types/WeightedArray.js +2 -0
- package/dist/types/WidenLiteral.js +2 -0
- package/dist/types/Writable.js +2 -0
- package/dist/types/private/CallbackTuple.js +2 -0
- package/dist/types/private/ModUpgradedWithFeatures.js +2 -0
- package/package.json +1 -1
- package/src/functions/utils.ts +4 -1
- package/src/lib/jsonLua.js +701 -0
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setCollectiblesRerolledForItemTracker = exports.setCollectibleSubType = exports.setCollectibleSprite = exports.setCollectiblePedestalType = exports.setCollectibleGlitched = exports.setCollectibleEmpty = exports.setCollectibleBlind = exports.removeCollectiblePickupDelay = exports.preventCollectibleRotation = exports.newCollectibleSprite = exports.isVanillaCollectibleType = exports.isValidCollectibleType = exports.isSingleUseCollectible = exports.isQuality = exports.isPassiveOrFamiliarCollectible = exports.isModdedCollectibleType = exports.isHiddenCollectible = exports.isGlitchedCollectible = exports.isFamiliarCollectible = exports.isBlindCollectible = exports.isActiveCollectible = exports.getVanillaCollectibleTypesOfQuality = exports.getCollectibleTags = exports.getCollectibleQuality = exports.getCollectiblePedestalType = exports.getCollectibleName = exports.getCollectibleMaxCharges = exports.getCollectibleItemType = exports.getCollectibleInitCharge = exports.getCollectibleGfxFilename = exports.getCollectibleDevilHeartPrice = exports.getCollectibleDevilCoinPrice = exports.getCollectibleDescription = exports.getCollectibleChargeType = exports.collectibleSpriteEquals = exports.collectibleHasCacheFlag = exports.clearCollectibleSprite = void 0;
|
|
4
|
+
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
|
|
5
|
+
const cachedClasses_1 = require("../core/cachedClasses");
|
|
6
|
+
const constants_1 = require("../core/constants");
|
|
7
|
+
const constantsFirstLast_1 = require("../core/constantsFirstLast");
|
|
8
|
+
const constantsVanilla_1 = require("../core/constantsVanilla");
|
|
9
|
+
const collectibleDescriptions_1 = require("../objects/collectibleDescriptions");
|
|
10
|
+
const collectibleNames_1 = require("../objects/collectibleNames");
|
|
11
|
+
const singleUseActiveCollectibleTypesSet_1 = require("../sets/singleUseActiveCollectibleTypesSet");
|
|
12
|
+
const entities_1 = require("./entities");
|
|
13
|
+
const flag_1 = require("./flag");
|
|
14
|
+
const pickupVariants_1 = require("./pickupVariants");
|
|
15
|
+
const sprites_1 = require("./sprites");
|
|
16
|
+
const types_1 = require("./types");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
18
|
+
const COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2";
|
|
19
|
+
const DEFAULT_COLLECTIBLE_PRICE = 15;
|
|
20
|
+
/** Glitched items start at id 4294967295 (the final 32-bit integer) and increment backwards. */
|
|
21
|
+
const GLITCHED_ITEM_THRESHOLD = 4_000_000_000;
|
|
22
|
+
const QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP = (() => {
|
|
23
|
+
const qualityToCollectibleTypesMap = new Map();
|
|
24
|
+
for (const quality of constants_1.QUALITIES) {
|
|
25
|
+
const collectibleTypes = [];
|
|
26
|
+
for (const collectibleType of constantsVanilla_1.VANILLA_COLLECTIBLE_TYPES) {
|
|
27
|
+
const collectibleTypeQuality = getCollectibleQuality(collectibleType);
|
|
28
|
+
if (collectibleTypeQuality === quality) {
|
|
29
|
+
collectibleTypes.push(collectibleType);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
qualityToCollectibleTypesMap.set(quality, collectibleTypes);
|
|
33
|
+
}
|
|
34
|
+
return qualityToCollectibleTypesMap;
|
|
35
|
+
})();
|
|
36
|
+
/** The `isBlindCollectible` function needs a reference sprite to work properly. */
|
|
37
|
+
const questionMarkSprite = (() => {
|
|
38
|
+
const sprite = Sprite();
|
|
39
|
+
sprite.Load("gfx/005.100_collectible.anm2", false);
|
|
40
|
+
sprite.ReplaceSpritesheet(1, "gfx/items/collectibles/questionmark.png");
|
|
41
|
+
sprite.LoadGraphics();
|
|
42
|
+
return sprite;
|
|
43
|
+
})();
|
|
44
|
+
function clearCollectibleSprite(collectible) {
|
|
45
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
46
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
47
|
+
error(`The "clearCollectibleSprite" function was given a non-collectible: ${entityID}`);
|
|
48
|
+
}
|
|
49
|
+
setCollectibleSprite(collectible, undefined);
|
|
50
|
+
}
|
|
51
|
+
exports.clearCollectibleSprite = clearCollectibleSprite;
|
|
52
|
+
/** Helper function to check in the item config if a given collectible has a given cache flag. */
|
|
53
|
+
function collectibleHasCacheFlag(collectibleOrCollectibleType, cacheFlag) {
|
|
54
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "collectibleHasCacheFlag");
|
|
55
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
56
|
+
if (itemConfigItem === undefined) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return (0, flag_1.hasFlag)(itemConfigItem.CacheFlags, cacheFlag);
|
|
60
|
+
}
|
|
61
|
+
exports.collectibleHasCacheFlag = collectibleHasCacheFlag;
|
|
62
|
+
/** Helper function to check if two collectible sprites have the same sprite sheet loaded. */
|
|
63
|
+
function collectibleSpriteEquals(sprite1, sprite2) {
|
|
64
|
+
// We start at negative 40 texels upwards, as by default we assume a collectible that is sitting
|
|
65
|
+
// on a pedestal. We finish at positive 10 texels downwards, in order to make comparing shop items
|
|
66
|
+
// more accurate.
|
|
67
|
+
const xStart = -1;
|
|
68
|
+
const xFinish = 1;
|
|
69
|
+
const xIncrement = 1;
|
|
70
|
+
const yStart = -40;
|
|
71
|
+
const yFinish = 10;
|
|
72
|
+
const yIncrement = 3;
|
|
73
|
+
return (0, sprites_1.spriteEquals)(sprite1, sprite2, isaac_typescript_definitions_1.CollectibleSpriteLayer.HEAD, xStart, xFinish, xIncrement, yStart, yFinish, yIncrement);
|
|
74
|
+
}
|
|
75
|
+
exports.collectibleSpriteEquals = collectibleSpriteEquals;
|
|
76
|
+
/**
|
|
77
|
+
* Helper function to get the charge type that a collectible has. Returns
|
|
78
|
+
* `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
79
|
+
*/
|
|
80
|
+
function getCollectibleChargeType(collectibleOrCollectibleType) {
|
|
81
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleChargeType");
|
|
82
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
83
|
+
if (itemConfigItem === undefined) {
|
|
84
|
+
return isaac_typescript_definitions_1.ItemConfigChargeType.NORMAL;
|
|
85
|
+
}
|
|
86
|
+
return itemConfigItem.ChargeType;
|
|
87
|
+
}
|
|
88
|
+
exports.getCollectibleChargeType = getCollectibleChargeType;
|
|
89
|
+
/**
|
|
90
|
+
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
91
|
+
* provided collectible type was not valid.
|
|
92
|
+
*
|
|
93
|
+
* This function works for both vanilla and modded collectibles.
|
|
94
|
+
*/
|
|
95
|
+
function getCollectibleDescription(collectibleOrCollectibleType) {
|
|
96
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleDescription");
|
|
97
|
+
// "ItemConfigItem.Description" is bugged with vanilla items on patch v1.7.6, so we use a
|
|
98
|
+
// hard-coded map as a workaround.
|
|
99
|
+
const collectibleDescription = collectibleDescriptions_1.COLLECTIBLE_DESCRIPTIONS[collectibleType];
|
|
100
|
+
if (collectibleDescription !== undefined) {
|
|
101
|
+
return collectibleDescription;
|
|
102
|
+
}
|
|
103
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
104
|
+
if (itemConfigItem !== undefined) {
|
|
105
|
+
return itemConfigItem.Description;
|
|
106
|
+
}
|
|
107
|
+
return collectibleDescriptions_1.DEFAULT_COLLECTIBLE_DESCRIPTION;
|
|
108
|
+
}
|
|
109
|
+
exports.getCollectibleDescription = getCollectibleDescription;
|
|
110
|
+
/**
|
|
111
|
+
* Helper function to get the coin cost that a collectible item would be if it were being offered in
|
|
112
|
+
* a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
|
|
113
|
+
*/
|
|
114
|
+
function getCollectibleDevilCoinPrice(collectibleOrCollectibleType) {
|
|
115
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleDescription");
|
|
116
|
+
if (collectibleType === isaac_typescript_definitions_1.CollectibleType.NULL) {
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
120
|
+
if (itemConfigItem === undefined) {
|
|
121
|
+
return DEFAULT_COLLECTIBLE_PRICE;
|
|
122
|
+
}
|
|
123
|
+
return itemConfigItem.DevilPrice * DEFAULT_COLLECTIBLE_PRICE;
|
|
124
|
+
}
|
|
125
|
+
exports.getCollectibleDevilCoinPrice = getCollectibleDevilCoinPrice;
|
|
126
|
+
/**
|
|
127
|
+
* Helper function to get the heart cost that a collectible item would be if it were being offered
|
|
128
|
+
* in a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
|
|
129
|
+
*/
|
|
130
|
+
function getCollectibleDevilHeartPrice(collectibleOrCollectibleType, player) {
|
|
131
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleDevilHeartPrice");
|
|
132
|
+
const maxHearts = player.GetMaxHearts();
|
|
133
|
+
if (collectibleType === isaac_typescript_definitions_1.CollectibleType.NULL) {
|
|
134
|
+
return 0;
|
|
135
|
+
}
|
|
136
|
+
if (maxHearts === 0) {
|
|
137
|
+
return isaac_typescript_definitions_1.PickupPrice.THREE_SOUL_HEARTS;
|
|
138
|
+
}
|
|
139
|
+
const defaultCollectiblePrice = isaac_typescript_definitions_1.PickupPrice.ONE_HEART;
|
|
140
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
141
|
+
if (itemConfigItem === undefined) {
|
|
142
|
+
return defaultCollectiblePrice;
|
|
143
|
+
}
|
|
144
|
+
const twoHeartPrice = maxHearts === 2
|
|
145
|
+
? isaac_typescript_definitions_1.PickupPrice.ONE_HEART_AND_TWO_SOUL_HEARTS
|
|
146
|
+
: isaac_typescript_definitions_1.PickupPrice.TWO_HEARTS;
|
|
147
|
+
return itemConfigItem.DevilPrice === 2
|
|
148
|
+
? twoHeartPrice
|
|
149
|
+
: isaac_typescript_definitions_1.PickupPrice.ONE_HEART;
|
|
150
|
+
}
|
|
151
|
+
exports.getCollectibleDevilHeartPrice = getCollectibleDevilHeartPrice;
|
|
152
|
+
/**
|
|
153
|
+
* Helper function to get the path to a collectible PNG file. Returns the path to the question mark
|
|
154
|
+
* sprite (i.e. from Curse of the Blind) if the provided collectible type was not valid.
|
|
155
|
+
*
|
|
156
|
+
* If you intentionally want the path to the question mark sprite, pass -1 as the collectible type.
|
|
157
|
+
*
|
|
158
|
+
* Note that this does not return the file name, but the full path to the collectible's PNG file.
|
|
159
|
+
* The function is named "GfxFilename" to correspond to the associated `ItemConfigItem.GfxFileName`
|
|
160
|
+
* field.
|
|
161
|
+
*/
|
|
162
|
+
function getCollectibleGfxFilename(collectibleOrCollectibleType) {
|
|
163
|
+
if (collectibleOrCollectibleType === -1) {
|
|
164
|
+
return constants_1.BLIND_ITEM_PNG_PATH;
|
|
165
|
+
}
|
|
166
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleGfxFilename");
|
|
167
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
168
|
+
if (itemConfigItem === undefined) {
|
|
169
|
+
return constants_1.BLIND_ITEM_PNG_PATH;
|
|
170
|
+
}
|
|
171
|
+
return itemConfigItem.GfxFileName;
|
|
172
|
+
}
|
|
173
|
+
exports.getCollectibleGfxFilename = getCollectibleGfxFilename;
|
|
174
|
+
/**
|
|
175
|
+
* Helper function to get the initial amount of charges that a collectible has. In most cases, when
|
|
176
|
+
* picking up an active collectible for the first time, it will be fully charged, which corresponds
|
|
177
|
+
* to an `InitCharge` value of -1. However, in some cases, this may be different. For example,
|
|
178
|
+
* Eden's Soul starts without any charges, so it has an `InitCharge` value of 0.
|
|
179
|
+
*
|
|
180
|
+
* This function returns 0 if the provided collectible type was not valid. This function returns -1
|
|
181
|
+
* if the provided collectible type was not an active collectible.
|
|
182
|
+
*/
|
|
183
|
+
function getCollectibleInitCharge(collectibleOrCollectibleType) {
|
|
184
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleInitCharge");
|
|
185
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
186
|
+
if (itemConfigItem === undefined) {
|
|
187
|
+
return 0;
|
|
188
|
+
}
|
|
189
|
+
return itemConfigItem.InitCharge;
|
|
190
|
+
}
|
|
191
|
+
exports.getCollectibleInitCharge = getCollectibleInitCharge;
|
|
192
|
+
/**
|
|
193
|
+
* Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
|
|
194
|
+
* provided collectible type was not valid.
|
|
195
|
+
*/
|
|
196
|
+
function getCollectibleItemType(collectibleOrCollectibleType) {
|
|
197
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleItemType");
|
|
198
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
199
|
+
if (itemConfigItem === undefined) {
|
|
200
|
+
return isaac_typescript_definitions_1.ItemType.NULL;
|
|
201
|
+
}
|
|
202
|
+
return itemConfigItem.Type;
|
|
203
|
+
}
|
|
204
|
+
exports.getCollectibleItemType = getCollectibleItemType;
|
|
205
|
+
/**
|
|
206
|
+
* Helper function to get the maximum amount of charges that a collectible has. Returns 0 if the
|
|
207
|
+
* provided collectible type was not valid.
|
|
208
|
+
*/
|
|
209
|
+
function getCollectibleMaxCharges(collectibleOrCollectibleType) {
|
|
210
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleMaxCharges");
|
|
211
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
212
|
+
if (itemConfigItem === undefined) {
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
return itemConfigItem.MaxCharges;
|
|
216
|
+
}
|
|
217
|
+
exports.getCollectibleMaxCharges = getCollectibleMaxCharges;
|
|
218
|
+
/**
|
|
219
|
+
* Helper function to get the name of a collectible. Returns "Unknown" if the provided collectible
|
|
220
|
+
* type is not valid.
|
|
221
|
+
*
|
|
222
|
+
* This function works for both vanilla and modded collectibles.
|
|
223
|
+
*
|
|
224
|
+
* For example, `getCollectibleName(CollectibleType.SAD_ONION)` would return "Sad Onion".
|
|
225
|
+
*/
|
|
226
|
+
function getCollectibleName(collectibleOrCollectibleType) {
|
|
227
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleName");
|
|
228
|
+
// "ItemConfigItem.Name" is bugged with vanilla items on patch v1.7.6, so we use a hard-coded map
|
|
229
|
+
// as a workaround.
|
|
230
|
+
const collectibleName = collectibleNames_1.COLLECTIBLE_NAMES[collectibleType];
|
|
231
|
+
if (collectibleName !== undefined) {
|
|
232
|
+
return collectibleName;
|
|
233
|
+
}
|
|
234
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
235
|
+
if (itemConfigItem !== undefined) {
|
|
236
|
+
return itemConfigItem.Name;
|
|
237
|
+
}
|
|
238
|
+
return collectibleNames_1.DEFAULT_COLLECTIBLE_NAME;
|
|
239
|
+
}
|
|
240
|
+
exports.getCollectibleName = getCollectibleName;
|
|
241
|
+
/**
|
|
242
|
+
* Helper function to get the "pedestal type" of a collectible. For example, it might be sitting on
|
|
243
|
+
* top of a broken Blood Donation Machine, or it might be sitting on top of an opened Spiked Chest.
|
|
244
|
+
*/
|
|
245
|
+
function getCollectiblePedestalType(collectible) {
|
|
246
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
247
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
248
|
+
error(`The "getCollectiblePedestalType" function was given a non-collectible: ${entityID}`);
|
|
249
|
+
}
|
|
250
|
+
const sprite = collectible.GetSprite();
|
|
251
|
+
return sprite.GetOverlayFrame();
|
|
252
|
+
}
|
|
253
|
+
exports.getCollectiblePedestalType = getCollectiblePedestalType;
|
|
254
|
+
/**
|
|
255
|
+
* Helper function to get a collectible's quality, which ranges from 0 to 4 (inclusive). For
|
|
256
|
+
* example, Mom's Knife has a quality of 4. Returns 0 if the provided collectible type was not
|
|
257
|
+
* valid.
|
|
258
|
+
*/
|
|
259
|
+
function getCollectibleQuality(collectibleOrCollectibleType) {
|
|
260
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleQuality");
|
|
261
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
262
|
+
if (itemConfigItem === undefined) {
|
|
263
|
+
return 0;
|
|
264
|
+
}
|
|
265
|
+
return itemConfigItem.Quality;
|
|
266
|
+
}
|
|
267
|
+
exports.getCollectibleQuality = getCollectibleQuality;
|
|
268
|
+
/**
|
|
269
|
+
* Helper function to get the tags of a collectible (which is the composition of zero or more
|
|
270
|
+
* `ItemConfigTag`). Returns 0 if the provided collectible type is not valid.
|
|
271
|
+
*
|
|
272
|
+
* For example:
|
|
273
|
+
*
|
|
274
|
+
* ```ts
|
|
275
|
+
* const collectibleType = CollectibleType.SAD_ONION;
|
|
276
|
+
* const itemConfigTags = getCollectibleTags(collectibleType); // itemConfigTags is "18350080"
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
function getCollectibleTags(collectibleOrCollectibleType) {
|
|
280
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "getCollectibleTags");
|
|
281
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
282
|
+
return itemConfigItem === undefined ? isaac_typescript_definitions_1.ItemConfigTagZero : itemConfigItem.Tags;
|
|
283
|
+
}
|
|
284
|
+
exports.getCollectibleTags = getCollectibleTags;
|
|
285
|
+
/**
|
|
286
|
+
* Returns an array containing every vanilla collectible type with the given quality.
|
|
287
|
+
*
|
|
288
|
+
* Note that this function will only return vanilla collectible types. To handle modded collectible
|
|
289
|
+
* types, use the `getCollectibleTypesOfQuality` helper function instead.
|
|
290
|
+
*/
|
|
291
|
+
function getVanillaCollectibleTypesOfQuality(quality) {
|
|
292
|
+
const collectibleTypes = QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP.get(quality);
|
|
293
|
+
(0, utils_1.assertDefined)(collectibleTypes, `Failed to find the vanilla collectible types corresponding to quality: ${quality}`);
|
|
294
|
+
return collectibleTypes;
|
|
295
|
+
}
|
|
296
|
+
exports.getVanillaCollectibleTypesOfQuality = getVanillaCollectibleTypesOfQuality;
|
|
297
|
+
/** Returns true if the item type in the item config is equal to `ItemType.ACTIVE`. */
|
|
298
|
+
function isActiveCollectible(collectibleType) {
|
|
299
|
+
const itemType = getCollectibleItemType(collectibleType);
|
|
300
|
+
return itemType === isaac_typescript_definitions_1.ItemType.ACTIVE;
|
|
301
|
+
}
|
|
302
|
+
exports.isActiveCollectible = isActiveCollectible;
|
|
303
|
+
/**
|
|
304
|
+
* Returns true if the collectible has a red question mark sprite.
|
|
305
|
+
*
|
|
306
|
+
* Note that this function will not work properly in a render callback with the `RenderMode` set to
|
|
307
|
+
* `RenderMode.WATER_REFLECT`. If this is detected, this function will throw a run-time error.
|
|
308
|
+
*/
|
|
309
|
+
function isBlindCollectible(collectible) {
|
|
310
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
311
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
312
|
+
error(`The "isBlindCollectible" function was given a non-collectible: ${entityID}`);
|
|
313
|
+
}
|
|
314
|
+
const room = cachedClasses_1.game.GetRoom();
|
|
315
|
+
const renderMode = room.GetRenderMode();
|
|
316
|
+
if (renderMode === isaac_typescript_definitions_1.RenderMode.WATER_REFLECT) {
|
|
317
|
+
error('The "isBlindCollectible" function will not work properly in a render callback with the render mode equal to "RenderMode.WATER_REFLECT". Make sure that you properly account for this case if you are calling this function in a render callback.');
|
|
318
|
+
}
|
|
319
|
+
const sprite = collectible.GetSprite();
|
|
320
|
+
const animation = sprite.GetAnimation();
|
|
321
|
+
const frame = sprite.GetFrame();
|
|
322
|
+
questionMarkSprite.SetFrame(animation, frame);
|
|
323
|
+
return collectibleSpriteEquals(sprite, questionMarkSprite);
|
|
324
|
+
}
|
|
325
|
+
exports.isBlindCollectible = isBlindCollectible;
|
|
326
|
+
/** Returns true if the item type in the item config is equal to `ItemType.FAMILIAR`. */
|
|
327
|
+
function isFamiliarCollectible(collectibleType) {
|
|
328
|
+
const itemType = getCollectibleItemType(collectibleType);
|
|
329
|
+
return itemType === isaac_typescript_definitions_1.ItemType.FAMILIAR;
|
|
330
|
+
}
|
|
331
|
+
exports.isFamiliarCollectible = isFamiliarCollectible;
|
|
332
|
+
/**
|
|
333
|
+
* Returns whether the given collectible is a "glitched" item. All items are replaced by glitched
|
|
334
|
+
* items once a player has TMTRAINER. However, glitched items can also "naturally" appear in secret
|
|
335
|
+
* rooms and I AM ERROR rooms if the "Corrupted Data" achievement is unlocked.
|
|
336
|
+
*
|
|
337
|
+
* Under the hood, this checks if the sub-type of the collectible is greater than 4,000,000,000.
|
|
338
|
+
*/
|
|
339
|
+
function isGlitchedCollectible(collectible) {
|
|
340
|
+
return (collectible.Variant === isaac_typescript_definitions_1.PickupVariant.COLLECTIBLE &&
|
|
341
|
+
collectible.SubType > GLITCHED_ITEM_THRESHOLD);
|
|
342
|
+
}
|
|
343
|
+
exports.isGlitchedCollectible = isGlitchedCollectible;
|
|
344
|
+
/**
|
|
345
|
+
* Returns true if the collectible has the "Hidden" attribute in the item config.
|
|
346
|
+
*
|
|
347
|
+
* Hidden collectibles will not show up in any pools and Eden will not start with them.
|
|
348
|
+
*/
|
|
349
|
+
function isHiddenCollectible(collectibleOrCollectibleType) {
|
|
350
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "isHiddenCollectible");
|
|
351
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(collectibleType);
|
|
352
|
+
return itemConfigItem !== undefined && itemConfigItem.Hidden;
|
|
353
|
+
}
|
|
354
|
+
exports.isHiddenCollectible = isHiddenCollectible;
|
|
355
|
+
function isModdedCollectibleType(collectibleType) {
|
|
356
|
+
return !isVanillaCollectibleType(collectibleType);
|
|
357
|
+
}
|
|
358
|
+
exports.isModdedCollectibleType = isModdedCollectibleType;
|
|
359
|
+
/**
|
|
360
|
+
* Returns true if the item type in the item config is equal to `ItemType.ITEM_PASSIVE` or
|
|
361
|
+
* `ItemType.ITEM_FAMILIAR`.
|
|
362
|
+
*/
|
|
363
|
+
function isPassiveOrFamiliarCollectible(collectibleOrCollectibleType) {
|
|
364
|
+
const collectibleType = getCollectibleTypeFromArg(collectibleOrCollectibleType, "isPassiveCollectible");
|
|
365
|
+
const itemType = getCollectibleItemType(collectibleType);
|
|
366
|
+
return itemType === isaac_typescript_definitions_1.ItemType.PASSIVE || itemType === isaac_typescript_definitions_1.ItemType.FAMILIAR;
|
|
367
|
+
}
|
|
368
|
+
exports.isPassiveOrFamiliarCollectible = isPassiveOrFamiliarCollectible;
|
|
369
|
+
/** Helper function to check if a collectible type is a particular quality. */
|
|
370
|
+
function isQuality(collectibleOrCollectibleType, quality) {
|
|
371
|
+
const actualQuality = getCollectibleQuality(collectibleOrCollectibleType);
|
|
372
|
+
return quality === actualQuality;
|
|
373
|
+
}
|
|
374
|
+
exports.isQuality = isQuality;
|
|
375
|
+
/**
|
|
376
|
+
* Helper function to determine if a particular collectible will disappear from the player's
|
|
377
|
+
* inventory upon use. Note that this will not work will modded collectibles, as there is no way to
|
|
378
|
+
* dynamically know if a modded collectible will disappear.
|
|
379
|
+
*/
|
|
380
|
+
function isSingleUseCollectible(collectibleType) {
|
|
381
|
+
return singleUseActiveCollectibleTypesSet_1.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET.has(collectibleType);
|
|
382
|
+
}
|
|
383
|
+
exports.isSingleUseCollectible = isSingleUseCollectible;
|
|
384
|
+
function isValidCollectibleType(collectibleType) {
|
|
385
|
+
const potentialCollectibleType = (0, types_1.asCollectibleType)(collectibleType);
|
|
386
|
+
const itemConfigItem = cachedClasses_1.itemConfig.GetCollectible(potentialCollectibleType);
|
|
387
|
+
return itemConfigItem !== undefined;
|
|
388
|
+
}
|
|
389
|
+
exports.isValidCollectibleType = isValidCollectibleType;
|
|
390
|
+
function isVanillaCollectibleType(collectibleType) {
|
|
391
|
+
return collectibleType <= constantsFirstLast_1.LAST_VANILLA_COLLECTIBLE_TYPE;
|
|
392
|
+
}
|
|
393
|
+
exports.isVanillaCollectibleType = isVanillaCollectibleType;
|
|
394
|
+
/**
|
|
395
|
+
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
396
|
+
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
397
|
+
*
|
|
398
|
+
* If you intentionally want a question mark sprite, pass -1 as the collectible type.
|
|
399
|
+
*/
|
|
400
|
+
function newCollectibleSprite(collectibleType) {
|
|
401
|
+
const sprite = Sprite();
|
|
402
|
+
sprite.Load(COLLECTIBLE_ANM2_PATH, false);
|
|
403
|
+
// We want to clear the pedestal layers so that the returned sprite only has the collectible
|
|
404
|
+
// image. We can't use the `Sprite.Reset` method for this purpose because that would unload the
|
|
405
|
+
// anm2 file.
|
|
406
|
+
(0, sprites_1.clearSprite)(sprite);
|
|
407
|
+
const gfxFileName = getCollectibleGfxFilename(collectibleType);
|
|
408
|
+
sprite.ReplaceSpritesheet(isaac_typescript_definitions_1.CollectibleSpriteLayer.HEAD, gfxFileName);
|
|
409
|
+
sprite.LoadGraphics();
|
|
410
|
+
const defaultAnimation = sprite.GetDefaultAnimation();
|
|
411
|
+
sprite.Play(defaultAnimation, true);
|
|
412
|
+
return sprite;
|
|
413
|
+
}
|
|
414
|
+
exports.newCollectibleSprite = newCollectibleSprite;
|
|
415
|
+
/**
|
|
416
|
+
* Helper function to remove the rotation behavior from a collectible. This will happen by default
|
|
417
|
+
* when collectibles are spawned when playing as Tainted Isaac or when having Binge Eater.
|
|
418
|
+
*
|
|
419
|
+
* Under the hood, this is accomplished by morphing the collectible with the `ignoreModifiers`
|
|
420
|
+
* argument set to true.
|
|
421
|
+
*/
|
|
422
|
+
function preventCollectibleRotation(collectible) {
|
|
423
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
424
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
425
|
+
error(`The "preventCollectibleRotation" function was given a non-collectible: ${entityID}`);
|
|
426
|
+
}
|
|
427
|
+
collectible.Morph(collectible.Type, collectible.Variant, collectible.SubType, true, true, true);
|
|
428
|
+
}
|
|
429
|
+
exports.preventCollectibleRotation = preventCollectibleRotation;
|
|
430
|
+
/**
|
|
431
|
+
* Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
|
|
432
|
+
* frame delay before they can be picked up by a player.
|
|
433
|
+
*/
|
|
434
|
+
function removeCollectiblePickupDelay(collectible) {
|
|
435
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
436
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
437
|
+
error(`The "removeCollectiblePickupDelay" function was given a non-collectible: ${entityID}`);
|
|
438
|
+
}
|
|
439
|
+
collectible.Wait = 0;
|
|
440
|
+
}
|
|
441
|
+
exports.removeCollectiblePickupDelay = removeCollectiblePickupDelay;
|
|
442
|
+
/**
|
|
443
|
+
* Helper function to set a collectible sprite to a question mark (i.e. how collectibles look when
|
|
444
|
+
* the player has Curse of the Blind).
|
|
445
|
+
*/
|
|
446
|
+
function setCollectibleBlind(collectible) {
|
|
447
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
448
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
449
|
+
error(`The "setCollectibleBlind" function was given a non-collectible: ${entityID}`);
|
|
450
|
+
}
|
|
451
|
+
setCollectibleSprite(collectible, constants_1.BLIND_ITEM_PNG_PATH);
|
|
452
|
+
}
|
|
453
|
+
exports.setCollectibleBlind = setCollectibleBlind;
|
|
454
|
+
/**
|
|
455
|
+
* Helper function to remove the collectible from a collectible pedestal and make it appear as if a
|
|
456
|
+
* player has already taken the item. This is accomplished by changing the sub-type to
|
|
457
|
+
* `CollectibleType.NULL` and then setting the sprite to an empty/missing PNG file.
|
|
458
|
+
*
|
|
459
|
+
* For more information, see the documentation for the "clearSprite" helper function.
|
|
460
|
+
*/
|
|
461
|
+
function setCollectibleEmpty(collectible) {
|
|
462
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
463
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
464
|
+
error(`The "setCollectibleEmpty" function was given a non-collectible: ${entityID}`);
|
|
465
|
+
}
|
|
466
|
+
collectible.SubType = isaac_typescript_definitions_1.CollectibleType.NULL;
|
|
467
|
+
clearCollectibleSprite(collectible);
|
|
468
|
+
}
|
|
469
|
+
exports.setCollectibleEmpty = setCollectibleEmpty;
|
|
470
|
+
/**
|
|
471
|
+
* Helper function to change a collectible into a "glitched" item (like the ones that appear when
|
|
472
|
+
* the player has TMTRAINER).
|
|
473
|
+
*/
|
|
474
|
+
function setCollectibleGlitched(collectible) {
|
|
475
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
476
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
477
|
+
error(`The "setCollectibleGlitched" function was given a non-collectible: ${entityID}`);
|
|
478
|
+
}
|
|
479
|
+
// We need to generate a new glitched item. Thus, we temporarily give the player TMTRAINER, if
|
|
480
|
+
// necessary.
|
|
481
|
+
const player = Isaac.GetPlayer();
|
|
482
|
+
const hasTMTRAINER = player.HasCollectible(isaac_typescript_definitions_1.CollectibleType.TMTRAINER);
|
|
483
|
+
if (!hasTMTRAINER) {
|
|
484
|
+
player.AddCollectible(isaac_typescript_definitions_1.CollectibleType.TMTRAINER, 0, false);
|
|
485
|
+
}
|
|
486
|
+
const itemPool = cachedClasses_1.game.GetItemPool();
|
|
487
|
+
const collectibleType = itemPool.GetCollectible(constants_1.DEFAULT_ITEM_POOL_TYPE);
|
|
488
|
+
setCollectibleSubType(collectible, collectibleType);
|
|
489
|
+
if (!hasTMTRAINER) {
|
|
490
|
+
player.RemoveCollectible(isaac_typescript_definitions_1.CollectibleType.TMTRAINER);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
exports.setCollectibleGlitched = setCollectibleGlitched;
|
|
494
|
+
/**
|
|
495
|
+
* Helper function to set the "pedestal type" of a collectible. For example, it might be sitting on
|
|
496
|
+
* top of a broken Blood Donation Machine and you want to change it to be sitting on top of an
|
|
497
|
+
* opened Spiked Chest.
|
|
498
|
+
*/
|
|
499
|
+
function setCollectiblePedestalType(collectible, collectiblePedestalType) {
|
|
500
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
501
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
502
|
+
error(`The "setCollectiblePedestalType" function was given a non-collectible: ${entityID}`);
|
|
503
|
+
}
|
|
504
|
+
const sprite = collectible.GetSprite();
|
|
505
|
+
const overlayAnimation = sprite.GetOverlayAnimation();
|
|
506
|
+
sprite.SetOverlayFrame(overlayAnimation, collectiblePedestalType);
|
|
507
|
+
}
|
|
508
|
+
exports.setCollectiblePedestalType = setCollectiblePedestalType;
|
|
509
|
+
/**
|
|
510
|
+
* Helper function to change the sprite of a collectible pedestal entity.
|
|
511
|
+
*
|
|
512
|
+
* For more information about removing the collectible sprite, see the documentation for the
|
|
513
|
+
* "clearSprite" helper function.
|
|
514
|
+
*
|
|
515
|
+
* @param collectible The collectible whose sprite you want to modify.
|
|
516
|
+
* @param pngPath Equal to either the spritesheet path to load (e.g.
|
|
517
|
+
* "gfx/items/collectibles/collectibles_001_thesadonion.png") or undefined. If
|
|
518
|
+
* undefined, the sprite will be removed, making it appear like the collectible has
|
|
519
|
+
* already been taken by the player.
|
|
520
|
+
*/
|
|
521
|
+
function setCollectibleSprite(collectible, pngPath) {
|
|
522
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
523
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
524
|
+
error(`The "setCollectibleSprite" function was given a non-collectible: ${entityID}`);
|
|
525
|
+
}
|
|
526
|
+
const sprite = collectible.GetSprite();
|
|
527
|
+
if (pngPath === undefined) {
|
|
528
|
+
// We want to remove the little circle that appears on top of the pedestal, which is why we also
|
|
529
|
+
// clear `CollectibleSpriteLayer.ITEM_SHADOW`.
|
|
530
|
+
(0, sprites_1.clearSprite)(sprite, isaac_typescript_definitions_1.CollectibleSpriteLayer.HEAD, isaac_typescript_definitions_1.CollectibleSpriteLayer.ITEM_SHADOW);
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
sprite.ReplaceSpritesheet(isaac_typescript_definitions_1.CollectibleSpriteLayer.HEAD, pngPath);
|
|
534
|
+
sprite.LoadGraphics();
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
exports.setCollectibleSprite = setCollectibleSprite;
|
|
538
|
+
/**
|
|
539
|
+
* Helper function to change the collectible on a pedestal. Simply updating the `SubType` field is
|
|
540
|
+
* not sufficient because the sprite will not change.
|
|
541
|
+
*/
|
|
542
|
+
function setCollectibleSubType(collectible, newCollectibleType) {
|
|
543
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
544
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
545
|
+
error(`The "setCollectibleSubType" function was given a non-collectible: ${entityID}`);
|
|
546
|
+
}
|
|
547
|
+
// You cannot morph a pedestal to "CollectibleType.NULL"; it would instead create a new random
|
|
548
|
+
// collectible item.
|
|
549
|
+
if (newCollectibleType === isaac_typescript_definitions_1.CollectibleType.NULL) {
|
|
550
|
+
setCollectibleEmpty(collectible);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
// The naive way to change a collectible's sub-type is to set it directly. However, doing this
|
|
554
|
+
// will not update the sprite. Manually updating the sprite works in most situations, but does not
|
|
555
|
+
// work when the pedestal is empty. Instead, we can simply morph the collectible, which seems to
|
|
556
|
+
// work in all situations.
|
|
557
|
+
collectible.Morph(isaac_typescript_definitions_1.EntityType.PICKUP, isaac_typescript_definitions_1.PickupVariant.COLLECTIBLE, newCollectibleType, true, true, true);
|
|
558
|
+
}
|
|
559
|
+
exports.setCollectibleSubType = setCollectibleSubType;
|
|
560
|
+
/**
|
|
561
|
+
* Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that
|
|
562
|
+
* the build has been rerolled.
|
|
563
|
+
*/
|
|
564
|
+
function setCollectiblesRerolledForItemTracker() {
|
|
565
|
+
// This cannot use the "log" function since the prefix will prevent the Rebirth Item Tracker from
|
|
566
|
+
// recognizing the message. The number here does not matter since the tracker does not check for a
|
|
567
|
+
// specific number.
|
|
568
|
+
Isaac.DebugString("Added 3 Collectibles");
|
|
569
|
+
}
|
|
570
|
+
exports.setCollectiblesRerolledForItemTracker = setCollectiblesRerolledForItemTracker;
|
|
571
|
+
function getCollectibleTypeFromArg(collectibleOrCollectibleType, functionName) {
|
|
572
|
+
if ((0, types_1.isInteger)(collectibleOrCollectibleType)) {
|
|
573
|
+
return collectibleOrCollectibleType;
|
|
574
|
+
}
|
|
575
|
+
const collectible = collectibleOrCollectibleType;
|
|
576
|
+
if (!(0, pickupVariants_1.isCollectible)(collectible)) {
|
|
577
|
+
const entityID = (0, entities_1.getEntityID)(collectible);
|
|
578
|
+
error(`The "${functionName}" function was given a non-collectible: ${entityID}`);
|
|
579
|
+
}
|
|
580
|
+
return collectible.SubType;
|
|
581
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeColor = exports.isSerializedColor = exports.isColor = exports.getRandomColor = exports.deserializeColor = exports.copyColor = exports.colorEquals = void 0;
|
|
4
|
+
const SerializationBrand_1 = require("../enums/private/SerializationBrand");
|
|
5
|
+
const isaacAPIClass_1 = require("./isaacAPIClass");
|
|
6
|
+
const random_1 = require("./random");
|
|
7
|
+
const rng_1 = require("./rng");
|
|
8
|
+
const table_1 = require("./table");
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
const OBJECT_NAME = "Color";
|
|
12
|
+
const KEYS = ["R", "G", "B", "A", "RO", "GO", "BO"];
|
|
13
|
+
function colorEquals(color1, color2) {
|
|
14
|
+
return (0, isaacAPIClass_1.isaacAPIClassEquals)(color1, color2, KEYS);
|
|
15
|
+
}
|
|
16
|
+
exports.colorEquals = colorEquals;
|
|
17
|
+
/** Helper function to copy a `Color` Isaac API class. */
|
|
18
|
+
function copyColor(color) {
|
|
19
|
+
if (!isColor(color)) {
|
|
20
|
+
error(`Failed to copy a ${OBJECT_NAME} object since the provided object was not a userdata ${OBJECT_NAME} class.`);
|
|
21
|
+
}
|
|
22
|
+
return Color(color.R, color.G, color.B, color.A, color.RO, color.GO, color.BO);
|
|
23
|
+
}
|
|
24
|
+
exports.copyColor = copyColor;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to convert a `SerializedColor` object to a normal `Color` object. (This is used
|
|
27
|
+
* by the save data manager when reading data from the "save#.dat" file.)
|
|
28
|
+
*/
|
|
29
|
+
function deserializeColor(color) {
|
|
30
|
+
if (!(0, types_1.isTable)(color)) {
|
|
31
|
+
error(`Failed to deserialize a ${OBJECT_NAME} object since the provided object was not a Lua table.`);
|
|
32
|
+
}
|
|
33
|
+
const [r, g, b, a, ro, go, bo] = (0, table_1.getNumbersFromTable)(color, OBJECT_NAME, ...KEYS);
|
|
34
|
+
(0, utils_1.assertDefined)(r, `Failed to deserialize a ${OBJECT_NAME} object since the provided object did not have a value for: R`);
|
|
35
|
+
(0, utils_1.assertDefined)(g, `Failed to deserialize a ${OBJECT_NAME} object since the provided object did not have a value for: G`);
|
|
36
|
+
(0, utils_1.assertDefined)(b, `Failed to deserialize a ${OBJECT_NAME} object since the provided object did not have a value for: B`);
|
|
37
|
+
return Color(r, g, b, a, ro, go, bo);
|
|
38
|
+
}
|
|
39
|
+
exports.deserializeColor = deserializeColor;
|
|
40
|
+
/**
|
|
41
|
+
* Helper function to get a random `Color` object.
|
|
42
|
+
*
|
|
43
|
+
* If you want to generate an unseeded object, you must explicitly pass `undefined` to the
|
|
44
|
+
* `seedOrRNG` parameter.
|
|
45
|
+
*
|
|
46
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
47
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
48
|
+
* a random seed.
|
|
49
|
+
* @param alpha Optional. The alpha value to use. Default is 1.
|
|
50
|
+
*/
|
|
51
|
+
function getRandomColor(seedOrRNG, alpha = 1) {
|
|
52
|
+
const rng = (0, rng_1.isRNG)(seedOrRNG) ? seedOrRNG : (0, rng_1.newRNG)(seedOrRNG);
|
|
53
|
+
const r = (0, random_1.getRandom)(rng);
|
|
54
|
+
const g = (0, random_1.getRandom)(rng);
|
|
55
|
+
const b = (0, random_1.getRandom)(rng);
|
|
56
|
+
return Color(r, g, b, alpha);
|
|
57
|
+
}
|
|
58
|
+
exports.getRandomColor = getRandomColor;
|
|
59
|
+
/** Helper function to check if something is an instantiated `Color` object. */
|
|
60
|
+
function isColor(object) {
|
|
61
|
+
return (0, isaacAPIClass_1.isIsaacAPIClassOfType)(object, OBJECT_NAME);
|
|
62
|
+
}
|
|
63
|
+
exports.isColor = isColor;
|
|
64
|
+
/**
|
|
65
|
+
* Used to determine is the given table is a serialized `Color` object created by the `deepCopy`
|
|
66
|
+
* function.
|
|
67
|
+
*/
|
|
68
|
+
function isSerializedColor(object) {
|
|
69
|
+
if (!(0, types_1.isTable)(object)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return (0, table_1.tableHasKeys)(object, ...KEYS) && object.has(SerializationBrand_1.SerializationBrand.COLOR);
|
|
73
|
+
}
|
|
74
|
+
exports.isSerializedColor = isSerializedColor;
|
|
75
|
+
/**
|
|
76
|
+
* Helper function to convert a `Color` object to a `SerializedColor` object. (This is used by the
|
|
77
|
+
* save data manager when writing data from the "save#.dat" file.)
|
|
78
|
+
*/
|
|
79
|
+
function serializeColor(color) {
|
|
80
|
+
if (!isColor(color)) {
|
|
81
|
+
error(`Failed to serialize a ${OBJECT_NAME} object since the provided object was not a userdata ${OBJECT_NAME} class.`);
|
|
82
|
+
}
|
|
83
|
+
const colorTable = new LuaMap();
|
|
84
|
+
(0, table_1.copyUserdataValuesToTable)(color, KEYS, colorTable);
|
|
85
|
+
colorTable.set(SerializationBrand_1.SerializationBrand.COLOR, "");
|
|
86
|
+
return colorTable;
|
|
87
|
+
}
|
|
88
|
+
exports.serializeColor = serializeColor;
|