@@ -15,8 +15,9 @@ export type GameEvent =
15
15
| CompassGameEvent
16
16
| VitalsProgressBarGameEvent
17
17
| ExperienceGameEvent
18
- | PromptGameEvent
19
- | RoundtimeGameEvent ;
18
+ | RoomGameEvent
19
+ | ServerTimeGameEvent
20
+ | RoundTimeGameEvent ;
20
21
21
22
/**
22
23
* Indicates text to display to the player.
@@ -121,7 +122,7 @@ export interface CompassGameEvent {
121
122
* <progressBar id='mana' value='100'/>
122
123
*/
123
124
export interface VitalsProgressBarGameEvent {
124
- type : GameEventType . VITALS_PROGRESS_BAR ;
125
+ type : GameEventType . VITALS ;
125
126
vitalId : string ; // health, mana, concentration, spirit, stamina
126
127
value : number ; // 0-100 (percentage)
127
128
}
@@ -140,19 +141,40 @@ export interface ExperienceGameEvent {
140
141
mindState : string ; // e.g. 'clear', 'pondering', 'mind lock', etc.
141
142
}
142
143
144
+ /**
145
+ * One or more properties might be specified.
146
+ * If defined then that property has changed.
147
+ * If undefined then that property has not changed.
148
+ *
149
+ * <streamWindow id='room' title='Room' subtitle=" - [The Crossing, Hodierna Way]"/>
150
+ * <component id='room desc'>The hustle...</component>
151
+ * <component id='room objs'>You also see ...</component>
152
+ * <component id='room players'>Also here: Katoak.</component>
153
+ * <component id='room exits'>Obvious paths: <d>east</d>, <d>southwest</d>, <d>northwest</d>.<compass></compass></component>
154
+ */
155
+ export interface RoomGameEvent {
156
+ type : GameEventType . ROOM ;
157
+ roomName ?: string ;
158
+ roomDescription ?: string ;
159
+ roomCreatures ?: string ;
160
+ roomObjects ?: string ;
161
+ roomPlayers ?: string ;
162
+ roomExits ?: string ;
163
+ }
164
+
143
165
/**
144
166
* <prompt time="1703617000">></prompt>
145
167
*/
146
- export interface PromptGameEvent {
147
- type : GameEventType . PROMPT ;
168
+ export interface ServerTimeGameEvent {
169
+ type : GameEventType . SERVER_TIME ;
148
170
time : number ;
149
171
}
150
172
151
173
/**
152
174
* <roundTime value='1703617016'/>
153
175
*/
154
- export interface RoundtimeGameEvent {
155
- type : GameEventType . ROUNDTIME ;
176
+ export interface RoundTimeGameEvent {
177
+ type : GameEventType . ROUND_TIME ;
156
178
time : number ;
157
179
}
158
180
@@ -214,26 +236,31 @@ export enum GameEventType {
214
236
*/
215
237
COMPASS = 'COMPASS' ,
216
238
/**
217
- * Indicates one of the character's vital progress bars .
218
- * For example, health, energy (mana, conc. or inner fire), stamina, spirit
239
+ * Indicates one of the character's vitals .
240
+ * For example, health, energy (mana, conc. or inner fire), stamina, spirit.
219
241
*/
220
- VITALS_PROGRESS_BAR = 'VITALS_PROGRESS_BAR ' ,
242
+ VITALS = 'VITALS ' ,
221
243
/**
222
244
* Indicates a change in the character's experience for a specific skill.
223
245
*/
224
246
EXPERIENCE = 'EXPERIENCE' ,
225
247
/**
226
- * Tells us the game server time, as well as outputting a `>` line
227
- * to the main game window .
248
+ * Indicates a change in the current room.
249
+ * For example, the name, description, attendees, etc .
228
250
*/
229
- PROMPT = 'PROMPT' ,
251
+ ROOM = 'ROOM' ,
252
+ /**
253
+ * Tells us the game server time.
254
+ * Use this in round time and cast time calculations.
255
+ */
256
+ SERVER_TIME = 'SERVER_TIME' ,
230
257
/**
231
258
* Indicates the character took an action that they must now wait
232
259
* until the game server time reaches the specified roundtime.
233
260
* Subtracting the roundtime from the current game time tells you
234
261
* the number of seconds to wait.
235
262
*/
236
- ROUNDTIME = 'ROUNDTIME ' ,
263
+ ROUND_TIME = 'ROUND_TIME ' ,
237
264
}
238
265
239
266
export enum IndicatorType {
@@ -305,3 +332,10 @@ export interface GameSocket {
305
332
*/
306
333
send ( command : string ) : void ;
307
334
}
335
+
336
+ export interface GameParser {
337
+ /**
338
+ * Parses the game socket stream to emit game events.
339
+ */
340
+ parse ( gameSocketStream : rxjs . Observable < string > ) : rxjs . Observable < GameEvent > ;
341
+ }
0 commit comments