-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtab_basics.dat
475 lines (402 loc) · 15.8 KB
/
tab_basics.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
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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file contains the definition of the "Basics" tab panel. This tab is where
the user configures that attributes and skills of the character.
All public visual elements used with this tab panel start with the prefix "ba"
to associate them with the tab.
-->
<document signature="Hero Lab Data">
<!-- baAttrib portal
Presents a fixed table that consists of the various attributes for the
character. The "explicit" sortset is used to enforce a hand-numbered
ordering of the attributes. Since the full list is short enough to always
be visible, the table has no scroller.
We use a "headertitle" script to place a suitable title above the table.
-->
<portal
id="baAttrib"
style="tblInvis">
<table_fixed
component="Attribute"
showtemplate="baAttrPick"
showsortset="explicit"
scrollable="no">
<list>HeroType.PC|HeroType.NPC</list>
<headertitle><![CDATA[
@text = "Attributes"
@text &= ": " & hero.child[resAttribute].field[resSummary].text
]]></headertitle>
</table_fixed>
</portal>
<!-- baSkill portal
Presents a fixed table consisting of all skills for the character, which
are shown in alphabetical order (the default). The full list will fit, so
no scroller is needed.
We use a "headertitle" script to place a suitable title above the table.
-->
<portal
id="baSkill"
style="tblInvis">
<table_fixed
component="Skill"
showtemplate="baSklPick"
scrollable="no"
columns="2">
<list>!HeroType.Creature</list>
<headertitle><![CDATA[
@text = "Skills: " & hero.child[resSkill].field[resSummary].text
]]></headertitle>
</table_fixed>
</portal>
<!-- baTrait portal
Presents a fixed table with all derived traits in it. The sortset allows
us to dictate the order of display via a hand-numbered sequence. All traits
are always visible, so we don't need a scroller.
-->
<portal
id="baTrait"
style="tblInvis">
<table_fixed
component="Derived"
showtemplate="baTrtPick"
showsortset="explicit"
scrollable="no">
<list>!Hide.Trait & (HeroType.PC|HeroType.NPC)</list>
<headertitle><![CDATA[
@text = "Traits"
]]></headertitle>
</table_fixed>
</portal>
<!-- baAttrPick template
Displays one attribute within the table of attributes. We setup suitable
margins around each template, which provides substantial spacing between
each item and the edges of the table. Each attribute consists of its name,
an incrementer where the user can assign the value, and an info button that
provides details on the attribute when the user moves the mouse over it.
-->
<template
id="baAttrPick"
name="Attribute Pick"
compset="Attribute"
marginhorz="13"
marginvert="9">
<portal
id="name"
style="lblXLarge"
showinvalid="yes">
<label
field="name">
</label>
</portal>
<portal
id="value"
style="incrSimple">
<incrementer
field="trtUser">
</incrementer>
<mouseinfo><![CDATA[
if (hero.tagis[mode.creation] = 0) then
@text = "Attributes must be modified via the Advances tab once the character is locked for play."
elseif (autonomous = 0) then
@text = "This trait has been improved via the Advances tab and cannot be modified further from here."
else
@text = "Allocate points to this attribute by clicking on the arrows to increase/decrease the number of points assigned."
endif
]]></mouseinfo>
</portal>
<portal
id="info"
style="actInfo">
<action
action="info">
</action>
</portal>
<position><![CDATA[
~set up our height based on our tallest portal
height = portal[info].height
~if this is a "sizing" calculation, we're done
doneif (issizing <> 0)
~freeze our value in advancement mode or if an advancement has modified us
~Note: All freezing must be done *before* any positioning is performed.
if (state.iscreate = 0) then
portal[value].freeze = 1
elseif (autonomous = 0) then
portal[value].freeze = 1
endif
~position our tallest portal at the top
portal[info].top = 0
~center the other portals vertically
perform portal[name].centervert
perform portal[value].centervert
~position the info portal on the far right
perform portal[info].alignedge[right,0]
~position the incrementer to the left of the info portal (plus a gap)
perform portal[value].alignrel[rtol,info,-10]
~position the name on the left and make sure its width does not exceed the available space
portal[name].left = 0
portal[name].width = minimum(portal[name].width,portal[value].left - portal[name].left - 10)
]]></position>
</template>
<!-- baSklPick template
Displays one skill within the table of skills. This template is very
similar to the one used for attributes. The key differences are that this
template is tied to skills and has slightly different margins for closer
grouping of the items in the table.
-->
<template
id="baSklPick"
name="Skill Pick"
compset="Skill"
marginhorz="8"
marginvert="3">
<portal
id="name"
style="lblNormal"
showinvalid="yes">
<label>
<labeltext><![CDATA[
~set the color based on if career skill or not
if (tagcount[Skill.TagSkill] = 0) then
@text = "{text ffffff}"
else
@text = "{text 00ff00}"
endif
@text &= field[name].text
]]></labeltext>
</label>
</portal>
<portal
id="value"
style="incrSimple">
<incrementer
field="trtUser">
</incrementer>
<mouseinfo><![CDATA[
if (hero.tagis[mode.creation] = 0) then
@text = "Skills must be modified via the Advances tab once the character is locked for play."
elseif (autonomous = 0) then
@text = "This trait has been improved via the Advances tab and cannot be modified further from here."
else
@text = "Allocate points to this skill by clicking on the arrows to increase/decrease the number of points assigned."
endif
]]></mouseinfo>
</portal>
<portal
id="lblvalue"
style="lblStatic"
showinvalid="yes">
<label>
<labeltext><![CDATA[
if (tagis[Helper.NoSkillValue] <> 0) then
@text &= " -- "
else
@text &= field[trtFinal].text
endif
]]></labeltext>
</label>
</portal>
<portal
id="info"
style="actInfo">
<action
action="info">
</action>
</portal>
<position><![CDATA[
~set up our height based on our tallest portal
height = portal[info].height
~if this is a "sizing" calculation, we're done
doneif (issizing <> 0)
~freeze our value in advancement mode or if an advancement has modified us
~Note: All freezing must be done *before* any positioning is performed.
if (state.iscreate = 0) then
portal[value].freeze = 1
elseif (autonomous = 0) then
portal[value].freeze = 1
endif
if (hero.tagis[HeroType.Creature] <> 0) then
portal[lblvalue].visible = 1
portal[value].visible = 0
else
portal[lblvalue].visible = 0
portal[value].visible = 1
endif
~position our tallest portal at the top
portal[info].top = 0
~center the other portals vertically
perform portal[name].centervert
perform portal[value].centervert
perform portal[lblvalue].centervert
~position the info portal on the far right
perform portal[info].alignedge[right,0]
~position the incrementer to the left of the info portal (plus a gap)
perform portal[value].alignrel[rtol,info,-5]
perform portal[lblvalue].alignrel[rtol,info,-10]
~position the name on the left and make sure its width does not exceed the available space
portal[name].left = 0
portal[name].width = minimum(portal[name].width,portal[value].left - portal[name].left - 5)
]]></position>
</template>
<!-- baTrtPick template
Displays one trait within the table of traits. The trait name is shown on
the left, with appropriate details about the derived value on the right.
At the right edge is an info button that can be moused over for more info.
As with the other templates above, we use the margins to establish good
visual spacing between and around the items in the table.
-->
<template
id="baTrtPick"
name="Trait Pick"
compset="Trait"
marginhorz="16"
marginvert="3">
<portal
id="name"
style="lblLeft"
showinvalid="yes">
<label>
<labeltext><![CDATA[
@text = field[name].text & ":"
]]></labeltext>
</label>
</portal>
<portal
id="details"
style="lblNormal">
<label>
<labeltext><![CDATA[
if (tagis[User.DamageDice] <> 0) then
if (field[trtFinal].value = 0) then
@text = "--"
else
@text = signed(field[trtFinal].value) & " CD"
endif
else
@text = field[trtFinal].text
endif
]]></labeltext>
</label>
<mouseinfo><![CDATA[
~insert appropriate code to explain how the trait was derived
@text = "???"
]]></mouseinfo>
</portal>
<portal
id="info"
style="actInfo">
<action
action="info">
</action>
</portal>
<position><![CDATA[
~set up our height based on our tallest portal
height = portal[info].height
~if this is a "sizing" calculation, we're done
doneif (issizing <> 0)
~position our tallest portal at the top
portal[info].top = 0
~center the other portals vertically
perform portal[name].centervert
perform portal[details].centervert
~position the info portal on the far right
perform portal[info].alignedge[right,0]
~position the name on the left and give it some reasonable space
portal[name].left = 0
portal[name].width = 135
~position the details to the right of the name and the left of the info portal
perform portal[details].alignrel[ltor,name,10]
portal[details].width = portal[info].left - portal[details].left - 5
]]></position>
</template>
<!-- basics layout
This layout orchestrates the display of all various visual elements that
comprise the Basics tab. We have titles above the attributes and skills,
the attributes and skills tables themselves, a horizontal separator, and
the table of derived traits.
Each of these portals and templates is identified as a "reference" by the
layout. Using references allows distinct instances of portals and templates
to be re-used within multiple layouts. You can even use the same template
multiple times within a single layout.
The visual elements used in the layout are all sized and positioned via
the "position" script. This script is invoked to setup the dimensions of
visual elements and trigger the positioning of the contents of those
elements via the "render" invocation.
The tab order between items is controlled via the optional "taborder" XML
attribute on the various portal and template references. Within a template,
the tab order is dictated by the order the portals are listed within the
XML. Within a table, the tab order is dictated by the item sequence. The
"taborder" attribute coordinates the relative sequence of portals and
templates within the layout. In this layout, the tab order will move down
the left column and then shift over to the right column.
-->
<layout
id="basics">
<portalref portal="baAttrib" taborder="10"/>
<portalref portal="baTrait" taborder="20"/>
<portalref portal="baSkill" taborder="30"/>
<!-- This script sizes and positions the layout and its child visual elements. -->
<position><![CDATA[
~size and position the attributes table in the top left; we set the height to
~the full layout height, but the table will only use the space it needs
portal[baAttrib].width = width / 2 - 5
portal[baAttrib].left = 0
portal[baAttrib].height = height
~size and position the skills table in the top right; we set the height to
~the full layout height, but the table will only use the space it needs
portal[baTrait].width = portal[baAttrib].width
portal[baTrait].left = width - portal[baTrait].width
portal[baTrait].height = height - portal[baTrait].top
~set the separator width and position it beneath the attributes
~portal[Horizontal].width = width - 30
~portal[Horizontal].top = maximum(portal[baAttrib].bottom,portal[baTrait].bottom) + 10
~portal[Horizontal].left = portal[baAttrib].left + 15
~size and position the traits table beneath the separator; we set the height
~the the full layout height, but the table will only use the space it needs
portal[baSkill].width = width
portal[baSkill].left = portal[baAttrib].left
portal[baSkill].top = maximum(portal[baAttrib].bottom,portal[baTrait].bottom) + 10
portal[baSkill].height = height - portal[baSkill].top
~figure out the total height we need for the tab
height = portal[baSkill].bottom
]]></position>
</layout>
<!-- basics panel
This is the "Basics" panel shown within Hero Lab.
The "order" attribute dictates the sequence in which the various tabs will
be displayed. To keep everything well organized, We break the tabs up into
four logical groupings: (1) traits and creation details, (2) equipment,
(3) details, and (4) in-play support. Each of these groupings will have a
three-digit value that starts with the grouping number. Since the Basics
panel should appear first within the traits group, it has an order of "110".
As we assign order values, We'll leave gaps in the sequence (e.g. 110, 120,
etc.). This will allow us to easily change our minds and slip a new panel
inbetween two existing ones as the data files evolve, without having to go
through and re-number everything.
We setup a suitable margin around the edges of the panel. This ensures that
there is a little bit of spacing from the edges and eliminates the need for
our positioning scripts to make the appropriate adjustments.
Like with layouts, panels have a "position" script to setup the dimensions
of child elements and orchestrate the rendering of their contents. In many
cases, as with this panel, the default handling of panels will ensure that
the layouts are properly rendered.
The panel is assigned a "live" tagexpr so that its visibility can be
controlled for different types of characters. While not really useful in the
sample data files, this approach can be quite useful when the data files
expand to govern creation of widely varying characters, such as vampires vs.
ghosts vs. mortals in the World of Darkness game system.
-->
<panel
id="basics"
name="Basics"
marginhorz="5"
marginvert="5"
order="110">
<live>!HideTab.basics & !CharType.typCreature</live>
<layoutref layout="basics"/>
<position><![CDATA[
~get the height used by the layout and use it, as that means we scroll
~if necessary
perform layout[basics].render
height = layout[basics].height
]]></position>
</panel>
</document>