rpgmaker-mz-mcp 1.0.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 (219) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +425 -0
  3. package/dist/events/commandBuilders.d.ts +405 -0
  4. package/dist/events/commandBuilders.d.ts.map +1 -0
  5. package/dist/events/commandBuilders.js +554 -0
  6. package/dist/events/commandBuilders.js.map +1 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +105 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/registry.d.ts +81 -0
  12. package/dist/registry.d.ts.map +1 -0
  13. package/dist/registry.js +49 -0
  14. package/dist/registry.js.map +1 -0
  15. package/dist/tiles/autotile.d.ts +65 -0
  16. package/dist/tiles/autotile.d.ts.map +1 -0
  17. package/dist/tiles/autotile.js +201 -0
  18. package/dist/tiles/autotile.js.map +1 -0
  19. package/dist/tiles/catalog/dungeon.d.ts +16 -0
  20. package/dist/tiles/catalog/dungeon.d.ts.map +1 -0
  21. package/dist/tiles/catalog/dungeon.js +765 -0
  22. package/dist/tiles/catalog/dungeon.js.map +1 -0
  23. package/dist/tiles/catalog/index.d.ts +78 -0
  24. package/dist/tiles/catalog/index.d.ts.map +1 -0
  25. package/dist/tiles/catalog/index.js +115 -0
  26. package/dist/tiles/catalog/index.js.map +1 -0
  27. package/dist/tiles/catalog/inside.d.ts +16 -0
  28. package/dist/tiles/catalog/inside.d.ts.map +1 -0
  29. package/dist/tiles/catalog/inside.js +765 -0
  30. package/dist/tiles/catalog/inside.js.map +1 -0
  31. package/dist/tiles/catalog/outside.d.ts +16 -0
  32. package/dist/tiles/catalog/outside.d.ts.map +1 -0
  33. package/dist/tiles/catalog/outside.js +799 -0
  34. package/dist/tiles/catalog/outside.js.map +1 -0
  35. package/dist/tiles/catalog/overworld.d.ts +16 -0
  36. package/dist/tiles/catalog/overworld.d.ts.map +1 -0
  37. package/dist/tiles/catalog/overworld.js +585 -0
  38. package/dist/tiles/catalog/overworld.js.map +1 -0
  39. package/dist/tiles/catalog/sf.d.ts +16 -0
  40. package/dist/tiles/catalog/sf.d.ts.map +1 -0
  41. package/dist/tiles/catalog/sf.js +1313 -0
  42. package/dist/tiles/catalog/sf.js.map +1 -0
  43. package/dist/tiles/paint.d.ts +20 -0
  44. package/dist/tiles/paint.d.ts.map +1 -0
  45. package/dist/tiles/paint.js +65 -0
  46. package/dist/tiles/paint.js.map +1 -0
  47. package/dist/tiles/png.d.ts +11 -0
  48. package/dist/tiles/png.d.ts.map +1 -0
  49. package/dist/tiles/png.js +180 -0
  50. package/dist/tiles/png.js.map +1 -0
  51. package/dist/tiles/tileCodec.d.ts +95 -0
  52. package/dist/tiles/tileCodec.d.ts.map +1 -0
  53. package/dist/tiles/tileCodec.js +186 -0
  54. package/dist/tiles/tileCodec.js.map +1 -0
  55. package/dist/tiles/tileFlags.d.ts +98 -0
  56. package/dist/tiles/tileFlags.d.ts.map +1 -0
  57. package/dist/tiles/tileFlags.js +129 -0
  58. package/dist/tiles/tileFlags.js.map +1 -0
  59. package/dist/tiles/tilegeom.d.ts +29 -0
  60. package/dist/tiles/tilegeom.d.ts.map +1 -0
  61. package/dist/tiles/tilegeom.js +111 -0
  62. package/dist/tiles/tilegeom.js.map +1 -0
  63. package/dist/tiles/transparency.d.ts +22 -0
  64. package/dist/tiles/transparency.d.ts.map +1 -0
  65. package/dist/tiles/transparency.js +59 -0
  66. package/dist/tiles/transparency.js.map +1 -0
  67. package/dist/tools/actorTools.d.ts +48 -0
  68. package/dist/tools/actorTools.d.ts.map +1 -0
  69. package/dist/tools/actorTools.js +154 -0
  70. package/dist/tools/actorTools.js.map +1 -0
  71. package/dist/tools/allTools.d.ts +8 -0
  72. package/dist/tools/allTools.d.ts.map +1 -0
  73. package/dist/tools/allTools.js +56 -0
  74. package/dist/tools/allTools.js.map +1 -0
  75. package/dist/tools/assetTools.d.ts +113 -0
  76. package/dist/tools/assetTools.d.ts.map +1 -0
  77. package/dist/tools/assetTools.js +97 -0
  78. package/dist/tools/assetTools.js.map +1 -0
  79. package/dist/tools/batchTools.d.ts +3 -0
  80. package/dist/tools/batchTools.d.ts.map +1 -0
  81. package/dist/tools/batchTools.js +138 -0
  82. package/dist/tools/batchTools.js.map +1 -0
  83. package/dist/tools/battleTools.d.ts +72 -0
  84. package/dist/tools/battleTools.d.ts.map +1 -0
  85. package/dist/tools/battleTools.js +322 -0
  86. package/dist/tools/battleTools.js.map +1 -0
  87. package/dist/tools/catalogTools.d.ts +3 -0
  88. package/dist/tools/catalogTools.d.ts.map +1 -0
  89. package/dist/tools/catalogTools.js +134 -0
  90. package/dist/tools/catalogTools.js.map +1 -0
  91. package/dist/tools/classTools.d.ts +85 -0
  92. package/dist/tools/classTools.d.ts.map +1 -0
  93. package/dist/tools/classTools.js +279 -0
  94. package/dist/tools/classTools.js.map +1 -0
  95. package/dist/tools/commonEventTools.d.ts +32 -0
  96. package/dist/tools/commonEventTools.d.ts.map +1 -0
  97. package/dist/tools/commonEventTools.js +150 -0
  98. package/dist/tools/commonEventTools.js.map +1 -0
  99. package/dist/tools/eventCommandTools.d.ts +37 -0
  100. package/dist/tools/eventCommandTools.d.ts.map +1 -0
  101. package/dist/tools/eventCommandTools.js +893 -0
  102. package/dist/tools/eventCommandTools.js.map +1 -0
  103. package/dist/tools/eventPageTools.d.ts +112 -0
  104. package/dist/tools/eventPageTools.d.ts.map +1 -0
  105. package/dist/tools/eventPageTools.js +597 -0
  106. package/dist/tools/eventPageTools.js.map +1 -0
  107. package/dist/tools/itemTools.d.ts +82 -0
  108. package/dist/tools/itemTools.d.ts.map +1 -0
  109. package/dist/tools/itemTools.js +380 -0
  110. package/dist/tools/itemTools.js.map +1 -0
  111. package/dist/tools/listTools.d.ts +58 -0
  112. package/dist/tools/listTools.d.ts.map +1 -0
  113. package/dist/tools/listTools.js +99 -0
  114. package/dist/tools/listTools.js.map +1 -0
  115. package/dist/tools/mapTools.d.ts +270 -0
  116. package/dist/tools/mapTools.d.ts.map +1 -0
  117. package/dist/tools/mapTools.js +1066 -0
  118. package/dist/tools/mapTools.js.map +1 -0
  119. package/dist/tools/moveTools.d.ts +43 -0
  120. package/dist/tools/moveTools.d.ts.map +1 -0
  121. package/dist/tools/moveTools.js +240 -0
  122. package/dist/tools/moveTools.js.map +1 -0
  123. package/dist/tools/objectTools.d.ts +12 -0
  124. package/dist/tools/objectTools.d.ts.map +1 -0
  125. package/dist/tools/objectTools.js +221 -0
  126. package/dist/tools/objectTools.js.map +1 -0
  127. package/dist/tools/paintTools.d.ts +3 -0
  128. package/dist/tools/paintTools.d.ts.map +1 -0
  129. package/dist/tools/paintTools.js +134 -0
  130. package/dist/tools/paintTools.js.map +1 -0
  131. package/dist/tools/pluginScanTools.d.ts +22 -0
  132. package/dist/tools/pluginScanTools.d.ts.map +1 -0
  133. package/dist/tools/pluginScanTools.js +119 -0
  134. package/dist/tools/pluginScanTools.js.map +1 -0
  135. package/dist/tools/pluginTools.d.ts +11 -0
  136. package/dist/tools/pluginTools.d.ts.map +1 -0
  137. package/dist/tools/pluginTools.js +63 -0
  138. package/dist/tools/pluginTools.js.map +1 -0
  139. package/dist/tools/projectTools.d.ts +11 -0
  140. package/dist/tools/projectTools.d.ts.map +1 -0
  141. package/dist/tools/projectTools.js +74 -0
  142. package/dist/tools/projectTools.js.map +1 -0
  143. package/dist/tools/skillTools.d.ts +83 -0
  144. package/dist/tools/skillTools.d.ts.map +1 -0
  145. package/dist/tools/skillTools.js +369 -0
  146. package/dist/tools/skillTools.js.map +1 -0
  147. package/dist/tools/stateTools.d.ts +28 -0
  148. package/dist/tools/stateTools.d.ts.map +1 -0
  149. package/dist/tools/stateTools.js +161 -0
  150. package/dist/tools/stateTools.js.map +1 -0
  151. package/dist/tools/systemTools.d.ts +86 -0
  152. package/dist/tools/systemTools.d.ts.map +1 -0
  153. package/dist/tools/systemTools.js +342 -0
  154. package/dist/tools/systemTools.js.map +1 -0
  155. package/dist/tools/tileTools.d.ts +9 -0
  156. package/dist/tools/tileTools.d.ts.map +1 -0
  157. package/dist/tools/tileTools.js +34 -0
  158. package/dist/tools/tileTools.js.map +1 -0
  159. package/dist/tools/tileTransparency.d.ts +40 -0
  160. package/dist/tools/tileTransparency.d.ts.map +1 -0
  161. package/dist/tools/tileTransparency.js +156 -0
  162. package/dist/tools/tileTransparency.js.map +1 -0
  163. package/dist/tools/tilesetTools.d.ts +23 -0
  164. package/dist/tools/tilesetTools.d.ts.map +1 -0
  165. package/dist/tools/tilesetTools.js +209 -0
  166. package/dist/tools/tilesetTools.js.map +1 -0
  167. package/dist/tools/validationTools.d.ts +50 -0
  168. package/dist/tools/validationTools.d.ts.map +1 -0
  169. package/dist/tools/validationTools.js +229 -0
  170. package/dist/tools/validationTools.js.map +1 -0
  171. package/dist/utils/commit.d.ts +62 -0
  172. package/dist/utils/commit.d.ts.map +1 -0
  173. package/dist/utils/commit.js +119 -0
  174. package/dist/utils/commit.js.map +1 -0
  175. package/dist/utils/fileHandler.d.ts +49 -0
  176. package/dist/utils/fileHandler.d.ts.map +1 -0
  177. package/dist/utils/fileHandler.js +137 -0
  178. package/dist/utils/fileHandler.js.map +1 -0
  179. package/dist/utils/records.d.ts +8 -0
  180. package/dist/utils/records.d.ts.map +1 -0
  181. package/dist/utils/records.js +10 -0
  182. package/dist/utils/records.js.map +1 -0
  183. package/dist/utils/types.d.ts +465 -0
  184. package/dist/utils/types.d.ts.map +1 -0
  185. package/dist/utils/types.js +5 -0
  186. package/dist/utils/types.js.map +1 -0
  187. package/dist/validation/assets.d.ts +53 -0
  188. package/dist/validation/assets.d.ts.map +1 -0
  189. package/dist/validation/assets.js +198 -0
  190. package/dist/validation/assets.js.map +1 -0
  191. package/dist/validation/createRefs.d.ts +37 -0
  192. package/dist/validation/createRefs.d.ts.map +1 -0
  193. package/dist/validation/createRefs.js +89 -0
  194. package/dist/validation/createRefs.js.map +1 -0
  195. package/dist/validation/eventCommands.d.ts +70 -0
  196. package/dist/validation/eventCommands.d.ts.map +1 -0
  197. package/dist/validation/eventCommands.js +273 -0
  198. package/dist/validation/eventCommands.js.map +1 -0
  199. package/dist/validation/gate.d.ts +56 -0
  200. package/dist/validation/gate.d.ts.map +1 -0
  201. package/dist/validation/gate.js +50 -0
  202. package/dist/validation/gate.js.map +1 -0
  203. package/dist/validation/moveCommands.d.ts +31 -0
  204. package/dist/validation/moveCommands.d.ts.map +1 -0
  205. package/dist/validation/moveCommands.js +123 -0
  206. package/dist/validation/moveCommands.js.map +1 -0
  207. package/dist/validation/pluginCommands.d.ts +83 -0
  208. package/dist/validation/pluginCommands.d.ts.map +1 -0
  209. package/dist/validation/pluginCommands.js +134 -0
  210. package/dist/validation/pluginCommands.js.map +1 -0
  211. package/dist/validation/pluginManifest.d.ts +67 -0
  212. package/dist/validation/pluginManifest.d.ts.map +1 -0
  213. package/dist/validation/pluginManifest.js +199 -0
  214. package/dist/validation/pluginManifest.js.map +1 -0
  215. package/dist/validation/references.d.ts +57 -0
  216. package/dist/validation/references.d.ts.map +1 -0
  217. package/dist/validation/references.js +314 -0
  218. package/dist/validation/references.js.map +1 -0
  219. package/package.json +67 -0
