-
Notifications
You must be signed in to change notification settings - Fork 1
/
hsreplay.dtd
389 lines (347 loc) · 11.3 KB
/
hsreplay.dtd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<!--
! This is HSReplay 1.8 DTD.
! Project page: https://hearthsim.info/hsreplay/
! The DTD is available at the following URL:
! https://hearthsim.info/hsreplay/dtd/hsreplay-1.8.dtd
-->
<!--
! An entity element SHOULD always be an integer representing the entity ID.
! Also note that they can be "UNKNOWN HUMAN PLAYER" in case of a
! logging/connection issue.
-->
<!ENTITY % entity "NMTOKEN">
<!--
! An enumValue element MUST always be an integer.
! It represents the value of one of the game's enums. For specifics, see
! the tag's documentation.
-->
<!ENTITY % enumValue "NMTOKEN">
<!--
! This is a GameTag enumValue.
-->
<!ENTITY % gameTag "NMTOKEN">
<!--
! ALL non-root tags accept an optional `ts` attribute which denotes the
! timestamp most relevant to the element.
! The attribute SHOULD be omitted for elements which will never have a
! different timestamp than their parent element.
! The `ts` attribute on the main Game element represents the time at which
! the game started.
! Timestamps SHOULD be in RFC3339 datetime format. If only the time is
! available, the date can be inferred from the original file's lastmod or
! the timestamp can instead be saved in ISO8601 time-only format.
-->
<!ENTITY % timestamp "NMTOKEN">
<!--
! A card ID (aka a "mini guid")
-->
<!ENTITY % cardID "NMTOKEN">
<!-- Core tags -->
<!-- HSReplay root tag
! Contains a list of Hearthstone games
! build: The Hearthstone build used to generate the replays
! version: The version of the HSReplay spec used for the document
-->
<!ELEMENT HSReplay (Game*)>
<!ATTLIST HSReplay
build NMTOKEN #IMPLIED
version NMTOKEN #REQUIRED>
<!-- A Hearthstone game
! Contains a full or partial Hearthstone game. Begins on CREATE_GAME.
! id: The game's ID (as output by Net.log)
! type: A GameType (GameType) enum value. Optional.
! format: A FormatType enum value. Optional.
! scenarioID: A Scenario ID value. Optional.
-->
<!ELEMENT Game (Block | ChangeEntity | Choices | ChosenEntities | FullEntity | GameEntity | HideEntity | Options | Player | ResetGame | SendChoices | SendOption | ShowEntity | TagChange)*>
<!ATTLIST Game
id NMTOKEN #IMPLIED
type %enumValue; #IMPLIED
format %enumValue; #IMPLIED
scenarioID %enumValue; #IMPLIED
ts %timestamp; #IMPLIED>
<!--
! Corresponds to GameEntity in Power.log.
! Its ID SHOULD always be 1 - if it's not, something is terribly wrong!
-->
<!ELEMENT GameEntity (Tag*)>
<!ATTLIST GameEntity
id %entity; #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! Corresponds to Player in Power.log.
! id is the entity id and should not be confused with playerID!
! name SHOULD be included - it has to be reversed from followup packets
! which carry the player's name instead of ID.
! rank: The player's ladder rank. Should only be filled if available and
! only if the game type is ranked. 25 is Angry Chicken, 1 is Innkeeper
! and 0 is Legend. Defaults to "-1"
! legendRank: The Player's legend ranking at the beginning of the game.
! cardback: The Player's cardback id at the beginning of the game.
-->
<!ELEMENT Player (Tag | Deck)*>
<!ATTLIST Player
id %entity; #REQUIRED
playerID NMTOKEN #REQUIRED
name CDATA #IMPLIED
accountHi NMTOKEN #IMPLIED
accountLo NMTOKEN #IMPLIED
rank NMTOKEN "-1"
legendRank NMTOKEN "0"
cardback NMTOKEN "0"
ts %timestamp; #IMPLIED>
<!--
! Contains a full action block (from BLOCK_START to corresponding BLOCK_END)
! Previously known as ACTION_START / ACTION_END.
! This is recursive: Blocks may contain further Blocks.
! index: The index the block action is performed at (-1 if not provided)
! target: The id of the entity being targeted (0 if not provided)
! type: A PowSubType enum value representing the type of block
! subOption: An option ID defaulting to 0 or -1 depending on the type of block
! triggerKeyword: The GameTag which triggered this block (0 if not provided)
-->
<!ELEMENT Block (Block | ChangeEntity | FullEntity | HideEntity | TagChange | MetaData | ShowEntity | Choices | ChosenEntities | SendChoices)*>
<!ATTLIST Block
entity %entity; #REQUIRED
index NMTOKEN "-1"
effectCardId %cardID; #IMPLIED
effectIndex NMTOKEN "-1"
target %entity; "0"
type %enumValue; #REQUIRED
subOption NMTOKEN "-1"
triggerKeyword %gameTag; "0"
ts %timestamp; #IMPLIED>
<!--
! Represents a GameTag key/value pair (tag=... value=...)
! It is included as part of all types of entity definitions and
! carries the initial tags attached to the entity.
! tag: A GameTag key
! value: A value for the GameTag. SHOULD always be an integer.
-->
<!ELEMENT Tag EMPTY>
<!ATTLIST Tag
tag %gameTag; #REQUIRED
value NMTOKEN #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! Corresponds to TAG_CHANGE in Power.log
! tag: A GameTag key
! value: A value for the GameTag. SHOULD always be an integer.
-->
<!ELEMENT TagChange EMPTY>
<!ATTLIST TagChange
entity %entity; #REQUIRED
tag %gameTag; #REQUIRED
value NMTOKEN #REQUIRED
ts %timestamp; #IMPLIED>
<!-- Card Entity definitions -->
<!--
! Corresponds to FULL_ENTITY in Power.log.
! Represents a complete entity definition, with a list of tags.
-->
<!ELEMENT FullEntity (Tag*)>
<!ATTLIST FullEntity
cardID %cardID; #IMPLIED
id %entity; #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! Corresponds to a SHOW_ENTITY in Power.log.
! Represents an entity being revealed from an unrevealed state.
! Carries a list of tags like FullEntity.
! entity: The id of the entity being revealed
-->
<!ELEMENT ShowEntity (Tag*)>
<!ATTLIST ShowEntity
cardID %cardID; #IMPLIED
entity %entity; #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! Corresponds to a HIDE_ENTITY in Power.log.
! entity: The id of the entity being hidden
! zone: The zone the entity is being moved to
-->
<!ELEMENT HideEntity EMPTY>
<!ATTLIST HideEntity
entity %entity; #REQUIRED
zone %enumValue; #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! Corresponds to a CHANGE_ENTITY in Power.log.
! Introduced in Hearthstone 5.0.0.12574
! Represents an entity's Card ID being changed.
! Carries a list of tags like ShowEntity. The previous tags are reset.
! entity: The id of the entity being changed
! cardID: The new card ID of the entity.
-->
<!ELEMENT ChangeEntity (Tag*)>
<!ATTLIST ChangeEntity
cardID %cardID; #REQUIRED
entity %entity; #REQUIRED
ts %timestamp; #IMPLIED>
<!-- Metadata -->
<!--
! Corresponds to META_DATA in Power.log
! meta: A MetaDataType enum value
! data: The data integer. In the case of JOUST, is an entity. Defaults to 0.
! entity: An entity definition (aka "data"). Defaults to 0
! infoCount: The info count. SHOULD NOT be included if Info tags are available.
-->
<!ELEMENT MetaData (Info*)>
<!ATTLIST MetaData
meta %enumValue; #REQUIRED
data NMTOKEN "0"
infoCount NMTOKEN #IMPLIED
ts %timestamp; #IMPLIED>
<!--
! In verbose mode, Power.log outputs detailed Info for META_DATA packets.
! index: The index of the info element. Only needed if not ordered.
! entity: The id of the entity in question
-->
<!ELEMENT Info EMPTY>
<!ATTLIST Info
index NMTOKEN #IMPLIED
entity %entity; #REQUIRED>
<!-- Choices -->
<!--
! Represents data output by DebugPrintEntityChoices() in Power.log
! id: The ID of the choice
! entity: The entity ID of the player the choices are presented to
! taskList: The TaskList element from Power.log (>= 10357) - not needed for replays
! type: A ChoiceType enum value representing the type of choice (MULLIGAN vs. GENERAL)
! min: The minimum amount of entities that can be chosen
! max: The maximum amount of entities that can be chosen
! source: The source of the choices
-->
<!ELEMENT Choices (Choice+)>
<!ATTLIST Choices
id NMTOKEN #REQUIRED
entity %entity; #REQUIRED
taskList NMTOKEN #IMPLIED
type %enumValue; #REQUIRED
min NMTOKEN #REQUIRED
max NMTOKEN #REQUIRED
source NMTOKEN #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! Represents data output by DebugPrintChosenEntities() in Power.log.
! Not to be confused with SendChoices! This is inbound, SendChoices is
! outbound. Ideally, SendChoices will be collapsed into ChosenEntities
! but Power.log does not output ChosenEntities for the player who sent
! the choices. New in 10357.
! id: The id of the choice
! entity: The entity id of the player who made the choice
-->
<!ELEMENT ChosenEntities (Choice*)>
<!ATTLIST ChosenEntities
id NMTOKEN #REQUIRED
entity %entity; #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! Represents data output by SendChoices() in Power.log
! id: The id of the choice being sent
! type: A ChoiceType enum value representing MULLIGAN or GENERAL, eg. Tracking
! May contain no choice as not sending a choice is valid, eg. in Mulligan
-->
<!ELEMENT SendChoices (Choice*)>
<!ATTLIST SendChoices
id NMTOKEN #REQUIRED
type %enumValue; #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! Represents a choice, either being proposed or sent
! entity: The id of the choice entity
! index: The index of the choice in the choice list. Only needed if unordered.
-->
<!ELEMENT Choice EMPTY>
<!ATTLIST Choice
entity %entity; #REQUIRED
index NMTOKEN #IMPLIED
ts %timestamp; #IMPLIED>
<!-- Options -->
<!--
! Represents data output by DebugPrintOptions() in Power.log
! id: The option packet ID
-->
<!ELEMENT Options (Option+)>
<!ATTLIST Options
id NMTOKEN #REQUIRED
ts %timestamp; #IMPLIED>
<!--
! A single option presented to the user.
! May have suboptions ("choose one"), or multiple targets.
! entity: The id of the entity chosen as the option. SHOULD be 0 for END_TURN
! type: An OptionType enum value: PASS (unused), END_TURN or POWER
-->
<!ELEMENT Option (SubOption*|Target*)>
<!ATTLIST Option
entity %entity; #IMPLIED
index NMTOKEN #REQUIRED
type %enumValue; #REQUIRED
error %enumValue; #IMPLIED
errorParam NMTOKEN #IMPLIED
ts %timestamp; #IMPLIED>
<!--
! Behaves exactly like Option, but may not have further sub-options and
! does not have a type.
-->
<!ELEMENT SubOption (Target*)>
<!ATTLIST SubOption
entity %entity; #REQUIRED
index NMTOKEN #REQUIRED
error %enumValue; #IMPLIED
errorParam NMTOKEN #IMPLIED
ts %timestamp; #IMPLIED>
<!--
! A target for an Option or SubOption
! entity: The id of the target
! index: The index of the target in the targets list
-->
<!ELEMENT Target EMPTY>
<!ATTLIST Target
entity %entity; #REQUIRED
index NMTOKEN #REQUIRED
error %enumValue; #IMPLIED
errorParam NMTOKEN #IMPLIED
ts %timestamp; #IMPLIED>
<!--
! Sends a chosen option.
! option: The index of the chosen Option
! subOption: The index of the chosen SubOption (default -1)
! position: The position chosen for the option (default 0)
! target: The entity id of the chosen target
-->
<!ELEMENT SendOption EMPTY>
<!ATTLIST SendOption
option NMTOKEN #REQUIRED
subOption NMTOKEN "-1"
position NMTOKEN "0"
target %entity; #IMPLIED
ts %timestamp; #IMPLIED>
<!--
! Resets the current game.
-->
<!ELEMENT ResetGame EMPTY>
<!ATTLIST ResetGame
ts %timestamp; #IMPLIED>
<!--
! Decklist support
! If a player's deck list is available, it can be added to the replay
! by appending it to the Player entity. These are only the cards that
! the player started the game with, in no particular order.
! This must not be added unless the entire deck list is available.
! type: The type of deck (DeckType enum)
-->
<!ELEMENT Deck (Card+)>
<!ATTLIST Deck
type NMTOKEN #REQUIRED>
<!--
! A card in the player's deck
! id: The card's ID
! premium: determines whether the card is golden (1) or not (0, default)
! count: The amount of cards with that ID and premium in the deck (default 1)
-->
<!ELEMENT Card EMPTY>
<!ATTLIST Card
id %cardID; #REQUIRED
count NMTOKEN "1"
premium NMTOKEN "0">