-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathout_statblock.dat
330 lines (276 loc) · 10 KB
/
out_statblock.dat
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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- This file contains the definition of a traditional "statblock" output for the
game system. The statblock is defined as a dossier and then uses an assortment
of procedures to orchestrate the synthesis of the output.
-->
<document signature="Hero Lab Data">
<!-- Procedure sbname
Get the character's name, using a suitable default if unnamed. The name is
placed in the "name" text variable.
Outbound parameter: name
-->
<procedure id="sbname" scripttype="synthesize"><![CDATA[
var name as string
if (empty(hero.actorname) = 0) then
name = hero.actorname
else
name = "Unnamed Character"
endif
]]></procedure>
<!-- Procedure sbtraits
Output all of the traits that satisfy the provided tag expression, reporting
the name and final value for each. The "tagexpr" text variable specifies the
constraints that must be satisfied for the list of traits.
Inbound parameter: tagexpr
-->
<procedure id="sbtraits" scripttype="synthesize"><![CDATA[
var tagexpr as string
var ismore as number
ismore = 0
foreach pick in hero where tagexpr
if (ismore <> 0) then
append ", "
endif
if (eachpick.tagis[component.HeroicAbility] <> 0) then
append eachpick.field[spcName].text
else
append eachpick.field[name].text
endif
if (eachpick.tagis[component.Ability] = 0) then
append " " & eachpick.field[trtFinal].text
endif
ismore = 1
nexteach
append @newline
]]></procedure>
<!-- Procedure sbattrib
Output all of the traits that satisfy the provided tag expression, reporting
the name and final value for each. The "tagexpr" text variable specifies the
constraints that must be satisfied for the list of traits.
Inbound parameter: tagexpr
-->
<procedure id="sbattrib" scripttype="synthesize"><![CDATA[
var tagexpr as string
var ismore as number
ismore = 0
foreach pick in hero where tagexpr
if (ismore <> 0) then
append ", "
endif
append eachpick.field[name].text & " " & eachpick.field[trtFinal].text
ismore = 1
nexteach
append @newline
]]></procedure>
<!-- Procedure sbskills
Output all of the traits that satisfy the provided tag expression, reporting
the name and final value for each. The "tagexpr" text variable specifies the
constraints that must be satisfied for the list of traits.
Inbound parameter: tagexpr
-->
<procedure id="sbskills" scripttype="synthesize"><![CDATA[
var tagexpr as string
var ismore as number
ismore = 0
foreach pick in hero where tagexpr
if (eachpick.field[trtFinal].value + eachpick.tagis[Helper.ShowSkill] <> 0) then
if (ismore <> 0) then
append ", "
endif
append eachpick.field[name].text & " " & eachpick.field[sklPool].text
ismore = 1
endif
nexteach
append @newline
]]></procedure>
<!-- Procedure sbweapons
Output all of the weapons possessed by the character, listing equipped
weapons first and including attack values, damage, and ranges for eachpick.
-->
<procedure id="sbweapons" scripttype="synthesize"><![CDATA[
var ismore as number
append @boldon & "Weapons/Attacks: " & @boldoff & @newline
~output a list of all weapons (equipped first)
ismore = 0
foreach pick in hero from WeaponBase sortas Armory
ismore = 1
append @indent & eachpick.field[wpSkill].text & " - " & eachpick.field[name].text
append " - Dmg: " & eachpick.field[wpDamage].text
append " Crit: " & eachpick.field[wpCrit].text
if (eachpick.field[grIsEquip].value <> 0) then
append " (Equipped)"
endif
append " (Rng: " & eachpick.field[wpRange].text & ")"
append @newline
nexteach
~if we have no weapons, output that fact
if (ismore = 0) then
append @indent & "-none-" & @newline
endif
]]></procedure>
<!-- Procedure sbarmor
Output all of the armor possessed by the character, listing equipped gear
first and including the defense value for eachpick.
-->
<procedure id="sbarmor" scripttype="synthesize"><![CDATA[
var ismore as number
append @boldon & "Armor: " & @boldoff & @newline
~output the details of all armor (equipped first)
ismore = 0
foreach pick in hero from Defense sortas Armory
ismore = 1
append @indent & eachpick.field[name].text
if (eachpick.field[grIsEquip].value <> 0) then
append " (Equipped)"
endif
append " (Soak: " & eachpick.field[defSoak].text
append "; Mel/Rng: " & eachpick.field[defDefenseMelee].text & "/" & eachpick.field[defDefenseRange].text & ")"
append @newline
nexteach
~if we have no armor, output that fact
if (ismore = 0) then
append @indent & "-none-" & @newline
endif
]]></procedure>
<!-- Procedure sbtrackres
Output all of the tracked resources possessed by the character, if the
right output source is enabled.
-->
<procedure id="sbtrackres" scripttype="synthesize"><![CDATA[
doneif (hero.tagis[source.ShowTrackR] = 0)
var ismore as number
append @boldon & "Tracked Resources: " & @boldoff & @newline
~output the details of all resources
ismore = 0
foreach pick in hero from Tracker where "!Hide.Tracker"
ismore = 1
append @indent & eachpick.field[name].text & " - " & eachpick.field[trkUser].text
append @newline
nexteach
~if we have no resources, output that fact
if (ismore = 0) then
append @indent & "-none-" & @newline
endif
]]></procedure>
<procedure id="sbcareer" scripttype="synthesize"><![CDATA[
var ismore as number
var txt as string
~output the details of career
txt = hero.findchild[Career].field[name].text
if (empty(txt) <> 0) then
txt = "-none-"
endif
append @boldon & "Career: " & @boldoff & txt & @newline
append @boldon & "Specializations: " & @boldoff
ismore = 0
foreach pick in hero from SpecTree where "!Hide.SpecTree"
if (ismore <> 0) then
append ", "
endif
ismore = 1
append eachpick.field[name].text
nexteach
~if we have no resources, output that fact
if (ismore = 0) then
append "-none-"
endif
append @newline
]]></procedure>
<!-- Procedure sbnpcinfo
Checks all npc info picks with a certain tag expression and appends
their info to the text.
-->
<procedure id="sbnpcinfo" scripttype="synthesize"><![CDATA[
var title as string
var tagexpr as string
~go through the npc info picks, adding them to the info string
var info as string
info = ""
foreach pick in hero from NPCInfo where tagexpr sortas explicit
if (eachpick.field[npcInfo].isempty = 0) then
info &= eachpick.field[name].text & ": " & eachpick.field[npcInfo].text & @newline
endif
nexteach
~if we ended up with any text, append it to our output with the
~appropriate title
if (empty(info) = 0) then
append @newline & "===== " & title & " =====" & @newline
append info
endif
]]></procedure>
<!-- Define the statblock as a text-based dossier. The "synthesize" script actually
generates the output.
-->
<dossier
id="statblock"
name="Character Statblock">
<dossier_text
styles="plain+html+bbcode+wikitext+print"
grouping="statblock">
<synthesize><![CDATA[
var txt as string
var tagexpr as string
~start by getting our name
var name as string
call sbname
~output our name
append @boldon & "Name: " & @boldoff & name & @newline
~output any race
txt = hero.findchild[Archetype].field[name].text
if (empty(txt) <> 0) then
txt = "-none-"
endif
append @boldon & "Archetype: " & @boldoff & txt & @newline
~output Career and Specializations
call sbcareer
~output age
~append @boldon & "Age: " & @boldoff & hero.child[mscPerson].field[perAge].text & @newline
~output attributes
append @boldon & "Attributes: " & @boldoff
tagexpr = "component.Attribute"
call sbattrib
~output skills
append @boldon & "Skills: " & @boldoff
tagexpr = "component.Skill"
call sbskills
~output special abilities
append @boldon & "Special Abilities: " & @boldoff
tagexpr = "component.Ability & !Hide.Special"
call sbtraits
~output derived traits
foreach pick in hero from Derived sortas explicit
append @boldon & eachpick.field[name].text & ": " & @boldoff & eachpick.field[trtFinal].text & @newline
nexteach
~output weapons/attacks
call sbweapons
~output armor
call sbarmor
~output encumbrance
append @boldon & "Encumbrance: " & @boldoff & #resspent[resEncumbrance] & " (" & #resmax[resEncumbrance] & ")" & @newline
~output tracked resources
call sbtrackres
~output NPC details if this character is a NPC - if any field for any
~of the three blocks of text is set, output that block
doneif (hero.tagis[CharType.typNPC] = 0)
var tagexpr as string
var title as string
~values of up to 15 are basic details only
tagexpr = "val:explicit.? <= 15"
title = "Basic Details"
call sbnpcinfo
~values of up to 30 are tactics
tagexpr = "val:explicit.? > 15 & val:explicit.? <= 30"
title = "Tactics"
call sbnpcinfo
~values of up to 45 are ecology
tagexpr = "val:explicit.? > 30 & val:explicit.? <= 45"
title = "Ecology"
call sbnpcinfo
~anything else is extra
tagexpr = "val:explicit.? > 45"
title = "Additional Details"
call sbnpcinfo
]]></synthesize>
</dossier_text>
</dossier>
</document>