@@ -0,0 +1,86 @@
1
+ import { SystemData, Terms } from '../utils/types.js';
2
+ import { ToolDefinition } from '../registry.js';
3
+ /**
4
+ * Get system data
5
+ */
6
+ export declare function getSystem(projectPath: string): Promise<SystemData>;
7
+ /**
8
+ * Update system data
9
+ */
10
+ export declare function updateSystem(projectPath: string, updates: Partial<SystemData>): Promise<SystemData>;
11
+ /**
12
+ * Get game variables
13
+ */
14
+ export declare function getVariables(projectPath: string): Promise<string[]>;
15
+ /**
16
+ * Set a variable name
17
+ */
18
+ export declare function setVariableName(projectPath: string, variableId: number, name: string): Promise<void>;
19
+ /**
20
+ * Get game switches
21
+ */
22
+ export declare function getSwitches(projectPath: string): Promise<string[]>;
23
+ /**
24
+ * Set a switch name
25
+ */
26
+ export declare function setSwitchName(projectPath: string, switchId: number, name: string): Promise<void>;
27
+ /**
28
+ * Get party members
29
+ */
30
+ export declare function getPartyMembers(projectPath: string): Promise<number[]>;
31
+ /**
32
+ * Update the starting party (the actor ids the game begins with). Validates every
33
+ * id references an existing actor (throws otherwise — mirrors create_map's parent
34
+ * check) so a bad party can't silently break new-game setup.
35
+ */
36
+ export declare function updatePartyMembers(projectPath: string, partyMembers: number[]): Promise<void>;
37
+ /**
38
+ * Get starting position
39
+ */
40
+ export declare function getStartingPosition(projectPath: string): Promise<{
41
+ mapId: number;
42
+ x: number;
43
+ y: number;
44
+ }>;
45
+ /**
46
+ * Update starting position. Validates the map exists (in MapInfos) and that x/y
47
+ * fall within that map's bounds — consistent with set_party's actor-id check and
48
+ * set_encounters' troop check, so a typo can't point new-game at a missing map or
49
+ * an off-map tile.
50
+ */
51
+ export declare function updateStartingPosition(projectPath: string, mapId: number, x: number, y: number): Promise<void>;
52
+ /**
53
+ * Get game title
54
+ */
55
+ export declare function getGameTitle(projectPath: string): Promise<string>;
56
+ /**
57
+ * Update game title
58
+ */
59
+ export declare function updateGameTitle(projectPath: string, title: string): Promise<void>;
60
+ /**
61
+ * Get all terms (vocabulary): the `basic`, `commands`, `params` string arrays
62
+ * and the `messages` string map.
63
+ */
64
+ export declare function getTerms(projectPath: string): Promise<Terms>;
65
+ /** The four vocabulary categories in System.json's `terms`. */
66
+ export type TermCategory = 'basic' | 'commands' | 'params' | 'messages';
67
+ /**
68
+ * Set one vocabulary term. For `basic`/`commands`/`params` the `key` is a numeric
69
+ * index (passed as a string); for `messages` it's a string message key. Throws on
70
+ * an out-of-range index (so a typo can't silently grow a sparse array).
71
+ */
72
+ export declare function setTerm(projectPath: string, category: TermCategory, key: string, value: string): Promise<Terms>;
73
+ /** The System.json "type name" arrays other data references by index. */
74
+ export type TypeCategory = 'elements' | 'skillTypes' | 'weaponTypes' | 'armorTypes' | 'equipTypes';
75
+ /** Get one type-name array (elements, skillTypes, weaponTypes, armorTypes, equipTypes). */
76
+ export declare function getTypes(projectPath: string, category: TypeCategory): Promise<string[]>;
77
+ /**
78
+ * Rename one entry in a type-name array. `index` 0 is the conventional empty slot
79
+ * (kept as `""` by the editor). Throws on an out-of-range index rather than
80
+ * growing the array with holes.
81
+ */
82
+ export declare function setTypeName(projectPath: string, category: TypeCategory, index: number, name: string): Promise<string[]>;
83
+ /** Set the currency unit shown next to gold amounts (e.g. "G"). */
84
+ export declare function setCurrencyUnit(projectPath: string, unit: string): Promise<void>;
85
+ export declare const systemToolDefinitions: ToolDefinition[];
86
+ //# sourceMappingURL=systemTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemTools.d.ts","sourceRoot":"","sources":["../../src/tools/systemTools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,KAAK,EAA2B,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;GAEG;AACH,wBAAsB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAGxE;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAC3B,OAAO,CAAC,UAAU,CAAC,CAQrB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGzE;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGxE;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX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G,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,CAAC;AAEnG,2FAA2F;AAC3F,wBAAsB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAG7F;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,EAAE,CAAC,CAUnB;AAED,mEAAmE;AACnE,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAItF;AAED,eAAO,MAAM,qBAAqB,EAAE,cAAc,EAiKjD,CAAC"}
@@ -0,0 +1,342 @@
1
+ import { z } from 'zod';
2
+ import { readJsonFile, readJsonArraySoft, getDataPath, getMapPath } from '../utils/fileHandler.js';
3
+ import { commitChange } from '../utils/commit.js';
4
+ /**
5
+ * Get system data
6
+ */
7
+ export async function getSystem(projectPath) {
8
+ const systemPath = getDataPath(projectPath, 'System.json');
9
+ return await readJsonFile(systemPath);
10
+ }
11
+ /**
12
+ * Update system data
13
+ */
14
+ export async function updateSystem(projectPath, updates) {
15
+ const system = await getSystem(projectPath);
16
+ const updatedSystem = { ...system, ...updates };
17
+ const systemPath = getDataPath(projectPath, 'System.json');
18
+ await commitChange(systemPath, updatedSystem);
19
+ return updatedSystem;
20
+ }
21
+ /**
22
+ * Get game variables
23
+ */
24
+ export async function getVariables(projectPath) {
25
+ const system = await getSystem(projectPath);
26
+ return system.variables;
27
+ }
28
+ /**
29
+ * Set a variable name
30
+ */
31
+ export async function setVariableName(projectPath, variableId, name) {
32
+ const system = await getSystem(projectPath);
33
+ if (variableId < 1 || variableId >= system.variables.length) {
34
+ throw new Error(`Variable id ${variableId} is out of range (project has ${system.variables.length - 1} variables). Add more in the editor's Database > System first.`);
35
+ }
36
+ system.variables[variableId] = name;
37
+ const systemPath = getDataPath(projectPath, 'System.json');
38
+ await commitChange(systemPath, system);
39
+ }
40
+ /**
41
+ * Get game switches
42
+ */
43
+ export async function getSwitches(projectPath) {
44
+ const system = await getSystem(projectPath);
45
+ return system.switches;
46
+ }
47
+ /**
48
+ * Set a switch name
49
+ */
50
+ export async function setSwitchName(projectPath, switchId, name) {
51
+ const system = await getSystem(projectPath);
52
+ if (switchId < 1 || switchId >= system.switches.length) {
53
+ throw new Error(`Switch id ${switchId} is out of range (project has ${system.switches.length - 1} switches). Add more in the editor's Database > System first.`);
54
+ }
55
+ system.switches[switchId] = name;
56
+ const systemPath = getDataPath(projectPath, 'System.json');
57
+ await commitChange(systemPath, system);
58
+ }
59
+ /**
60
+ * Get party members
61
+ */
62
+ export async function getPartyMembers(projectPath) {
63
+ const system = await getSystem(projectPath);
64
+ return system.partyMembers;
65
+ }
66
+ /**
67
+ * Update the starting party (the actor ids the game begins with). Validates every
68
+ * id references an existing actor (throws otherwise — mirrors create_map's parent
69
+ * check) so a bad party can't silently break new-game setup.
70
+ */
71
+ export async function updatePartyMembers(projectPath, partyMembers) {
72
+ const actors = await readJsonFile(getDataPath(projectPath, 'Actors.json'));
73
+ for (const id of partyMembers) {
74
+ if (!actors[id]) {
75
+ throw new Error(`Party member actor id ${id} does not exist in Actors.json`);
76
+ }
77
+ }
78
+ const system = await getSystem(projectPath);
79
+ system.partyMembers = partyMembers;
80
+ const systemPath = getDataPath(projectPath, 'System.json');
81
+ await commitChange(systemPath, system);
82
+ }
83
+ /**
84
+ * Get starting position
85
+ */
86
+ export async function getStartingPosition(projectPath) {
87
+ const system = await getSystem(projectPath);
88
+ return {
89
+ mapId: system.startMapId,
90
+ x: system.startX,
91
+ y: system.startY,
92
+ };
93
+ }
94
+ /**
95
+ * Update starting position. Validates the map exists (in MapInfos) and that x/y
96
+ * fall within that map's bounds — consistent with set_party's actor-id check and
97
+ * set_encounters' troop check, so a typo can't point new-game at a missing map or
98
+ * an off-map tile.
99
+ */
100
+ export async function updateStartingPosition(projectPath, mapId, x, y) {
101
+ const mapInfos = await readJsonArraySoft(getDataPath(projectPath, 'MapInfos.json'));
102
+ if (!mapInfos[mapId]) {
103
+ throw new Error(`Starting map id ${mapId} does not exist in MapInfos.json`);
104
+ }
105
+ const map = await readJsonFile(getMapPath(projectPath, mapId));
106
+ if (x < 0 || x >= map.width || y < 0 || y >= map.height) {
107
+ throw new Error(`Starting position (${x}, ${y}) is out of bounds for map ${mapId} (${map.width}x${map.height})`);
108
+ }
109
+ const system = await getSystem(projectPath);
110
+ system.startMapId = mapId;
111
+ system.startX = x;
112
+ system.startY = y;
113
+ const systemPath = getDataPath(projectPath, 'System.json');
114
+ await commitChange(systemPath, system);
115
+ }
116
+ /**
117
+ * Get game title
118
+ */
119
+ export async function getGameTitle(projectPath) {
120
+ const system = await getSystem(projectPath);
121
+ return system.gameTitle;
122
+ }
123
+ /**
124
+ * Update game title
125
+ */
126
+ export async function updateGameTitle(projectPath, title) {
127
+ const system = await getSystem(projectPath);
128
+ system.gameTitle = title;
129
+ const systemPath = getDataPath(projectPath, 'System.json');
130
+ await commitChange(systemPath, system);
131
+ }
132
+ /**
133
+ * Get all terms (vocabulary): the `basic`, `commands`, `params` string arrays
134
+ * and the `messages` string map.
135
+ */
136
+ export async function getTerms(projectPath) {
137
+ const system = await getSystem(projectPath);
138
+ return system.terms;
139
+ }
140
+ /**
141
+ * Set one vocabulary term. For `basic`/`commands`/`params` the `key` is a numeric
142
+ * index (passed as a string); for `messages` it's a string message key. Throws on
143
+ * an out-of-range index (so a typo can't silently grow a sparse array).
144
+ */
145
+ export async function setTerm(projectPath, category, key, value) {
146
+ const system = await getSystem(projectPath);
147
+ const terms = system.terms;
148
+ if (category === 'messages') {
149
+ terms.messages[key] = value;
150
+ }
151
+ else {
152
+ const index = Number(key);
153
+ const arr = terms[category];
154
+ if (!Number.isInteger(index) || index < 0 || index >= arr.length) {
155
+ throw new Error(`terms.${category} index ${key} is out of range (0..${arr.length - 1})`);
156
+ }
157
+ arr[index] = value;
158
+ }
159
+ await commitChange(getDataPath(projectPath, 'System.json'), system);
160
+ return terms;
161
+ }
162
+ /** Get one type-name array (elements, skillTypes, weaponTypes, armorTypes, equipTypes). */
163
+ export async function getTypes(projectPath, category) {
164
+ const system = await getSystem(projectPath);
165
+ return system[category];
166
+ }
167
+ /**
168
+ * Rename one entry in a type-name array. `index` 0 is the conventional empty slot
169
+ * (kept as `""` by the editor). Throws on an out-of-range index rather than
170
+ * growing the array with holes.
171
+ */
172
+ export async function setTypeName(projectPath, category, index, name) {
173
+ const system = await getSystem(projectPath);
174
+ const arr = system[category];
175
+ if (!Number.isInteger(index) || index < 0 || index >= arr.length) {
176
+ throw new Error(`${category} index ${index} is out of range (0..${arr.length - 1})`);
177
+ }
178
+ arr[index] = name;
179
+ await commitChange(getDataPath(projectPath, 'System.json'), system);
180
+ return arr;
181
+ }
182
+ /** Set the currency unit shown next to gold amounts (e.g. "G"). */
183
+ export async function setCurrencyUnit(projectPath, unit) {
184
+ const system = await getSystem(projectPath);
185
+ system.currencyUnit = unit;
186
+ await commitChange(getDataPath(projectPath, 'System.json'), system);
187
+ }
188
+ export const systemToolDefinitions = [
189
+ {
190
+ name: 'get_system',
191
+ description: 'Get system data',
192
+ inputSchema: {},
193
+ handler: (ctx) => getSystem(ctx.projectPath),
194
+ },
195
+ {
196
+ name: 'get_variables',
197
+ description: 'Get all game variable names',
198
+ inputSchema: {},
199
+ handler: (ctx) => getVariables(ctx.projectPath),
200
+ },
201
+ {
202
+ name: 'set_variable_name',
203
+ mutates: true,
204
+ description: 'Set a variable name',
205
+ inputSchema: {
206
+ variableId: z.number().int().positive().describe('The 1-based variable ID'),
207
+ name: z.string().describe('The name to assign'),
208
+ },
209
+ handler: async (ctx, args) => {
210
+ await setVariableName(ctx.projectPath, args.variableId, args.name);
211
+ return { success: true };
212
+ },
213
+ },
214
+ {
215
+ name: 'get_switches',
216
+ description: 'Get all game switch names',
217
+ inputSchema: {},
218
+ handler: (ctx) => getSwitches(ctx.projectPath),
219
+ },
220
+ {
221
+ name: 'set_switch_name',
222
+ mutates: true,
223
+ description: 'Set a switch name',
224
+ inputSchema: {
225
+ switchId: z.number().int().positive().describe('The 1-based switch ID'),
226
+ name: z.string().describe('The name to assign'),
227
+ },
228
+ handler: async (ctx, args) => {
229
+ await setSwitchName(ctx.projectPath, args.switchId, args.name);
230
+ return { success: true };
231
+ },
232
+ },
233
+ {
234
+ name: 'get_game_title',
235
+ description: 'Get the game title',
236
+ inputSchema: {},
237
+ handler: (ctx) => getGameTitle(ctx.projectPath),
238
+ },
239
+ {
240
+ name: 'update_game_title',
241
+ mutates: true,
242
+ description: 'Update the game title',
243
+ inputSchema: { title: z.string().describe('The new game title') },
244
+ handler: async (ctx, args) => {
245
+ await updateGameTitle(ctx.projectPath, args.title);
246
+ return { success: true };
247
+ },
248
+ },
249
+ {
250
+ name: 'get_starting_position',
251
+ description: 'Get the game starting position ({ mapId, x, y })',
252
+ inputSchema: {},
253
+ handler: (ctx) => getStartingPosition(ctx.projectPath),
254
+ },
255
+ {
256
+ name: 'update_starting_position',
257
+ mutates: true,
258
+ description: 'Update the game starting position',
259
+ inputSchema: {
260
+ mapId: z.number().int().positive().describe('Starting map ID'),
261
+ x: z.number().int().nonnegative().describe('Starting x tile'),
262
+ y: z.number().int().nonnegative().describe('Starting y tile'),
263
+ },
264
+ handler: async (ctx, args) => {
265
+ await updateStartingPosition(ctx.projectPath, args.mapId, args.x, args.y);
266
+ return { success: true };
267
+ },
268
+ },
269
+ {
270
+ name: 'get_party',
271
+ description: "Get the starting party — the actor ids the game begins with. Returns `{ partyMembers }`, rhyming with set_party's input/output shape.",
272
+ inputSchema: {},
273
+ handler: async (ctx) => ({ partyMembers: await getPartyMembers(ctx.projectPath) }),
274
+ },
275
+ {
276
+ name: 'set_party',
277
+ mutates: true,
278
+ description: 'Set the starting party (the actor ids the game begins with, in order). Every id must reference an existing actor.',
279
+ inputSchema: {
280
+ partyMembers: z
281
+ .array(z.number().int().positive())
282
+ .describe('Ordered actor ids for the starting party'),
283
+ },
284
+ handler: async (ctx, args) => {
285
+ await updatePartyMembers(ctx.projectPath, args.partyMembers);
286
+ return { success: true, partyMembers: args.partyMembers };
287
+ },
288
+ },
289
+ {
290
+ name: 'get_terms',
291
+ description: 'Get the game vocabulary/terms: the `basic`, `commands`, `params` string arrays and the `messages` map (menu labels, system messages).',
292
+ inputSchema: {},
293
+ handler: (ctx) => getTerms(ctx.projectPath),
294
+ },
295
+ {
296
+ name: 'set_term',
297
+ mutates: true,
298
+ description: "Set one vocabulary term. For category 'basic'/'commands'/'params' the key is a numeric index (as a string); for 'messages' it's a message key (e.g. 'actorDamage'). Returns the updated terms.",
299
+ inputSchema: {
300
+ category: z
301
+ .enum(['basic', 'commands', 'params', 'messages'])
302
+ .describe('Which term group to edit'),
303
+ key: z.string().describe('Index (for basic/commands/params) or message key (for messages)'),
304
+ value: z.string().describe('The new term text'),
305
+ },
306
+ handler: (ctx, args) => setTerm(ctx.projectPath, args.category, args.key, args.value),
307
+ },
308
+ {
309
+ name: 'get_types',
310
+ description: 'Get one System.json type-name array — the named lists other data references by index: elements, skillTypes, weaponTypes, armorTypes, or equipTypes.',
311
+ inputSchema: {
312
+ category: z
313
+ .enum(['elements', 'skillTypes', 'weaponTypes', 'armorTypes', 'equipTypes'])
314
+ .describe('Which type-name array to read'),
315
+ },
316
+ handler: (ctx, args) => getTypes(ctx.projectPath, args.category),
317
+ },
318
+ {
319
+ name: 'set_type_name',
320
+ mutates: true,
321
+ description: 'Rename one entry in a System.json type-name array (elements/skillTypes/weaponTypes/armorTypes/equipTypes). Index 0 is the conventional empty slot. Returns the updated array.',
322
+ inputSchema: {
323
+ category: z
324
+ .enum(['elements', 'skillTypes', 'weaponTypes', 'armorTypes', 'equipTypes'])
325
+ .describe('Which type-name array to edit'),
326
+ index: z.number().int().nonnegative().describe('Index within the array (0 = empty slot)'),
327
+ name: z.string().describe('The new type name'),
328
+ },
329
+ handler: (ctx, args) => setTypeName(ctx.projectPath, args.category, args.index, args.name),
330
+ },
331
+ {
332
+ name: 'set_currency_unit',
333
+ mutates: true,
334
+ description: 'Set the currency unit shown next to gold amounts (e.g. "G", "Gold").',
335
+ inputSchema: { unit: z.string().describe('The currency unit string') },
336
+ handler: async (ctx, args) => {
337
+ await setCurrencyUnit(ctx.projectPath, args.unit);
338
+ return { success: true, currencyUnit: args.unit };
339
+ },
340
+ },
341
+ ];
342
+ //# sourceMappingURL=systemTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemTools.js","sourceRoot":"","sources":["../../src/tools/systemTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,WAAmB;IACjD,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC3D,OAAO,MAAM,YAAY,CAAa,UAAU,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,WAAmB,EACnB,OAA4B;IAE5B,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,aAAa,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC;IAEhD,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC3D,MAAM,YAAY,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAE9C,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAA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AE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;iBAC3E,QAAQ,CAAC,+BAA+B,CAAC;YAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;YACzF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;SAC/C;QACD,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CACrB,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,QAAwB,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC;KACrF;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,sEAAsE;QACnF,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC,EAAE;QACtE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACpD,CAAC;KACF;CACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ToolDefinition } from '../registry.js';
2
+ /**
3
+ * Read-only tools over the tile-id codec. `describe_tile` turns an opaque raw
4
+ * tile integer into a legible {sheet, kind, shape, autotile geometry} view —
5
+ * the inspection counterpart to the low-level `set_map_tile` primitive, and the
6
+ * foothold for the semantic catalog and paint commands that follow.
7
+ */
8
+ export declare const tileToolDefinitions: ToolDefinition[];
9
+ //# sourceMappingURL=tileTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tileTools.d.ts","sourceRoot":"","sources":["../../src/tools/tileTools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKhD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,cAAc,EAsB/C,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { decodeTile } from '../tiles/tileCodec.js';
3
+ import { getTileset } from './tilesetTools.js';
4
+ import { tileTransparencyDetail } from './tileTransparency.js';
5
+ /**
6
+ * Read-only tools over the tile-id codec. `describe_tile` turns an opaque raw
7
+ * tile integer into a legible {sheet, kind, shape, autotile geometry} view —
8
+ * the inspection counterpart to the low-level `set_map_tile` primitive, and the
9
+ * foothold for the semantic catalog and paint commands that follow.
10
+ */
11
+ export const tileToolDefinitions = [
12
+ {
13
+ name: 'describe_tile',
14
+ description: 'Decode a raw RPG Maker MZ tile id into its tileset sheet (A1–A5, B–E), and for autotiles its kind + shape slot (0–47) and autotile geometry (floor/wall/waterfall). Read-only inspection helper — raw tile ids are opaque integers, this makes one legible. Returns { tileId, empty, sheet, sheetIndex, autotile, kind?, shape?, autotileType? }. Pass `tilesetId` to also inspect the sheet PNG and report `transparent` (true = the tile is see-through and needs an opaque base tile on a lower layer; painting it on layer 0 alone shows the map void) + `transparentPercent`.',
15
+ inputSchema: {
16
+ tileId: z.number().int().nonnegative().describe('The raw tile id to decode'),
17
+ tilesetId: z
18
+ .number()
19
+ .int()
20
+ .positive()
21
+ .optional()
22
+ .describe('Tileset id — when given, also report the tile transparency (needs-a-base) flag'),
23
+ },
24
+ handler: async (ctx, args) => {
25
+ const decoded = decodeTile(args.tileId);
26
+ if (args.tilesetId === undefined)
27
+ return decoded;
28
+ const tileset = await getTileset(ctx.projectPath, args.tilesetId);
29
+ const detail = await tileTransparencyDetail(ctx.projectPath, tileset, args.tileId);
30
+ return detail ? { ...decoded, ...detail } : decoded;
31
+ },
32
+ },
33
+ ];
34
+ //# sourceMappingURL=tileTools.js.map
@@ -0,0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{ MapData, Tileset } from '../utils/types.js';
2
+ import { CatalogEntry } from '../tiles/catalog/index.js';
3
+ /**
4
+ * Whether a raw tile id is transparent enough to need an opaque base beneath it.
5
+ * `undefined` = unknown (empty tile, or the sheet PNG couldn't be read). A small
6
+ * `cache` map memoises results within one operation so a big fill doesn't
7
+ * reclassify the same id repeatedly.
8
+ */
9
+ export declare function isTileTransparent(projectPath: string, tileset: Tileset, tileId: number, cache?: Map<number, boolean | undefined>): Promise<boolean | undefined>;
10
+ /**
11
+ * The transparency reading for one tile: whether it needs a base and the percent
12
+ * of its sample that is transparent (for `describe_tile`). `undefined` when the
13
+ * tile is empty or the sheet PNG can't be read.
14
+ */
15
+ export declare function tileTransparencyDetail(projectPath: string, tileset: Tileset, tileId: number): Promise<{
16
+ transparent: boolean;
17
+ transparentPercent: number;
18
+ } | undefined>;
19
+ /**
20
+ * Set each catalog entry's `transparent` flag by inspecting its tileset sheet
21
+ * (in place). Entries whose sheet PNG can't be read are left unset (unknown).
22
+ * Only worth calling on a bounded entry list (one sheet, or `find_tile` matches).
23
+ */
24
+ export declare function annotateTransparency(projectPath: string, tileset: Tileset, entries: CatalogEntry[]): Promise<void>;
25
+ /** A cell paint plus the layer it landed on — the input to the base-aware scan. */
26
+ export interface PaintedCell {
27
+ x: number;
28
+ y: number;
29
+ tileId: number;
30
+ layer: number;
31
+ }
32
+ /**
33
+ * Scan painted cells for the transparent-tile-without-a-base footgun: a
34
+ * transparent tile on layer L with no *opaque* tile on any lower layer in the
35
+ * same cell will show the map's void through its see-through areas. Returns a
36
+ * single aggregated warning (or `undefined`) so a large fill doesn't spam one
37
+ * line per cell. Fails soft — cells whose transparency can't be read are ignored.
38
+ */
39
+ export declare function baseAwareTransparencyWarning(projectPath: string, map: MapData, tileset: Tileset, cells: PaintedCell[]): Promise<string | undefined>;
40
+ //# sourceMappingURL=tileTransparency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tileTransparency.d.ts","sourceRoot":"","sources":["../../src/tools/tileTransparency.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA0DzD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC,GACvC,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAK9B;AAUD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,CAO3E;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAChD,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,WAAW,EAAE,GACnB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAgC7B"}