-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmiscellaneous.str
805 lines (663 loc) · 22 KB
/
miscellaneous.str
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
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- This file contains the definitions of components that don't really fit anywhere
else, such as resources, journal entries, etc.
-->
<document signature="Hero Lab Structure">
<!-- Resource component
Encapsulates management of script-controlled resource pools (e.g. XP, XP,
etc.). Resources track a minimum and maximum value, as well as a tally of
how much of the resource has been spent. Summaries of the resource usage
are auto-generated for display where appropriate.
-->
<component
id="Resource"
name="Resource">
<!-- Name of target object managed by resource (for display to user) -->
<field
id="resObject"
name="Managed Object"
type="static"
maxlength="50">
</field>
<!-- Minimum value for resource -->
<field
id="resMin"
name="Minimum Value"
type="derived">
</field>
<!-- Maximum value for resource -->
<field
id="resMax"
name="Maximum Value"
type="derived">
</field>
<!-- Quantity of resource that has been spent -->
<field
id="resSpent"
name="Quantity Spent"
type="derived">
</field>
<!-- Extra value for arbitrary use with a given resource -->
<field
id="resExtra"
name="Extra Value"
type="derived">
</field>
<!-- Quantity of resource leftover -->
<field
id="resLeft"
name="Quantity Remaining"
type="derived">
<!-- Calculate the amount unused from the maximum and amount spent -->
<calculate phase="Final" priority="1000" name="Calc resLeft"><![CDATA[
@value = field[resMax].value - field[resSpent].value
]]></calculate>
</field>
<!-- Summary display of resource usage -->
<field
id="resSummary"
name="Summary"
type="derived"
maxlength="50">
</field>
<!-- Short summary display of resource usage -->
<field
id="resShort"
name="Short Summary"
type="derived"
maxlength="40">
</field>
<!-- Text to display within the "AddItem" script of a table portal using the resource -->
<field
id="resAddItem"
name="Add Item Text"
type="derived"
maxfinal="50">
<!-- Calculate a value that is based on all the fields referenced by the
"finalize" script. This ensures that the field always changes if any of
its pieces changes, which triggers the finalized value to be updated.
-->
<calculate phase="Render" priority="10000"><![CDATA[
@value = field[resLeft].value
]]></calculate>
<!-- Final value for display shows the color-highlighted quantity left
-->
<finalize><![CDATA[
~determine any color highlighting to be applied to the text
var unspent as number
unspent = field[resLeft].value
if (unspent = 0) then
@text = "{text clrgrey}"
elseif (unspent < 0) then
@text = "{text clrwarning}"
elseif (unspent > 0) then
@text = "{text clrprompt}"
else
@text = ""
endif
~append the managed object (or the resource name if no object given)
if (field[resObject].isempty = 0) then
@text &= "Add New " & field[resObject].text
else
@text &= "Add New " & field[name].text
endif
]]></finalize>
</field>
<!-- Synthesize the "short" field for display, showing the quantity unspent
and total available, with color highlighting to indicate if underspent
or overspent
-->
<eval index="1" phase="Render" priority="9000"><![CDATA[
~show the quantity unspent and the total available
var short as string
var unspent as number
unspent = field[resLeft].value
short = unspent & " (" & field[resMax].value & ")"
~if we've overspent, put the text in red; if underspent, put the text in yellow
if (unspent < 0) then
short = "{text clrwarning}" & short
elseif (unspent > 0) then
short = "{text clrprompt}" & short
endif
~put the result into the field
field[resShort].text = short
]]></eval>
<!-- Synthesize the "summary" field for display, showing the quantity used and
the maximum, with an additional indication of how much is unused or over-used
-->
<eval index="2" phase="Render" priority="9000"><![CDATA[
~start with the quantity used out of the quantity possessed
var summary as string
summary = field[resSpent].value & " of " & field[resMax].value
~if we've overspent, append the count and put the text in red
var unspent as number
unspent = field[resLeft].value
if (unspent < 0) then
unspent = -unspent
summary &= " (" & unspent & " Overspent)"
summary = "{text clrwarning}" & summary
~if we've got points left, append the count and put the text in yellow
elseif (unspent > 0) then
summary &= " (" & unspent & " Left)"
summary = "{text clrprompt}" & summary
endif
~put the result into the field
field[resSummary].text = summary
]]></eval>
<!-- If the resource is overspent, report a validation error -->
<evalrule index="1" phase="Validate" priority="5000" message="Resource overspent"><![CDATA[
~if we aren't overspent, we're valid
validif (field[resLeft].value >= 0)
~mark any associated tab as invalid
if (ispanel <> 0) then
linkvalid = 0
endif
]]></evalrule>
<!-- If the resource is underspent, report a validation warning -->
<evalrule index="2" phase="Validate" priority="5000" severity="warning" message="Resource unspent"><![CDATA[
~if this resource does not require full utilization, we're valid
validif (tagis[Helper.NoMinimum] <> 0)
~if we aren't underspent, we're valid
validif (field[resLeft].value <= 0)
~mark any associated tab as invalid
if (ispanel <> 0) then
linkvalid = 0
endif
]]></evalrule>
</component>
<!-- Transact component
Used for game-specific transaction info when buying/selling gear. Each
transaction needs to track the amount of cash to change hands, whether the
entire transaction is free, and whether the item being sold holds other
items that need to be dealt with properly.
-->
<component
id="Transact"
name="Buy/Sell Transaction Helper"
autocompset="no"
ispublic="no">
<!-- User-specified cost of the item in cash -->
<field
id="xactCash"
name="User Cash Cost"
type="user">
</field>
<!-- Whether the purchase is being made for free (0=no, 1=yes) -->
<field
id="xactIsFree"
name="Buy for Free?"
type="user"
minvalue="0"
maxvalue="1">
</field>
<!-- Whether the item being sold holds other items (0=no, 1=yes) -->
<field
id="xactHolder"
name="Contains Gear?"
type="derived">
</field>
</component>
<!-- Journal component
Used for game-specific journal info. Each journal entry needs to track the
amount XP and cash awarded, which entails both a field and a usage pool for
each facet. A summary is also generated to properly display the award totals
for the entry.
-->
<component
id="Journal"
name="Journal"
autocompset="no">
<!-- User-specified XP quantity awarded -->
<field
id="jrnXP"
name="XP Awarded"
type="user">
</field>
<!-- User-specified cash amount awared -->
<field
id="jrnCash"
name="Cash Awarded"
type="user">
</field>
<!-- Summary of the total XP and cash amount awarded -->
<field
id="jrnSummary"
name="Summary"
type="derived"
maxfinal="50">
<!-- Calculate a value that is based on all the values referenced by the
"finalize" script. This ensures that the field always changes if any of
its pieces changes, which triggers the finalized value to be updated.
-->
<calculate phase="Render" priority="10000"><![CDATA[
@value = usagepool[JrnlCash].value * 1000 + usagepool[JrnlXP].value
]]></calculate>
<!-- Final value for display shows the total cash and XP amounts awarded -->
<finalize><![CDATA[
var moneyvalue as number
var money as string
moneyvalue = usagepool[JrnlCash].value
call MoneyBare
@text = "$: " & money & "{horz 20}XP: " & usagepool[JrnlXP].value
]]></finalize>
</field>
<!-- Each journal entry makes use of usage pools to track the quantities awarded -->
<usage usagepool="JrnlXP"/>
<usage usagepool="JrnlCash"/>
<!-- If a journal entry is deleted, we must delete the awarded totals for the entry
out of our overall tracked pools for the actor -->
<deletion><![CDATA[
perform hero.usagepool[TotalXP].adjust[-usagepool[JrnlXP].value]
perform hero.usagepool[TotalCash].adjust[-usagepool[JrnlCash].value]
]]></deletion>
</component>
<!-- Damage component
Used for tracking the application of damage to the actor. A single field is
needed so the user can specify the amount of damage or healing to apply to
the character.
-->
<component
id="Damage"
name="Damage"
ispublic="no">
<!-- Damage to be sustained or healed -->
<field
id="dmgDamage"
name="Damage"
type="user"
minvalue="0"
maxvalue="99">
</field>
</component>
<!-- UserImage component
Used for user-added images (i.e. on the Personal tab). A single field tracks
the image selected by the user.
-->
<component
id="UserImage"
name="User Image"
ispublic="no"
orderfield="uimgIndex">
<field
id="uimgImage"
name="Image"
type="user">
</field>
</component>
<!-- Simple component
Used for validation reporting and other similar stuff
NOTE! This component has no fields because validation rules don't necessarily
need any fields. The rules can simply access the fields they need to
test on other picks that have been added to the actor.
-->
<component
id="Simple"
name="Simple">
</component>
<!-- Mechanics component
Used for generic instrumentation mechanics added by other users
NOTE! See the documentation for more on how "mechanics" things are used.
-->
<component
id="Mechanics"
name="Mechanics">
<!-- Track the ability on the actor -->
<eval index="2" phase="Initialize" priority="500"><![CDATA[
perform forward[SettingRule.?]
]]></eval>
</component>
<!-- CharType component
Used for specifying character types (usually "Player", "NPC" or "Monster").
-->
<component
id="CharType"
name="Character Type">
<!-- Each type needs its own identity tag that is forwarded to the hero
by the actor pick when selected -->
<identity group="CharType"/>
</component>
<!-- NPCInfo component
Used for specifying a type of information about an NPC. Displayed in
the tables on the NPC tab.
-->
<component
id="NPCInfo"
name="NPC Info">
<field
id="npcInfo"
name="Info Text"
type="user"
maxlength="10000">
</field>
<creation><![CDATA[
~custom items need to pick a name
if (tagis[Helper.CustomItem] <> 0) then
field[username].text = "Enter Name"
endif
]]></creation>
<!-- Make sure the choose template has enough width for our names -->
<tag group="SimpleItem" tag="width300"/>
</component>
<component
id="SpecHelper"
name="SpecTree Helper">
<!-- Selection Tag Expressions -->
<field
id="SpecExpr"
name="SpecTree Tag Expression"
type="derived"
maxlength="500">
</field>
</component>
<component
id="Material"
name="Implement Material"
autocompset="yes">
<field
id="matRarityMod"
name="Rarity Modifier"
type="derived"
defvalue="0">
</field>
<field
id="matPriceMod"
name="Price Modifier"
type="derived">
</field>
<identity group="Material"/>
<!-- Track the ability on the actor -->
<eval index="1" phase="Setup" priority="5000"><![CDATA[
perform forward[Material.?]
]]></eval>
<!-- Set the cost for use in the display header -->
<eval index="4" phase="Traits" name="Set Mod Cost" priority="6000"><![CDATA[
~ make sure we're on an item with a gizmo
doneif (parent.isgizmo = 0)
parent.field[grCostMult].value += field[matPriceMod].value
parent.field[grRarity].value += field[matRarityMod].value
]]></eval>
</component>
<component
id="Construction"
name="Construction Type"
autocompset="yes">
<field
id="ctRarityMod"
name="Rarity Modifier"
type="derived"
defvalue="0">
</field>
<field
id="ctPriceMod"
name="Price Modifier"
type="derived">
</field>
<identity group="Construction"/>
<!-- Track the ability on the actor -->
<eval index="1" phase="Setup" priority="5000"><![CDATA[
perform forward[Construction.?]
]]></eval>
<!-- Set the cost for use in the display header -->
<eval index="4" phase="Traits" name="Set Mod Cost" priority="6000"><![CDATA[
~ make sure we're on an item with a gizmo
doneif (parent.isgizmo = 0)
parent.field[grCostMult].value += field[ctPriceMod].value
parent.field[grRarity].value += field[ctRarityMod].value
]]></eval>
</component>
<!-- ItemMod component -->
<component
id="ItemMod"
name="Item Modifications"
autocompset="no">
<!-- Activation state of ability - we're not activated by default -->
<field
id="imodActive"
name="Is Activated?"
type="user"
minvalue="0"
maxvalue="1">
</field>
<field
id="imodRarity"
name="Rarity"
type="derived"
minvalue="0"
maxvalue="10">
</field>
<field
id="imodHPCost"
name="HP Cost of the Item"
type="derived">
</field>
<field
id="imodCost"
name="Cost of the Mod"
type="derived">
</field>
<field
id="imodPaid"
name="Amount Paid for the Item"
type="user">
</field>
<!-- Manage an optional user-assigned name for custom equipment -->
<field
id="imodUserNm"
name="User Name"
maxlength="100"
type="user">
</field>
<!-- This is to place a value for Crew Reduction -->
<field
id="imodValue"
name="Value"
type="user">
</field>
<!-- Manage an optional notes for custom equipment -->
<field
id="imodNotes"
name="Notes"
maxlength="250"
type="user">
</field>
<!-- Manage an optional notes for custom equipment -->
<field
id="imodExpr"
name="Mod Expression"
maxlength="500"
type="derived">
</field>
<!-- Damage bonus -->
<field
id="imodDmgBoTx"
name="Damage Bonus Text"
type="derived"
maxlength="5">
</field>
<identity group="ItemMod"/>
<identity group="Activated"/>
<!-- Add the exclusion for Standard Modifications
<containerreq phase="Initialize" priority="500">
<match>Equipment.StandardMod</match>
!hero#Hero.NoStandardMods
</containerreq> -->
<eval index="1" phase="Initialize" priority="400"><![CDATA[
~empty script, but earlier than scripts on the picks in this gizmo
]]></eval>
<eval index="2" phase="Initialize" priority="500"><![CDATA[
perform forward[Weapon.?]
perform forward[ItemMod.?]
]]></eval>
<!-- Set the actual slot cost and max duplicates for the item where it is based on the vehicle size -->
<eval index="3" phase="Setup" priority="5000" name="Modify slot cost and dups for Size"><![CDATA[
var VehSize as number
var HalfSize as number
var QuartSize as number
var TwiceSize as number
var NegHalfSz as number
var VehHull as number
var HalfHull as number
var VehStrain as number
var HalfStrain as number
if (ispick = 1) then
if (tagis[component.WeaponBase] = 0) then
if (container.parent.tagis[component.Vehicle] <> 0) then
VehSize = container.parent.field[vehSil].value
VehHull = container.parent.field[vehHullThreshold].value
field[grHardpointsOrig].value = field[grHardpointsUsed].value
TwiceSize = VehSize * 2
HalfSize = VehSize / 2
HalfSize = round(HalfSize,0,1)
QuartSize = VehSize / 4
QuartSize = round(QuartSize,0,1)
NegHalfSz = HalfSize * -1
HalfHull = VehHull / 2
HalfHull = round(VehHull,0,1)
endif
endif
endif
]]></eval>
<!-- Set the cost for use in the display header -->
<eval index="4" phase="Traits" name="Set Mod Cost" priority="6000"><![CDATA[
~ make sure we're on an item with a gizmo
doneif (parent.isgizmo = 0)
parent.field[grCost].value += field[imodCost].value
parent.field[grHardpointsUsed].value += field[imodHPCost].value
]]></eval>
<!-- This initializes and manages the user-generated name field,
the Notes field, the Trappings field, and sets up the item type text fields. -->
<eval index="5" phase="Initialize" name="Set User Name/Notes" priority="5000"><![CDATA[
if (field[imodUserNm].isempty = 0) then
trustme
parent.field[grUserName].text = field[imodUserNm].text
endif
~notes
if (field[imodNotes].isempty = 0) then
trustme
parent.field[grNotes].text = splice(field[grNotes].text,field[imodNotes].text,"; ")
endif
]]></eval>
<!-- If the mod is activated, designate it appropriately -->
<eval index="6" phase="Setup" priority="100"><![CDATA[
~if we're not able to be activated, we don't qualify
doneif (tagis[User.Activation] = 0)
~if we've been activated by the user, mark ourselves as activated; in addition,
~forward our identity tag to our parent actor; this allows the actor to track
~when abilities are activated and reflect the state to the user
if (field[imodActive].value <> 0) then
perform assign[Helper.Activated]
perform forward[Activated.?]
endif
]]></eval>
<evalrule index="1" phase="Validate" priority="9000" message="Modification exceeds limit on number of uses per item."><![CDATA[
var totaluses as number
~if (empty(field[grDupMax].text) = 1) then
~ @valid = 1
~ endif
~totaluses = container.intersect[ItemMod,ItemMod,counttarget]
~if (totaluses <= field[grDupMax].text) then
@valid = 1
~ endif
]]></evalrule>
</component>
<component
id="ItemModHelper"
name="Item Mod Helper"
autocompset="yes">
<field
id="imhItemName"
name="Item Name"
maxlength="100"
type="derived">
</field>
<field
id="imhUserName"
name="Item Name"
maxlength="100"
type="user">
</field>
<field
id="imhMaxHP"
name="Max Hardpoints"
type="derived">
</field>
<field
id="imhUsedHP"
name="Used Hardpoints"
type="derived">
</field>
<field
id="imhExpr"
name="Expression"
maxlength="500"
type="derived">
</field>
<field
id="imhImpMaterial"
name="Implement Material"
maxlength="500"
type="derived"
defvalue="component.Material">
</field>
<field
id="imhConstExpr"
name="Construction Type Expression"
maxlength="500"
type="derived">
</field>
<eval index="1" phase="Initialize" priority="2100"><![CDATA[
perform forward[ItemMod.ItemModHelper]
field[imhImpMaterial].text = "component.Material"
if (parent.tagis[component.WeaponBase] <> 0) then
field[imhConstExpr].text = "ConType.Weapon"
elseif (parent.tagis[component.Armor] <> 0) then
field[imhConstExpr].text = "ConType.Armor"
else
field[imhConstExpr].text = "ConType.Dummy"
endif
]]></eval>
<eval index="2" phase="Render" priority="10000"><![CDATA[
~ notify parent.field[name].text
field[imhItemName].text = parent.field[name].text
]]></eval>
<eval index="3" phase="Setup" priority="5000"><![CDATA[
~ notify parent.field[name].text
trustme
parent.field[UserName].text = field[imhUserName].text
]]></eval>
<eval index="4" phase="Initialize" priority="100"><![CDATA[
~empty script, but earlier than scripts on the picks in this gizmo
]]></eval>
<!-- <eval index="2" phase="Final" priority="1000"><![CDATA[
~ compile all item mod notes and transfer to parent
var itmNotes as string
foreach pick in container from ItemMod
itmNotes = splice(itmNotes,eachpick.field[name].text,", ")
nexteach
doneif (empty(itmNotes) <> 0)
~ parent.field[grNotes].text = "Item Stress (" & itmNotes & ")"
notify parent.field[name].text & " - " & itmNotes
]]></eval> -->
</component>
<!-- Define various component sets associated with the components defined above.
-->
<!-- The "Resource" compset is auto-defined for the component -->
<!-- The "Damage" compset is auto-defined for the component -->
<!-- The "UserImage" compset is auto-defined for the component -->
<!-- The "Simple" compset is auto-defined for the component -->
<!-- The "Mechanic" compset is auto-defined for the component -->
<!-- Journal - all journal entries are based on this compset -->
<compset
id="Journal">
<compref component="Journal"/>
</compset>
<!-- Transact - all transactions utilize this compset -->
<compset
id="Transact">
<compref component="Transact"/>
</compset>
<compset
id="ItemMod">
<compref component="ItemMod"/>
</compset>
</document>