@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-seed.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/seed/scene-seed.ts"],"names":[],"mappings":""}
|
package/bundle/typescript/src/commands/game/sideQuest/types/{abstracts.d.ts → shared/abstracts.d.ts}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { Room, Player, NPC, Item, Puzzle, Door, Inventory } from '
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { PlayerEquipment } from '
|
|
6
|
-
import { Logger } from '
|
|
2
|
+
import { Room, Player, NPC, Item, Puzzle, Door, Inventory } from '../../models/_index';
|
|
3
|
+
import { Size, Category, Rating } from '../shared/item-enum.js';
|
|
4
|
+
import { Direction } from '../shared/direction-enum';
|
|
5
|
+
import { PlayerEquipment } from '../player-equipment.js';
|
|
6
|
+
import { Logger } from '../../utilities/logger.js';
|
|
7
7
|
/**
|
|
8
8
|
* The Scene class serves as the container for various gameplay elements. It holds rooms, manages player
|
|
9
9
|
* and NPC locations, and enables interactions between these entities.
|
|
10
10
|
*/
|
|
11
11
|
export declare abstract class AbstractScene {
|
|
12
|
-
protected rooms:
|
|
12
|
+
protected rooms: Record<string, Room>;
|
|
13
13
|
protected player: Player;
|
|
14
14
|
protected logger: Logger;
|
|
15
15
|
protected characterLocations: Map<string, Room>;
|
|
@@ -17,7 +17,7 @@ export declare abstract class AbstractScene {
|
|
|
17
17
|
abstract removeActor(name: string): void;
|
|
18
18
|
abstract addActor(actor: Player | NPC): void;
|
|
19
19
|
abstract getPlayer(): Player;
|
|
20
|
-
abstract getRooms():
|
|
20
|
+
abstract getRooms(): Record<string, Room>;
|
|
21
21
|
abstract addRoom(room: Room): void;
|
|
22
22
|
abstract removeRoom(roomName: string): boolean;
|
|
23
23
|
abstract addItemToRoom(item: Item, roomName: string): void;
|
|
@@ -55,6 +55,7 @@ export declare abstract class AbstractRoom extends EventEmitter {
|
|
|
55
55
|
* to navigate between different areas of the game world.
|
|
56
56
|
*/
|
|
57
57
|
export declare abstract class AbstractDoor {
|
|
58
|
+
name: string;
|
|
58
59
|
roomA: Room;
|
|
59
60
|
roomB: Room;
|
|
60
61
|
isLocked: boolean;
|
|
@@ -86,7 +87,6 @@ export declare abstract class AbstractInventory {
|
|
|
86
87
|
* Each item has distinct attributes and can potentially have special functions when used.
|
|
87
88
|
*/
|
|
88
89
|
export declare abstract class AbstractItem {
|
|
89
|
-
uuid: string;
|
|
90
90
|
name: string;
|
|
91
91
|
description: string;
|
|
92
92
|
size: Size;
|
|
@@ -102,14 +102,17 @@ export declare abstract class AbstractItem {
|
|
|
102
102
|
* The Player class represents the user's character within the game world.
|
|
103
103
|
* The player has a name, location, inventory for holding items, and equipment for wearing and wielding items.
|
|
104
104
|
* Each player can interact with the game environment, carry items, and equip or unequip them.
|
|
105
|
+
*
|
|
106
|
+
* The Player is the base class the NPC is derived from
|
|
105
107
|
*/
|
|
106
|
-
export declare abstract class AbstractPlayer
|
|
108
|
+
export declare abstract class AbstractPlayer extends EventEmitter {
|
|
107
109
|
readonly _playerName: string;
|
|
108
110
|
protected _currentLocation: Room;
|
|
109
111
|
protected _inventory: Inventory;
|
|
110
112
|
protected _equipment: PlayerEquipment;
|
|
111
113
|
protected _maxCarryingWeight: number;
|
|
112
114
|
protected _logger: Logger;
|
|
115
|
+
constructor();
|
|
113
116
|
abstract get name(): string;
|
|
114
117
|
abstract get currentLocation(): Room;
|
|
115
118
|
abstract set currentLocation(room: Room);
|
package/bundle/typescript/src/commands/game/sideQuest/types/{abstracts.js → shared/abstracts.js}
RENAMED
|
@@ -29,6 +29,7 @@ export class AbstractRoom extends EventEmitter {
|
|
|
29
29
|
* to navigate between different areas of the game world.
|
|
30
30
|
*/
|
|
31
31
|
export class AbstractDoor {
|
|
32
|
+
name;
|
|
32
33
|
roomA; // One side of the door
|
|
33
34
|
roomB; // The other side of the door
|
|
34
35
|
isLocked;
|
|
@@ -49,7 +50,6 @@ export class AbstractInventory {
|
|
|
49
50
|
* Each item has distinct attributes and can potentially have special functions when used.
|
|
50
51
|
*/
|
|
51
52
|
export class AbstractItem {
|
|
52
|
-
uuid;
|
|
53
53
|
name;
|
|
54
54
|
description;
|
|
55
55
|
size;
|
|
@@ -64,14 +64,19 @@ export class AbstractItem {
|
|
|
64
64
|
* The Player class represents the user's character within the game world.
|
|
65
65
|
* The player has a name, location, inventory for holding items, and equipment for wearing and wielding items.
|
|
66
66
|
* Each player can interact with the game environment, carry items, and equip or unequip them.
|
|
67
|
+
*
|
|
68
|
+
* The Player is the base class the NPC is derived from
|
|
67
69
|
*/
|
|
68
|
-
export class AbstractPlayer {
|
|
70
|
+
export class AbstractPlayer extends EventEmitter {
|
|
69
71
|
_playerName;
|
|
70
72
|
_currentLocation;
|
|
71
73
|
_inventory;
|
|
72
74
|
_equipment;
|
|
73
75
|
_maxCarryingWeight;
|
|
74
76
|
_logger;
|
|
77
|
+
constructor() {
|
|
78
|
+
super(); // Initialize EventEmitter
|
|
79
|
+
}
|
|
75
80
|
}
|
|
76
81
|
/**
|
|
77
82
|
* The Puzzle class represents a challenge or riddle in the game that the player must solve.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstracts.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/shared/abstracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAsBtC;;;GAGG;AACH,MAAM,OAAgB,aAAa;IACvB,KAAK,CAAuB;IAC5B,MAAM,CAAS;IACf,MAAM,CAAS;IACf,kBAAkB,CAAoB;CAcjD;AAED;;;;GAIG;AACH,MAAM,OAAgB,YAAa,SAAQ,YAAY;IAC9C,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,KAAK,CAAgC;IACrC,SAAS,CAAY;IACrB,MAAM,CAAU;IAChB,QAAQ,CAAS;IACjB,WAAW,CAAU;CAW7B;AAED;;;;GAIG;AACH,MAAM,OAAgB,YAAY;IAChC,IAAI,CAAS;IACb,KAAK,CAAO,CAAE,uBAAuB;IACrC,KAAK,CAAO,CAAE,6BAA6B;IAC3C,QAAQ,CAAU;IAClB,oBAAoB,CAAU;IAC9B,MAAM,CAAS;IACf,UAAU,CAAU;CAMrB;AAED;;;GAGG;AACH,MAAM,OAAgB,iBAAiB;IAC3B,KAAK,CAAoB;IACzB,MAAM,CAAS;CAS1B;AAED;;;GAGG;AACH,MAAM,OAAgB,YAAY;IACzB,IAAI,CAAS;IACb,WAAW,CAAS;IACpB,IAAI,CAAO;IACX,QAAQ,CAAW;IACnB,KAAK,CAAS;IACd,KAAK,CAAS;IACd,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,MAAM,CAAS;CAGvB;AAED;;;;;;GAMG;AACH,MAAM,OAAgB,cAAe,SAAQ,YAAY;IAC9C,WAAW,CAAS;IACnB,gBAAgB,CAAO;IACvB,UAAU,CAAY;IACtB,UAAU,CAAkB;IAC5B,kBAAkB,CAAS;IAC3B,OAAO,CAAS;IAE1B;QACE,KAAK,EAAE,CAAC,CAAC,0BAA0B;IACrC,CAAC;CAsBF;AAED;;;;GAIG;AACH,MAAM,OAAgB,cAAc;IACxB,MAAM,CAAS;IACf,MAAM,CAAU;CAc3B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var Direction;
|
|
2
|
+
(function (Direction) {
|
|
3
|
+
Direction["NORTH"] = "north";
|
|
4
|
+
Direction["EAST"] = "east";
|
|
5
|
+
Direction["SOUTH"] = "south";
|
|
6
|
+
Direction["WEST"] = "west";
|
|
7
|
+
Direction["UP"] = "up";
|
|
8
|
+
Direction["DOWN"] = "down";
|
|
9
|
+
})(Direction || (Direction = {}));
|
|
10
|
+
//# sourceMappingURL=direction-enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direction-enum.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/shared/direction-enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,0BAAa,CAAA;IACb,sBAAS,CAAA;IACT,0BAAa,CAAA;AACf,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum EquipmentSlot {
|
|
2
|
+
Eyes = "eyes",
|
|
3
|
+
Skull = "skull",
|
|
4
|
+
Ears = "ears",
|
|
5
|
+
Mouth = "mouth",
|
|
6
|
+
Nose = "nose",
|
|
7
|
+
Backpack = "backpack",
|
|
8
|
+
LeftShoulder = "leftShoulder",
|
|
9
|
+
RightShoulder = "rightShoulder",
|
|
10
|
+
Bandolier = "bandolier",
|
|
11
|
+
LeftHip = "leftHip",
|
|
12
|
+
RightHip = "rightHip",
|
|
13
|
+
LeftThigh = "leftThigh",
|
|
14
|
+
RightThigh = "rightThigh",
|
|
15
|
+
LeftAnkle = "leftAnkle",
|
|
16
|
+
RightAnkle = "rightAnkle",
|
|
17
|
+
LeftBicept = "leftBicept",
|
|
18
|
+
RightBicept = "rightBicept",
|
|
19
|
+
LeftForearm = "leftForearm",
|
|
20
|
+
RightForearm = "rightForearm",
|
|
21
|
+
LeftWrist = "leftWrist",
|
|
22
|
+
RightWrist = "rightWrist",
|
|
23
|
+
LeftRing = "leftRing",
|
|
24
|
+
RightRing = "rightRing"
|
|
25
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export var EquipmentSlot;
|
|
2
|
+
(function (EquipmentSlot) {
|
|
3
|
+
EquipmentSlot["Eyes"] = "eyes";
|
|
4
|
+
EquipmentSlot["Skull"] = "skull";
|
|
5
|
+
EquipmentSlot["Ears"] = "ears";
|
|
6
|
+
EquipmentSlot["Mouth"] = "mouth";
|
|
7
|
+
EquipmentSlot["Nose"] = "nose";
|
|
8
|
+
EquipmentSlot["Backpack"] = "backpack";
|
|
9
|
+
EquipmentSlot["LeftShoulder"] = "leftShoulder";
|
|
10
|
+
EquipmentSlot["RightShoulder"] = "rightShoulder";
|
|
11
|
+
EquipmentSlot["Bandolier"] = "bandolier";
|
|
12
|
+
EquipmentSlot["LeftHip"] = "leftHip";
|
|
13
|
+
EquipmentSlot["RightHip"] = "rightHip";
|
|
14
|
+
EquipmentSlot["LeftThigh"] = "leftThigh";
|
|
15
|
+
EquipmentSlot["RightThigh"] = "rightThigh";
|
|
16
|
+
EquipmentSlot["LeftAnkle"] = "leftAnkle";
|
|
17
|
+
EquipmentSlot["RightAnkle"] = "rightAnkle";
|
|
18
|
+
EquipmentSlot["LeftBicept"] = "leftBicept";
|
|
19
|
+
EquipmentSlot["RightBicept"] = "rightBicept";
|
|
20
|
+
EquipmentSlot["LeftForearm"] = "leftForearm";
|
|
21
|
+
EquipmentSlot["RightForearm"] = "rightForearm";
|
|
22
|
+
EquipmentSlot["LeftWrist"] = "leftWrist";
|
|
23
|
+
EquipmentSlot["RightWrist"] = "rightWrist";
|
|
24
|
+
EquipmentSlot["LeftRing"] = "leftRing";
|
|
25
|
+
EquipmentSlot["RightRing"] = "rightRing";
|
|
26
|
+
})(EquipmentSlot || (EquipmentSlot = {}));
|
|
27
|
+
//# sourceMappingURL=equipment-enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equipment-enum.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/shared/equipment-enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAwBX;AAxBD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,gCAAe,CAAA;IACf,8BAAa,CAAA;IACb,gCAAe,CAAA;IACf,8BAAa,CAAA;IACb,sCAAqB,CAAA;IACrB,8CAA6B,CAAA;IAC7B,gDAA+B,CAAA;IAC/B,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;IACnB,sCAAqB,CAAA;IACrB,wCAAuB,CAAA;IACvB,0CAAyB,CAAA;IACzB,wCAAuB,CAAA;IACvB,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;IACzB,4CAA2B,CAAA;IAC3B,4CAA2B,CAAA;IAC3B,8CAA6B,CAAA;IAC7B,wCAAuB,CAAA;IACvB,0CAAyB,CAAA;IACzB,sCAAqB,CAAA;IACrB,wCAAuB,CAAA;AACzB,CAAC,EAxBW,aAAa,KAAb,aAAa,QAwBxB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare enum Size {
|
|
2
|
+
Tiny = "tiny",
|
|
3
|
+
Small = "small",
|
|
4
|
+
Medium = "medium",
|
|
5
|
+
Large = "large",
|
|
6
|
+
VeryLarge = "very large"
|
|
7
|
+
}
|
|
8
|
+
export declare enum Rating {
|
|
9
|
+
Common = "common",
|
|
10
|
+
Standard = "standard",
|
|
11
|
+
Rare = "rare",
|
|
12
|
+
Legendary = "legendary",
|
|
13
|
+
MilitaryGrade = "military-grade"
|
|
14
|
+
}
|
|
15
|
+
export declare enum Category {
|
|
16
|
+
Weapon = "weapon",
|
|
17
|
+
Shield = "shield",
|
|
18
|
+
Key = "key",
|
|
19
|
+
Gloves = "gloves",
|
|
20
|
+
Helmet = "helmet",
|
|
21
|
+
Hat = "hat",
|
|
22
|
+
Boots = "boots",
|
|
23
|
+
LegArmor = "leg armor",
|
|
24
|
+
ArmArmor = "arm armor",
|
|
25
|
+
BodyArmor = "body armor",
|
|
26
|
+
Book = "book",
|
|
27
|
+
Cup = "cup",
|
|
28
|
+
Unknown = "unknown",
|
|
29
|
+
CurrencyContainer = "currency container",
|
|
30
|
+
Medical = "medical",
|
|
31
|
+
Consumable = "consumable",
|
|
32
|
+
Tool = "tool",
|
|
33
|
+
Vice = "vice"
|
|
34
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export var Size;
|
|
2
|
+
(function (Size) {
|
|
3
|
+
Size["Tiny"] = "tiny";
|
|
4
|
+
Size["Small"] = "small";
|
|
5
|
+
Size["Medium"] = "medium";
|
|
6
|
+
Size["Large"] = "large";
|
|
7
|
+
Size["VeryLarge"] = "very large";
|
|
8
|
+
})(Size || (Size = {}));
|
|
9
|
+
export var Rating;
|
|
10
|
+
(function (Rating) {
|
|
11
|
+
Rating["Common"] = "common";
|
|
12
|
+
Rating["Standard"] = "standard";
|
|
13
|
+
Rating["Rare"] = "rare";
|
|
14
|
+
Rating["Legendary"] = "legendary";
|
|
15
|
+
Rating["MilitaryGrade"] = "military-grade";
|
|
16
|
+
})(Rating || (Rating = {}));
|
|
17
|
+
export var Category;
|
|
18
|
+
(function (Category) {
|
|
19
|
+
Category["Weapon"] = "weapon";
|
|
20
|
+
Category["Shield"] = "shield";
|
|
21
|
+
Category["Key"] = "key";
|
|
22
|
+
Category["Gloves"] = "gloves";
|
|
23
|
+
Category["Helmet"] = "helmet";
|
|
24
|
+
Category["Hat"] = "hat";
|
|
25
|
+
Category["Boots"] = "boots";
|
|
26
|
+
Category["LegArmor"] = "leg armor";
|
|
27
|
+
Category["ArmArmor"] = "arm armor";
|
|
28
|
+
Category["BodyArmor"] = "body armor";
|
|
29
|
+
Category["Book"] = "book";
|
|
30
|
+
Category["Cup"] = "cup";
|
|
31
|
+
Category["Unknown"] = "unknown";
|
|
32
|
+
Category["CurrencyContainer"] = "currency container";
|
|
33
|
+
Category["Medical"] = "medical";
|
|
34
|
+
Category["Consumable"] = "consumable";
|
|
35
|
+
Category["Tool"] = "tool";
|
|
36
|
+
Category["Vice"] = "vice";
|
|
37
|
+
})(Category || (Category = {}));
|
|
38
|
+
//# sourceMappingURL=item-enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-enum.js","sourceRoot":"","sources":["../../../../../../../../src/commands/game/sideQuest/types/shared/item-enum.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,IAMX;AAND,WAAY,IAAI;IACd,qBAAa,CAAA;IACX,uBAAe,CAAA;IACf,yBAAiB,CAAA;IACjB,uBAAe,CAAA;IACf,gCAAwB,CAAA;AAC5B,CAAC,EANW,IAAI,KAAJ,IAAI,QAMf;AAED,MAAM,CAAN,IAAY,MAMX;AAND,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACf,+BAAqB,CAAA;IACrB,uBAAa,CAAA;IACb,iCAAuB,CAAA;IACvB,0CAAgC,CAAA;AACpC,CAAC,EANW,MAAM,KAAN,MAAM,QAMjB;AAED,MAAM,CAAN,IAAY,QAmBX;AAnBD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACf,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,kCAAsB,CAAA;IACtB,kCAAsB,CAAA;IACtB,oCAAwB,CAAA;IACxB,yBAAa,CAAA;IACb,uBAAW,CAAA;IACX,+BAAmB,CAAA;IACnB,oDAAwC,CAAA;IACxC,+BAAmB,CAAA;IACnB,qCAAyB,CAAA;IACzB,yBAAa,CAAA;IACb,yBAAa,CAAA;AACjB,CAAC,EAnBW,QAAQ,KAAR,QAAQ,QAmBnB"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ISceneSeedJson } from './types/seed/scene-seed.js';
|
|
2
|
+
export interface IMainGameConfig {
|
|
3
|
+
debug?: boolean;
|
|
4
|
+
logFilePath: string;
|
|
5
|
+
useAi: boolean;
|
|
6
|
+
}
|
|
3
7
|
export declare function main(playerName: string, sceneSeed: ISceneSeedJson, options: IMainGameConfig): Promise<void>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import blessed from 'blessed';
|
|
2
2
|
import { capitalCase } from 'change-case';
|
|
3
3
|
import Game from './game.js';
|
|
4
|
-
import { Player } from './models/
|
|
5
|
-
import { Door } from './models/door.js';
|
|
4
|
+
import { Player, Room } from './models/_index.js';
|
|
6
5
|
import { Logger } from './utilities/logger.js';
|
|
7
6
|
export async function main(playerName, sceneSeed, options) {
|
|
7
|
+
// Create a screen object
|
|
8
|
+
const screen = blessed.screen({
|
|
9
|
+
smartCSR: true,
|
|
10
|
+
title: 'Side Quest Adventure Game',
|
|
11
|
+
});
|
|
12
|
+
// Initialize Logger
|
|
13
|
+
const gameLog = Logger.getInstance(options.logFilePath, screen);
|
|
8
14
|
try {
|
|
9
|
-
// Create a screen object
|
|
10
|
-
const screen = blessed.screen({
|
|
11
|
-
smartCSR: true,
|
|
12
|
-
title: 'Side Quest Adventure Game',
|
|
13
|
-
});
|
|
14
15
|
const inventoryBox = blessed.box({
|
|
15
16
|
top: '0%',
|
|
16
17
|
left: '75%',
|
|
@@ -81,69 +82,32 @@ export async function main(playerName, sceneSeed, options) {
|
|
|
81
82
|
// Append the equipment box to the screen
|
|
82
83
|
screen.append(equipmentBox);
|
|
83
84
|
const updateEquipment = (playerEquipment) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
`Arms: ${playerEquipment.arms ? playerEquipment.arms.name : 'None'}\n` +
|
|
90
|
-
`Gloves: ${playerEquipment.gloves ? playerEquipment.gloves.name : 'None'}\n` +
|
|
91
|
-
`Left Hand: ${playerEquipment.leftHand ? playerEquipment.leftHand.name : 'None'}\n` +
|
|
92
|
-
`Right Hand: ${playerEquipment.rightHand ? playerEquipment.rightHand.name : 'None'}\n`);
|
|
93
|
-
// Render the screen to reflect the changes
|
|
94
|
-
screen.render();
|
|
95
|
-
};
|
|
96
|
-
// Map
|
|
97
|
-
const exitsBox = blessed.box({
|
|
98
|
-
top: '70%',
|
|
99
|
-
left: '75%',
|
|
100
|
-
width: '25%',
|
|
101
|
-
height: '20%',
|
|
102
|
-
border: {
|
|
103
|
-
type: 'line'
|
|
104
|
-
},
|
|
105
|
-
label: ' Map ',
|
|
106
|
-
content: 'Available exits will be shown here...',
|
|
107
|
-
tags: true,
|
|
108
|
-
scrollable: true,
|
|
109
|
-
scrollbar: {
|
|
110
|
-
ch: ' ',
|
|
111
|
-
track: {
|
|
112
|
-
bg: 'yellow'
|
|
113
|
-
},
|
|
114
|
-
style: {
|
|
115
|
-
inverse: true
|
|
85
|
+
const sections = [];
|
|
86
|
+
const renderSlotGroup = (label, group) => {
|
|
87
|
+
if (!group) {
|
|
88
|
+
sections.push(`{bold}${label}:{/bold} None`);
|
|
89
|
+
return;
|
|
116
90
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
description += `${capitalCase(key)}\n`; // Example: "NORTH"
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
description += '\nThere are no exits here.';
|
|
145
|
-
}
|
|
146
|
-
exitsBox.setContent(description);
|
|
91
|
+
const equipped = Object.entries(group)
|
|
92
|
+
.filter(([_, item]) => item !== null)
|
|
93
|
+
.map(([slot, item]) => ` ${slot}: ${item.name}`);
|
|
94
|
+
if (equipped.length > 0) {
|
|
95
|
+
sections.push(`{bold}${label}:{/bold}`);
|
|
96
|
+
sections.push(...equipped);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
sections.push(`{bold}${label}:{/bold} None`);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
renderSlotGroup("Head", playerEquipment.head);
|
|
103
|
+
renderSlotGroup("Torso", playerEquipment.torso);
|
|
104
|
+
renderSlotGroup("Legs", playerEquipment.legs);
|
|
105
|
+
renderSlotGroup("Feet", playerEquipment.feet);
|
|
106
|
+
renderSlotGroup("Arms", playerEquipment.arms);
|
|
107
|
+
renderSlotGroup("Gloves", playerEquipment.gloves);
|
|
108
|
+
renderSlotGroup("Left Hand", playerEquipment.leftHand);
|
|
109
|
+
renderSlotGroup("Right Hand", playerEquipment.rightHand);
|
|
110
|
+
equipmentBox.setContent(sections.join('\n'));
|
|
147
111
|
screen.render();
|
|
148
112
|
};
|
|
149
113
|
// Create a log box to display game output
|
|
@@ -195,17 +159,21 @@ export async function main(playerName, sceneSeed, options) {
|
|
|
195
159
|
inputBox.focus();
|
|
196
160
|
// Render the screen
|
|
197
161
|
screen.render();
|
|
198
|
-
// Initialize Logger
|
|
199
|
-
const gameLog = Logger.getInstance(options.logFilePath, screen);
|
|
200
|
-
const player = new Player({ playerName });
|
|
201
|
-
// Create the game instance
|
|
202
162
|
gameLog.write(`----->>>>>> Initializing Game`);
|
|
203
|
-
const
|
|
163
|
+
const nexus = new Room({
|
|
164
|
+
name: 'Nexus',
|
|
165
|
+
description: 'A featureless room where lost souls drift.',
|
|
166
|
+
roomType: 'void'
|
|
167
|
+
});
|
|
168
|
+
const player = new Player({ playerName, startLocation: nexus });
|
|
169
|
+
// Create the game instance
|
|
170
|
+
const game = await Game.getInstance(player, sceneSeed);
|
|
171
|
+
const ready = await game.init(options, screen);
|
|
204
172
|
// Print welcome message or initial room description
|
|
205
|
-
logBox.setContent(
|
|
173
|
+
logBox.setContent(ready); // getWelcomeMessage should return the initial game introduction or room description
|
|
206
174
|
updateEquipment(game.player.equipment);
|
|
207
175
|
updateInventory(game.player.inventory, capitalCase(game.scene.getCurrencyType()));
|
|
208
|
-
updateExits(game.player.currentLocation);
|
|
176
|
+
game.updateExits(game.player.currentLocation);
|
|
209
177
|
inputBox.key(['enter'], async () => {
|
|
210
178
|
const input = inputBox.getValue();
|
|
211
179
|
const response = game.handleInput(input); // handleInput is the method that processes commands
|
|
@@ -217,13 +185,13 @@ export async function main(playerName, sceneSeed, options) {
|
|
|
217
185
|
}
|
|
218
186
|
// eslint-disable-next-line no-constant-condition
|
|
219
187
|
if (input.split(' ')[0] === 'go' || 'lock' || 'unlock') {
|
|
220
|
-
updateExits(game.player.currentLocation);
|
|
188
|
+
game.updateExits(game.player.currentLocation);
|
|
221
189
|
}
|
|
222
190
|
if (input.split(' ')[0] === 'clear') {
|
|
223
191
|
logBox.setContent('');
|
|
224
192
|
}
|
|
193
|
+
gameLog.write(`Input response: ${response}`);
|
|
225
194
|
if (response === null) {
|
|
226
|
-
console.log('Thanks for playing!');
|
|
227
195
|
screen.render();
|
|
228
196
|
gameLog.write(`<<<<<<<<--------- Terminating game`);
|
|
229
197
|
process.exit(0); // Exit the game
|
|
@@ -236,7 +204,8 @@ export async function main(playerName, sceneSeed, options) {
|
|
|
236
204
|
});
|
|
237
205
|
}
|
|
238
206
|
catch (error) {
|
|
239
|
-
|
|
207
|
+
gameLog.error(error);
|
|
208
|
+
gameLog.error(`<<<<<<<<--------- Terminating game`);
|
|
240
209
|
process.exit(1);
|
|
241
210
|
}
|
|
242
211
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../../../../src/commands/game/sideQuest/ui.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../../../../src/commands/game/sideQuest/ui.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EACL,MAAM,EAIN,IAAI,EACL,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAU/C,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,UAAkB,EAClB,SAAyB,EACzB,OAAwB;IAExB,yBAAyB;IACzB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC5B,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,2BAA2B;KACnC,CAAC,CAAC;IAEH,oBAAoB;IACpB,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAEhE,IAAI,CAAC;QAEH,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC;YAC/B,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,KAAK;YACb,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;aACb;YACD,KAAK,EAAE,aAAa;YACpB,OAAO,EAAE,mCAAmC;YAC5C,IAAI,EAAE,IAAI,EAAE,oCAAoC;YAChD,UAAU,EAAE,IAAI,EAAE,4CAA4C;YAC9D,SAAS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| 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | 'lightred' | 'lightgreen' | 'lightblue' | 'lightmagenta' | 'lightcyan' | 'lightgray';
|
|
3
|
+
export declare class Logger {
|
|
4
4
|
private static instance;
|
|
5
5
|
private filePath;
|
|
6
6
|
private screen?;
|
|
@@ -10,5 +10,7 @@ export declare class Logger implements ILogger {
|
|
|
10
10
|
write(message: string): void;
|
|
11
11
|
error(message: string): void;
|
|
12
12
|
log(message: string): void;
|
|
13
|
+
logWithColor(message: string, color?: BlessedColor): void;
|
|
13
14
|
hasScreen(): boolean;
|
|
14
15
|
}
|
|
16
|
+
export {};
|
|
@@ -43,18 +43,22 @@ export class Logger {
|
|
|
43
43
|
fs.appendFileSync(this.filePath, errorMessage);
|
|
44
44
|
}
|
|
45
45
|
log(message) {
|
|
46
|
-
// Retrieve logBox from the screen
|
|
47
46
|
const logBox = this.screen?.children.find(child => child.type === 'box' && child.options.id === 'logBox');
|
|
48
47
|
if (logBox) {
|
|
49
|
-
logBox.
|
|
48
|
+
logBox.insertBottom(message); // Supports color tags
|
|
50
49
|
logBox.scrollTo(logBox.getScrollHeight());
|
|
51
50
|
this.screen?.render();
|
|
52
51
|
}
|
|
53
52
|
else {
|
|
54
53
|
this.error(`The logbox ${logBox} could not be found on screen ${this.screen}`);
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
// Strip Blessed color tags before writing to file
|
|
56
|
+
const strippedMessage = message.replace(/\{[^}]+\}/g, '');
|
|
57
|
+
this.write(strippedMessage);
|
|
58
|
+
}
|
|
59
|
+
logWithColor(message, color = 'white') {
|
|
60
|
+
const coloredMessage = `{${color}-fg}${message}{/${color}-fg}`;
|
|
61
|
+
this.log(coloredMessage);
|
|
58
62
|
}
|
|
59
63
|
hasScreen() {
|
|
60
64
|
return !!this.screen;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/utilities/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../../../../src/commands/game/sideQuest/utilities/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAoB7B,MAAM,OAAO,MAAM;IACT,MAAM,CAAC,QAAQ,CAAS;IACxB,QAAQ,CAAS;IACjB,MAAM,CAAkB,CAAE,yBAAyB;IAE3D,YAAoB,QAAgB,EAAE,MAAuB;QAC3D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,WAAmB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,MAAuB;QACjH,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;YAC9F,CAAC;YACD,MAAM,CAAC,QAAQ,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAEO,mBAAmB;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,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