isaacscript-common 9.14.0 → 9.15.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.
Files changed (86) hide show
  1. package/dist/features/extraConsoleCommands/listCommands.d.ts +2 -0
  2. package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
  3. package/dist/features/extraConsoleCommands/listCommands.lua +76 -19
  4. package/dist/functions/collectibles.lua +4 -4
  5. package/dist/functions/string.d.ts +2 -0
  6. package/dist/functions/string.d.ts.map +1 -1
  7. package/dist/functions/string.lua +5 -0
  8. package/dist/functions/trinkets.d.ts.map +1 -1
  9. package/dist/functions/trinkets.lua +4 -4
  10. package/dist/index.d.ts +10 -7
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.lua +4 -4
  13. package/dist/maps/cardNameToTypeMap.d.ts +4 -0
  14. package/dist/maps/cardNameToTypeMap.d.ts.map +1 -0
  15. package/dist/maps/{cardMap.lua → cardNameToTypeMap.lua} +2 -2
  16. package/dist/maps/characterNameToTypeMap.d.ts +4 -0
  17. package/dist/maps/characterNameToTypeMap.d.ts.map +1 -0
  18. package/dist/maps/characterNameToTypeMap.lua +92 -0
  19. package/dist/maps/collectibleDescriptionMap.d.ts +6 -0
  20. package/dist/maps/collectibleDescriptionMap.d.ts.map +1 -1
  21. package/dist/maps/collectibleDescriptionMap.lua +4 -0
  22. package/dist/maps/collectibleNameToTypeMap.d.ts +3 -0
  23. package/dist/maps/collectibleNameToTypeMap.d.ts.map +1 -0
  24. package/dist/maps/collectibleNameToTypeMap.lua +21 -0
  25. package/dist/maps/collectibleTypeToNameMap.d.ts +12 -0
  26. package/dist/maps/collectibleTypeToNameMap.d.ts.map +1 -0
  27. package/dist/maps/{collectibleNameMap.lua → collectibleTypeToNameMap.lua} +7 -1
  28. package/dist/maps/{pillEffectMap.d.ts → pillNameToEffectMap.d.ts} +2 -2
  29. package/dist/maps/pillNameToEffectMap.d.ts.map +1 -0
  30. package/dist/maps/{pillEffectMap.lua → pillNameToEffectMap.lua} +1 -1
  31. package/dist/maps/roomNameToTypeMap.d.ts +4 -0
  32. package/dist/maps/roomNameToTypeMap.d.ts.map +1 -0
  33. package/dist/maps/{roomTypeMap.lua → roomNameToTypeMap.lua} +2 -2
  34. package/dist/maps/trinketDescriptionMap.d.ts +6 -0
  35. package/dist/maps/trinketDescriptionMap.d.ts.map +1 -1
  36. package/dist/maps/trinketDescriptionMap.lua +4 -0
  37. package/dist/maps/trinketNameToTypeMap.d.ts +3 -0
  38. package/dist/maps/trinketNameToTypeMap.d.ts.map +1 -0
  39. package/dist/maps/trinketNameToTypeMap.lua +21 -0
  40. package/dist/maps/trinketTypeToNameMap.d.ts +12 -0
  41. package/dist/maps/trinketTypeToNameMap.d.ts.map +1 -0
  42. package/dist/maps/{trinketNameMap.lua → trinketTypeToNameMap.lua} +7 -1
  43. package/dist/objects/characterDamageMultipliers.lua +1 -1
  44. package/dist/objects/characterNames.lua +1 -1
  45. package/dist/objects/playerNamePNGFileNames.lua +1 -1
  46. package/dist/objects/playerPortraitPNGFileNames.lua +1 -1
  47. package/dist/sets/charactersWithBlackHeartFromEternalHeartSet.lua +1 -1
  48. package/dist/sets/charactersWithNoRedHeartsSet.lua +1 -1
  49. package/package.json +2 -2
  50. package/src/features/extraConsoleCommands/listCommands.ts +85 -16
  51. package/src/functions/collectibles.ts +3 -3
  52. package/src/functions/string.ts +6 -0
  53. package/src/functions/trinkets.ts +5 -2
  54. package/src/index.ts +4 -4
  55. package/src/maps/{cardMap.ts → cardNameToTypeMap.ts} +2 -2
  56. package/src/maps/characterNameToTypeMap.ts +88 -0
  57. package/src/maps/collectibleDescriptionMap.ts +6 -2
  58. package/src/maps/collectibleNameToTypeMap.ts +19 -0
  59. package/src/maps/collectibleTypeToNameMap.ts +739 -0
  60. package/src/maps/pillNameToEffectMap.ts +90 -0
  61. package/src/maps/{roomTypeMap.ts → roomNameToTypeMap.ts} +2 -2
  62. package/src/maps/trinketDescriptionMap.ts +6 -2
  63. package/src/maps/trinketNameToTypeMap.ts +17 -0
  64. package/src/maps/trinketTypeToNameMap.ts +205 -0
  65. package/src/objects/characterDamageMultipliers.ts +1 -1
  66. package/src/objects/characterNames.ts +1 -1
  67. package/src/objects/playerNamePNGFileNames.ts +1 -1
  68. package/src/objects/playerPortraitPNGFileNames.ts +1 -1
  69. package/src/sets/charactersWithBlackHeartFromEternalHeartSet.ts +1 -1
  70. package/src/sets/charactersWithNoRedHeartsSet.ts +1 -1
  71. package/dist/maps/cardMap.d.ts +0 -4
  72. package/dist/maps/cardMap.d.ts.map +0 -1
  73. package/dist/maps/characterMap.d.ts +0 -4
  74. package/dist/maps/characterMap.d.ts.map +0 -1
  75. package/dist/maps/characterMap.lua +0 -90
  76. package/dist/maps/collectibleNameMap.d.ts +0 -4
  77. package/dist/maps/collectibleNameMap.d.ts.map +0 -1
  78. package/dist/maps/pillEffectMap.d.ts.map +0 -1
  79. package/dist/maps/roomTypeMap.d.ts +0 -4
  80. package/dist/maps/roomTypeMap.d.ts.map +0 -1
  81. package/dist/maps/trinketNameMap.d.ts +0 -4
  82. package/dist/maps/trinketNameMap.d.ts.map +0 -1
  83. package/src/maps/characterMap.ts +0 -87
  84. package/src/maps/collectibleNameMap.ts +0 -731
  85. package/src/maps/pillEffectMap.ts +0 -88
  86. package/src/maps/trinketNameMap.ts +0 -198
