isaacscript-common 1.0.543 → 1.0.544

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.
@@ -1,11 +1,11 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * Helper function to get a card name from a Card.
3
+ * Helper function to get a card description from a Card enum value.
4
4
  *
5
5
  * Example:
6
6
  * ```
7
7
  * const card = Card.CARD_FOOL;
8
- * const cardName = getCardName(card); // cardName is "0 - The Fool"
8
+ * const cardDescription = getCardDescription(card); // cardDescription is "Where journey begins"
9
9
  * ```
10
10
  */
11
11
  export declare function getCardDescription(card: Card | int): string;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
- * Helper function to get a pill effect name from a PillEffect.
3
+ * Helper function to get a pill effect name from a PillEffect enum value.
4
4
  *
5
5
  * Example:
6
6
  * ```
@@ -2,3 +2,13 @@
2
2
  /** Returns the number of items that a player has towards a particular transformation. */
3
3
  export declare function getPlayerNumTransformationCollectibles(player: EntityPlayer, playerForm: PlayerForm): int;
4
4
  export declare function getTransformationsForItem(collectibleType: CollectibleType | int): Set<PlayerForm>;
5
+ /**
6
+ * Helper function to get a transformation name from a PlayerForm enum.
7
+ *
8
+ * Example:
9
+ * ```
10
+ * const transformationName = getTransformationName(PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES);
11
+ * // transformationName is "Beelzebub"
12
+ * ```
13
+ */
14
+ export declare function getTransformationName(transformation: PlayerForm): string;
@@ -1,10 +1,12 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local ____transformationMap = require("maps.transformationMap")
5
- local ITEM_TO_TRANSFORMATION_MAP = ____transformationMap.ITEM_TO_TRANSFORMATION_MAP
6
- local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = ____transformationMap.TRANSFORMATIONS_NOT_BASED_ON_ITEMS
7
- local TRANSFORMATION_TO_ITEMS_MAP = ____transformationMap.TRANSFORMATION_TO_ITEMS_MAP
4
+ local ____transformationMaps = require("maps.transformationMaps")
5
+ local ITEM_TO_TRANSFORMATION_MAP = ____transformationMaps.ITEM_TO_TRANSFORMATION_MAP
6
+ local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = ____transformationMaps.TRANSFORMATIONS_NOT_BASED_ON_ITEMS
7
+ local TRANSFORMATION_TO_ITEMS_MAP = ____transformationMaps.TRANSFORMATION_TO_ITEMS_MAP
8
+ local ____transformationNameMap = require("maps.transformationNameMap")
9
+ local TRANSFORMATION_NAME_MAP = ____transformationNameMap.TRANSFORMATION_NAME_MAP
8
10
  local ____util = require("functions.util")
9
11
  local copySet = ____util.copySet
10
12
  function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
@@ -31,4 +33,9 @@ function ____exports.getTransformationsForItem(self, collectibleType)
31
33
  local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
32
34
  return ((transformations == nil) and __TS__New(Set)) or copySet(nil, transformations)
33
35
  end
36
+ function ____exports.getTransformationName(self, transformation)
37
+ local defaultName = "Unknown"
38
+ local transformationName = TRANSFORMATION_NAME_MAP:get(transformation)
39
+ return ((transformationName == nil) and defaultName) or transformationName
40
+ end
34
41
  return ____exports
package/dist/index.d.ts CHANGED
@@ -56,7 +56,8 @@ export * from "./maps/collectibleNameMap";
56
56
  export * from "./maps/gridEntityXMLMap";
57
57
  export * from "./maps/pillEffectNameMap";
58
58
  export * from "./maps/roomShapeToTopLeftWallGridIndexMap";
59
- export * from "./maps/transformationMap";
59
+ export * from "./maps/transformationMaps";
60
+ export * from "./maps/transformationNameMap";
60
61
  export * from "./maps/trinketNameMap";
61
62
  export * from "./sets/cards";
62
63
  export * from "./types/CallbackParametersCustom";
package/dist/index.lua CHANGED
@@ -455,7 +455,15 @@ do
455
455
  end
456
456
  end
457
457
  do
458
- local ____export = require("maps.transformationMap")
458
+ local ____export = require("maps.transformationMaps")
459
+ for ____exportKey, ____exportValue in pairs(____export) do
460
+ if ____exportKey ~= "default" then
461
+ ____exports[____exportKey] = ____exportValue
462
+ end
463
+ end
464
+ end
465
+ do
466
+ local ____export = require("maps.transformationNameMap")
459
467
  for ____exportKey, ____exportValue in pairs(____export) do
460
468
  if ____exportKey ~= "default" then
461
469
  ____exports[____exportKey] = ____exportValue
@@ -0,0 +1,5 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const TRANSFORMATION_TO_TAG_MAP: Map<PlayerForm, ItemConfigTag>;
3
+ export declare const TRANSFORMATIONS_NOT_BASED_ON_ITEMS: Set<PlayerForm>;
4
+ export declare const TRANSFORMATION_TO_ITEMS_MAP: Map<PlayerForm, Set<number>>;
5
+ export declare const ITEM_TO_TRANSFORMATION_MAP: Map<number, Set<PlayerForm>>;
@@ -0,0 +1,56 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ local initMaps
5
+ local ____collectibles = require("functions.collectibles")
6
+ local collectibleHasTag = ____collectibles.collectibleHasTag
7
+ local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
8
+ function initMaps(self)
9
+ for ____, playerForm in __TS__Iterator(
10
+ ____exports.TRANSFORMATION_TO_TAG_MAP:keys()
11
+ ) do
12
+ ____exports.TRANSFORMATION_TO_ITEMS_MAP:set(
13
+ playerForm,
14
+ __TS__New(Set)
15
+ )
16
+ end
17
+ do
18
+ local collectibleType = 1
19
+ while collectibleType <= getMaxCollectibleID(nil) do
20
+ for ____, ____value in __TS__Iterator(
21
+ ____exports.TRANSFORMATION_TO_TAG_MAP:entries()
22
+ ) do
23
+ local playerForm
24
+ playerForm = ____value[1]
25
+ local tag
26
+ tag = ____value[2]
27
+ do
28
+ if not collectibleHasTag(nil, collectibleType, tag) then
29
+ goto __continue5
30
+ end
31
+ local items = ____exports.TRANSFORMATION_TO_ITEMS_MAP:get(playerForm)
32
+ if items == nil then
33
+ error(
34
+ "Failed to get the items for transformation: " .. tostring(playerForm)
35
+ )
36
+ end
37
+ items:add(collectibleType)
38
+ local transformations = ____exports.ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
39
+ if transformations == nil then
40
+ transformations = __TS__New(Set)
41
+ ____exports.ITEM_TO_TRANSFORMATION_MAP:set(collectibleType, transformations)
42
+ end
43
+ transformations:add(playerForm)
44
+ end
45
+ ::__continue5::
46
+ end
47
+ collectibleType = collectibleType + 1
48
+ end
49
+ end
50
+ end
51
+ ____exports.TRANSFORMATION_TO_TAG_MAP = __TS__New(Map, {{PlayerForm.PLAYERFORM_GUPPY, 32}, {PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES, 64}, {PlayerForm.PLAYERFORM_MUSHROOM, 256}, {PlayerForm.PLAYERFORM_ANGEL, 1024}, {PlayerForm.PLAYERFORM_BOB, 128}, {PlayerForm.PLAYERFORM_DRUGS, 2}, {PlayerForm.PLAYERFORM_MOM, 4}, {PlayerForm.PLAYERFORM_BABY, 512}, {PlayerForm.PLAYERFORM_EVIL_ANGEL, 2048}, {PlayerForm.PLAYERFORM_POOP, 4096}, {PlayerForm.PLAYERFORM_BOOK_WORM, 8192}, {PlayerForm.PLAYERFORM_SPIDERBABY, 16384}})
52
+ ____exports.TRANSFORMATIONS_NOT_BASED_ON_ITEMS = __TS__New(Set, {PlayerForm.PLAYERFORM_ADULTHOOD, PlayerForm.PLAYERFORM_STOMPY, PlayerForm.PLAYERFORM_FLIGHT})
53
+ ____exports.TRANSFORMATION_TO_ITEMS_MAP = __TS__New(Map)
54
+ ____exports.ITEM_TO_TRANSFORMATION_MAP = __TS__New(Map)
55
+ initMaps(nil)
56
+ return ____exports
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const TRANSFORMATION_NAME_MAP: Map<PlayerForm, string>;
@@ -0,0 +1,5 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ ____exports.TRANSFORMATION_NAME_MAP = __TS__New(Map, {{PlayerForm.PLAYERFORM_GUPPY, "Guppy"}, {PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES, "Beelzebub"}, {PlayerForm.PLAYERFORM_MUSHROOM, "Fun Guy"}, {PlayerForm.PLAYERFORM_ANGEL, "Seraphim"}, {PlayerForm.PLAYERFORM_BOB, "Bob"}, {PlayerForm.PLAYERFORM_DRUGS, "Spun"}, {PlayerForm.PLAYERFORM_MOM, "Yes Mother?"}, {PlayerForm.PLAYERFORM_BABY, "Conjoined"}, {PlayerForm.PLAYERFORM_EVIL_ANGEL, "Leviathan"}, {PlayerForm.PLAYERFORM_POOP, "Oh Crap"}, {PlayerForm.PLAYERFORM_BOOK_WORM, "Bookworm"}, {PlayerForm.PLAYERFORM_ADULTHOOD, "Adult"}, {PlayerForm.PLAYERFORM_SPIDERBABY, "Spider Baby"}, {PlayerForm.PLAYERFORM_STOMPY, "Stompy"}, {PlayerForm.PLAYERFORM_FLIGHT, "Flight"}})
5
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.543",
3
+ "version": "1.0.544",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,8 +25,8 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.305",
29
- "isaacscript-lint": "^1.0.72",
28
+ "isaac-typescript-definitions": "^1.0.306",
29
+ "isaacscript-lint": "^1.0.73",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",
32
32
  "typescript-to-lua": "1.1.1"