@maka/maka-cli 5.1.31 → 5.1.33
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/bundle/typescript/package.json +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js +2 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/command.d.ts +2 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/drop.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/drop.js +8 -5
- package/bundle/typescript/src/commands/game/sideQuest/commands/drop.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/equip.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js +44 -9
- package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/give.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/give.js +10 -3
- package/bundle/typescript/src/commands/game/sideQuest/commands/give.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/go.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/go.js +5 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/go.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/kill.d.ts +6 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/kill.js +36 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/kill.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/lock.d.ts +2 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/lock.js +54 -18
- package/bundle/typescript/src/commands/game/sideQuest/commands/lock.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/look.d.ts +2 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/look.js +58 -6
- package/bundle/typescript/src/commands/game/sideQuest/commands/look.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/read.d.ts +6 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/read.js +26 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/read.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/say.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/say.js +12 -16
- package/bundle/typescript/src/commands/game/sideQuest/commands/say.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/search.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/search.js +15 -11
- package/bundle/typescript/src/commands/game/sideQuest/commands/search.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/solve.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/store.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/store.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/store.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/take.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/take.js +6 -4
- package/bundle/typescript/src/commands/game/sideQuest/commands/take.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/talk.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/talk.js +4 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/talk.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/unequip.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/unequip.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/unequip.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js +2 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/use.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/use.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/use.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js +2 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js +22 -11
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/game.d.ts +17 -4
- package/bundle/typescript/src/commands/game/sideQuest/game.js +195 -4
- package/bundle/typescript/src/commands/game/sideQuest/game.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/inventory.d.ts +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js +19 -6
- package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/item.d.ts +5 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/item.js +20 -0
- package/bundle/typescript/src/commands/game/sideQuest/models/item.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.d.ts +11 -2
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +302 -96
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/player.d.ts +6 -2
- package/bundle/typescript/src/commands/game/sideQuest/models/player.js +142 -19
- package/bundle/typescript/src/commands/game/sideQuest/models/player.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/room.d.ts +2 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/room.js +24 -18
- package/bundle/typescript/src/commands/game/sideQuest/models/room.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.d.ts +6 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js +28 -2
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene1.json +114 -0
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene2.json +323 -116
- package/bundle/typescript/src/commands/game/sideQuest/types/player-equipment.d.ts +16 -5
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/item-seed.d.ts +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/player-seed.d.ts +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.d.ts +4 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.d.ts +47 -12
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js +53 -11
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/ui.js +17 -161
- package/bundle/typescript/src/commands/game/sideQuest/ui.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js +5 -2
- package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/templates/meteor/api/api.js +1 -1
- package/bundle/typescript/src/templates/meteor/api/api.js.ts +1 -1
- package/package.json +1 -1
|
@@ -6,14 +6,44 @@ export class NPC extends Player {
|
|
|
6
6
|
_dialogue;
|
|
7
7
|
_description;
|
|
8
8
|
_scene;
|
|
9
|
+
_commandHelp;
|
|
9
10
|
_history = [];
|
|
10
|
-
_maxHistory =
|
|
11
|
+
_maxHistory = 200;
|
|
11
12
|
commandRegistry;
|
|
13
|
+
lastNpcHeardTime = 0;
|
|
14
|
+
static npcHearCooldownMs = 500; // 10 seconds. Adjust as you like!
|
|
15
|
+
lastNpcSeenTime = 0;
|
|
16
|
+
static npcSeeCooldownMs = 500; // 10 seconds (tune as you like)
|
|
17
|
+
_maxRecursion = 5;
|
|
18
|
+
waitingForPlayer = false;
|
|
12
19
|
constructor(npcConfig, commandRegistry) {
|
|
13
20
|
super(npcConfig.playerConstructorConfig);
|
|
14
21
|
this._dialogue = npcConfig.dialog;
|
|
15
22
|
this._description = npcConfig.description;
|
|
16
23
|
this.commandRegistry = commandRegistry;
|
|
24
|
+
this._commandHelp = `
|
|
25
|
+
Available in-game commands (use with [COMMAND] prefix):
|
|
26
|
+
|
|
27
|
+
- go <direction> — move in a direction like north, south, east, west
|
|
28
|
+
- say <message> — speak a message
|
|
29
|
+
- take <item name> — pick up an item from the current room
|
|
30
|
+
- drop <item name> — drop an item
|
|
31
|
+
- use <item name> — use an item
|
|
32
|
+
- equip <item name> — equip an item (e.g., equip a weapon to use)
|
|
33
|
+
- equip all - equip all wearable items in inventory
|
|
34
|
+
- unequip <item name> — remove an equipped item
|
|
35
|
+
- unlock <door name> — unlock a door (if you have the key or solution)
|
|
36
|
+
- lock <door name> — lock a door
|
|
37
|
+
- solve <puzzle name> — attempt to solve a puzzle
|
|
38
|
+
- search — search the room for hidden things
|
|
39
|
+
- look — look around the current room
|
|
40
|
+
- look at <target> - looks at an item, player, or direction
|
|
41
|
+
- store <item name> — store an item (in bank, safe, etc.)
|
|
42
|
+
- give <item name> to <target> — give an item to someone
|
|
43
|
+
- talk-to <target> — initiate conversation with another character
|
|
44
|
+
- read <target> - Reads an item of Category "Book"
|
|
45
|
+
- kill <target> - Kills an actor, removing them from the game.
|
|
46
|
+
`.trim();
|
|
17
47
|
}
|
|
18
48
|
set scene(scene) {
|
|
19
49
|
this._scene = scene;
|
|
@@ -21,46 +51,153 @@ export class NPC extends Player {
|
|
|
21
51
|
get description() {
|
|
22
52
|
return this._description;
|
|
23
53
|
}
|
|
24
|
-
|
|
25
|
-
|
|
54
|
+
set description(description) {
|
|
55
|
+
this._description = description;
|
|
56
|
+
}
|
|
57
|
+
async act(commandString) {
|
|
58
|
+
const command = await this.commandRegistry.parse(commandString, this);
|
|
26
59
|
if (command) {
|
|
27
|
-
|
|
28
|
-
|
|
60
|
+
// Capture the result of the command
|
|
61
|
+
const result = await command.execute();
|
|
62
|
+
await this.recursiveReflect(commandString, result);
|
|
29
63
|
}
|
|
30
64
|
else {
|
|
31
65
|
this.logger.error(`${this.name} tried to perform unknown command: ${commandString}`);
|
|
32
66
|
}
|
|
33
67
|
}
|
|
34
68
|
async hear(actor, message) {
|
|
35
|
-
if (actor === this)
|
|
69
|
+
if (actor === this || actor.name === this.name)
|
|
36
70
|
return;
|
|
71
|
+
// Player wakes us up
|
|
72
|
+
if (!(actor instanceof NPC)) {
|
|
73
|
+
if (this.waitingForPlayer)
|
|
74
|
+
this.logger.write(`[DEBUG] ${this.name} received player input, waking up.`);
|
|
75
|
+
this.waitingForPlayer = false;
|
|
76
|
+
}
|
|
77
|
+
// If another NPC tries to trigger us and we are waiting for a player, ignore
|
|
78
|
+
if (this.waitingForPlayer && actor instanceof NPC) {
|
|
79
|
+
this.logger.write(`[DEBUG] ${this.name} is waiting for player input, ignoring NPC.`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// If another NPC tries to trigger us and we are on cooldown, ignore
|
|
83
|
+
if (actor instanceof NPC) {
|
|
84
|
+
const now = Date.now();
|
|
85
|
+
if (now - this.lastNpcHeardTime < NPC.npcHearCooldownMs) {
|
|
86
|
+
this.logger.write(`[DEBUG] ${this.name} is on NPC hear cooldown.`);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.lastNpcHeardTime = now;
|
|
90
|
+
this.waitingForPlayer = true;
|
|
91
|
+
this.logger.write(`[DEBUG] ${this.name} heard NPC, entering waiting state.`);
|
|
92
|
+
}
|
|
93
|
+
// Process input
|
|
37
94
|
const entry = `${actor.name} says: "${message}"`;
|
|
38
95
|
this._addToHistory(entry);
|
|
39
96
|
this.logger.write(`${this.name} heard from ${actor.name}`);
|
|
40
|
-
|
|
97
|
+
this.respondTo(actor, message);
|
|
41
98
|
}
|
|
42
99
|
async see(actor, verb, details) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
100
|
+
try {
|
|
101
|
+
if (actor === this || actor.name === this.name)
|
|
102
|
+
return;
|
|
103
|
+
if (!(actor instanceof NPC)) {
|
|
104
|
+
if (this.waitingForPlayer)
|
|
105
|
+
this.logger.write(`[DEBUG] ${this.name} received player action, waking up.`);
|
|
106
|
+
this.waitingForPlayer = false;
|
|
107
|
+
}
|
|
108
|
+
if (this.waitingForPlayer && actor instanceof NPC) {
|
|
109
|
+
this.logger.write(`[DEBUG] ${this.name} is waiting for player input, ignoring NPC action.`);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (actor instanceof NPC) {
|
|
113
|
+
const now = Date.now();
|
|
114
|
+
if (now - this.lastNpcSeenTime < NPC.npcSeeCooldownMs) {
|
|
115
|
+
this.logger.write(`[DEBUG] ${this.name} is on NPC see cooldown.`);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.lastNpcSeenTime = now;
|
|
119
|
+
this.waitingForPlayer = true;
|
|
120
|
+
this.logger.write(`[DEBUG] ${this.name} saw NPC, entering waiting state.`);
|
|
121
|
+
}
|
|
122
|
+
const entry = `${actor.name} ${verb}${details ? ` ${details}` : ''}`;
|
|
123
|
+
this._addToHistory(entry);
|
|
124
|
+
this.logger.write(`${this.name} sees ${entry}`);
|
|
125
|
+
this.respondTo(actor, entry);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
this.logger.error(`Error in see: ${error}`);
|
|
129
|
+
throw new Error(error);
|
|
130
|
+
}
|
|
49
131
|
}
|
|
50
132
|
_addToHistory(entry) {
|
|
51
133
|
this._history.push(entry);
|
|
52
134
|
if (this._history.length > this._maxHistory) {
|
|
53
135
|
this._history.shift();
|
|
54
136
|
}
|
|
55
|
-
this.logger.write(`Added ${entry} to ${this.name} history`);
|
|
56
137
|
}
|
|
57
138
|
getHistorySummary() {
|
|
58
139
|
if (this._history.length === 0)
|
|
59
140
|
return `This NPC has not observed any recent activity.`;
|
|
60
|
-
|
|
141
|
+
let history = `Recent activity around this NPC:\n${this._history.map((h, i) => ` ${i + 1}. ${h}`)?.join('\n')}`;
|
|
142
|
+
this.logger.write(history);
|
|
143
|
+
return history;
|
|
144
|
+
}
|
|
145
|
+
speak(message) {
|
|
146
|
+
return message || this._dialogue[Math.floor(Math.random() * this._dialogue.length)];
|
|
61
147
|
}
|
|
62
|
-
|
|
63
|
-
|
|
148
|
+
async recursiveReflect(commandString, result, recursionDepth = 0, maxRecursion = this._maxRecursion) {
|
|
149
|
+
if (recursionDepth >= maxRecursion) {
|
|
150
|
+
this.logger.write('Max recursion reached.');
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const historySummary = this.getHistorySummary();
|
|
154
|
+
// Build the prompt context
|
|
155
|
+
const context = `
|
|
156
|
+
You are an NPC named ${this.name}.
|
|
157
|
+
|
|
158
|
+
You just performed the action: "${commandString}"
|
|
159
|
+
With the result: "${result}"
|
|
160
|
+
|
|
161
|
+
Based on this, what is the most logical next in-game command (from the following list)?
|
|
162
|
+
${this._commandHelp}
|
|
163
|
+
- Only respond with: [COMMAND] <in-game command here>
|
|
164
|
+
- Do not respond on behalf of another player or NPC
|
|
165
|
+
- If there is nothing to do, respond with: wait
|
|
166
|
+
- Only respond with one [COMMAND]
|
|
167
|
+
|
|
168
|
+
This is what has already happened:
|
|
169
|
+
${historySummary}
|
|
170
|
+
`;
|
|
171
|
+
// Send to GPT
|
|
172
|
+
const gptResult = await HTTPS.askGPT({
|
|
173
|
+
prompt: context,
|
|
174
|
+
openApiKey: process.env.OPENAI_API_KEY || '',
|
|
175
|
+
model: 'gpt-4.1'
|
|
176
|
+
});
|
|
177
|
+
const reply = JSON.parse(gptResult.data)?.choices?.[0]?.message?.content?.trim();
|
|
178
|
+
if (!reply || reply.toLowerCase().includes('wait')) {
|
|
179
|
+
this.logger.write(`${this.name} is finished reflecting for now.`);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// Parse the next command, execute, and reflect again
|
|
183
|
+
const nextCommandMatch = reply.match(/^\[COMMAND\]\s*(.*)$/i);
|
|
184
|
+
if (nextCommandMatch && nextCommandMatch[1]) {
|
|
185
|
+
const nextCommand = nextCommandMatch[1];
|
|
186
|
+
const command = await this.commandRegistry.parse(nextCommand, this);
|
|
187
|
+
if (command) {
|
|
188
|
+
const nextResult = await command.execute();
|
|
189
|
+
if (nextResult) {
|
|
190
|
+
this._addToHistory(nextResult);
|
|
191
|
+
}
|
|
192
|
+
await this.recursiveReflect(nextCommand, nextResult, recursionDepth + 1, maxRecursion);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
this.logger.error(`NPC planned unknown command: ${nextCommand}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
this.logger.write('No valid command parsed from GPT reflection.');
|
|
200
|
+
}
|
|
64
201
|
}
|
|
65
202
|
async respondTo(actor, message) {
|
|
66
203
|
this.logger.write('Attempting to respond');
|
|
@@ -69,76 +206,116 @@ export class NPC extends Player {
|
|
|
69
206
|
actor.hear(this, this.speak());
|
|
70
207
|
return;
|
|
71
208
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- talk-to <target> — initiate conversation with another character
|
|
90
|
-
`.trim();
|
|
209
|
+
// ---------- helpers ----------
|
|
210
|
+
const safeArray = (arr, label = 'unknown') => {
|
|
211
|
+
const ok = Array.isArray(arr) ? arr : [];
|
|
212
|
+
if (!Array.isArray(arr)) {
|
|
213
|
+
this.logger.write(`[DEBUG][${this.name}] ${label} was not an array, substituting []. Value: ${JSON.stringify(arr)}`);
|
|
214
|
+
}
|
|
215
|
+
return ok;
|
|
216
|
+
};
|
|
217
|
+
const toLines = (s) => {
|
|
218
|
+
if (typeof s !== 'string')
|
|
219
|
+
return [];
|
|
220
|
+
return s.split(/\r?\n/);
|
|
221
|
+
};
|
|
222
|
+
// ---------- scene + npc context ----------
|
|
223
|
+
const story = this._scene?.story
|
|
224
|
+
? `The overall storyline for this scene is: ${this._scene.story}`
|
|
225
|
+
: `This scene has no overall storyline`;
|
|
91
226
|
const historySummary = this.getHistorySummary();
|
|
92
|
-
const
|
|
227
|
+
const npcDescription = this.description
|
|
228
|
+
? `This NPC has the following characteristics: ${this._description}`
|
|
229
|
+
: `This NPC is non-descript.`;
|
|
230
|
+
this.logger.write(npcDescription);
|
|
231
|
+
const lifestyleSummary = Array.isArray(this.lifestyleChoices) && this.lifestyleChoices.length > 0
|
|
93
232
|
? `This NPC has the following lifestyle characteristics: ${this.lifestyleChoices.join(', ')}.`
|
|
94
233
|
: `This NPC has no defined lifestyle preferences.`;
|
|
95
234
|
const room = this.currentLocation;
|
|
235
|
+
if (!room) {
|
|
236
|
+
this.logger.error(`[ERROR][${this.name}] currentLocation is undefined in respondTo!`);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
96
239
|
const roomDesc = `They are currently in: "${room.name}" — ${room.description}`;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return `${directionLabel} → ${targetRoom}${lockedStatus}`;
|
|
107
|
-
}
|
|
108
|
-
else if (typeof exit === 'string') {
|
|
109
|
-
return `${directionLabel} → ${exit}`;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
return `${directionLabel} → Unknown`;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
exitList = `The room has the following exits:\n${formattedExits.map(e => ` - ${e}`).join('\n')}`;
|
|
240
|
+
// ---------- exits (fully defensive) ----------
|
|
241
|
+
let safeExits = [];
|
|
242
|
+
try {
|
|
243
|
+
if (room.exits && typeof room.exits.entries === 'function') {
|
|
244
|
+
safeExits = Array.from(room.exits.entries());
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
this.logger.write(`[DEBUG][${this.name}] room.exits missing or not iterable; using empty exits.`);
|
|
248
|
+
}
|
|
116
249
|
}
|
|
117
|
-
|
|
118
|
-
|
|
250
|
+
catch (e) {
|
|
251
|
+
this.logger.error(`[ERROR][${this.name}] room.exits.entries() failed: ${e}`);
|
|
119
252
|
}
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
253
|
+
const formattedExitsArr = safeExits.map(([direction, exit]) => {
|
|
254
|
+
const directionLabel = capitalCase(direction);
|
|
255
|
+
if (exit instanceof Door) {
|
|
256
|
+
const targetRoom = exit.getOtherSideToName(room);
|
|
257
|
+
const isLocked = exit.checkIfLocked();
|
|
258
|
+
const isLockable = exit.checkIfLockable();
|
|
259
|
+
let requirementDetail = '';
|
|
260
|
+
if (isLocked)
|
|
261
|
+
requirementDetail = ` Requires key: "${exit.unlockItemOrSolution}".`;
|
|
262
|
+
const status = isLocked ? ' (Locked)' : (isLockable ? ' (Unlocked)' : '');
|
|
263
|
+
return `${directionLabel} → ${targetRoom}${status}${requirementDetail}`;
|
|
264
|
+
}
|
|
265
|
+
if (typeof exit === 'string') {
|
|
266
|
+
return `${directionLabel} → ${exit}`;
|
|
267
|
+
}
|
|
268
|
+
return `${directionLabel} → Unknown`;
|
|
269
|
+
});
|
|
270
|
+
const formattedExitsStr = Array.isArray(formattedExitsArr) && formattedExitsArr.length > 0
|
|
271
|
+
? formattedExitsArr.join('\n')
|
|
272
|
+
: '';
|
|
273
|
+
// ---------- ownership + inventories (defensive) ----------
|
|
274
|
+
const ownedRooms = safeArray(this._scene?.getOwnedRoomsBy?.(this.name), 'ownedRooms');
|
|
275
|
+
this.logger.write(`[DEBUG][${this.name}] ownedRooms: ${JSON.stringify(ownedRooms)}`);
|
|
129
276
|
const ownedRoomsDesc = ownedRooms.length > 0
|
|
130
|
-
? `They own the following rooms: ${ownedRooms.map(r => `"${r.name}"`).join(', ')}.`
|
|
277
|
+
? `They own the following rooms: ${ownedRooms.filter(r => r && r.name).map(r => `"${r.name}"`).join(', ')}.`
|
|
131
278
|
: `They do not appear to own any rooms.`;
|
|
132
|
-
const ownedItems = this._scene?.getOwnedItemsBy?.(this.name)
|
|
279
|
+
const ownedItems = safeArray(this._scene?.getOwnedItemsBy?.(this.name), 'ownedItems');
|
|
280
|
+
this.logger.write(`[DEBUG][${this.name}] ownedItems: ${JSON.stringify(ownedItems)}`);
|
|
133
281
|
const ownedItemsDesc = ownedItems.length > 0
|
|
134
|
-
? `They own the following items: ${ownedItems.map(i => `"${i.name}"`).join(', ')}.`
|
|
282
|
+
? `They own the following items: ${ownedItems.filter(i => i && i.name).map(i => `"${i.name}"`).join(', ')}.`
|
|
135
283
|
: `They do not appear to own any items.`;
|
|
136
|
-
|
|
284
|
+
const npcItems = safeArray(this.inventory?.getAllItems?.(), 'npcItems');
|
|
285
|
+
this.logger.write(`[DEBUG][${this.name}] npcItems: ${JSON.stringify(npcItems)}`);
|
|
286
|
+
const npcInventoryDesc = npcItems.length > 0
|
|
287
|
+
? `This NPC is carrying the following items:\n${npcItems
|
|
288
|
+
.filter(item => !!item)
|
|
289
|
+
.map(item => `- ${item.getFormattedCharacteristics?.() ?? (item.name ?? '[unnamed item]')}`)
|
|
290
|
+
.join('\n')}`
|
|
291
|
+
: `This NPC is not carrying anything.`;
|
|
292
|
+
const visibleItems = safeArray(room.inventory?.getAllItems?.(), 'visibleItems');
|
|
293
|
+
this.logger.write(`[DEBUG][${this.name}] visibleItems: ${JSON.stringify(visibleItems)}`);
|
|
294
|
+
const roomInventoryDesc = visibleItems.length > 0
|
|
295
|
+
? `Items visible in the room: ${visibleItems.filter(i => i && i.name).map(i => i.name).join(', ')}.`
|
|
296
|
+
: `There are no visible items in the room.`;
|
|
297
|
+
// ---------- prompt ----------
|
|
137
298
|
const prompt = `
|
|
138
299
|
You are an NPC named ${this.name} in a gritty cyberpunk text adventure game.
|
|
139
300
|
|
|
301
|
+
- Stay in character. Respond naturally based on your surroundings, personality, and the player’s message.
|
|
302
|
+
- Any exposition should be in 3rd person. Keep exposition to bare minimum.
|
|
303
|
+
- When speaking, use the "say" command. Syntax is "[COMMAND] say <message>"
|
|
304
|
+
- If you want to perform an action, include a separate line that starts with:
|
|
305
|
+
[COMMAND] <your in-game command here>
|
|
306
|
+
- Attempt to use [COMMAND] when appropriate for interacting with the environment. (e.g., "take <item>" when picking up)
|
|
307
|
+
- You should only provide one [COMMAND] at a time.
|
|
308
|
+
- Do not respond on behalf of another player or NPC
|
|
309
|
+
|
|
310
|
+
Your objective is to drive the story line.
|
|
311
|
+
${story}
|
|
312
|
+
|
|
313
|
+
${this._commandHelp}
|
|
314
|
+
|
|
315
|
+
${npcDescription}
|
|
316
|
+
|
|
140
317
|
${roomDesc}
|
|
141
|
-
${
|
|
318
|
+
${formattedExitsStr}
|
|
142
319
|
${roomInventoryDesc}
|
|
143
320
|
|
|
144
321
|
${lifestyleSummary}
|
|
@@ -149,52 +326,81 @@ You are an NPC named ${this.name} in a gritty cyberpunk text adventure game.
|
|
|
149
326
|
|
|
150
327
|
${historySummary}
|
|
151
328
|
|
|
152
|
-
|
|
153
|
-
Any exposition should be in 3rd person.
|
|
154
|
-
|
|
155
|
-
If you want to perform an action, include a separate line that starts with:
|
|
156
|
-
[COMMAND] <your in-game command here>
|
|
157
|
-
|
|
158
|
-
${commandHelp}
|
|
159
|
-
|
|
160
|
-
Player: ${message}
|
|
161
|
-
${this.name}:
|
|
329
|
+
${actor.name}: ${message}
|
|
162
330
|
`.trim();
|
|
331
|
+
// ---------- GPT call + parsing (defensive) ----------
|
|
163
332
|
try {
|
|
164
333
|
const result = await HTTPS.askGPT({
|
|
165
334
|
prompt,
|
|
166
335
|
openApiKey: process.env.OPENAI_API_KEY,
|
|
167
336
|
model: 'gpt-4.1'
|
|
168
337
|
});
|
|
169
|
-
|
|
170
|
-
|
|
338
|
+
let parsed;
|
|
339
|
+
try {
|
|
340
|
+
parsed = JSON.parse(result?.data ?? '{}');
|
|
171
341
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
342
|
+
catch (e) {
|
|
343
|
+
this.logger.error(`[ERROR][${this.name}] JSON.parse failed on result.data: ${e}`);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (parsed?.error) {
|
|
347
|
+
throw new Error(parsed.error.message ?? 'Unknown GPT error');
|
|
348
|
+
}
|
|
349
|
+
const reply = parsed?.choices?.[0]?.message?.content?.trim?.();
|
|
350
|
+
if (!reply || typeof reply !== 'string') {
|
|
351
|
+
this.logger.write(`[DEBUG][${this.name}] Empty or invalid reply from GPT; no action taken.`);
|
|
175
352
|
return;
|
|
176
353
|
}
|
|
177
354
|
this._addToHistory(reply);
|
|
178
|
-
const lines = reply
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
//
|
|
182
|
-
|
|
183
|
-
|
|
355
|
+
const lines = toLines(reply);
|
|
356
|
+
// Spoken lines
|
|
357
|
+
const spokenLines = lines.filter(line => line.startsWith('[COMMAND] say'));
|
|
358
|
+
// Commands (excluding say/talk-to)
|
|
359
|
+
const commandLines = lines.filter(line => line.startsWith('[COMMAND]') &&
|
|
360
|
+
!line.startsWith('[COMMAND] say') &&
|
|
361
|
+
!line.startsWith('[COMMAND] talk-to'));
|
|
362
|
+
// Exposition (non-command lines)
|
|
363
|
+
const expositionLines = lines.filter(line => !line.startsWith('[COMMAND]'));
|
|
364
|
+
// Speak each say command
|
|
365
|
+
for (const spokenText of spokenLines) {
|
|
366
|
+
const commandText = (spokenText ?? '').replace('[COMMAND]', '').trim();
|
|
367
|
+
this.logger.write(`${this.name} attempts to say: ${commandText}`);
|
|
368
|
+
try {
|
|
369
|
+
if (commandText.length > 0) {
|
|
370
|
+
this.act(commandText);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
catch (err) {
|
|
374
|
+
this.logger.error(`${this.name} failed to say "${commandText}": ${err}`);
|
|
375
|
+
// continue; don't throw so we can process remaining lines
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
// Log exposition
|
|
379
|
+
for (const exposition of expositionLines) {
|
|
380
|
+
if (exposition?.length) {
|
|
381
|
+
this.logger.logWithColor(`${exposition}`, 'blue');
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
// Execute other commands
|
|
184
385
|
for (const commandLine of commandLines) {
|
|
185
|
-
const commandText = commandLine.replace('[COMMAND]', '').trim();
|
|
386
|
+
const commandText = (commandLine ?? '').replace('[COMMAND]', '').trim();
|
|
186
387
|
this.logger.write(`${this.name} attempts to execute: ${commandText}`);
|
|
187
388
|
try {
|
|
188
|
-
|
|
389
|
+
if (commandText.length > 0) {
|
|
390
|
+
this.act(commandText);
|
|
391
|
+
}
|
|
189
392
|
}
|
|
190
393
|
catch (err) {
|
|
191
394
|
this.logger.error(`${this.name} failed to execute command "${commandText}": ${err}`);
|
|
395
|
+
// continue; don't throw so we can process remaining lines
|
|
192
396
|
}
|
|
193
397
|
}
|
|
194
398
|
}
|
|
195
399
|
catch (err) {
|
|
196
400
|
this.logger.write(`GPT fallback due to error: ${err}`);
|
|
197
|
-
|
|
401
|
+
// surface a consistent Error instance, but don't double-wrap Errors
|
|
402
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
403
|
+
throw e;
|
|
198
404
|
}
|
|
199
405
|
}
|
|
200
406
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npc.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/npc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEr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,GAAG,IAAI,CAAC,IAAI,+BAA+B,WAAW,MAAM,GAAG,EAAE,CAAC,CAAC;oBACrF,0DAA0D;gBAC5D,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC;YACvD,oEAAoE;YACpE,MAAM,CAAC,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC9D,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC"}
|
|
@@ -20,6 +20,7 @@ export declare class Player extends AbstractPlayer {
|
|
|
20
20
|
protected logger: Logger;
|
|
21
21
|
private _currency;
|
|
22
22
|
constructor(config: IPlayerConstructorConfig);
|
|
23
|
+
private initializeEquipment;
|
|
23
24
|
get name(): string;
|
|
24
25
|
get currentLocation(): Room;
|
|
25
26
|
set currentLocation(room: Room);
|
|
@@ -33,8 +34,11 @@ export declare class Player extends AbstractPlayer {
|
|
|
33
34
|
removeInventory(item: Item): boolean;
|
|
34
35
|
equip(item: Item): string;
|
|
35
36
|
unequip(input: string): string;
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
determineEquipmentSlot(input: string): {
|
|
38
|
+
group: keyof PlayerEquipment;
|
|
39
|
+
slot: string;
|
|
40
|
+
} | null;
|
|
41
|
+
canEquip(item: Item): boolean;
|
|
38
42
|
private unequipBySlot;
|
|
39
43
|
hear(actor: Player, message: string): void;
|
|
40
44
|
see(actor: Player, verb: string, details?: string): void;
|