@maka/maka-cli 5.1.29 → 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/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 -11
- package/bundle/typescript/src/commands/game/sideQuest/commands/say.js +5 -32
- 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 +3 -4
- 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 -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 +38 -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 -14
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +36 -36
- 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 +84 -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 +13 -7
- package/bundle/typescript/src/commands/game/sideQuest/types/enums.js +12 -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} +12 -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 +1 -0
- package/bundle/typescript/src/tools/https/https.class.js +49 -1
- package/bundle/typescript/src/tools/https/https.class.js.map +1 -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
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { Room } from './room.js';
|
|
2
1
|
import { Player } from './player.js';
|
|
3
|
-
import {
|
|
2
|
+
import { Scene } from './scene.js';
|
|
3
|
+
import { IPlayerConstructorConfig } from '../models/player.js';
|
|
4
|
+
export interface INPCConstructorConfig {
|
|
5
|
+
dialog: string[];
|
|
6
|
+
description: string;
|
|
7
|
+
playerConstructorConfig: IPlayerConstructorConfig;
|
|
8
|
+
}
|
|
4
9
|
export declare class NPC extends Player {
|
|
5
|
-
readonly _name: string;
|
|
6
10
|
private _dialogue;
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
get
|
|
12
|
-
hear(actor: Player, message: string): void
|
|
13
|
-
|
|
11
|
+
private _description;
|
|
12
|
+
private _scene;
|
|
13
|
+
constructor(npcConfig: INPCConstructorConfig);
|
|
14
|
+
set scene(scene: Scene);
|
|
15
|
+
get description(): string;
|
|
16
|
+
hear(actor: Player, message: string): Promise<void>;
|
|
17
|
+
see(actor: Player, verb: string, details?: string): Promise<void>;
|
|
14
18
|
speak(): string;
|
|
15
|
-
|
|
16
|
-
moveTo(direction: string): void;
|
|
17
|
-
get image(): string;
|
|
18
|
-
set image(asciiArtImage: string);
|
|
19
|
+
respondTo(actor: Player, message: string): Promise<void>;
|
|
19
20
|
}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
import { Player } from './player.js';
|
|
2
|
-
import { GoCommand } from '../commands/go.js';
|
|
3
2
|
import { HTTPS } from '../../../../tools/https/https.class.js';
|
|
4
3
|
export class NPC extends Player {
|
|
5
|
-
_name;
|
|
6
4
|
_dialogue;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
this._dialogue = dialogue;
|
|
14
|
-
this.rooms = rooms;
|
|
5
|
+
_description;
|
|
6
|
+
_scene;
|
|
7
|
+
constructor(npcConfig) {
|
|
8
|
+
super(npcConfig.playerConstructorConfig);
|
|
9
|
+
this._dialogue = npcConfig.dialog;
|
|
10
|
+
this._description = npcConfig.description;
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
set scene(scene) {
|
|
13
|
+
this._scene = scene;
|
|
18
14
|
}
|
|
19
|
-
|
|
15
|
+
get description() {
|
|
16
|
+
return this._description;
|
|
17
|
+
}
|
|
18
|
+
async hear(actor, message) {
|
|
20
19
|
if (actor === this)
|
|
21
20
|
return;
|
|
22
21
|
this.logger.write(`${this.name} received from ${actor.name}: "${message}"`);
|
|
23
|
-
this.respondTo(actor, message);
|
|
22
|
+
await this.respondTo(actor, message);
|
|
23
|
+
}
|
|
24
|
+
async see(actor, verb, details) {
|
|
25
|
+
if (actor !== this) {
|
|
26
|
+
this.logger.write(`${this.name} sees ${actor.name} ${verb} ${details}`);
|
|
27
|
+
await this.respondTo(actor, `${actor.name} ${verb} ${details}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
speak() {
|
|
31
|
+
return this._dialogue[Math.floor(Math.random() * this._dialogue.length)];
|
|
24
32
|
}
|
|
25
33
|
async respondTo(actor, message) {
|
|
26
34
|
this.logger.write('Attempting to respond');
|
|
@@ -49,6 +57,16 @@ export class NPC extends Player {
|
|
|
49
57
|
const npcInventoryDesc = npcItems.length > 0
|
|
50
58
|
? `This NPC is carrying: ${npcItems.map(item => item.name).join(', ')}.`
|
|
51
59
|
: `This NPC is not visibly carrying anything.`;
|
|
60
|
+
// Owned Rooms
|
|
61
|
+
const ownedRooms = this._scene?.getOwnedRoomsBy?.(this.name) ?? [];
|
|
62
|
+
const ownedRoomsDesc = ownedRooms.length > 0
|
|
63
|
+
? `They own the following rooms: ${ownedRooms.map(r => `"${r.name}"`).join(', ')}.`
|
|
64
|
+
: `They do not appear to own any rooms.`;
|
|
65
|
+
// Owned Items
|
|
66
|
+
const ownedItems = this._scene?.getOwnedItemsBy?.(this.name) ?? [];
|
|
67
|
+
const ownedItemsDesc = ownedItems.length > 0
|
|
68
|
+
? `They own the following items: ${ownedItems.map(i => `"${i.name}"`).join(', ')}.`
|
|
69
|
+
: `They do not appear to own any items.`;
|
|
52
70
|
// Build final GPT prompt
|
|
53
71
|
const prompt = `
|
|
54
72
|
You are an NPC named ${this.name} in a gritty cyberpunk text adventure game.
|
|
@@ -60,7 +78,11 @@ You are an NPC named ${this.name} in a gritty cyberpunk text adventure game.
|
|
|
60
78
|
${lifestyleSummary}
|
|
61
79
|
${npcInventoryDesc}
|
|
62
80
|
|
|
81
|
+
${ownedRoomsDesc}
|
|
82
|
+
${ownedItemsDesc}
|
|
83
|
+
|
|
63
84
|
Stay in character. Respond naturally based on your surroundings, personality, and the player’s message.
|
|
85
|
+
Any exposition should be in 3rd person.
|
|
64
86
|
|
|
65
87
|
Player: ${message}
|
|
66
88
|
${this.name}:
|
|
@@ -83,27 +105,5 @@ Player: ${message}
|
|
|
83
105
|
actor.hear(this, this.speak());
|
|
84
106
|
}
|
|
85
107
|
}
|
|
86
|
-
speak() {
|
|
87
|
-
return this._dialogue[Math.floor(Math.random() * this._dialogue.length)];
|
|
88
|
-
}
|
|
89
|
-
autonomousMove(possibleRooms) {
|
|
90
|
-
const nextRoom = possibleRooms[Math.floor(Math.random() * possibleRooms.length)];
|
|
91
|
-
this.moveTo(nextRoom.name);
|
|
92
|
-
}
|
|
93
|
-
moveTo(direction) {
|
|
94
|
-
const context = {
|
|
95
|
-
actor: this,
|
|
96
|
-
rooms: this.rooms,
|
|
97
|
-
scene: this.scene
|
|
98
|
-
};
|
|
99
|
-
const goCommand = new GoCommand(context);
|
|
100
|
-
goCommand.execute([direction]);
|
|
101
|
-
}
|
|
102
|
-
get image() {
|
|
103
|
-
return this._image;
|
|
104
|
-
}
|
|
105
|
-
set image(asciiArtImage) {
|
|
106
|
-
this._image = asciiArtImage;
|
|
107
|
-
}
|
|
108
108
|
}
|
|
109
109
|
//# sourceMappingURL=npc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npc.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/npc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"npc.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/npc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAQ/D,MAAM,OAAO,GAAI,SAAQ,MAAM;IACrB,SAAS,CAAW;IACpB,YAAY,CAAS;IACrB,MAAM,CAAQ;IAEtB,YAAY,SAAgC;QAC1C,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC;IAC5C,CAAC;IAED,IAAI,KAAK,CAAC,KAAY;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAa,EAAE,OAAe;QACvC,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO;QAE3B,IAAI,CAAC,MAAM,CAAC,KAAK,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AAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC9E,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;CAEF"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { PlayerEquipment } from '../types/
|
|
2
|
-
import {
|
|
1
|
+
import { PlayerEquipment } from '../types/player-equipment.js';
|
|
2
|
+
import { LifestyleChoices } from '../types/seed/lifestyle-seed.js';
|
|
3
3
|
import { Logger } from '../utilities/logger.js';
|
|
4
4
|
import { Room } from './room.js';
|
|
5
5
|
import { Item } from './item.js';
|
|
6
6
|
import { Inventory } from './inventory.js';
|
|
7
|
-
import { AbstractPlayer } from '../types/abstracts.js';
|
|
8
|
-
export
|
|
7
|
+
import { AbstractPlayer } from '../types/shared/abstracts.js';
|
|
8
|
+
export interface IPlayerConstructorConfig {
|
|
9
|
+
playerName: string;
|
|
10
|
+
startLocation: Room;
|
|
11
|
+
lifestyleChoices?: LifestyleChoices;
|
|
12
|
+
}
|
|
13
|
+
export declare class Player extends AbstractPlayer {
|
|
9
14
|
readonly _playerName: string;
|
|
10
15
|
protected _currentLocation: Room;
|
|
11
16
|
protected _inventory: Inventory;
|
|
@@ -32,6 +37,13 @@ export declare class Player extends AbstractPlayer implements IPlayer {
|
|
|
32
37
|
private canEquip;
|
|
33
38
|
private unequipBySlot;
|
|
34
39
|
hear(actor: Player, message: string): void;
|
|
40
|
+
see(actor: Player, verb: string, details?: string): void;
|
|
41
|
+
performAction(verb: string, details?: string): void;
|
|
42
|
+
readonly _onSeenAction: ({ actor, verb, details }: {
|
|
43
|
+
actor: Player;
|
|
44
|
+
verb: string;
|
|
45
|
+
details?: string;
|
|
46
|
+
}) => void;
|
|
35
47
|
enterRoom(room: Room): void;
|
|
36
48
|
leaveRoom(): void;
|
|
37
49
|
get lifestyleChoices(): LifestyleChoices;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Category } from '../types/enums.js';
|
|
1
|
+
import { Category } from '../types/shared/item-enum.js';
|
|
3
2
|
import { Logger } from '../utilities/logger.js';
|
|
4
|
-
import { Room } from './room.js';
|
|
5
3
|
import { Inventory } from './inventory.js';
|
|
6
|
-
import { AbstractPlayer } from '../types/abstracts.js';
|
|
4
|
+
import { AbstractPlayer } from '../types/shared/abstracts.js';
|
|
7
5
|
export class Player extends AbstractPlayer {
|
|
8
6
|
_playerName;
|
|
9
7
|
_currentLocation;
|
|
@@ -16,16 +14,11 @@ export class Player extends AbstractPlayer {
|
|
|
16
14
|
constructor(config) {
|
|
17
15
|
super();
|
|
18
16
|
this._playerName = config.playerName;
|
|
19
|
-
this._currentLocation = config.startLocation
|
|
17
|
+
this._currentLocation = config.startLocation;
|
|
20
18
|
this._inventory = new Inventory();
|
|
21
19
|
this.logger = Logger.getInstance();
|
|
22
20
|
this._lifestyleChoices = config.lifestyleChoices ?? [];
|
|
23
|
-
|
|
24
|
-
for (const item of config.inventoryItems) {
|
|
25
|
-
this._inventory.addItem(item);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
this._equipment = config?.initialEquipment || {
|
|
21
|
+
this._equipment = {
|
|
29
22
|
head: null, torso: null, legs: null, feet: null,
|
|
30
23
|
arms: null, gloves: null, leftHand: null, rightHand: null
|
|
31
24
|
};
|
|
@@ -96,80 +89,115 @@ export class Player extends AbstractPlayer {
|
|
|
96
89
|
if (!this.canEquip(item)) {
|
|
97
90
|
return `You can't equip ${item.name}.`;
|
|
98
91
|
}
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
92
|
+
const slotInfo = this.determineEquipmentSlot(item.category);
|
|
93
|
+
if (!slotInfo) {
|
|
101
94
|
return `${item.name} doesn't fit any known equipment slot.`;
|
|
102
95
|
}
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
const { group, slot } = slotInfo;
|
|
97
|
+
const groupRef = this._equipment[group];
|
|
98
|
+
if (!groupRef) {
|
|
99
|
+
return `You have no ${group} equipment group initialized.`;
|
|
100
|
+
}
|
|
101
|
+
if (groupRef[slot]) {
|
|
102
|
+
return `You already have something equipped in your ${group}.${slot} slot.`;
|
|
105
103
|
}
|
|
106
|
-
|
|
104
|
+
groupRef[slot] = item;
|
|
107
105
|
this.removeInventory(item);
|
|
108
|
-
return `You equipped ${item.name}.`;
|
|
106
|
+
return `You equipped ${item.name} in your ${group}.${slot} slot.`;
|
|
109
107
|
}
|
|
110
108
|
unequip(input) {
|
|
111
|
-
|
|
112
|
-
if (
|
|
113
|
-
slot =
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
const slotInfo = this.determineEquipmentSlot(input);
|
|
110
|
+
if (slotInfo) {
|
|
111
|
+
const { group, slot } = slotInfo;
|
|
112
|
+
return this.unequipBySlot(group, slot);
|
|
113
|
+
}
|
|
114
|
+
// Fallback: try to unequip by item name
|
|
115
|
+
for (const [groupName, group] of Object.entries(this._equipment)) {
|
|
116
|
+
if (!group)
|
|
117
|
+
continue;
|
|
118
|
+
for (const [slotName, equippedItem] of Object.entries(group)) {
|
|
119
|
+
if (equippedItem?.name.toLowerCase() === input.toLowerCase()) {
|
|
120
|
+
return this.unequipBySlot(groupName, slotName);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
116
123
|
}
|
|
117
|
-
return
|
|
124
|
+
return `No equipped item matches "${input}".`;
|
|
118
125
|
}
|
|
119
126
|
determineEquipmentSlot(input) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
case Category.Gloves.toLowerCase(): return 'gloves';
|
|
127
|
+
const normalized = input.toLowerCase();
|
|
128
|
+
switch (normalized) {
|
|
129
|
+
// HEAD
|
|
124
130
|
case Category.Helmet.toLowerCase():
|
|
125
|
-
case Category.Hat.toLowerCase():
|
|
126
|
-
|
|
127
|
-
case
|
|
128
|
-
case
|
|
129
|
-
|
|
130
|
-
case '
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
case
|
|
134
|
-
case '
|
|
135
|
-
|
|
136
|
-
case '
|
|
137
|
-
|
|
138
|
-
case '
|
|
139
|
-
|
|
140
|
-
case '
|
|
141
|
-
|
|
142
|
-
case
|
|
143
|
-
|
|
131
|
+
case Category.Hat.toLowerCase():
|
|
132
|
+
return { group: 'head', slot: 'skull' };
|
|
133
|
+
case 'glasses':
|
|
134
|
+
case 'goggles':
|
|
135
|
+
return { group: 'head', slot: 'eyes' };
|
|
136
|
+
case 'earpiece':
|
|
137
|
+
return { group: 'head', slot: 'ears' };
|
|
138
|
+
// TORSO
|
|
139
|
+
case Category.BodyArmor.toLowerCase(): return { group: 'torso', slot: 'bandolier' };
|
|
140
|
+
case 'backpack': return { group: 'torso', slot: 'backpack' };
|
|
141
|
+
// LEGS
|
|
142
|
+
case Category.LegArmor.toLowerCase(): return { group: 'legs', slot: 'leftThigh' };
|
|
143
|
+
// FEET
|
|
144
|
+
case Category.Boots.toLowerCase(): return { group: 'feet', slot: 'leftAnkle' };
|
|
145
|
+
// ARMS
|
|
146
|
+
case Category.ArmArmor.toLowerCase(): return { group: 'arms', slot: 'leftForearm' };
|
|
147
|
+
// GLOVES
|
|
148
|
+
case Category.Gloves.toLowerCase(): return { group: 'gloves', slot: 'leftWrist' };
|
|
149
|
+
// HANDS
|
|
150
|
+
case Category.Weapon.toLowerCase(): return { group: 'rightHand', slot: 'ring' };
|
|
151
|
+
case Category.Shield.toLowerCase(): return { group: 'leftHand', slot: 'ring' };
|
|
152
|
+
default:
|
|
153
|
+
return null;
|
|
144
154
|
}
|
|
145
155
|
}
|
|
146
156
|
canEquip(item) {
|
|
147
157
|
return Object.values(Category).includes(item.category);
|
|
148
158
|
}
|
|
149
|
-
unequipBySlot(slot) {
|
|
150
|
-
const
|
|
159
|
+
unequipBySlot(group, slot) {
|
|
160
|
+
const groupRef = this._equipment[group];
|
|
161
|
+
if (!groupRef) {
|
|
162
|
+
return `You don't have any equipment group for ${group}.`;
|
|
163
|
+
}
|
|
164
|
+
const itemToUnequip = groupRef[slot];
|
|
151
165
|
if (!itemToUnequip) {
|
|
152
|
-
return `
|
|
166
|
+
return `Nothing is equipped in the ${group}.${slot} slot.`;
|
|
153
167
|
}
|
|
154
168
|
this.addInventory(itemToUnequip);
|
|
155
|
-
|
|
156
|
-
return `You unequipped ${itemToUnequip.name}.`;
|
|
169
|
+
groupRef[slot] = null;
|
|
170
|
+
return `You unequipped ${itemToUnequip.name} from your ${group}.${slot} slot.`;
|
|
157
171
|
}
|
|
158
172
|
hear(actor, message) {
|
|
159
173
|
if (actor !== this) {
|
|
160
174
|
this.logger.write(`${this.name} heard ${actor.name} say: ${message}`);
|
|
161
|
-
this.logger.
|
|
175
|
+
this.logger.logWithColor(message, 'green');
|
|
162
176
|
}
|
|
163
177
|
}
|
|
178
|
+
see(actor, verb, details) {
|
|
179
|
+
if (actor !== this) {
|
|
180
|
+
this.logger.write(`You see ${actor.name} ${verb} ${details}`);
|
|
181
|
+
this.logger.logWithColor(`${actor.name} ${verb} ${details}`, 'cyan');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
performAction(verb, details) {
|
|
185
|
+
const message = `${this.name} performs '${verb}'${details ? `: ${details}` : ''}`;
|
|
186
|
+
this.logger.write(message);
|
|
187
|
+
this.emit('action', { actor: this, verb, details });
|
|
188
|
+
}
|
|
189
|
+
_onSeenAction = ({ actor, verb, details }) => {
|
|
190
|
+
this.see(actor, verb, details);
|
|
191
|
+
};
|
|
164
192
|
enterRoom(room) {
|
|
193
|
+
room.addActor(this);
|
|
165
194
|
this._currentLocation = room;
|
|
166
|
-
|
|
167
|
-
this.logger.write(`${this.name} is now listening in room ${room.name}`);
|
|
195
|
+
this.logger.write(`${this.name} is now listening and observing in ${room.name}`);
|
|
168
196
|
}
|
|
169
197
|
leaveRoom() {
|
|
170
198
|
if (this._currentLocation) {
|
|
171
|
-
this._currentLocation.
|
|
172
|
-
this.logger.write(`${this.name}
|
|
199
|
+
this._currentLocation.removeActor(this);
|
|
200
|
+
this.logger.write(`${this.name} has left ${this._currentLocation.name}`);
|
|
173
201
|
}
|
|
174
202
|
}
|
|
175
203
|
get lifestyleChoices() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"player.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/player.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"player.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/player.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAIhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAU9D,MAAM,OAAO,MAAO,SAAQ,cAAc;IAC/B,WAAW,CAAS;IACnB,gBAAgB,CAAO;IACvB,UAAU,CAAY;IACtB,UAAU,CAAkB;IAC5B,kBAAkB,GAAG,EAAE,CAAC;IACxB,iBAAiB,GAAqB,EAAE,CAAC;IACzC,MAAM,CAAS;IAEjB,SAAS,GAAW,CAAC,CAAC,CAAC,yBAAyB;IAExD,YAAY,MAAgC;QAC1C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC;QAC7C,IAAI,CAAC,UAAU,GAAG,IAA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AAC;IACR,CAAC;IAED,IAAI,QAAQ,CAAC,MAAc;QACzB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,yCAAyC;IACjF,CAAC;IAED,cAAc,CAAC,KAAa;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAClF,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;gBAClB,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;YAC9C,CAAC;iBAAM,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;gBACzB,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC;YAClD,CAAC;YAED,IAAI,SAAS,KAAK,CAAC;gBAAE,MAAM;QAC7B,CAAC;QAED,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC;IAC9B,CAAC;CAEF"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { Logger } from '../utilities/logger.js';
|
|
2
|
-
import { IPuzzleConstructorConfig } from '../types/interfaces.js';
|
|
3
2
|
import { Item } from './item.js';
|
|
4
3
|
import { Inventory } from './inventory.js';
|
|
5
|
-
import { AbstractPuzzle } from '../types/abstracts.js';
|
|
4
|
+
import { AbstractPuzzle } from '../types/shared/abstracts.js';
|
|
5
|
+
export interface IPuzzleConstructorConfig {
|
|
6
|
+
name: string;
|
|
7
|
+
requiredItem?: Item;
|
|
8
|
+
requiredPhrase?: string;
|
|
9
|
+
riddle?: string;
|
|
10
|
+
rewardItem?: Item;
|
|
11
|
+
successMessage?: string;
|
|
12
|
+
failureMessage?: string;
|
|
13
|
+
hobbyTags?: string[];
|
|
14
|
+
}
|
|
6
15
|
export declare class Puzzle extends AbstractPuzzle {
|
|
7
16
|
protected logger: Logger;
|
|
8
17
|
protected solved: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Logger } from '../utilities/logger.js';
|
|
2
|
-
import { AbstractPuzzle } from '../types/abstracts.js';
|
|
2
|
+
import { AbstractPuzzle } from '../types/shared/abstracts.js';
|
|
3
3
|
export class Puzzle extends AbstractPuzzle {
|
|
4
4
|
logger = Logger.getInstance();
|
|
5
5
|
solved = false;
|
|
@@ -24,7 +24,7 @@ export class Puzzle extends AbstractPuzzle {
|
|
|
24
24
|
this.rewardItem = config.rewardItem;
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
throw new Error(`No reward item defined for puzzle ${this.
|
|
27
|
+
throw new Error(`No reward item defined for puzzle ${this.name}`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
isSolved() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"puzzle.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/puzzle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"puzzle.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/puzzle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAIhD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAa9D,MAAM,OAAO,MAAO,SAAQ,cAAc;IAC9B,MAAM,GAAW,MAAM,CAAC,WAAW,EAAE,CAAC;IACtC,MAAM,GAAG,KAAK,CAAC;IAElB,IAAI,CAAS;IACb,YAAY,CAAQ;IACpB,cAAc,CAAU;IACxB,MAAM,CAAU;IAChB,UAAU,CAAO;IACjB,cAAc,CAAS;IACvB,cAAc,CAAS;IACvB,SAAS,CAAY;IAE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AAC;QACJ,CAAC;QAED,IAAI,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,EAAE,CAAC;YACxF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACxD,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,IAAI,CAAC,cAAc;aAC7B,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YAC5E,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,IAAI,CAAC,cAAc;aAC7B,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,15 +1,34 @@
|
|
|
1
|
-
import { Direction } from '../types/
|
|
2
|
-
import { IRoomConfig } from '../types/interfaces.js';
|
|
1
|
+
import { Direction } from '../types/shared/direction-enum.js';
|
|
3
2
|
import { Item } from './item.js';
|
|
4
3
|
import { Puzzle } from './puzzle.js';
|
|
5
4
|
import { Door } from './door.js';
|
|
6
5
|
import { Inventory } from './inventory.js';
|
|
7
6
|
import { Player } from './player.js';
|
|
8
|
-
import { AbstractRoom } from '../types/abstracts.js';
|
|
7
|
+
import { AbstractRoom } from '../types/shared/abstracts.js';
|
|
8
|
+
export interface IRoomConstructorConfig {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
details?: string;
|
|
12
|
+
roomType: string;
|
|
13
|
+
exits?: Map<Direction, Door | string>;
|
|
14
|
+
inventory?: Inventory;
|
|
15
|
+
puzzle?: Puzzle;
|
|
16
|
+
isStartRoom?: boolean;
|
|
17
|
+
tags?: string[];
|
|
18
|
+
supportedLifestyles?: {
|
|
19
|
+
residenceTypes?: ('Street' | 'Squatter' | 'Low' | 'Middle' | 'High' | 'Luxury')[];
|
|
20
|
+
employmentRoles?: string[];
|
|
21
|
+
habitTags?: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
9
24
|
export declare class Room extends AbstractRoom {
|
|
10
25
|
private logger;
|
|
26
|
+
private actors;
|
|
27
|
+
private _owner?;
|
|
28
|
+
private hasAIDescription?;
|
|
11
29
|
name: string;
|
|
12
30
|
description: string;
|
|
31
|
+
details?: string;
|
|
13
32
|
exits: Map<Direction, Door | string>;
|
|
14
33
|
roomType: string;
|
|
15
34
|
isStartRoom: boolean;
|
|
@@ -17,12 +36,17 @@ export declare class Room extends AbstractRoom {
|
|
|
17
36
|
supportedLifestyles?: {
|
|
18
37
|
residenceTypes?: string[];
|
|
19
38
|
employmentRoles?: string[];
|
|
20
|
-
habitTags?: string[];
|
|
21
39
|
};
|
|
22
40
|
governsCurrency: boolean;
|
|
23
41
|
tags?: string[];
|
|
24
42
|
private _currencyLedger;
|
|
25
|
-
constructor(config:
|
|
43
|
+
constructor(config: IRoomConstructorConfig);
|
|
44
|
+
get owner(): string | undefined;
|
|
45
|
+
set owner(owner: string | undefined);
|
|
46
|
+
ensureAIDescription(sceneContext: string): Promise<void>;
|
|
47
|
+
addActor(actor: Player): void;
|
|
48
|
+
removeActor(actor: Player): void;
|
|
49
|
+
getActors(): Player[];
|
|
26
50
|
say(actor: Player, message: string): void;
|
|
27
51
|
addExit(direction: Direction, targetRoom: Room, keyItemOrSolution?: string): void;
|
|
28
52
|
attemptUnlockExit(direction: Direction, itemOrSolution: string): string;
|
|
@@ -35,7 +59,6 @@ export declare class Room extends AbstractRoom {
|
|
|
35
59
|
findExistingDoor(targetRoom: Room): Door | undefined;
|
|
36
60
|
supportsResidence(type: string): boolean;
|
|
37
61
|
supportsEmployment(role: string): boolean;
|
|
38
|
-
supportsHabit(habit: string): boolean;
|
|
39
62
|
depositCurrencyCarrier(player: Player, item: Item): boolean;
|
|
40
63
|
getPlayerCurrency(player: Player): number;
|
|
41
64
|
withdrawCurrencyCarrier(player: Player, itemName: string): Item | null;
|