-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnpcactions.php
90 lines (69 loc) · 3.19 KB
/
npcactions.php
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
<?php
$filename = "npcactions.html";
$start = 1;
$max = 20;
$file = file_get_contents($filename);
$wrapper_start = <<<END
END;
$action_rows = <<<'END'
<!-- BEGIN npc action row -->
<div class="sheet-npc-row">
<div class="sheet-row">
<div class="sheet-col-1-12 sheet-center sheet-small-label sheet-vert-bottom">Row</div>
<div class="sheet-col-1-2 sheet-center sheet-small-label sheet-vert-bottom">Name</div>
<div class="sheet-col-1-6 sheet-center sheet-small-label sheet-vert-bottom">Action Type</div>
<div class="sheet-col-1-6 sheet-center sheet-small-label sheet-vert-bottom">Multiattack?</div>
<div class="sheet-col-1-12 sheet-center sheet-small-label sheet-vert-bottom">Macro</div>
</div>
<div class="sheet-row">
<div class="sheet-col-1-12 sheet-center sheet-small-label sheet-margin-top">CURRENTROW</div>
<div class="sheet-col-1-2 sheet-center"><input type="text" class="sheet-center" name="attr_npc_action_nameCURRENTROW"></div>
<div class="sheet-col-1-6">
<select name="attr_npc_action_typeCURRENTROW">
<option value="(Normal Action) " selected="selected">Normal</option>
<option value="(Bonus Action) ">Bonus</option>
<option value="(Reaction) ">Reaction</option>
<option value="(Lair Action) ">Lair</option>
<option value="(Legendary Action) ">Legendary</option>
<option value="(Special Action) ">Other/Special</option>
</select>
</div>
<div class="sheet-col-1-6 sheet-center sheet-checkbox-row">
<input type="checkbox" name="attr_npc_action_multiattackCURRENTROW" value="{{npc_showmultiattack=1}} {{npc_multiattack=@{npc_multiattack}}}" \>
</div>
<div class="sheet-col-1-12 sheet-center"><button type="roll" class="sheet-roll" name="roll_NPCActionCURRENTROW" value="/w GM &{template:5eDefault} {{npcaction=1}} {{title=@{npc_action_nameCURRENTROW}}} {{subheader=@{character_name}}} {{subheaderright=@{npc_action_typeCURRENTROW}}} @{npc_action_multiattackCURRENTROW} {{npc_action_description=@{npc_action_descriptionCURRENTROW}}} {{npc_action_effect=@{npc_action_effectCURRENTROW}}}" >Use</button></div>
</div>
<div class="sheet-row">
<div class="sheet-col-5-12 sheet-offset-1-12 sheet-center sheet-small-label sheet-vert-bottom">Description</div>
<div class="sheet-col-5-12 sheet-center sheet-small-label sheet-vert-bottom">Effect</div>
</div>
<div class="sheet-row">
<div class="sheet-col-5-12 sheet-offset-1-12 sheet-margin-top"><textarea class="sheet-medium-textarea" name="attr_npc_action_descriptionCURRENTROW"></textarea></div>
<div class="sheet-col-5-12 sheet-margin-top"><textarea class="sheet-medium-textarea" name="attr_npc_action_effectCURRENTROW"></textarea></div>
</div>
</div>
<!-- END npc action row -->
END;
$wrapper_end = <<<END
<hr/>
END;
$full_output = "";
// action loop
for ($i=$start; $i<=$max; $i++)
{
$return_text = "";
if (($i==1) )
{
//Add start of section wrapper
$return_text .= $wrapper_start;
}
$return_text .= $action_rows;
// Replace placeholders with correct values
$return_text = str_replace("CURRENTROW", $i, $return_text);
$full_output .= $return_text;
}
$full_output .= $wrapper_end;
//echo $full_output;
$file = $full_output;
file_put_contents($filename, $file);
?>