@maka/maka-cli 5.1.31 → 5.1.32
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 +1 -1
- 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 +7 -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 +2 -1
- 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 +34 -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 +52 -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 +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/look.js +4 -4
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +12 -10
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/game.d.ts +16 -4
- package/bundle/typescript/src/commands/game/sideQuest/game.js +191 -3
- 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 +3 -2
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +78 -38
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/player.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/player.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/room.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/room.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.d.ts +3 -0
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js +30 -2
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene1.json +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene2.json +241 -116
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/item-seed.d.ts +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.d.ts +1 -0
- 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/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maka/maka-cli",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"summary": "A command line tool for scaffolding Meteor 2.x applications using either React.",
|
|
6
6
|
"description": "A command line tool for scaffolding Meteor 2.x applications using React.",
|
|
@@ -5,5 +5,5 @@ import { Scene } from '../models/scene.js';
|
|
|
5
5
|
export declare class CommandRegistry {
|
|
6
6
|
private scene;
|
|
7
7
|
constructor(scene: Scene);
|
|
8
|
-
parse(commandString: string, actor: Player | NPC): Command | null
|
|
8
|
+
parse(commandString: string, actor: Player | NPC): Promise<Command | null>;
|
|
9
9
|
}
|
|
@@ -5,7 +5,7 @@ export class CommandRegistry {
|
|
|
5
5
|
constructor(scene) {
|
|
6
6
|
this.scene = scene;
|
|
7
7
|
}
|
|
8
|
-
parse(commandString, actor) {
|
|
8
|
+
async parse(commandString, actor) {
|
|
9
9
|
const parts = commandString.trim().split(' ');
|
|
10
10
|
const verb = parts[0].toLowerCase();
|
|
11
11
|
const args = parts.slice(1);
|
|
@@ -19,7 +19,7 @@ export class CommandRegistry {
|
|
|
19
19
|
if (!command)
|
|
20
20
|
return null;
|
|
21
21
|
// Wrap the command with the args pre-bound (if needed)
|
|
22
|
-
command.execute(args); // only if you have such a method
|
|
22
|
+
await command.execute(args); // only if you have such a method
|
|
23
23
|
return command;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-registry.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/command-registry.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAMjE,MAAM,OAAO,eAAe;IAClB,KAAK,CAAQ;IAErB,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,aAAqB,EAAE,KAAmB;
|
|
1
|
+
{"version":3,"file":"command-registry.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/command-registry.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAMjE,MAAM,OAAO,eAAe;IAClB,KAAK,CAAQ;IAErB,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,aAAqB,EAAE,KAAmB;QACpD,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAE5B,MAAM,OAAO,GAAG;YACd,KAAK;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YAC5B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,2DAA2D;SAClE,CAAC;QAEF,MAAM,OAAO,GAAG,cAAc,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE5D,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAE1B,uDAAuD;QACvD,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,iCAAiC;QAE9D,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -2,7 +2,7 @@ import { Direction } from '../types/shared/direction-enum.js';
|
|
|
2
2
|
import { Player, Scene, Room, NPC } from '../models/_index.js';
|
|
3
3
|
import { Logger } from '../utilities/logger.js';
|
|
4
4
|
export interface ICommand {
|
|
5
|
-
execute(args: string[]): string
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
6
|
}
|
|
7
7
|
export interface ICommandConstructor {
|
|
8
8
|
actor: Player | NPC;
|
|
@@ -17,7 +17,7 @@ export declare abstract class Command {
|
|
|
17
17
|
protected logger: Logger;
|
|
18
18
|
protected scene: Scene;
|
|
19
19
|
constructor(context: ICommandConstructor);
|
|
20
|
-
abstract execute(args?: string[]): string
|
|
20
|
+
abstract execute(args?: string[]): Promise<string>;
|
|
21
21
|
protected isValidDirection(value: string): value is Direction;
|
|
22
22
|
static getDescription(): string;
|
|
23
23
|
}
|
|
@@ -2,6 +2,6 @@ import { Command, ICommand } from './command.js';
|
|
|
2
2
|
export declare class DropCommand extends Command implements ICommand {
|
|
3
3
|
protected static verb: string;
|
|
4
4
|
protected static description: string;
|
|
5
|
-
execute(args: string[]): string
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
6
|
private drop;
|
|
7
7
|
}
|
|
@@ -2,11 +2,11 @@ import { Command } from './command.js';
|
|
|
2
2
|
export class DropCommand extends Command {
|
|
3
3
|
static verb = 'drop';
|
|
4
4
|
static description = 'Drop an item from your inventory.';
|
|
5
|
-
execute(args) {
|
|
5
|
+
async execute(args) {
|
|
6
6
|
this.logger.write(`${this.actor.name} is Attempting 'Drop' command with item: ${args.join(' ')}`);
|
|
7
|
-
return this.drop(args);
|
|
7
|
+
return await this.drop(args);
|
|
8
8
|
}
|
|
9
|
-
drop(args) {
|
|
9
|
+
async drop(args) {
|
|
10
10
|
const itemName = args.join(' ').toLowerCase(); // Assuming the item name may contain spaces
|
|
11
11
|
// Check if the item exists in the player's inventory
|
|
12
12
|
if (!this.actor.inventory.hasItem(itemName)) {
|
|
@@ -20,8 +20,11 @@ export class DropCommand extends Command {
|
|
|
20
20
|
return `You don't have ${itemName} in your inventory.`;
|
|
21
21
|
}
|
|
22
22
|
// Remove the item from player's inventory and add it to the current room's inventory
|
|
23
|
-
this.actor.inventory.
|
|
24
|
-
|
|
23
|
+
const didDrop = this.actor.inventory.transferItemTo(itemName, this.actor.currentLocation.inventory);
|
|
24
|
+
if (!didDrop) {
|
|
25
|
+
this.logger.write(`${this.actor.name} could not drop the ${itemName}. It is no droppable`);
|
|
26
|
+
return `You cannot drop ${itemName}`;
|
|
27
|
+
}
|
|
25
28
|
this.logger.write(`${this.actor.name} has successfully dropped "${itemName}" from inventory to ${this.actor.currentLocation.name} during 'Drop' command.`);
|
|
26
29
|
this.actor.performAction('drop', itemName);
|
|
27
30
|
return `You dropped ${itemName}.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/drop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC5B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,WAAW,GAAG,mCAAmC,CAAC;IAEnE,OAAO,CAAC,IAAc;
|
|
1
|
+
{"version":3,"file":"drop.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/drop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC5B,MAAM,CAAC,IAAI,GAAG,MA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CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,uBAAuB,QAAQ,sBAAsB,CAAC,CAAC;YAC3F,OAAO,mBAAmB,QAAQ,EAAE,CAAC;QAEvC,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,8BAA8B,QAAQ,uBAAuB,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,yBAAyB,CAAC,CAAC;QAE3J,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC3C,OAAO,eAAe,QAAQ,GAAG,CAAC;IACpC,CAAC"}
|
|
@@ -2,6 +2,6 @@ import { Command, ICommand } from './command.js';
|
|
|
2
2
|
export declare class EquipCommand extends Command implements ICommand {
|
|
3
3
|
protected static verb: string;
|
|
4
4
|
protected static description: string;
|
|
5
|
-
execute(args: string[]): string
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
6
|
private equip;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equip.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/equip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,YAAa,SAAQ,OAAO;IAC7B,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IACtB,MAAM,CAAC,WAAW,GAAG,gBAAgB,CAAC;IAEhD,OAAO,CAAC,IAAc;
|
|
1
|
+
{"version":3,"file":"equip.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/equip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,YAAa,SAAQ,OAAO;IAC7B,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IACtB,MAAM,CAAC,WAA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,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,aAAa,EAAE,CAAC,CAAC;QAEpD,OAAO,aAAa,CAAC;IACvB,CAAC"}
|
|
@@ -2,6 +2,6 @@ import { Command, ICommand } from './command.js';
|
|
|
2
2
|
export declare class GiveCommand extends Command implements ICommand {
|
|
3
3
|
protected static verb: string;
|
|
4
4
|
protected static description: string;
|
|
5
|
-
execute(args: string[]): string
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
6
|
private give;
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ import { Command } from './command.js';
|
|
|
2
2
|
export class GiveCommand extends Command {
|
|
3
3
|
static verb = 'give';
|
|
4
4
|
static description = 'Give an item or money to someone.';
|
|
5
|
-
execute(args) {
|
|
5
|
+
async execute(args) {
|
|
6
6
|
this.logger.write(`Attempting 'Give' command with input: ${args.join(' ')}`);
|
|
7
7
|
return this.give(args);
|
|
8
8
|
}
|
|
@@ -41,8 +41,12 @@ export class GiveCommand extends Command {
|
|
|
41
41
|
this.logger.write(`${this.actor.name} tried to give item "${itemOrAmount}" but does not have it.`);
|
|
42
42
|
return `You don’t have "${itemOrAmount}".`;
|
|
43
43
|
}
|
|
44
|
-
this.actor.
|
|
45
|
-
|
|
44
|
+
const didTransfer = this.actor.inventory.transferItemTo(item.name, recipient.inventory);
|
|
45
|
+
if (!didTransfer) {
|
|
46
|
+
this.logger.write(`Item "${item.name}" is not transferable.`);
|
|
47
|
+
this.actor.performAction('did not give', `item cannot be given`);
|
|
48
|
+
return `You cannot give that item away`;
|
|
49
|
+
}
|
|
46
50
|
this.actor.performAction('give', `${item.name} to ${recipient.name}`);
|
|
47
51
|
this.logger.write(`${this.actor.name} gave item "${item.name}" to ${recipient.name}`);
|
|
48
52
|
return `You gave ${item.name} to ${recipient.name}.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"give.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/give.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"give.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/give.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC5B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,WAAW,GAAG,mCAAmC,CAAC;IAEnE,KAAK,CAAC,OAAO,CAAC,IAAc;QAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAEO,IAAI,CAAC,IAAc;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAElD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sCAAsC,SAAS,EAAE,CAAC,CAAC;YACrE,OAAO,sCAAsC,CAAC;QAChD,CAAC;QAED,MAAM,CAAC,EAAE,YAAY,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;QACxC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,CAC1D,CAAC;QAEF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,IAAI,CAAC,M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CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,wBAAwB,YAAY,yBAAyB,CAAC,CAAC;YACnG,OAAO,mBAAmB,YAAY,IAAI,CAAC;QAC7C,CAAC;QAGD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAExF,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,wBAAwB,CAAC,CAAC;YAC9D,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;YACjE,OAAO,gCAAgC,CAAC;QAC1C,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,eAAe,IAAI,CAAC,IAAI,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QAEtF,OAAO,YAAY,IAAI,CAAC,IAAI,OAAO,SAAS,CAAC,IAAI,GAAG,CAAC;IACvD,CAAC"}
|
|
@@ -2,6 +2,6 @@ import { Command, ICommand } from './command.js';
|
|
|
2
2
|
export declare class GoCommand extends Command implements ICommand {
|
|
3
3
|
protected static verb: string;
|
|
4
4
|
protected static description: string;
|
|
5
|
-
execute(args: string[]): string
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
6
|
private go;
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@ import { Command } from './command.js';
|
|
|
3
3
|
export class GoCommand extends Command {
|
|
4
4
|
static verb = 'go';
|
|
5
5
|
static description = 'Move in the specified direction.';
|
|
6
|
-
execute(args) {
|
|
6
|
+
async execute(args) {
|
|
7
7
|
this.logger.write(`${this.actor.name} is attempting 'Go' command with direction: ${args.join(' ')}`);
|
|
8
8
|
return this.go(args);
|
|
9
9
|
}
|
|
@@ -39,6 +39,7 @@ export class GoCommand extends Command {
|
|
|
39
39
|
this.logger.error(`${this.actor.name} 'Go' command failed: Unable to determine the other side of the door.`);
|
|
40
40
|
return 'There seems to be an error with the door you\'re trying to go through.';
|
|
41
41
|
}
|
|
42
|
+
this.actor.performAction('exits', this.actor.currentLocation.name);
|
|
42
43
|
this.actor.currentLocation = targetRoom; // Update player's location
|
|
43
44
|
this.actor.performAction('enters', targetRoom.name);
|
|
44
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/go.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,SAAU,SAAQ,OAAO;IAC1B,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,WAAW,GAAG,kCAAkC,CAAC;IAElE,OAAO,CAAC,IAAc;
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/go.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,SAAU,SAAQ,OAAO;IAC1B,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,WAAW,GAAG,kCAAkC,CAAC;IAElE,KAAK,CAAC,OAAO,CAAC,IAAc;QAC1B,IAAI,CAAC,MAAM,CAAC,KAAK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AAI,CAAC,KAAK,CAAC,IAAI,mBAAmB,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,IAAI,cAAc,GAAG,CAAC,CAAC;QAE7G,6DAA6D;QAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC;IAChD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Command } from './command.js';
|
|
2
|
+
export class KillCommand extends Command {
|
|
3
|
+
static verb = 'kill';
|
|
4
|
+
static description = 'Attempt to kill another character in the room.';
|
|
5
|
+
async execute(args = []) {
|
|
6
|
+
if (args.length === 0) {
|
|
7
|
+
return 'Who do you want to kill? Try: `kill [character name]`';
|
|
8
|
+
}
|
|
9
|
+
const targetName = args.join(' ').toLowerCase();
|
|
10
|
+
const currentRoom = this.actor.currentLocation;
|
|
11
|
+
const scene = this.scene;
|
|
12
|
+
if (!currentRoom || !scene) {
|
|
13
|
+
return 'You are not in a valid location to perform this action.';
|
|
14
|
+
}
|
|
15
|
+
const possibleTargets = scene.getActorsInRoom(currentRoom).filter(actor => actor !== this.actor);
|
|
16
|
+
const target = possibleTargets.find(actor => actor.name.toLowerCase() === targetName);
|
|
17
|
+
const possibleTargetNames = possibleTargets.map(a => a.name).join(', ');
|
|
18
|
+
this.logger.write(`KillCommand: Possible targets in ${currentRoom.name}: ${possibleTargetNames}`);
|
|
19
|
+
if (!target) {
|
|
20
|
+
return `You don’t see anyone named "${targetName}" here.`;
|
|
21
|
+
}
|
|
22
|
+
const isPlayer = target === scene.getPlayer();
|
|
23
|
+
scene.removeActor(target.name);
|
|
24
|
+
this.logger.write(`KillCommand: ${this.actor.name} killed ${target.name} in ${currentRoom.name}`);
|
|
25
|
+
this.actor.performAction('kills', target.name);
|
|
26
|
+
if (isPlayer) {
|
|
27
|
+
this.scene.endGame();
|
|
28
|
+
this.logger.logWithColor(`Game Over: ${target.name} (the player) was killed by ${this.actor.name}.`, 'red');
|
|
29
|
+
this.logger.logWithColor(`Press ctrl-c to quit`, 'red');
|
|
30
|
+
}
|
|
31
|
+
return `You swiftly end ${target.name}'s life. Their body collapses in ${currentRoom.name}.`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=kill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kill.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/kill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAGjD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC5B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,WAAW,GAAG,gDAAgD,CAAC;IAEhF,KAAK,CAAC,OAAO,CAAC,OAAiB,EAAE;QAC/B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,uDAAuD,CAAC;QACjE,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAc,CAAC;QAElC,IAAI,CAAC,WAAW,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,OAAO,yDAAyD,CAAC;QACnE,CAAC;QAED,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC;QACjG,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,CAAC;QAEtF,MAAM,mBAAmB,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,WAAW,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC,CAAC;QAElG,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,+BAA+B,UAAU,SAAS,CAAC;QAC5D,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAE/B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,MAAM,CAAC,IAAI,OAAO,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAClG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAE/C,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,MAAM,CAAC,IAAI,+BAA+B,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC;YAC5G,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,mBAAmB,MAAM,CAAC,IAAI,oCAAoC,WAAW,CAAC,IAAI,GAAG,CAAC;IAC/F,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { Command, ICommand } from './command.js';
|
|
|
2
2
|
export declare class LockCommand extends Command implements ICommand {
|
|
3
3
|
protected static verb: string;
|
|
4
4
|
protected static description: string;
|
|
5
|
-
execute(args: string[]): string
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
6
|
private lock;
|
|
7
|
+
private attemptToLockDoor;
|
|
7
8
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Door } from '../models/door.js';
|
|
1
2
|
import { Command } from './command.js';
|
|
2
3
|
export class LockCommand extends Command {
|
|
3
4
|
static verb = 'lock';
|
|
4
5
|
static description = 'Lock a door.';
|
|
5
|
-
execute(args) {
|
|
6
|
+
async execute(args) {
|
|
6
7
|
return this.lock(args);
|
|
7
8
|
}
|
|
8
9
|
lock(args) {
|
|
@@ -10,28 +11,61 @@ export class LockCommand extends Command {
|
|
|
10
11
|
this.logger.error('LockCommand: No target specified.');
|
|
11
12
|
return 'Please specify which door you want to lock.';
|
|
12
13
|
}
|
|
13
|
-
const target = args
|
|
14
|
+
const target = args.join(' ').toLowerCase();
|
|
14
15
|
const room = this.actor.currentLocation;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
// 1. Try finding the door by direction
|
|
17
|
+
let doorEntry = [...room.exits.entries()].find(entry => entry[0].toLowerCase() === target);
|
|
18
|
+
// 2. If not found by direction, try matching the connected room name
|
|
19
|
+
if (!doorEntry) {
|
|
20
|
+
doorEntry = [...room.exits.entries()].find(([_, d]) => {
|
|
21
|
+
if (!(d instanceof Door))
|
|
22
|
+
return false;
|
|
23
|
+
const otherRoomName = d.roomA.name.toLowerCase() === room.name.toLowerCase()
|
|
24
|
+
? d.roomB.name.toLowerCase()
|
|
25
|
+
: d.roomA.name.toLowerCase();
|
|
26
|
+
return otherRoomName === target;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (!doorEntry) {
|
|
30
|
+
this.logger.write(`LockCommand: No door found for target "${target}" in ${room.name}.`);
|
|
31
|
+
return `There's no door named or leading to "${target}" here.`;
|
|
32
|
+
}
|
|
33
|
+
const [direction, door] = doorEntry;
|
|
34
|
+
if (!(door instanceof Door)) {
|
|
35
|
+
this.logger.write(`LockCommand: Exit found but is not a door: "${target}"`);
|
|
36
|
+
return `There's no door named or leading to "${target}" here.`;
|
|
37
|
+
}
|
|
38
|
+
if (door.checkIfLocked()) {
|
|
39
|
+
return `The door leading to "${door.getOtherSideToName(room)}" is already locked.`;
|
|
40
|
+
}
|
|
41
|
+
const requiredKeyOrSolution = door.unlockItemOrSolution?.toLowerCase();
|
|
42
|
+
if (requiredKeyOrSolution && this.actor.inventory.hasItem(requiredKeyOrSolution)) {
|
|
43
|
+
const key = this.actor.inventory.getItem(requiredKeyOrSolution);
|
|
44
|
+
if (key) {
|
|
22
45
|
door.isLocked = true;
|
|
23
|
-
this.logger.write(`LockCommand: ${this.actor.name}
|
|
24
|
-
this.actor.performAction('
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
else {
|
|
28
|
-
this.logger.write(`LockCommand: ${this.actor.name} does not have the necessary key for ${target}.`);
|
|
29
|
-
return `You don't have the key to lock this door.`;
|
|
46
|
+
this.logger.write(`LockCommand: ${this.actor.name} locked the door to ${door.getOtherSideToName(room)}.`);
|
|
47
|
+
this.actor.performAction('locked', `the door to ${door.getOtherSideToName(room)}`);
|
|
48
|
+
this.scene.updateExits(room);
|
|
49
|
+
return `You locked the door leading to ${door.getOtherSideToName(room)}.`;
|
|
30
50
|
}
|
|
31
51
|
}
|
|
52
|
+
this.logger.write(`LockCommand: ${this.actor.name} does not have the required key (${requiredKeyOrSolution}) for "${target}".`);
|
|
53
|
+
return `You don't have the key to lock this door.`;
|
|
54
|
+
}
|
|
55
|
+
attemptToLockDoor(door, label) {
|
|
56
|
+
if (door.checkIfLocked()) {
|
|
57
|
+
return `The door "${label}" is already locked.`;
|
|
58
|
+
}
|
|
59
|
+
const requiredKeyOrSolution = door.unlockItemOrSolution?.toLowerCase();
|
|
60
|
+
if (requiredKeyOrSolution && this.actor.inventory.hasItem(requiredKeyOrSolution)) {
|
|
61
|
+
door.isLocked = true;
|
|
62
|
+
this.logger.write(`LockCommand: ${this.actor.name} locked the door: ${label}`);
|
|
63
|
+
this.actor.performAction('lock', label);
|
|
64
|
+
return `You locked the door "${label}".`;
|
|
65
|
+
}
|
|
32
66
|
else {
|
|
33
|
-
this.logger.write(`LockCommand: ${
|
|
34
|
-
return `
|
|
67
|
+
this.logger.write(`LockCommand: ${this.actor.name} does not have the required key for door "${label}".`);
|
|
68
|
+
return `You don't have the key to lock this door.`;
|
|
35
69
|
}
|
|
36
70
|
}
|
|
37
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC5B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,WAAW,GAAG,cAAc,CAAC;IAE9C,KAAK,CAAC,OAAO,CAAC,IAAc;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAEO,IAAI,CAAC,IAAc;QACzB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACvD,OAAO,6CAA6C,CAAC;QACvD,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;QAExC,uCAAuC;QACvC,IAAI,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAC5C,KAAK,CAAC,EAAE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E,CAAC;YACjF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,IAAI,qBAAqB,KAAK,EAAE,CAAC,CAAC;YAC/E,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACxC,OAAO,wBAAwB,KAAK,IAAI,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,IAAI,6CAA6C,KAAK,IAAI,CAAC,CAAC;YACzG,OAAO,2CAA2C,CAAC;QACrD,CAAC;IACH,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { Command, ICommand } from './command.js';
|
|
|
2
2
|
export declare class LookCommand extends Command implements ICommand {
|
|
3
3
|
protected static verb: string;
|
|
4
4
|
protected static description: string;
|
|
5
|
-
execute(args
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
6
|
private look;
|
|
7
7
|
private lookOutside;
|
|
8
8
|
private inspectItem;
|
|
@@ -3,7 +3,7 @@ import { Command } from './command.js';
|
|
|
3
3
|
export class LookCommand extends Command {
|
|
4
4
|
static verb = 'look';
|
|
5
5
|
static description = 'Examine your surroundings';
|
|
6
|
-
execute(args
|
|
6
|
+
async execute(args) {
|
|
7
7
|
this.logger.write("Executing 'Look' command.");
|
|
8
8
|
const target = args.join(' ');
|
|
9
9
|
if (target) {
|
|
@@ -43,9 +43,9 @@ export class LookCommand extends Command {
|
|
|
43
43
|
const actorList = otherActors.map(a => `• ${a.name}`).join('\n');
|
|
44
44
|
description += `\n\nYou see:\n${actorList}`;
|
|
45
45
|
}
|
|
46
|
-
if (room.puzzle && !room.puzzle.isSolved()) {
|
|
47
|
-
|
|
48
|
-
}
|
|
46
|
+
// if (room.puzzle && !room.puzzle.isSolved()) {
|
|
47
|
+
// description += `\n\nPuzzle here: ${room.puzzle.riddle}`;
|
|
48
|
+
// }
|
|
49
49
|
return description;
|
|
50
50
|
}
|
|
51
51
|
lookOutside(direction) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"look.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/look.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzC,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC5B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,WAAW,GAAG,2BAA2B,CAAC;IAE3D,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"look.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/look.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzC,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC5B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,WAAW,GAAG,2BAA2B,CAAC;IAE3D,KAAK,CAAC,OAAO,CAAC,IAAc;QAC1B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAE/C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE9B,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,MAAM,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,CAAC;gBAClF,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CA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,CAAC;YAC9C,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,OAAO,oDAAoD,SAAS,IAAI,CAAC;YAC3E,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,yEAAyE,SAAS,IAAI,CAAC;QAChG,CAAC;QAGD,OAAO,wBAAwB,CAAC;IAClC,CAAC;IAEO,WAAW,CAAC,QAAgB,EAAE,SAAoB;QACxD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEzC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,qBAAqB,QAAQ,QAAQ,CAAC;QAC/C,CAAC;QAED,qGAAqG;QACrG,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,IAAI,uBAAuB,QAAQ,GAAG,CAAC;IAChF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from './command.js';
|
|
2
|
+
import { Category } from '../types/shared/item-enum.js';
|
|
3
|
+
export class ReadCommand extends Command {
|
|
4
|
+
static verb = 'read';
|
|
5
|
+
static description = 'Read a book from your surroundings.';
|
|
6
|
+
async execute(args) {
|
|
7
|
+
if (args.length === 0) {
|
|
8
|
+
return 'What do you want to read? Try: `read [item name]`';
|
|
9
|
+
}
|
|
10
|
+
const targetName = args.join(' ').toLowerCase();
|
|
11
|
+
const actorItems = this.actor.inventory.getAllItems();
|
|
12
|
+
const item = actorItems.find((i) => i.name.toLowerCase() === targetName);
|
|
13
|
+
if (!item) {
|
|
14
|
+
return `You don't have anything called "${targetName}" here.`;
|
|
15
|
+
}
|
|
16
|
+
if (item.category !== Category.Book) {
|
|
17
|
+
return `${item.name} isn't something you can read.`;
|
|
18
|
+
}
|
|
19
|
+
// Log the action
|
|
20
|
+
this.logger.write(`ReadCommand: ${this.actor.name} reads "${item.name}".`);
|
|
21
|
+
this.actor.performAction('reads', item.name);
|
|
22
|
+
// Provide a default response if no extra details are present
|
|
23
|
+
return item.details || `You flip through "${item.name}" but it's mostly blank pages.`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,MAAM,OAAO,WAAY,SAAQ,OAAO;IAC5B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACrB,MAAM,CAAC,WAAW,GAAG,qCAAqC,CAAC;IAErE,KAAK,CAAC,OAAO,CAAC,IAAc;QAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,mDAAmD,CAAC;QAC7D,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;QAChD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAEtD,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,CAAC;QAE/E,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,mCAAmC,UAAU,SAAS,CAAC;QAChE,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YACpC,OAAO,GAAG,IAAI,CAAC,IAAI,gCAAgC,CAAC;QACtD,CAAC;QAED,iBAAiB;QACjB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7C,6DAA6D;QAC7D,OAAO,IAAI,CAAC,OAAO,IAAI,qBAAqB,IAAI,CAAC,IAAI,gCAAgC,CAAC;IACxF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"say.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/say.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAC;AAE5D,MAAM,OAAO,UAAW,SAAQ,OAAO;IACrC,6DAA6D;IACnD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,MAAM,CAAC,WAAW,GAAG,sDAAsD,CAAC;IAC5E,OAAO,CAAsB;IAEvC,YAAY,OAA4B;QACtC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,IAAc;
|
|
1
|
+
{"version":3,"file":"say.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/say.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAC;AAE5D,MAAM,OAAO,UAAW,SAAQ,OAAO;IACrC,6DAA6D;IACnD,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,MAAM,CAAC,WAAW,GAAG,sDAAsD,CAAC;IAC5E,OAAO,CAAsB;IAEvC,YAAY,OAA4B;QACtC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAc;QAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,0BAA0B,CAAC;QACpC,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,6CAA6C;QAE/E,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC,CAAC,mCAAmC;YACtF,OAAO,oBAAoB,CAAC;QAC9B,CAAC;QAED,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,KAAK,aAAa,CAAC,eAAe,CAAC,CAAC;QAE5G,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;YAC/B,IAAI,KAAK,IAAI,aAAa,EAAE,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACjD,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC,IAAI,UAAU,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC;YAChF,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC"}
|
|
@@ -2,19 +2,23 @@ import { Command } from './command.js';
|
|
|
2
2
|
export class SearchCommand extends Command {
|
|
3
3
|
static verb = 'search';
|
|
4
4
|
static description = 'Search for items in your area';
|
|
5
|
-
execute() {
|
|
6
|
-
|
|
7
|
-
const roomItems =
|
|
8
|
-
|
|
5
|
+
async execute(args) {
|
|
6
|
+
const room = this.actor.currentLocation;
|
|
7
|
+
const roomItems = room.inventory.listItems();
|
|
8
|
+
let description = '';
|
|
9
9
|
if (roomItems.length === 0) {
|
|
10
|
-
|
|
11
|
-
return "You search the area thoroughly, but don't find anything of interest.";
|
|
10
|
+
description += "You search the area thoroughly, but don't find any items.";
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
else {
|
|
13
|
+
const itemsList = roomItems.join(', ');
|
|
14
|
+
this.logger.write(`SearchCommand: ${this.actor.name} found the following items: ${itemsList}`);
|
|
15
|
+
this.actor.performAction('search', itemsList);
|
|
16
|
+
description += `You search the area and find: ${itemsList}`;
|
|
17
|
+
}
|
|
18
|
+
if (room.puzzle && !room.puzzle.isSolved()) {
|
|
19
|
+
description += `\n\nPuzzle here: ${room.puzzle.riddle}`;
|
|
20
|
+
}
|
|
21
|
+
return description;
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,aAAc,SAAQ,OAAO;IAC9B,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;IACvB,MAAM,CAAC,WAAW,GAAG,+BAA+B,CAAC;IAE/D,OAAO
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,cAAc,CAAC;AAEjD,MAAM,OAAO,aAAc,SAAQ,OAAO;IAC9B,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;IACvB,MAAM,CAAC,WAAW,GAAG,+BAA+B,CAAC;IAE/D,KAAK,CAAC,OAAO,CAAC,IAAc;QAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;QACxC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QAC7C,IAAI,WAAW,GAAG,EAAE,CAAC;QAErB,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,WAAW,IAAI,2DAA2D,CAAC;QAC7E,CAAC;aAAM,CAAC;YACN,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,KAAK,CAAC,IAAI,+BAA+B,SAAS,EAAE,CAAC,CAAC;YAC/F,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;YAC9C,WAAW,IAAI,iCAAiC,SAAS,EAAE,CAAC;QAC9D,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC3C,WAAW,IAAI,oBAAoB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1D,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC"}
|
|
@@ -2,5 +2,5 @@ import { Command, ICommand } from './command.js';
|
|
|
2
2
|
export declare class SolveCommand extends Command implements ICommand {
|
|
3
3
|
protected static verb: string;
|
|
4
4
|
protected static description: string;
|
|
5
|
-
execute(args: string[]): string
|
|
5
|
+
execute(args: string[]): Promise<string>;
|
|
6
6
|
}
|
|
@@ -2,7 +2,7 @@ import { Command } from './command.js';
|
|
|
2
2
|
export class SolveCommand extends Command {
|
|
3
3
|
static verb = 'solve';
|
|
4
4
|
static description = 'Attempt to solve a puzzle.';
|
|
5
|
-
execute(args) {
|
|
5
|
+
async execute(args) {
|
|
6
6
|
const answer = args.join(' ').toLowerCase();
|
|
7
7
|
const room = this.actor.currentLocation;
|
|
8
8
|
if (!room || !room.puzzle) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solve.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/commands/solve.ts"],"names":[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