@maka/maka-cli 5.1.28 → 5.1.30
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/_index.d.ts +1 -0
- package/bundle/typescript/src/commands/_index.js +1 -1
- package/bundle/typescript/src/commands/_index.js.map +1 -1
- package/bundle/typescript/src/commands/ai.js +0 -1
- package/bundle/typescript/src/commands/ai.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/command.d.ts +12 -6
- package/bundle/typescript/src/commands/game/sideQuest/commands/command.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/command.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/drop.d.ts +1 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/drop.js +2 -1
- 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 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/equip.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/go.d.ts +1 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/go.js +3 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/go.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/lock.d.ts +1 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/lock.js +1 -0
- 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 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/look.js +2 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/look.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/say.d.ts +3 -4
- package/bundle/typescript/src/commands/game/sideQuest/commands/say.js +5 -3
- 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 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/search.js +1 -0
- 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 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/solve.js +1 -0
- 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 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/store.js +1 -0
- 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 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/take.js +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/take.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/talk.d.ts +9 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/talk.js +52 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/talk.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/unequip.d.ts +1 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/unequip.js +1 -0
- 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 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/unlock.js +1 -0
- 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 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/use.js +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/use.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/command-factory.d.ts +9 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/{commandF.js → command-factory.js} +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/command-factory.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.d.ts +5 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js +24 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/item-factory.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.d.ts +9 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js +33 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.d.ts +6 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.js +24 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/puzzle-factory.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.d.ts +6 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.js +19 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/room-factory.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/{sceneSynthesizer.d.ts → scene-factory.d.ts} +2 -2
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js +116 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-factory.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/game.d.ts +7 -5
- package/bundle/typescript/src/commands/game/sideQuest/game.js +40 -10
- package/bundle/typescript/src/commands/game/sideQuest/game.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/door.d.ts +7 -3
- package/bundle/typescript/src/commands/game/sideQuest/models/door.js +1 -2
- package/bundle/typescript/src/commands/game/sideQuest/models/door.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/inventory.d.ts +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/inventory.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/item.d.ts +25 -4
- package/bundle/typescript/src/commands/game/sideQuest/models/item.js +27 -13
- package/bundle/typescript/src/commands/game/sideQuest/models/item.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.d.ts +15 -12
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +97 -29
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/player.d.ts +16 -4
- package/bundle/typescript/src/commands/game/sideQuest/models/player.js +85 -56
- package/bundle/typescript/src/commands/game/sideQuest/models/player.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.d.ts +11 -2
- package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.js +2 -2
- package/bundle/typescript/src/commands/game/sideQuest/models/puzzle.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/room.d.ts +29 -6
- package/bundle/typescript/src/commands/game/sideQuest/models/room.js +78 -6
- package/bundle/typescript/src/commands/game/sideQuest/models/room.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.d.ts +25 -17
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js +76 -68
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene1.json +55 -108
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene2.json +131 -151
- package/bundle/typescript/src/commands/game/sideQuest/types/enums.d.ts +16 -7
- package/bundle/typescript/src/commands/game/sideQuest/types/enums.js +15 -6
- package/bundle/typescript/src/commands/game/sideQuest/types/enums.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/types/{types.d.ts → player-equipment.d.ts} +8 -10
- package/bundle/typescript/src/commands/game/sideQuest/types/player-equipment.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/player-equipment.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/exit-seed.d.ts +6 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/exit-seed.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/exit-seed.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/item-seed.d.ts +22 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/item-seed.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/item-seed.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/lifestyle-seed.d.ts +22 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/lifestyle-seed.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/lifestyle-seed.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/npc-seed.d.ts +6 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/npc-seed.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/npc-seed.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/player-seed.d.ts +6 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/player-seed.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/player-seed.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/puzzle-seed.d.ts +11 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/puzzle-seed.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/puzzle-seed.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/room-seed.d.ts +16 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/room-seed.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/room-seed.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.d.ts +16 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/{abstracts.d.ts → shared/abstracts.d.ts} +13 -9
- package/bundle/typescript/src/commands/game/sideQuest/types/{abstracts.js → shared/abstracts.js} +7 -2
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/abstracts.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/direction-enum.d.ts +8 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/direction-enum.js +10 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/direction-enum.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/equipment-enum.d.ts +25 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/equipment-enum.js +27 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/equipment-enum.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.d.ts +34 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js +38 -0
- package/bundle/typescript/src/commands/game/sideQuest/types/shared/item-enum.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/ui.d.ts +6 -2
- package/bundle/typescript/src/commands/game/sideQuest/ui.js +47 -25
- package/bundle/typescript/src/commands/game/sideQuest/ui.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/logger.d.ts +4 -2
- package/bundle/typescript/src/commands/game/sideQuest/utilities/logger.js +8 -4
- package/bundle/typescript/src/commands/game/sideQuest/utilities/logger.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js +19 -12
- package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/tools/https/https.class.d.ts +4 -1
- package/bundle/typescript/src/tools/https/https.class.js +67 -12
- package/bundle/typescript/src/tools/https/https.class.js.map +1 -1
- package/bundle/typescript/src/tools/https/https.interface.d.ts +2 -1
- package/package.json +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/commandF.d.ts +0 -10
- package/bundle/typescript/src/commands/game/sideQuest/factories/commandF.js.map +0 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/roomsF.d.ts +0 -6
- package/bundle/typescript/src/commands/game/sideQuest/factories/roomsF.js +0 -18
- package/bundle/typescript/src/commands/game/sideQuest/factories/roomsF.js.map +0 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/sceneSynthesizer.js +0 -77
- package/bundle/typescript/src/commands/game/sideQuest/factories/sceneSynthesizer.js.map +0 -1
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene3.json +0 -380
- package/bundle/typescript/src/commands/game/sideQuest/types/abstracts.js.map +0 -1
- package/bundle/typescript/src/commands/game/sideQuest/types/interfaces.d.ts +0 -197
- package/bundle/typescript/src/commands/game/sideQuest/types/interfaces.js +0 -2
- package/bundle/typescript/src/commands/game/sideQuest/types/interfaces.js.map +0 -1
- package/bundle/typescript/src/commands/game/sideQuest/types/types.js +0 -2
- package/bundle/typescript/src/commands/game/sideQuest/types/types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-factory.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/factories/command-factory.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IACjB,MAAM,CAAC,UAAU,GAAqE,EAAE,CAAC;IAE1F,MAAM,CAAC,eAAe,CAAC,IAAY,EAAE,YAA2D;QACrG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC;IACvC,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,IAAY,EAAE,OAA4B;QACpE,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,wBAAwB;QACpC,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Item } from '../models/item.js';
|
|
2
|
+
import { Size, Category, Rating } from '../types/shared/item-enum.js';
|
|
3
|
+
export class ItemFactory {
|
|
4
|
+
async createItemFromJson(json) {
|
|
5
|
+
const item = new Item({
|
|
6
|
+
name: json.name,
|
|
7
|
+
description: json.description,
|
|
8
|
+
size: Size[json.size],
|
|
9
|
+
category: Category[json.category],
|
|
10
|
+
shape: json.shape,
|
|
11
|
+
color: json.color,
|
|
12
|
+
texture: json.texture,
|
|
13
|
+
rating: Rating[json.rating],
|
|
14
|
+
weight: json.weight,
|
|
15
|
+
details: json.details,
|
|
16
|
+
satisfiesLifestyle: json.satisfiesLifestyle
|
|
17
|
+
});
|
|
18
|
+
if (json.currencyAmount && item.isCurrencyCarrier()) {
|
|
19
|
+
item.addCurrency(json.currencyAmount);
|
|
20
|
+
}
|
|
21
|
+
return item;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=item-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-factory.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/factories/item-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtE,MAAM,OAAO,WAAW;IACtB,KAAK,CAAC,kBAAkB,CAAC,IAAmB;QAC1C,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC;YACpB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YACrB,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;YACjC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;YAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;YACpD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACxC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NPC } from '../models/npc.js';
|
|
2
|
+
import { Scene } from '../models/scene.js';
|
|
3
|
+
import { INPCSeedJson } from '../types/seed/npc-seed.js';
|
|
4
|
+
export declare class NPCFactory {
|
|
5
|
+
private scene;
|
|
6
|
+
constructor(scene: Scene);
|
|
7
|
+
createNPCFromJson(json: INPCSeedJson): Promise<NPC>;
|
|
8
|
+
private convertPlayerSeedToConstructorConfig;
|
|
9
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NPC } from '../models/npc.js';
|
|
2
|
+
export class NPCFactory {
|
|
3
|
+
scene;
|
|
4
|
+
constructor(scene) {
|
|
5
|
+
this.scene = scene;
|
|
6
|
+
}
|
|
7
|
+
async createNPCFromJson(json) {
|
|
8
|
+
if (!json?.player?.name) {
|
|
9
|
+
throw new Error(`NPC missing name in player: ${JSON.stringify(json)}`);
|
|
10
|
+
}
|
|
11
|
+
const playerConstructorConfig = this.convertPlayerSeedToConstructorConfig(json.player);
|
|
12
|
+
return new NPC({
|
|
13
|
+
dialog: json.dialogue ?? ["..."],
|
|
14
|
+
description: json.description ?? "Not interesting",
|
|
15
|
+
playerConstructorConfig
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
convertPlayerSeedToConstructorConfig(seed) {
|
|
19
|
+
if (!seed.name) {
|
|
20
|
+
throw new Error(`Cannot create NPC without a name`);
|
|
21
|
+
}
|
|
22
|
+
if (!seed.startLocation) {
|
|
23
|
+
throw new Error(`Cannot create NPC with a start location`);
|
|
24
|
+
}
|
|
25
|
+
const startLocation = this.scene.getRoom(seed.startLocation);
|
|
26
|
+
return {
|
|
27
|
+
playerName: seed.name,
|
|
28
|
+
lifestyleChoices: seed.lifestyleChoices,
|
|
29
|
+
startLocation
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=npc-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npc-factory.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/factories/npc-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAKvC,MAAM,OAAO,UAAU;IACb,KAAK,CAAQ;IAErB,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,IAAkB;QACxC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;QACD,MAAM,uBAAuB,GAAG,IAAI,CAAC,oCAAoC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEvF,OAAO,IAAI,GAAG,CAAC;YACb,MAAM,EAAE,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC;YAChC,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,iBAAiB;YAClD,uBAAuB;SACxB,CAAC,CAAC;IACL,CAAC;IAEO,oCAAoC,CAAC,IAA4B;QACvE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC7D,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,IAAI;YACrB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,aAAa;SACd,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Puzzle } from '../models/puzzle.js';
|
|
2
|
+
import { IPuzzleSeedJson } from '../types/seed/puzzle-seed.js';
|
|
3
|
+
import { Item } from '../models/item.js';
|
|
4
|
+
export declare class PuzzleFactory {
|
|
5
|
+
createPuzzleFromJson(json: IPuzzleSeedJson, itemMap: Map<string, Item>): Promise<Puzzle>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Puzzle } from '../models/puzzle.js';
|
|
2
|
+
export class PuzzleFactory {
|
|
3
|
+
async createPuzzleFromJson(json, itemMap) {
|
|
4
|
+
const requiredItem = json.requiredItem ? itemMap.get(json.requiredItem) : undefined;
|
|
5
|
+
const rewardItem = json.rewardItem ? itemMap.get(json.rewardItem) : undefined;
|
|
6
|
+
if (json.requiredItem && !requiredItem) {
|
|
7
|
+
throw new Error(`Required item '${json.requiredItem}' not found for puzzle "${json.name}"`);
|
|
8
|
+
}
|
|
9
|
+
if (json.rewardItem && !rewardItem) {
|
|
10
|
+
throw new Error(`Reward item '${json.rewardItem}' not found for puzzle "${json.name}"`);
|
|
11
|
+
}
|
|
12
|
+
return new Puzzle({
|
|
13
|
+
name: json.name,
|
|
14
|
+
riddle: json.riddle,
|
|
15
|
+
requiredPhrase: json.requiredPhrase,
|
|
16
|
+
requiredItem,
|
|
17
|
+
rewardItem,
|
|
18
|
+
successMessage: json.successMessage,
|
|
19
|
+
failureMessage: json.failureMessage,
|
|
20
|
+
hobbyTags: json.hobbyTags
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=puzzle-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puzzle-factory.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/factories/puzzle-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C,MAAM,OAAO,aAAa;IACxB,KAAK,CAAC,oBAAoB,CAAC,IAAqB,EAAE,OAA0B;QAC1E,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACpF,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE9E,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,YAAY,2BAA2B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAC9F,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,UAAU,2BAA2B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,IAAI,MAAM,CAAC;YAChB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,YAAY;YACZ,UAAU;YACV,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Room } from '../models/_index.js';
|
|
2
|
+
export class RoomFactory {
|
|
3
|
+
async createRoomFromJson(config) {
|
|
4
|
+
const roomConfig = this.convertToRoomConfigFromJson(config);
|
|
5
|
+
const room = new Room(roomConfig);
|
|
6
|
+
return room;
|
|
7
|
+
}
|
|
8
|
+
convertToRoomConfigFromJson(roomJson) {
|
|
9
|
+
return {
|
|
10
|
+
name: roomJson.name,
|
|
11
|
+
description: roomJson.description,
|
|
12
|
+
isStartRoom: roomJson.isStartRoom,
|
|
13
|
+
roomType: roomJson.roomType,
|
|
14
|
+
tags: roomJson.tags ?? [],
|
|
15
|
+
supportedLifestyles: roomJson.supportedLifestyles
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=room-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room-factory.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/factories/room-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,MAAM,qBAAqB,CAAC;AAGnE,MAAM,OAAO,WAAW;IACtB,KAAK,CAAC,kBAAkB,CAAC,MAAqB;QAC5C,MAAM,UAAU,GAA2B,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC;QACpF,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,2BAA2B,CAAC,QAAuB;QACzD,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE;YACzB,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB;SAClD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Scene } from '../models/scene.js';
|
|
2
2
|
import { Player } from '../models/player.js';
|
|
3
|
-
import { ISceneSeedJson } from '../types/
|
|
3
|
+
import { ISceneSeedJson } from '../types/seed/scene-seed.js';
|
|
4
4
|
export declare class SceneSynthesizer {
|
|
5
|
-
static synthesizeFromJson(json: ISceneSeedJson, player: Player): Scene
|
|
5
|
+
static synthesizeFromJson(json: ISceneSeedJson, player: Player, useAi: boolean): Promise<Scene>;
|
|
6
6
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Scene } from '../models/scene.js';
|
|
2
|
+
import { RoomFactory } from './room-factory.js';
|
|
3
|
+
import { NPCFactory } from './npc-factory.js';
|
|
4
|
+
import { ItemFactory } from './item-factory.js';
|
|
5
|
+
import { PuzzleFactory } from './puzzle-factory.js';
|
|
6
|
+
import { Logger } from '../utilities/logger.js';
|
|
7
|
+
export class SceneSynthesizer {
|
|
8
|
+
static async synthesizeFromJson(json, player, useAi) {
|
|
9
|
+
const logger = Logger.getInstance();
|
|
10
|
+
// Step 1: Create the Scene using the JSON’s room configuration
|
|
11
|
+
logger.write(`Initilizing Scene`);
|
|
12
|
+
const scene = new Scene({
|
|
13
|
+
player,
|
|
14
|
+
currency: {
|
|
15
|
+
type: json.currency.type,
|
|
16
|
+
authorityRoomTags: json.currency.authorityRoomTags
|
|
17
|
+
},
|
|
18
|
+
residenceTiers: json.residenceTiers
|
|
19
|
+
});
|
|
20
|
+
// Step 2: Create and Register Rooms using RoomFactory
|
|
21
|
+
logger.write(`Creating Rooms`);
|
|
22
|
+
const roomFactory = new RoomFactory();
|
|
23
|
+
for (const roomJson of json.rooms) {
|
|
24
|
+
const room = await roomFactory.createRoomFromJson(roomJson);
|
|
25
|
+
scene.addRoom(room); // Assumes you have a method like this on Scene
|
|
26
|
+
}
|
|
27
|
+
// Step 2.5: Wire exits between rooms
|
|
28
|
+
logger.write(`Adding Exits`);
|
|
29
|
+
for (const roomJson of json.rooms) {
|
|
30
|
+
for (const exit of roomJson.exits ?? []) {
|
|
31
|
+
try {
|
|
32
|
+
scene.connectRooms(roomJson.name, exit.direction.toLowerCase(), exit.targetRoom, exit.keyRequired // Optional unlock item/solution
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
throw new Error(`Failed to connect exit from "${roomJson.name}" to "${exit.targetRoom}" via "${exit.direction}": ${err.message}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Step 3: Add NPCs
|
|
41
|
+
logger.write(`Adding NPCs`);
|
|
42
|
+
const npcFactory = new NPCFactory(scene);
|
|
43
|
+
for (const npcJson of json.npcs ?? []) {
|
|
44
|
+
const npc = await npcFactory.createNPCFromJson(npcJson);
|
|
45
|
+
if (!npc) {
|
|
46
|
+
throw new Error(`NPC creation failed for: ${JSON.stringify(npcJson, null, 2)}`);
|
|
47
|
+
}
|
|
48
|
+
logger.write(`Adding ${npc?.name}`);
|
|
49
|
+
scene.addActor(npc);
|
|
50
|
+
scene.setCharacterLocation(npc, npcJson.player.startLocation);
|
|
51
|
+
npc.scene = scene;
|
|
52
|
+
}
|
|
53
|
+
// Step 4: Add Items
|
|
54
|
+
const itemFactory = new ItemFactory();
|
|
55
|
+
const itemMap = new Map();
|
|
56
|
+
for (const itemJson of json.items ?? []) {
|
|
57
|
+
const item = await itemFactory.createItemFromJson(itemJson);
|
|
58
|
+
itemMap.set(item.name, item);
|
|
59
|
+
// Step 4.5: Distribute Items
|
|
60
|
+
if (itemJson.heldBy) {
|
|
61
|
+
const actor = scene.getActor(itemJson.heldBy);
|
|
62
|
+
if (!actor) {
|
|
63
|
+
throw new Error(`No actor named "${itemJson.heldBy}" to receive item "${itemJson.name}"`);
|
|
64
|
+
}
|
|
65
|
+
actor.addInventory(item);
|
|
66
|
+
}
|
|
67
|
+
else if (itemJson.room) {
|
|
68
|
+
scene.addItemToRoom(item, itemJson.room);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
throw new Error(`Item "${itemJson.name}" must have either 'room' or 'heldBy'.`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Step 5: Add Puzzles
|
|
75
|
+
const puzzleFactory = new PuzzleFactory();
|
|
76
|
+
for (const puzzleJson of json.puzzles ?? []) {
|
|
77
|
+
const puzzle = await puzzleFactory.createPuzzleFromJson(puzzleJson, itemMap);
|
|
78
|
+
scene.addPuzzleToRoom(puzzle, puzzleJson.room);
|
|
79
|
+
}
|
|
80
|
+
// Step 6: Sync AI descriptions for all rooms
|
|
81
|
+
const sceneContext = `
|
|
82
|
+
Scene: ${scene.name}
|
|
83
|
+
Currency: ${json.currency.type}
|
|
84
|
+
Residence Tiers: ${json.residenceTiers.join(', ')}
|
|
85
|
+
Key Locations: ${json.rooms.map(r => r.name).join(', ')}
|
|
86
|
+
`;
|
|
87
|
+
for (const room of Object.values(scene.getRooms())) {
|
|
88
|
+
await room.ensureAIDescription(sceneContext);
|
|
89
|
+
}
|
|
90
|
+
// Step 7: Assign ownership to rooms and items
|
|
91
|
+
logger.write(`Assigning Ownership`);
|
|
92
|
+
for (const roomJson of json.rooms) {
|
|
93
|
+
if (roomJson.owner) {
|
|
94
|
+
const room = scene.getRoom(roomJson.name);
|
|
95
|
+
if (!room) {
|
|
96
|
+
throw new Error(`No room found with name "${roomJson.name}" for ownership assignment.`);
|
|
97
|
+
}
|
|
98
|
+
room.owner = roomJson.owner;
|
|
99
|
+
logger.write(`Room "${room.name}" now owned by "${room.owner}"`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const itemJson of json.items ?? []) {
|
|
103
|
+
if (itemJson.owner) {
|
|
104
|
+
const item = itemMap.get(itemJson.name);
|
|
105
|
+
if (!item) {
|
|
106
|
+
throw new Error(`No item found with name "${itemJson.name}" for ownership assignment.`);
|
|
107
|
+
}
|
|
108
|
+
item.owner = itemJson.owner;
|
|
109
|
+
logger.write(`Item "${item.name}" now owned by "${item.owner}"`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Done: the scene is now ready
|
|
113
|
+
return scene;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=scene-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-factory.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/factories/scene-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,MAAM,OAAO,gBAAgB;IAC3B,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAoB,EAAE,MAAc,EAAE,KAAc;QAClF,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QAEpC,+DAA+D;QAC/D,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;YACtB,MAAM;YACN,QAAQ,EAAE;gBACR,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;gBACxB,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB;aACnD;YACD,cAAc,EAAE,IAAI,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,CAAC,IAAI,6BAA6B,CAAC,CAAC;gBAC1F,CAAC;gBACD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAC5B,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,mBAAmB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;YACxC,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACnB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACxC,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,MAAM,IAAI,KAAK,CAAC,4BAA4B,QAAQ,CAAC,IAAI,6BAA6B,CAAC,CAAC;gBAC1F,CAAC;gBACD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAC5B,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,mBAAmB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;QAGD,+BAA+B;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import blessed from 'blessed';
|
|
2
|
+
import { ISceneSeedJson } from './types/seed/scene-seed.js';
|
|
2
3
|
import { Room } from './models/room.js';
|
|
3
4
|
import { Player } from './models/player.js';
|
|
4
5
|
import { Scene } from './models/scene.js';
|
|
5
|
-
import {
|
|
6
|
+
import { IMainGameConfig } from './ui.js';
|
|
6
7
|
export default class Game {
|
|
7
8
|
private static instance;
|
|
9
|
+
private sceneSeed;
|
|
8
10
|
scene: Scene;
|
|
9
11
|
player: Player;
|
|
10
12
|
currentRoom: Room;
|
|
11
|
-
rooms:
|
|
13
|
+
rooms: Room[];
|
|
12
14
|
constructor(player: Player, sceneSeed: ISceneSeedJson);
|
|
13
15
|
private registerCommands;
|
|
14
16
|
private determineStartRoom;
|
|
15
|
-
|
|
16
|
-
static getInstance(player: Player, sceneSeed: ISceneSeedJson): Game
|
|
17
|
+
init(options: IMainGameConfig, screen: blessed.Widgets.Screen): Promise<string>;
|
|
18
|
+
static getInstance(player: Player, sceneSeed: ISceneSeedJson): Promise<Game>;
|
|
17
19
|
handleInput(input: string): string | null;
|
|
18
20
|
private getHelpMessage;
|
|
19
21
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import blessed from 'blessed';
|
|
1
2
|
import { LookCommand } from './commands/look.js';
|
|
2
3
|
import { TakeCommand } from './commands/take.js';
|
|
3
4
|
import { GoCommand } from './commands/go.js';
|
|
@@ -10,21 +11,20 @@ import { UnlockCommand } from './commands/unlock.js';
|
|
|
10
11
|
import { LockCommand } from './commands/lock.js';
|
|
11
12
|
import { SearchCommand } from './commands/search.js';
|
|
12
13
|
import { SayCommand } from './commands/say.js';
|
|
14
|
+
import { TalkCommand } from './commands/talk.js';
|
|
13
15
|
import { StoreCommand } from './commands/store.js';
|
|
14
|
-
import { CommandFactory } from './factories/
|
|
15
|
-
import { SceneSynthesizer } from './factories/
|
|
16
|
+
import { CommandFactory } from './factories/command-factory.js';
|
|
17
|
+
import { SceneSynthesizer } from './factories/scene-factory.js';
|
|
16
18
|
export default class Game {
|
|
17
19
|
static instance;
|
|
20
|
+
sceneSeed;
|
|
18
21
|
scene;
|
|
19
22
|
player;
|
|
20
23
|
currentRoom;
|
|
21
24
|
rooms;
|
|
22
25
|
constructor(player, sceneSeed) {
|
|
23
26
|
this.player = player;
|
|
24
|
-
this.
|
|
25
|
-
this.scene.initialize();
|
|
26
|
-
this.player.currentLocation = this.determineStartRoom();
|
|
27
|
-
this.registerCommands();
|
|
27
|
+
this.sceneSeed = sceneSeed;
|
|
28
28
|
}
|
|
29
29
|
registerCommands() {
|
|
30
30
|
CommandFactory.registerCommand('look', LookCommand);
|
|
@@ -40,15 +40,45 @@ export default class Game {
|
|
|
40
40
|
CommandFactory.registerCommand('search', SearchCommand);
|
|
41
41
|
CommandFactory.registerCommand('say', SayCommand);
|
|
42
42
|
CommandFactory.registerCommand('store', StoreCommand);
|
|
43
|
+
CommandFactory.registerCommand('talk-to', TalkCommand);
|
|
43
44
|
}
|
|
44
45
|
determineStartRoom() {
|
|
45
46
|
return this.scene.determineStartRoom();
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
async init(options, screen) {
|
|
49
|
+
// Create a loading box
|
|
50
|
+
const loadingBox = blessed.box({
|
|
51
|
+
parent: screen,
|
|
52
|
+
top: 'center',
|
|
53
|
+
left: 'center',
|
|
54
|
+
width: '50%',
|
|
55
|
+
height: 'shrink',
|
|
56
|
+
content: 'Generating Scene... Please wait.',
|
|
57
|
+
border: { type: 'line' },
|
|
58
|
+
style: {
|
|
59
|
+
fg: 'white',
|
|
60
|
+
bg: 'black',
|
|
61
|
+
border: { fg: 'cyan' },
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
screen.append(loadingBox);
|
|
65
|
+
screen.render();
|
|
66
|
+
try {
|
|
67
|
+
this.scene = await SceneSynthesizer.synthesizeFromJson(this.sceneSeed, this.player, options.useAi);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
throw new Error(`Scene generation failed: ${err.message}`);
|
|
71
|
+
}
|
|
72
|
+
// Remove loading box
|
|
73
|
+
screen.remove(loadingBox);
|
|
74
|
+
screen.render();
|
|
75
|
+
this.scene.initialize();
|
|
76
|
+
this.player.currentLocation = this.determineStartRoom();
|
|
77
|
+
this.registerCommands();
|
|
78
|
+
return `Welcome, ${this.player.name}`;
|
|
49
79
|
}
|
|
50
80
|
// Public method to get the instance of the Game class
|
|
51
|
-
static getInstance(player, sceneSeed) {
|
|
81
|
+
static async getInstance(player, sceneSeed) {
|
|
52
82
|
if (!Game.instance) {
|
|
53
83
|
Game.instance = new Game(player, sceneSeed);
|
|
54
84
|
}
|
|
@@ -73,7 +103,7 @@ export default class Game {
|
|
|
73
103
|
const context = {
|
|
74
104
|
actor: this.player,
|
|
75
105
|
rooms: this.scene.getRooms(),
|
|
76
|
-
scene: this.scene
|
|
106
|
+
scene: this.scene,
|
|
77
107
|
};
|
|
78
108
|
const command = CommandFactory.createCommand(verb, context);
|
|
79
109
|
if (command) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"game.js","sourceRoot":"","sources":["../../../../../../src/commands/game/sideQuest/game.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"game.js","sourceRoot":"","sources":["../../../../../../src/commands/game/sideQuest/game.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAS9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CA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I,IAAI,CAAC;IACrD,CAAC;IAEO,cAAc;QACpB,MAAM,QAAQ,GAAG,cAAc,CAAC,wBAAwB,EAAE,CAAC;QAC3D,IAAI,QAAQ,GAAG,uBAAuB,CAAC;QAEvC,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAA8B,CAAC;gBACjE,QAAQ,IAAI,KAAK,IAAI,KAAK,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC;YAC9D,CAAC;QACH,CAAC;QAED,QAAQ,IAAI,8BAA8B,CAAC;QAC3C,QAAQ,IAAI,0BAA0B,CAAC;QAEvC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { Logger } from '../utilities/logger.js';
|
|
2
2
|
import { Room } from './room.js';
|
|
3
|
-
import { AbstractDoor } from '../types/abstracts.js';
|
|
4
|
-
|
|
3
|
+
import { AbstractDoor } from '../types/shared/abstracts.js';
|
|
4
|
+
export interface IDoorConstructorConfig {
|
|
5
|
+
roomA: Room;
|
|
6
|
+
roomB: Room;
|
|
7
|
+
isLocked?: boolean;
|
|
8
|
+
unlockItemOrSolution?: string;
|
|
9
|
+
}
|
|
5
10
|
export declare class Door extends AbstractDoor {
|
|
6
11
|
roomA: Room;
|
|
7
12
|
roomB: Room;
|
|
8
13
|
isLocked: boolean;
|
|
9
14
|
unlockItemOrSolution?: string;
|
|
10
|
-
name: string;
|
|
11
15
|
logger: Logger;
|
|
12
16
|
isLockable: boolean;
|
|
13
17
|
constructor(config: IDoorConstructorConfig);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Logger } from '../utilities/logger.js';
|
|
2
|
-
import { AbstractDoor } from '../types/abstracts.js';
|
|
2
|
+
import { AbstractDoor } from '../types/shared/abstracts.js';
|
|
3
3
|
export class Door extends AbstractDoor {
|
|
4
4
|
roomA; // One side of the door
|
|
5
5
|
roomB; // The other side of the door
|
|
6
6
|
isLocked;
|
|
7
7
|
unlockItemOrSolution;
|
|
8
|
-
name;
|
|
9
8
|
logger;
|
|
10
9
|
isLockable;
|
|
11
10
|
constructor(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"door.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/door.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"door.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/door.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAS5D,MAAM,OAAO,IAAK,SAAQ,YAAY;IACpC,KAAK,CAAO,CAAE,uBAAuB;IACrC,KAAK,CAAO,CAAE,6BAA6B;IAC3C,QAAQ,CAAU;IAClB,oBAAoB,CAAU;IAC9B,MAAM,CAAS;IACf,UAAU,CAAS;IAEnB,YAAY,MAA8B;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC;QACzC,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC;QAEhD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,KAAK,CAAC,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,gBAAgB,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnH,CAAC;IAED,YAAY,CAAC,WAAiB;QAC5B,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAChE,CAAC;IAED,kBAAkB,CAAC,WAAiB;QAClC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1F,CAAC;IAED,aAAa,CAAC,cAAsB;QAClC,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,oBAAoB,KAAK,cAAc,EAAE,CAAC;YAC/F,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,IAAI,WAAW,cAAc,EAAE,CAAC,CAAC;YAC1E,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,IAAI,CAAC,IAAI,WAAW,cAAc,EAAE,CAAC,CAAC;QAClF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logger } from '../utilities/logger.js';
|
|
2
2
|
import { Item } from './item.js';
|
|
3
|
-
import { AbstractInventory } from '../types/abstracts.js';
|
|
3
|
+
import { AbstractInventory } from '../types/shared/abstracts.js';
|
|
4
4
|
export declare class Inventory extends AbstractInventory {
|
|
5
5
|
protected items: Map<string, Item>;
|
|
6
6
|
protected logger: Logger;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { capitalCase } from 'change-case';
|
|
2
2
|
import { Logger } from '../utilities/logger.js';
|
|
3
|
-
import { AbstractInventory } from '../types/abstracts.js';
|
|
3
|
+
import { AbstractInventory } from '../types/shared/abstracts.js';
|
|
4
4
|
export class Inventory extends AbstractInventory {
|
|
5
5
|
items;
|
|
6
6
|
logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inventory.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"inventory.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,OAAO,SAAU,SAAQ,iBAAiB;IACpC,KAAK,CAAoB;IACzB,MAAM,CAAS;IACjB,WAAW,GAAwB,IAAI,GAAG,EAAE,CAAC,CAAC,uBAAuB;IAE7E;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAgB,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,gCAAgC;IACtE,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAU;QAChB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW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
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { Size, Category, Rating } from '../types/
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Size, Category, Rating } from '../types/shared/item-enum.js';
|
|
2
|
+
import { AbstractItem } from '../types/shared/abstracts.js';
|
|
3
|
+
export interface IItemConstructorConfig {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
size: Size;
|
|
7
|
+
category: Category;
|
|
8
|
+
shape: string;
|
|
9
|
+
color: string;
|
|
10
|
+
texture: string;
|
|
11
|
+
rating: Rating;
|
|
12
|
+
weight: number;
|
|
13
|
+
details?: string;
|
|
14
|
+
content?: string;
|
|
15
|
+
satisfiesLifestyle?: {
|
|
16
|
+
addictionTypes?: string[];
|
|
17
|
+
habitTags?: string[];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
4
20
|
export declare class Item extends AbstractItem {
|
|
5
|
-
|
|
21
|
+
private _id;
|
|
22
|
+
private _owner?;
|
|
6
23
|
name: string;
|
|
7
24
|
description: string;
|
|
8
25
|
size: Size;
|
|
@@ -12,6 +29,7 @@ export declare class Item extends AbstractItem {
|
|
|
12
29
|
texture: string;
|
|
13
30
|
rating: Rating;
|
|
14
31
|
weight: number;
|
|
32
|
+
content?: string;
|
|
15
33
|
details?: string;
|
|
16
34
|
satisfiesLifestyle?: {
|
|
17
35
|
addictionTypes?: string[];
|
|
@@ -20,6 +38,9 @@ export declare class Item extends AbstractItem {
|
|
|
20
38
|
protected _currencyAmount: number;
|
|
21
39
|
protected _currencyCapacity?: number;
|
|
22
40
|
constructor(options: IItemConstructorConfig);
|
|
41
|
+
get owner(): string | undefined;
|
|
42
|
+
set owner(owner: string | undefined);
|
|
43
|
+
get id(): string;
|
|
23
44
|
use(): string;
|
|
24
45
|
supportsAddiction(addiction: string): boolean;
|
|
25
46
|
supportsHabit(habit: string): boolean;
|