@maka/maka-cli 5.1.29 → 5.1.31
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 +9 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js +26 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/command-registry.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/command.d.ts +13 -7
- 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/give.d.ts +7 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/give.js +51 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/give.js.map +1 -0
- 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 +7 -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 +34 -24
- 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 +10 -0
- package/bundle/typescript/src/commands/game/sideQuest/factories/npc-factory.js +36 -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 +115 -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 +11 -5
- package/bundle/typescript/src/commands/game/sideQuest/game.js +102 -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 +26 -4
- package/bundle/typescript/src/commands/game/sideQuest/models/item.js +36 -4
- package/bundle/typescript/src/commands/game/sideQuest/models/item.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.d.ts +22 -14
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +141 -49
- 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 -57
- 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 +79 -7
- package/bundle/typescript/src/commands/game/sideQuest/models/room.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.d.ts +29 -18
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js +82 -69
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene1.json +93 -114
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene2.json +130 -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 +48 -79
- 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 +20 -13
- 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,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
|
-
this.logger.write(`${this.name} heard ${actor.name}
|
|
161
|
-
this.logger.
|
|
174
|
+
this.logger.write(`${this.name} heard ${actor.name}`);
|
|
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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'../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":["../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AAO,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qBAAqB,CAAC,WAAmB;QACvC,OAAO,IAAI,CAAC,cAAc,KAAK,WAAW,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,cAAsB,EAAE,eAA0B;QACtD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;YAC1E,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,sCAAsC;aAChD,CAAC;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;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Logger } from '../utilities/logger.js';
|
|
2
|
-
import { Direction } from '../types/
|
|
2
|
+
import { Direction } from '../types/shared/direction-enum.js';
|
|
3
3
|
import { Door } from './door.js';
|
|
4
4
|
import { Inventory } from './inventory.js';
|
|
5
|
-
import {
|
|
5
|
+
import { HTTPS } from '../../../../tools/https/https.class.js';
|
|
6
|
+
import { AbstractRoom } from '../types/shared/abstracts.js';
|
|
6
7
|
export class Room extends AbstractRoom {
|
|
7
8
|
logger = Logger.getInstance();
|
|
9
|
+
actors = [];
|
|
10
|
+
_owner;
|
|
11
|
+
hasAIDescription;
|
|
8
12
|
name;
|
|
9
13
|
description;
|
|
14
|
+
details;
|
|
10
15
|
exits = new Map();
|
|
11
16
|
roomType;
|
|
12
17
|
isStartRoom;
|
|
@@ -28,6 +33,76 @@ export class Room extends AbstractRoom {
|
|
|
28
33
|
this.logger.write(`Room created: ${this.name}`);
|
|
29
34
|
this.tags = config.tags;
|
|
30
35
|
}
|
|
36
|
+
get owner() {
|
|
37
|
+
return this._owner;
|
|
38
|
+
}
|
|
39
|
+
set owner(owner) {
|
|
40
|
+
this._owner = owner;
|
|
41
|
+
}
|
|
42
|
+
async ensureAIDescription(sceneContext) {
|
|
43
|
+
if (!this.hasAIDescription) {
|
|
44
|
+
const prompt = `
|
|
45
|
+
You are a game narrator. Based on the following context, generate a rich, immersive description of the current room that enhances but does not repeat the existing description.
|
|
46
|
+
|
|
47
|
+
Scene context: ${sceneContext}
|
|
48
|
+
|
|
49
|
+
Room name: ${this.name}
|
|
50
|
+
Room description: ${this.description}
|
|
51
|
+
|
|
52
|
+
Include any mood, atmosphere, or inferred meaning from the surroundings.
|
|
53
|
+
Keep it concise and dramatic.`;
|
|
54
|
+
try {
|
|
55
|
+
const result = await HTTPS.askGPT({
|
|
56
|
+
prompt,
|
|
57
|
+
openApiKey: process.env.OPENAI_API_KEY || '',
|
|
58
|
+
model: 'gpt-4.1'
|
|
59
|
+
});
|
|
60
|
+
if (JSON.parse(result.data).error) {
|
|
61
|
+
throw new Error(JSON.parse(result.data).error.message);
|
|
62
|
+
}
|
|
63
|
+
const reply = JSON.parse(result.data)?.choices?.[0]?.message?.content?.trim();
|
|
64
|
+
if (reply) {
|
|
65
|
+
this.details = reply;
|
|
66
|
+
this.hasAIDescription = true;
|
|
67
|
+
this.logger.write(`Generated AI description for ${this.name}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
this.logger.write(`GPT fallback for AI description: ${err}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
addActor(actor) {
|
|
76
|
+
this.actors.push(actor);
|
|
77
|
+
this.emit('enter', actor);
|
|
78
|
+
// Bind hearing
|
|
79
|
+
this.on('speak', actor.hear.bind(actor));
|
|
80
|
+
// Bind mutual vision
|
|
81
|
+
for (const other of this.actors) {
|
|
82
|
+
if (other !== actor) {
|
|
83
|
+
other.on('action', actor._onSeenAction); // actor sees other
|
|
84
|
+
this.logger.write(`${actor.name} will observe ${other.name}`);
|
|
85
|
+
actor.on('action', other._onSeenAction); // other sees actor
|
|
86
|
+
this.logger.write(`${other.name} will observe ${actor.name}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
removeActor(actor) {
|
|
91
|
+
this.actors = this.actors.filter(a => a !== actor);
|
|
92
|
+
this.emit('leave', actor);
|
|
93
|
+
// Unbind hearing
|
|
94
|
+
this.off('speak', actor.hear.bind(actor));
|
|
95
|
+
// Unbind mutual vision
|
|
96
|
+
for (const other of this.actors) {
|
|
97
|
+
if (other !== actor) {
|
|
98
|
+
other.off('action', actor._onSeenAction);
|
|
99
|
+
actor.off('action', other._onSeenAction);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
getActors() {
|
|
104
|
+
return [...this.actors];
|
|
105
|
+
}
|
|
31
106
|
say(actor, message) {
|
|
32
107
|
this.emit('speak', actor, message);
|
|
33
108
|
}
|
|
@@ -49,7 +124,7 @@ export class Room extends AbstractRoom {
|
|
|
49
124
|
if (exit instanceof Door) {
|
|
50
125
|
const result = exit.attemptUnlock(itemOrSolution);
|
|
51
126
|
this.logger.write(`Attempted to unlock exit in direction ${direction}. Success: ${result}`);
|
|
52
|
-
return result ? `The ${exit.name} unlocked!` : `The ${exit.name} remains locked.`;
|
|
127
|
+
return result ? `The ${exit.roomB.name} unlocked!` : `The ${exit.roomB.name} remains locked.`;
|
|
53
128
|
}
|
|
54
129
|
this.logger.write(`No locked exit found in direction ${direction}`);
|
|
55
130
|
return `There's no locked exit in that direction.`;
|
|
@@ -108,9 +183,6 @@ export class Room extends AbstractRoom {
|
|
|
108
183
|
supportsEmployment(role) {
|
|
109
184
|
return this.supportedLifestyles?.employmentRoles?.includes(role) ?? false;
|
|
110
185
|
}
|
|
111
|
-
supportsHabit(habit) {
|
|
112
|
-
return this.supportedLifestyles?.habitTags?.includes(habit) ?? false;
|
|
113
|
-
}
|
|
114
186
|
depositCurrencyCarrier(player, item) {
|
|
115
187
|
if (!this.governsCurrency || !item.isCurrencyCarrier())
|
|
116
188
|
return false;
|
|
@@ -150,7 +222,7 @@ export class Room extends AbstractRoom {
|
|
|
150
222
|
const residenceLifestyle = typeof rawResidence === 'object' && rawResidence !== null && 'lifestyle' in rawResidence
|
|
151
223
|
? rawResidence
|
|
152
224
|
: undefined;
|
|
153
|
-
const actorResidence = residenceLifestyle?.
|
|
225
|
+
const actorResidence = residenceLifestyle?.location;
|
|
154
226
|
if (actorResidence && this.supportsResidence(actorResidence)) {
|
|
155
227
|
this.inventory.addSecureItem?.(actor.name, item); // assumes secure storage per actor
|
|
156
228
|
this.logger.write(`Item securely stored for ${actor.name} in their residence: ${this.name}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/room.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"room.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/models/room.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAI9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAoB5D,MAAM,OAAO,IAAK,SAAQ,YAAY;IAC5B,MAAM,GAAW,MAAM,CAAC,WAAW,EAAE,CAAC;IACtC,MAAM,GAAa,EAAE,CAAC;IACtB,MAAM,CAAU;IAChB,gBAAgB,CAAW;IAC5B,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,OAAO,CAAU;IACjB,KAAK,GAAkC,IAAI,GAAG,EAAE,CAAC;IACjD,QAAQ,CAAS;IACjB,WAAW,CAAU;IACrB,SAAS,GAAc,IAAI,SAAS,EAAE,CAAC;IACvC,mBA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I,EAAE,CAAC,CAAC;QACrF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB,CAAC,KAAa;QAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAClD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,WAAW,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
import { Room } from './
|
|
2
|
-
import { Player } from './player.js';
|
|
3
|
-
import { Item } from './item.js';
|
|
4
|
-
import { Puzzle } from './puzzle.js';
|
|
5
|
-
import { NPC } from './npc.js';
|
|
1
|
+
import { Room, Player, Item, Puzzle, NPC } from './_index.js';
|
|
6
2
|
import { Logger } from '../utilities/logger.js';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { AbstractScene } from '../types/abstracts.js';
|
|
3
|
+
import { Direction } from '../types/shared/direction-enum.js';
|
|
4
|
+
import Game from '../game.js';
|
|
5
|
+
import { AbstractScene } from '../types/shared/abstracts.js';
|
|
6
|
+
export interface ISceneConstructorConfig {
|
|
7
|
+
player: Player;
|
|
8
|
+
currency?: {
|
|
9
|
+
type: string;
|
|
10
|
+
authorityRoomTags: string[];
|
|
11
|
+
};
|
|
12
|
+
residenceTiers: string[];
|
|
13
|
+
puzzles?: Puzzle[];
|
|
14
|
+
items?: Item[];
|
|
15
|
+
}
|
|
10
16
|
export declare class Scene extends AbstractScene {
|
|
11
|
-
|
|
17
|
+
name: string;
|
|
12
18
|
protected player: Player;
|
|
13
19
|
protected logger: Logger;
|
|
14
20
|
protected actors: Map<string, (Player | NPC)>;
|
|
21
|
+
protected game: Game;
|
|
15
22
|
protected characterLocations: Map<string, Room>;
|
|
16
|
-
private roomFactory;
|
|
17
23
|
private _residenceTiers;
|
|
24
|
+
protected rooms: Record<string, Room>;
|
|
25
|
+
private roomOwnership;
|
|
26
|
+
private itemOwnership;
|
|
18
27
|
currency: {
|
|
19
28
|
type: string;
|
|
20
|
-
carrierItemSizes: Size[];
|
|
21
29
|
authorityRoomTags: string[];
|
|
22
30
|
};
|
|
23
31
|
constructor(config: ISceneConstructorConfig);
|
|
24
|
-
initialize(): void;
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
initialize(game: Game): void;
|
|
33
|
+
updateExits(room: Room): void;
|
|
34
|
+
setOwner(entity: Room | Item, owner: string): void;
|
|
35
|
+
getOwner(entity: Room | Item): string | undefined;
|
|
36
|
+
getOwnedItemsBy(owner: string): Item[];
|
|
37
|
+
getOwnedRoomsBy(owner: string): Room[];
|
|
27
38
|
addActor(actor: Player | NPC): void;
|
|
28
39
|
removeActor(name: string): void;
|
|
29
40
|
getActor(name: string): Player | NPC | undefined;
|
|
30
41
|
get allActors(): (Player | NPC)[];
|
|
31
42
|
getActorsInRoom(room: Room): (Player | NPC)[];
|
|
43
|
+
private normalize;
|
|
32
44
|
addRoom(room: Room): void;
|
|
33
45
|
removeRoom(roomName: string): boolean;
|
|
34
46
|
addItemToRoom(item: Item, roomName: string): void;
|
|
@@ -37,14 +49,13 @@ export declare class Scene extends AbstractScene {
|
|
|
37
49
|
getCharacterLocation(character: Player | NPC): Room | undefined;
|
|
38
50
|
determineStartRoom(): Room;
|
|
39
51
|
getPlayer(): Player;
|
|
40
|
-
getRooms():
|
|
52
|
+
getRooms(): Record<string, Room>;
|
|
53
|
+
listRooms(): string[];
|
|
54
|
+
getRoom(roomName: string): Room;
|
|
41
55
|
connectRooms(roomNameA: string, direction: Direction, roomNameB: string, keyItemOrSolution?: string): void;
|
|
42
56
|
private hasRoomSupportingResidence;
|
|
43
57
|
private hasRoomSupportingEmployment;
|
|
44
|
-
private hasRoomSupportingHabit;
|
|
45
58
|
private hasItemSupportingAddiction;
|
|
46
|
-
private hasItemSupportingHabit;
|
|
47
|
-
private hasPuzzleSupportingHobby;
|
|
48
59
|
validateLifestyleSupport(): void;
|
|
49
60
|
private validatePuzzleRequirements;
|
|
50
61
|
getCurrencyType(): string;
|