@@ -5,7 +5,7 @@ local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local PillEffect = ____isaac_2Dtypescript_2Ddefinitions.PillEffect
7
7
  --- Maps pill effect names to the values of the `PillEffect` enum.
8
- ____exports.PILL_EFFECT_MAP = __TS__New(Map, {
8
+ ____exports.PILL_NAME_TO_EFFECT_MAP = __TS__New(Map, {
9
9
  {"badGas", PillEffect.BAD_GAS},
10
10
  {"gas", PillEffect.BAD_GAS},
11
11
  {"badTrip", PillEffect.BAD_TRIP},
@@ -0,0 +1,4 @@
1
+ import { RoomType } from "isaac-typescript-definitions";
2
+ /** Maps room names to the values of the `RoomType` enum. */
3
+ export declare const ROOM_NAME_TO_TYPE_MAP: ReadonlyMap<string, RoomType>;
4
+ //# sourceMappingURL=roomNameToTypeMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roomNameToTypeMap.d.ts","sourceRoot":"","sources":["../../src/maps/roomNameToTypeMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAmC9D,CAAC"}
@@ -4,8 +4,8 @@ local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
7
- --- Maps room type names to room types.
8
- ____exports.ROOM_TYPE_MAP = __TS__New(Map, {
7
+ --- Maps room names to the values of the `RoomType` enum.
8
+ ____exports.ROOM_NAME_TO_TYPE_MAP = __TS__New(Map, {
9
9
  {"default", RoomType.DEFAULT},
10
10
  {"shop", RoomType.SHOP},
11
11
  {"error", RoomType.ERROR},
@@ -1,4 +1,10 @@
1
1
  import { TrinketType } from "isaac-typescript-definitions";
2
2
  export declare const DEFAULT_TRINKET_DESCRIPTION = "Unknown";
3
+ /**
4
+ * Maps trinket types to the real English descriptions from the "stringtable.sta" file.
5
+ *
6
+ * This is a temporary map due to missing features in the vanilla API. (Otherwise, this would be
7
+ * converted to a type-safe object.)
8
+ */
3
9
  export declare const TRINKET_DESCRIPTION_MAP: ReadonlyMap<TrinketType, string>;
4
10
  //# sourceMappingURL=trinketDescriptionMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trinketDescriptionMap.d.ts","sourceRoot":"","sources":["../../src/maps/trinketDescriptionMap.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAO,MAAM,2BAA2B,YAAY,CAAC;AAIrD,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,WAAW,EAAE,MAAM,CA8LjE,CAAC"}
1
+ {"version":3,"file":"trinketDescriptionMap.d.ts","sourceRoot":"","sources":["../../src/maps/trinketDescriptionMap.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAO,MAAM,2BAA2B,YAAY,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,WAAW,EAAE,MAAM,CA8LjE,CAAC"}
@@ -3,6 +3,10 @@ local Map = ____lualib.Map
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  ____exports.DEFAULT_TRINKET_DESCRIPTION = "Unknown"
6
+ --- Maps trinket types to the real English descriptions from the "stringtable.sta" file.
7
+ --
8
+ -- This is a temporary map due to missing features in the vanilla API. (Otherwise, this would be
9
+ -- converted to a type-safe object.)
6
10
  ____exports.TRINKET_DESCRIPTION_MAP = __TS__New(Map, {
7
11
  {1, "Gulp!"},
8
12
  {2, "It feels lucky?"},
@@ -0,0 +1,3 @@
1
+ import { TrinketType } from "isaac-typescript-definitions";
2
+ export declare const TRINKET_NAME_TO_TYPE_MAP: ReadonlyMap<string, TrinketType>;
3
+ //# sourceMappingURL=trinketNameToTypeMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trinketNameToTypeMap.d.ts","sourceRoot":"","sources":["../../src/maps/trinketNameToTypeMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAe3D,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAChD,CAAC"}
@@ -0,0 +1,21 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Map = ____lualib.Map
3
+ local __TS__New = ____lualib.__TS__New
4
+ local __TS__Iterator = ____lualib.__TS__Iterator
5
+ local ____exports = {}
6
+ local ____string = require("functions.string")
7
+ local removeNonAlphanumericCharacters = ____string.removeNonAlphanumericCharacters
8
+ local ____trinketTypeToNameMap = require("maps.trinketTypeToNameMap")
9
+ local TRINKET_TYPE_TO_NAME_MAP = ____trinketTypeToNameMap.TRINKET_TYPE_TO_NAME_MAP
10
+ --- Maps trinket names to the values of the `TrinketType` enum.
11
+ --
12
+ -- For a mapping of `TrinketType` to name, see `TRINKET_TYPE_TO_NAME_MAP`.
13
+ local trinketNameToTypeMap = __TS__New(Map)
14
+ for ____, ____value in __TS__Iterator(TRINKET_TYPE_TO_NAME_MAP) do
15
+ local trinketType = ____value[1]
16
+ local name = ____value[2]
17
+ local simpleString = removeNonAlphanumericCharacters(nil, name)
18
+ trinketNameToTypeMap:set(simpleString, trinketType)
19
+ end
20
+ ____exports.TRINKET_NAME_TO_TYPE_MAP = trinketNameToTypeMap
21
+ return ____exports
@@ -0,0 +1,12 @@
1
+ import { TrinketType } from "isaac-typescript-definitions";
2
+ export declare const DEFAULT_TRINKET_NAME = "Unknown";
3
+ /**
4
+ * Maps trinket types to the real English names from the "stringtable.sta" file.
5
+ *
6
+ * This is a temporary map due to missing features in the vanilla API. (Otherwise, this would be
7
+ * converted to a type-safe object.)
8
+ *
9
+ * For a mapping of name to `TrinketType`, see `TRINKET_NAME_TO_TYPE_MAP`.
10
+ */
11
+ export declare const TRINKET_TYPE_TO_NAME_MAP: ReadonlyMap<TrinketType, string>;
12
+ //# sourceMappingURL=trinketTypeToNameMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trinketTypeToNameMap.d.ts","sourceRoot":"","sources":["../../src/maps/trinketTypeToNameMap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,WAAW,EAAE,MAAM,CA8LlE,CAAC"}
@@ -3,7 +3,13 @@ local Map = ____lualib.Map
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  ____exports.DEFAULT_TRINKET_NAME = "Unknown"
6
- ____exports.TRINKET_NAME_MAP = __TS__New(Map, {
6
+ --- Maps trinket types to the real English names from the "stringtable.sta" file.
7
+ --
8
+ -- This is a temporary map due to missing features in the vanilla API. (Otherwise, this would be
9
+ -- converted to a type-safe object.)
10
+ --
11
+ -- For a mapping of name to `TrinketType`, see `TRINKET_NAME_TO_TYPE_MAP`.
12
+ ____exports.TRINKET_TYPE_TO_NAME_MAP = __TS__New(Map, {
7
13
  {1, "Swallowed Penny"},
8
14
  {2, "Petrified Poop"},
9
15
  {3, "AAA Battery"},
@@ -16,7 +16,7 @@ ____exports.CHARACTER_DAMAGE_MULTIPLIERS = {
16
16
  [PlayerType.EDEN] = 1,
17
17
  [PlayerType.THE_LOST] = 1,
18
18
  [PlayerType.LAZARUS_2] = 1.4,
19
- [PlayerType.BLACK_JUDAS] = 2,
19
+ [PlayerType.DARK_JUDAS] = 2,
20
20
  [PlayerType.LILITH] = 1,
21
21
  [PlayerType.KEEPER] = 1.2,
22
22
  [PlayerType.APOLLYON] = 1,
@@ -15,7 +15,7 @@ ____exports.CHARACTER_NAMES = {
15
15
  [PlayerType.EDEN] = "Eden",
16
16
  [PlayerType.THE_LOST] = "The Lost",
17
17
  [PlayerType.LAZARUS_2] = "Lazarus II",
18
- [PlayerType.BLACK_JUDAS] = "Dark Judas",
18
+ [PlayerType.DARK_JUDAS] = "Dark Judas",
19
19
  [PlayerType.LILITH] = "Lilith",
20
20
  [PlayerType.KEEPER] = "Keeper",
21
21
  [PlayerType.APOLLYON] = "Apollyon",
@@ -16,7 +16,7 @@ ____exports.PLAYER_NAME_PNG_FILE_NAMES = {
16
16
  [PlayerType.EDEN] = "playername_09_eden.png",
17
17
  [PlayerType.THE_LOST] = "playername_12_thelost.png",
18
18
  [PlayerType.LAZARUS_2] = "playername_10_lazarus.png",
19
- [PlayerType.BLACK_JUDAS] = "playername_04_judas.png",
19
+ [PlayerType.DARK_JUDAS] = "playername_04_judas.png",
20
20
  [PlayerType.LILITH] = "playername_13_lilith.png",
21
21
  [PlayerType.KEEPER] = "playername_14_thekeeper.png",
22
22
  [PlayerType.APOLLYON] = "playername_15_apollyon.png",
@@ -16,7 +16,7 @@ ____exports.PLAYER_PORTRAIT_PNG_FILE_NAMES = {
16
16
  [PlayerType.EDEN] = "playerportrait_eden.png",
17
17
  [PlayerType.THE_LOST] = "playerportrait_thelost.png",
18
18
  [PlayerType.LAZARUS_2] = "playerportrait_lazarus2.png",
19
- [PlayerType.BLACK_JUDAS] = "playerportrait_darkjudas.png",
19
+ [PlayerType.DARK_JUDAS] = "playerportrait_darkjudas.png",
20
20
  [PlayerType.LILITH] = "playerportrait_lilith.png",
21
21
  [PlayerType.KEEPER] = "playerportrait_keeper.png",
22
22
  [PlayerType.APOLLYON] = "playerportrait_apollyon.png",
@@ -4,5 +4,5 @@ local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
7
- ____exports.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET = __TS__New(Set, {PlayerType.BLACK_JUDAS, PlayerType.JUDAS_B})
7
+ ____exports.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET = __TS__New(Set, {PlayerType.DARK_JUDAS, PlayerType.JUDAS_B})
8
8
  return ____exports
@@ -9,7 +9,7 @@ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
9
9
  ____exports.CHARACTERS_WITH_NO_RED_HEARTS_SET = __TS__New(Set, {
10
10
  PlayerType.BLUE_BABY,
11
11
  PlayerType.THE_LOST,
12
- PlayerType.BLACK_JUDAS,
12
+ PlayerType.DARK_JUDAS,
13
13
  PlayerType.JUDAS_B,
14
14
  PlayerType.BLUE_BABY_B,
15
15
  PlayerType.THE_LOST_B,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "9.14.0",
3
+ "version": "9.15.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/index",
23
23
  "types": "dist/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^4.0.6"
25
+ "isaac-typescript-definitions": "^4.0.7"
26
26
  }
27
27
  }
@@ -85,7 +85,7 @@ import { runMergeTests } from "../../functions/mergeTests";
85
85
  import {
86
86
  spawnCard,
87
87
  spawnPill,
88
- spawnTrinket,
88
+ spawnTrinket as spawnTrinketFunction,
89
89
  } from "../../functions/pickupsSpecific";
90
90
  import { getPillEffectName } from "../../functions/pills";
91
91
  import { getPlayers } from "../../functions/playerIndex";
@@ -99,14 +99,21 @@ import { gridCoordinatesToWorldPosition } from "../../functions/roomGrid";
99
99
  import { changeRoom } from "../../functions/rooms";
100
100
  import { reloadRoom as reloadRoomFunction } from "../../functions/roomTransition";
101
101
  import { onSetSeed, restart, setUnseeded } from "../../functions/run";
102
+ import { spawnCollectible as spawnCollectibleFunction } from "../../functions/spawnCollectible";
102
103
  import { setStage } from "../../functions/stage";
103
104
  import { getGoldenTrinketType } from "../../functions/trinkets";
104
- import { asCardType } from "../../functions/types";
105
+ import {
106
+ asCardType,
107
+ asCollectibleType,
108
+ asTrinketType,
109
+ } from "../../functions/types";
105
110
  import { irange, printConsole, printEnabled } from "../../functions/utils";
106
- import { CARD_MAP } from "../../maps/cardMap";
107
- import { CHARACTER_MAP } from "../../maps/characterMap";
108
- import { PILL_EFFECT_MAP } from "../../maps/pillEffectMap";
109
- import { ROOM_TYPE_MAP } from "../../maps/roomTypeMap";
111
+ import { CARD_NAME_TO_TYPE_MAP } from "../../maps/cardNameToTypeMap";
112
+ import { CHARACTER_NAME_TO_TYPE_MAP } from "../../maps/characterNameToTypeMap";
113
+ import { COLLECTIBLE_NAME_TO_TYPE_MAP } from "../../maps/collectibleNameToTypeMap";
114
+ import { PILL_NAME_TO_EFFECT_MAP } from "../../maps/pillNameToEffectMap";
115
+ import { ROOM_NAME_TO_TYPE_MAP } from "../../maps/roomNameToTypeMap";
116
+ import { TRINKET_NAME_TO_TYPE_MAP } from "../../maps/trinketNameToTypeMap";
110
117
  import { getLastCardType, getLastPillEffect } from "../firstLast";
111
118
  import {
112
119
  addHeart,
@@ -343,7 +350,7 @@ export function card(params: string): void {
343
350
  let cardType: CardType;
344
351
  const num = tonumber(params) as CardType | undefined;
345
352
  if (num === undefined) {
346
- const match = getMapPartialMatch(params, CARD_MAP);
353
+ const match = getMapPartialMatch(params, CARD_NAME_TO_TYPE_MAP);
347
354
  if (match === undefined) {
348
355
  printConsole(`Unknown card: ${params}`);
349
356
  return;
@@ -414,7 +421,7 @@ export function character(params: string): void {
414
421
  let playerType: PlayerType;
415
422
  const num = tonumber(params) as PlayerType | undefined;
416
423
  if (num === undefined) {
417
- const match = getMapPartialMatch(params, CHARACTER_MAP);
424
+ const match = getMapPartialMatch(params, CHARACTER_NAME_TO_TYPE_MAP);
418
425
  if (match === undefined) {
419
426
  printConsole(`Unknown character: ${params}`);
420
427
  return;
@@ -940,7 +947,7 @@ export function pill(params: string): void {
940
947
  let pillEffect: PillEffect;
941
948
  const num = tonumber(params) as PillEffect | undefined;
942
949
  if (num === undefined) {
943
- const match = getMapPartialMatch(params, PILL_EFFECT_MAP);
950
+ const match = getMapPartialMatch(params, PILL_NAME_TO_EFFECT_MAP);
944
951
  if (match === undefined) {
945
952
  printConsole(`Unknown pill effect: ${params}`);
946
953
  return;
@@ -1315,25 +1322,87 @@ export function spam(): void {
1315
1322
  printEnabled(v.run.spamBloodRights, "spamming Blood Rights");
1316
1323
  }
1317
1324
 
1325
+ export function spawnCollectible(params: string): void {
1326
+ if (params === "") {
1327
+ printConsole(
1328
+ "You must specify the name or number corresponding to the collectible type.",
1329
+ );
1330
+ return;
1331
+ }
1332
+
1333
+ const collectibleTypeNumber = tonumber(params);
1334
+ let collectibleType: CollectibleType;
1335
+ if (collectibleTypeNumber === undefined) {
1336
+ const match = getMapPartialMatch(params, COLLECTIBLE_NAME_TO_TYPE_MAP);
1337
+ if (match === undefined) {
1338
+ printConsole(`Unknown collectible: ${params}`);
1339
+ return;
1340
+ }
1341
+
1342
+ collectibleType = match[1];
1343
+ } else {
1344
+ collectibleType = asCollectibleType(collectibleTypeNumber);
1345
+ }
1346
+
1347
+ const roomClass = game.GetRoom();
1348
+ const centerPos = roomClass.GetCenterPos();
1349
+ spawnCollectibleFunction(collectibleType, centerPos);
1350
+ }
1351
+
1318
1352
  /** Spawns a golden version of the specified trinket type. */
1319
1353
  export function spawnGoldenTrinket(params: string): void {
1320
1354
  if (params === "") {
1321
1355
  printConsole(
1322
- "You must specify the number corresponding to the trinket type.",
1356
+ "You must specify the name or number corresponding to the trinket type.",
1323
1357
  );
1324
1358
  return;
1325
1359
  }
1326
1360
 
1327
- const trinketType = tonumber(params) as TrinketType | undefined;
1328
- if (trinketType === undefined) {
1329
- printConsole(`That is an invalid trinket type: ${params}`);
1330
- return;
1361
+ const trinketTypeNumber = tonumber(params);
1362
+ let trinketType: TrinketType;
1363
+ if (trinketTypeNumber === undefined) {
1364
+ const match = getMapPartialMatch(params, TRINKET_NAME_TO_TYPE_MAP);
1365
+ if (match === undefined) {
1366
+ printConsole(`Unknown trinket: ${params}`);
1367
+ return;
1368
+ }
1369
+
1370
+ trinketType = match[1];
1371
+ } else {
1372
+ trinketType = asTrinketType(trinketTypeNumber);
1331
1373
  }
1332
1374
 
1375
+ const roomClass = game.GetRoom();
1376
+ const centerPos = roomClass.GetCenterPos();
1333
1377
  const goldenTrinketType = getGoldenTrinketType(trinketType);
1378
+ spawnTrinketFunction(goldenTrinketType, centerPos);
1379
+ }
1380
+
1381
+ export function spawnTrinket(params: string): void {
1382
+ if (params === "") {
1383
+ printConsole(
1384
+ "You must specify the name or number corresponding to the trinket type.",
1385
+ );
1386
+ return;
1387
+ }
1388
+
1389
+ const trinketTypeNumber = tonumber(params);
1390
+ let trinketType: TrinketType;
1391
+ if (trinketTypeNumber === undefined) {
1392
+ const match = getMapPartialMatch(params, TRINKET_NAME_TO_TYPE_MAP);
1393
+ if (match === undefined) {
1394
+ printConsole(`Unknown trinket: ${params}`);
1395
+ return;
1396
+ }
1397
+
1398
+ trinketType = match[1];
1399
+ } else {
1400
+ trinketType = asTrinketType(trinketTypeNumber);
1401
+ }
1402
+
1334
1403
  const roomClass = game.GetRoom();
1335
1404
  const centerPos = roomClass.GetCenterPos();
1336
- spawnTrinket(goldenTrinketType, centerPos);
1405
+ spawnTrinketFunction(trinketType, centerPos);
1337
1406
  }
1338
1407
 
1339
1408
  /** Toggles maximum movement speed and flight for the player. */
@@ -1441,7 +1510,7 @@ export function warp(params: string): void {
1441
1510
  let roomType: RoomType;
1442
1511
  const num = tonumber(params) as RoomType | undefined;
1443
1512
  if (num === undefined) {
1444
- const match = getMapPartialMatch(params, ROOM_TYPE_MAP);
1513
+ const match = getMapPartialMatch(params, ROOM_NAME_TO_TYPE_MAP);
1445
1514
  if (match === undefined) {
1446
1515
  printConsole(`Unknown room type: ${params}`);
1447
1516
  return;
@@ -20,9 +20,9 @@ import {
20
20
  DEFAULT_COLLECTIBLE_DESCRIPTION,
21
21
  } from "../maps/collectibleDescriptionMap";
22
22
  import {
23
- COLLECTIBLE_NAME_MAP,
23
+ COLLECTIBLE_TYPE_TO_NAME_MAP,
24
24
  DEFAULT_COLLECTIBLE_NAME,
25
- } from "../maps/collectibleNameMap";
25
+ } from "../maps/collectibleTypeToNameMap";
26
26
  import { SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET } from "../sets/singleUseActiveCollectibleTypesSet";
27
27
  import { CollectibleIndex } from "../types/CollectibleIndex";
28
28
  import { getEntityID } from "./entities";
@@ -308,7 +308,7 @@ export function getCollectibleMaxCharges(
308
308
  export function getCollectibleName(collectibleType: CollectibleType): string {
309
309
  // "ItemConfigItem.Name" is bugged with vanilla items on patch v1.7.6, so we use a hard-coded map
310
310
  // as a workaround.
311
- const collectibleName = COLLECTIBLE_NAME_MAP.get(collectibleType);
311
+ const collectibleName = COLLECTIBLE_TYPE_TO_NAME_MAP.get(collectibleType);
312
312
  if (collectibleName !== undefined) {
313
313
  return collectibleName;
314
314
  }
@@ -55,6 +55,12 @@ export function removeCharactersBefore(
55
55
  return string.slice(index);
56
56
  }
57
57
 
58
+ /** Helper function to remove all characters from a string that are not letters or numbers. */
59
+ export function removeNonAlphanumericCharacters(str: string): string {
60
+ const [returnValue, _] = string.gsub(str, "%W", "");
61
+ return returnValue;
62
+ }
63
+
58
64
  /**
59
65
  * Helper function to remove one or more substrings from a string, if they exist. Returns the
60
66
  * modified string.
@@ -13,7 +13,10 @@ import {
13
13
  DEFAULT_TRINKET_DESCRIPTION,
14
14
  TRINKET_DESCRIPTION_MAP,
15
15
  } from "../maps/trinketDescriptionMap";
16
- import { DEFAULT_TRINKET_NAME, TRINKET_NAME_MAP } from "../maps/trinketNameMap";
16
+ import {
17
+ DEFAULT_TRINKET_NAME,
18
+ TRINKET_TYPE_TO_NAME_MAP,
19
+ } from "../maps/trinketTypeToNameMap";
17
20
  import { getEntityID } from "./entities";
18
21
  import { isTrinket } from "./pickupVariants";
19
22
  import { isCharacter } from "./players";
@@ -123,7 +126,7 @@ export function getTrinketGfxFilename(trinketType: TrinketType): string {
123
126
  export function getTrinketName(trinketType: TrinketType): string {
124
127
  // "ItemConfigItem.Name" is bugged with vanilla items on patch v1.7.6, so we use a hard-coded map
125
128
  // as a workaround.
126
- const trinketName = TRINKET_NAME_MAP.get(trinketType);
129
+ const trinketName = TRINKET_TYPE_TO_NAME_MAP.get(trinketType);
127
130
  if (trinketName !== undefined) {
128
131
  return trinketName;
129
132
  }
package/src/index.ts CHANGED
@@ -159,10 +159,10 @@ export * from "./interfaces/RoomDescription";
159
159
  export * from "./interfaces/SaveData";
160
160
  export * from "./interfaces/StatTypeType";
161
161
  export * from "./interfaces/TrinketSituation";
162
- export * from "./maps/cardMap";
163
- export * from "./maps/characterMap";
164
- export * from "./maps/pillEffectMap";
165
- export * from "./maps/roomTypeMap";
162
+ export * from "./maps/cardNameToTypeMap";
163
+ export * from "./maps/characterNameToTypeMap";
164
+ export * from "./maps/pillNameToEffectMap";
165
+ export * from "./maps/roomNameToTypeMap";
166
166
  export * from "./objects/colors";
167
167
  export * from "./types/AnyEntity";
168
168
  export * from "./types/AnyGridEntity";
@@ -2,8 +2,8 @@ import { CardType } from "isaac-typescript-definitions";
2
2
 
3
3
  // cspell:ignore hiero
4
4
 
5
- /** Maps card names to card sub-types. */
6
- export const CARD_MAP: ReadonlyMap<string, CardType> = new Map([
5
+ /** Maps card names to the values of the `CardType` enum. */
6
+ export const CARD_NAME_TO_TYPE_MAP: ReadonlyMap<string, CardType> = new Map([
7
7
  ["fool", CardType.FOOL], // 1
8
8
  ["magician", CardType.MAGICIAN], // 2
9
9
  ["mag", CardType.MAGICIAN], // 2 - Needed since we have "mag?"
@@ -0,0 +1,88 @@
1
+ import { PlayerType } from "isaac-typescript-definitions";
2
+
3
+ /** Maps character names to the values of the `PlayerType` enum. */
4
+ export const CHARACTER_NAME_TO_TYPE_MAP = new Map<string, PlayerType>([
5
+ ["isaac", PlayerType.ISAAC], // 0
6
+ ["magdalene", PlayerType.MAGDALENE], // 1
7
+ ["maggy", PlayerType.MAGDALENE], // 1
8
+ ["cain", PlayerType.CAIN], // 2
9
+ ["judas", PlayerType.JUDAS], // 3
10
+ ["blueBaby", PlayerType.BLUE_BABY], // 4
11
+ ["bb", PlayerType.BLUE_BABY], // 4
12
+ ["eve", PlayerType.EVE], // 5
13
+ ["samson", PlayerType.SAMSON], // 6
14
+ ["azazel", PlayerType.AZAZEL], // 7
15
+ ["lazarus", PlayerType.LAZARUS], // 8
16
+ // Needed so that "laz2" does not take precedence over "lazarus".
17
+ ["laz", PlayerType.LAZARUS], // 8
18
+ ["eden", PlayerType.EDEN], // 9
19
+ ["theLost", PlayerType.THE_LOST], // 10
20
+ ["lost", PlayerType.THE_LOST], // 10
21
+ ["lazarus2", PlayerType.LAZARUS_2], // 11
22
+ ["laz2", PlayerType.LAZARUS_2], // 11
23
+ ["darkJudas", PlayerType.DARK_JUDAS], // 12
24
+ ["dJudas", PlayerType.DARK_JUDAS], // 12
25
+ ["blackJudas", PlayerType.DARK_JUDAS], // 12
26
+ ["bJudas", PlayerType.DARK_JUDAS], // 12
27
+ ["lilith", PlayerType.LILITH], // 13
28
+ ["keeper", PlayerType.KEEPER], // 14
29
+ ["apollyon", PlayerType.APOLLYON], // 15
30
+ ["theForgotten", PlayerType.THE_FORGOTTEN], // 16
31
+ ["forgotten", PlayerType.THE_FORGOTTEN], // 16
32
+ ["theSoul", PlayerType.THE_SOUL], // 17
33
+ ["soul", PlayerType.THE_SOUL], // 17
34
+ ["bethany", PlayerType.BETHANY], // 18
35
+ ["jacob", PlayerType.JACOB], // 19
36
+ ["esau", PlayerType.ESAU], // 20
37
+ ["taintedIsaac", PlayerType.ISAAC_B], // 21
38
+ ["tIsaac", PlayerType.ISAAC_B], // 21
39
+ ["taintedMagdalene", PlayerType.MAGDALENE_B], // 22
40
+ ["tMagdalene", PlayerType.MAGDALENE_B], // 22
41
+ ["taintedMaggy", PlayerType.MAGDALENE_B], // 22
42
+ ["tMaggy", PlayerType.MAGDALENE_B], // 22
43
+ ["taintedCain", PlayerType.CAIN_B], // 23
44
+ ["tCain", PlayerType.CAIN_B], // 23
45
+ ["taintedJudas", PlayerType.JUDAS_B], // 24
46
+ ["tJudas", PlayerType.JUDAS_B], // 24
47
+ ["taintedBlueBaby", PlayerType.BLUE_BABY_B], // 25
48
+ ["tBlueBaby", PlayerType.BLUE_BABY_B], // 25
49
+ ["tbb", PlayerType.BLUE_BABY_B], // 25
50
+ ["taintedEve", PlayerType.EVE_B], // 26
51
+ ["tEve", PlayerType.EVE_B], // 26
52
+ ["taintedSamson", PlayerType.SAMSON_B], // 27
53
+ ["tSamson", PlayerType.SAMSON_B], // 27
54
+ ["taintedAzazel", PlayerType.AZAZEL_B], // 28
55
+ ["tAzazel", PlayerType.AZAZEL_B], // 28
56
+ ["taintedLazarus", PlayerType.LAZARUS_B], // 29
57
+ ["tLazarus", PlayerType.LAZARUS_B], // 29
58
+ ["taintedLaz", PlayerType.LAZARUS_B], // 29
59
+ ["tLaz", PlayerType.LAZARUS_B], // 29
60
+ ["taintedEden", PlayerType.EDEN_B], // 30
61
+ ["tEden", PlayerType.EDEN_B], // 30
62
+ ["taintedLost", PlayerType.THE_LOST_B], // 31
63
+ ["tLost", PlayerType.THE_LOST_B], // 31
64
+ ["taintedLilith", PlayerType.LILITH_B], // 32
65
+ ["tLilith", PlayerType.LILITH_B], // 32
66
+ ["taintedKeeper", PlayerType.KEEPER_B], // 33
67
+ ["tKeeper", PlayerType.KEEPER_B], // 33
68
+ ["taintedApollyon", PlayerType.APOLLYON_B], // 34
69
+ ["tApollyon", PlayerType.APOLLYON_B], // 34
70
+ ["taintedForgotten", PlayerType.THE_FORGOTTEN_B], // 35
71
+ ["tForgotten", PlayerType.THE_FORGOTTEN_B], // 35
72
+ ["taintedBethany", PlayerType.BETHANY_B], // 36
73
+ ["tBethany", PlayerType.BETHANY_B], // 36
74
+ ["taintedJacob", PlayerType.JACOB_B], // 37
75
+ ["tJacob", PlayerType.JACOB_B], // 37
76
+ ["taintedLazarusDead", PlayerType.LAZARUS_2_B], // 38
77
+ ["tLazarusDead", PlayerType.LAZARUS_2_B], // 38
78
+ ["taintedLazDead", PlayerType.LAZARUS_2_B], // 38
79
+ ["tLazDead", PlayerType.LAZARUS_2_B], // 38
80
+ ["deadTaintedLazarus", PlayerType.LAZARUS_2_B], // 38
81
+ ["deadTLazarus", PlayerType.LAZARUS_2_B], // 38
82
+ ["deadTaintedLaz", PlayerType.LAZARUS_2_B], // 38
83
+ ["deadTLaz", PlayerType.LAZARUS_2_B], // 38
84
+ ["taintedJacobGhost", PlayerType.JACOB_2_B], // 39
85
+ ["tJacobGhost", PlayerType.JACOB_2_B], // 39
86
+ ["taintedSoul", PlayerType.THE_SOUL_B], // 40
87
+ ["tSoul", PlayerType.THE_SOUL_B], // 40
88
+ ]);
@@ -5,8 +5,12 @@ import { CollectibleType } from "isaac-typescript-definitions";
5
5
 
6
6
  export const DEFAULT_COLLECTIBLE_DESCRIPTION = "Unknown";
7
7
 
8
- // This is a temporary map due to missing features in the vanilla API. (Otherwise, this would be
9
- // converted to a type-safe object.)
8
+ /**
9
+ * Maps collectible types to the real English descriptions from the "stringtable.sta" file.
10
+ *
11
+ * This is a temporary map due to missing features in the vanilla API. (Otherwise, this would be
12
+ * converted to a type-safe object.)
13
+ */
10
14
  export const COLLECTIBLE_DESCRIPTION_MAP: ReadonlyMap<CollectibleType, string> =
11
15
  new Map([
12
16
  [1, "Tears up"],
@@ -0,0 +1,19 @@
1
+ import { CollectibleType } from "isaac-typescript-definitions";
2
+ import { removeNonAlphanumericCharacters } from "../functions/string";
3
+ import { COLLECTIBLE_TYPE_TO_NAME_MAP } from "./collectibleTypeToNameMap";
4
+
5
+ /**
6
+ * Maps collectible names to the values of the `CollectibleType` enum.
7
+ *
8
+ * For a mapping of `CollectibleType` to name, see `COLLECTIBLE_TYPE_TO_NAME_MAP`.
9
+ */
10
+ const collectibleNameToTypeMap = new Map<string, CollectibleType>();
11
+ for (const [collectibleType, name] of COLLECTIBLE_TYPE_TO_NAME_MAP) {
12
+ const simpleString = removeNonAlphanumericCharacters(name);
13
+ collectibleNameToTypeMap.set(simpleString, collectibleType);
14
+ }
15
+
16
+ export const COLLECTIBLE_NAME_TO_TYPE_MAP: ReadonlyMap<
17
+ string,
18
+ CollectibleType
19
+ > = collectibleNameToTypeMap;