-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathspells.php
352 lines (302 loc) · 19.8 KB
/
spells.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
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
<?php
$filename = "spells.html";
$start = 0;
$max = 9;
$current_page = 0;
$selected_spell_level = " selected=\"selected\"";
$spell_level_array = array (
0 => "Cantrip",
1 => "Level 1",
2 => "Level 2",
3 => "Level 3",
4 => "Level 4",
5 => "Level 5",
6 => "Level 6",
7 => "Level 7",
8 => "Level 8",
9 => "Level 9",
);
$file = file_get_contents($filename);
$wrapper_start = <<<END
<!-- BEGIN new spell page -->
<div class="sheet-spell-pagePAGENUMBER">
END;
$wrapper_end = <<<END
</div>
<!-- END spell page -->
END;
$spell_row = <<<'END'
<div class="sheet-row sheet-spell-header">
<div class="sheet-col-1 sheet-vert-bottom sheet-center sheet-small-label">SPELLLEVEL</div>
</div>
<fieldset class="repeating_spellbookSPELLSHORTLEVEL">
<!-- BEGIN spell row -->
<div class="sheet-margin-bottom sheet-padr sheet-padl">
<div class="sheet-row">
<div class="sheet-col-1-12 sheet-vert-bottom sheet-center sheet-small-label">Spell Level</div>
<div class="sheet-col-1-3 sheet-vert-bottom sheet-center sheet-small-label">Spell name</div>
<div class="sheet-col-1-8 sheet-vert-bottom sheet-center sheet-small-label">School</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Cast time</div>
<div class="sheet-col-1-12 sheet-vert-bottom sheet-center sheet-small-label" title="Concentration">Conc?</div>
<div class="sheet-col-1-12 sheet-vert-bottom sheet-center sheet-small-label">Ritual?</div>
<div class="sheet-col-1-8 sheet-vert-bottom sheet-center sheet-small-label">Prepared?</div>
</div>
<div class="sheet-row">
<div class="sheet-col-1-12 sheet-vert-middle sheet-center">FRIENDLYLEVEL<input type="hidden" name="attr_spellbaselevel" value="PAGENUMBER"><input type="hidden" name="attr_spellfriendlylevel" value="FRIENDLYLEVEL"></div>
<div class="sheet-col-1-3 sheet-vert-middle"><input type="text" class=" sheet-center" name="attr_spellname"></div>
<div class="sheet-col-1-8 sheet-vert-middle">
<select name="attr_spellschool">
<option value="" selected="selected">n/a</option>
<option value="Abjuration">Abjuration</option>
<option value="Conjuration">Conjuration</option>
<option value="Divination">Divination</option>
<option value="Enchantment">Enchantment</option>
<option value="Evocation">Evocation</option>
<option value="Illusion">Illusion</option>
<option value="Necromancy">Necromancy</option>
<option value="Transmutation">Transmutation</option>
</select>
</div>
<div class="sheet-col-1-6 sheet-vert-middle"><input type="text" class="sheet-center" name="attr_spellcasttime"></div>
<div class="sheet-col-1-12 sheet-checkbox-row">
<select name="attr_spellconcentration">
<option value="" selected="selected">No</option>
<option value="(Concentration)">Yes</option>
</select>
</div>
<div class="sheet-col-1-12 sheet-checkbox-row">
<select name="attr_spellritual">
<option value="" selected="selected">No</option>
<option value="(Ritual)">Yes</option>
</select>
</div>
<div class="sheet-col-1-8 sheet-vert-middle" title="Always prepared means the spell is either a cantrip or one that was provided to you via a method which indicated it would never count against your prepared/known limits.">
<select name="attr_spellisprepared"DISABLEPREP>
<option value="1">Yes</option>
<option value="0"SELECTEDPREPNO>NO</option>
<option value="0.0001"SELECTEDPREPALWAYS>Always</option>
</select>
</div>
</div>
<div class="sheet-row">
<div class="sheet-col-1-8 sheet-vert-bottom sheet-center sheet-small-label">Gained from</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Target/Area of Effect</div>
<div class="sheet-col-1-8 sheet-vert-bottom sheet-center sheet-small-label">Range</div>
<div class="sheet-col-1-8 sheet-vert-bottom sheet-center sheet-small-label">Duration</div>
<div class="sheet-col-1-8 sheet-vert-bottom sheet-center sheet-small-label">Components</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Spell Info</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Cast Spell</div>
</div>
<div class="sheet-row">
<div class="sheet-col-1-8 sheet-vert-middle" title="Use this field to indicate where you learned or have access to this spell from. Useful to know if multiclassing or if you gain access to spells your class would not normally have thanks to subclass bonuses">
<select name="attr_spellgainedfrom">
<option value="Not Set">Not Set</option>
<option value="Arcane Trickster">Arcane Trickster</option>
<option value="Bard">Bard</option>
<option value="Cleric">Cleric</option>
<option value="Druid">Druid</option>
<option value="Eldritch Knight">Eldritch Knight</option>
<option value="Paladin">Paladin</option>
<option value="Ranger">Ranger</option>
<option value="Sorcerer">Sorcerer</option>
<option value="Warlock">Warlock</option>
<option value="Wizard">Wizard</option>
<option value="Other Source">Other</option>
</select>
</div>
<div class="sheet-col-1-6 sheet-vert-middle"><input type="text" class="sheet-center" name="attr_spelltarget"></div>
<div class="sheet-col-1-8 sheet-vert-middle"><input type="text" class="sheet-center" name="attr_spellrange"></div>
<div class="sheet-col-1-8 sheet-vert-middle"><input type="text" class="sheet-center" name="attr_spellduration"></div>
<div class="sheet-col-1-8 sheet-vert-middle"><input type="text" class="sheet-center" name="attr_spellcomponents"></div>
<div class="sheet-col-1-6 sheet-vert-middle sheet-center"><button type="roll" class="sheet-roll" name="roll_SpellInfo" value="&{template:5eDefault} {{spell=1}} {{spellshowinfoblock=1}} {{spellshowdesc=1}} {{spellshowhigherlvl=1}} {{character_name=@{character_name}}} {{emote=looks at the instructions for a spell}} {{title=@{spellname}}} {{subheader=@{character_name}}} {{subheaderright=@{spellschool} @{spellfriendlylevel}}} {{subheader2=@{spellconcentration} @{spellritual}}} {{spellcasttime=@{spellcasttime}}} {{spellduration=@{spellduration}}} {{spelltarget=@{spelltarget}}} {{spellrange=@{spellrange}}} {{spellgainedfrom=@{spellgainedfrom}}} {{spellcomponents=@{spellcomponents}}} {{spelldescription=@{spelldescription}}} {{spellhigherlevel=@{spellhighersloteffect}}} @{classactionspellinfo}">Spell Info</button></div>
<div class="sheet-col-1-6 sheet-vert-middle sheet-center"><button type="roll" class="sheet-roll" name="roll_SpellCast" value="&{template:5eDefault} {{spell=1}} {{title=@{spellname}}} {{subheader=@{character_name}}} {{subheaderright=@{spellschool} @{spellfriendlylevel}}} {{subheader2=@{spellconcentration} @{spellritual}}} @{spellcastmacrooptions} {{spellcasttime=@{spellcasttime}}} {{spellduration=@{spellduration}}} {{spelltarget=@{spelltarget}}} {{spellrange=@{spellrange}}} {{spellgainedfrom=@{spellgainedfrom}}} {{spellcomponents=@{spellcomponents}}} @{classactionspellcast}">Cast Spell</button></div>
</div>
<div class="sheet-row sheet-padb sheet-spell-macro-output-options">
<div class="sheet-col-1-8 sheet-vert-middle sheet-small-label sheet-padl">Spellcast macro display options</div>
<div class="sheet-col-1-12 sheet-center sheet-small-label">Info block<br/><input type="checkbox" name="attr_spellshowinfoblock" value="{{spellshowinfoblock=1}}"/></div>
<div class="sheet-col-1-12 sheet-center sheet-small-label">Description<br><input type="checkbox" name="attr_spellshowdesc" value="{{spellshowdesc=1}} {{spelldescription=@{spelldescription}}}"/></div>
<div class="sheet-col-1-8 sheet-center sheet-small-label">At higher levels<br><input type="checkbox" name="attr_spellshowhigherlvl" value="{{spellshowhigherlvl=1}} {{spellhigherlevel=@{spellhighersloteffect}}}" /></div>
<div class="sheet-col-1-12 sheet-center sheet-small-label">Attack roll<br/><input type="checkbox" name="attr_spellshowattack" value="{{spellshowattack=1}} {{spellattack=[[1d20 + [[@{attackstat}]] + [[@{PB}]] + [[(@{global_spell_attack_bonus})]] ]]}}" /></div>
<div class="sheet-col-1-8 sheet-center sheet-small-label">2nd Attack roll<br/><input type="checkbox" name="attr_spellshowattackadv" value="{{spellshowattackadv=1}} {{spellattackadv=[[1d20 + [[@{attackstat}]] + [[@{PB}]] + [[(@{global_spell_attack_bonus})]] ]]}}" /></div>
<div class="sheet-col-1-8 sheet-center sheet-small-label">Saving throw<br/><input type="checkbox" name="attr_spellshowsavethrow" value="{{spellshowsavethrow=1}} {{spellsavedc=[[@{spellsavedc} + @{customsavedc}]]}} {{spellsavestat=@{savestat}}} {{spellsavesuccess=@{savesuccess}}}" /></div>
<div class="sheet-col-1-12 sheet-center sheet-small-label">Healing<br/><input type="checkbox" name="attr_spellshowhealing" value="{{spellshowhealing=1}} {{spellhealing=[[@{spellhealamount} + @{healstatbonus}]]}}" /></div>
<div class="sheet-col-1-12 sheet-center sheet-small-label">Damage<br/><input type="checkbox" name="attr_spellshowdamage" value="{{spellshowdamage=1}} {{spelldamage=[[@{damage} + [[@{damagestatbonus}]] + @{damagemiscbonus} + [[(@{global_spell_damage_bonus})]] ]] @{damagetype}}} @{spellcancrit}" /></div>
<div class="sheet-col-1-12 sheet-center sheet-small-label">Effects<br/><input type="checkbox" name="attr_spellshoweffects" value="{{spellshoweffects=1}} {{spelleffect=@{spelleffect}}}" /></div>
<input type="hidden" name="attr_spellcastmacrooptions" value="@{spellshowinfoblock} @{spellshowdesc} @{spellshowhigherlvl} @{spellshowattack} @{spellshowattackadv} @{spellshowsavethrow} @{spellshowhealing} @{spellshowdamage} @{spellshoweffects}" />
</div>
<span class="sheet-spacer"></span>
<span class="sheet-small-label">Show :</span>
<input type="checkbox" name="attr_spelltypeadvanced" class="sheet-spelltypetab sheet-spelltypeadvanced" value="1"/><span class="sheet-spelltypetab sheet-spelltypeadvanced">Description</span> |
<input type="checkbox" name="attr_spelltypeattack" class="sheet-spelltypetab sheet-spelltypeattack" value="1"/><span class="sheet-spelltypetab sheet-spelltypeattack">Attack</span>
<input type="checkbox" name="attr_spelltypesave" class="sheet-spelltypetab sheet-spelltypesave" value="1"/><span class="sheet-spelltypetab sheet-spelltypesave">Save</span>
<input type="checkbox" name="attr_spelltypeheal" class="sheet-spelltypetab sheet-spelltypeheal" value="1"/><span class="sheet-spelltypetab sheet-spelltypeheal">Healing</span> |
<input type="checkbox" name="attr_spelltypdamage" class="sheet-spelltypetab sheet-spelltypedamage" value="1"/><span class="sheet-spelltypetab sheet-spelltypedamage">Damage</span>
<input type="checkbox" name="attr_spelltypeeffects" class="sheet-spelltypetab sheet-spelltypeeffects" value="1"/><span class="sheet-spelltypetab sheet-spelltypeeffects">Effects</span>
<span class="sheet-spacer"></span>
<div class="sheet-spell-type-advanced">
<div class="sheet-row">
<div class="sheet-col-1-2 sheet-vert-bottom sheet-center sheet-small-label">Spell Description/Flavour</div>
<div class="sheet-col-1-2 sheet-vert-bottom sheet-center sheet-small-label">Higher Spell Slot Effect</div>
</div>
<div class="sheet-row">
<div class="sheet-col-1-2 sheet-small-label sheet-center"><textarea class="sheet-medium-textarea" name="attr_spelldescription"></textarea></div>
<div class="sheet-col-1-2 sheet-small-label sheet-center"><textarea name="attr_spellhighersloteffect" class="sheet-medium-textarea"></textarea></div>
</div>
</div>
<div class="sheet-spell-type-attack">
<div class="sheet-row">
<div class="sheet-col-1-6 sheet-offset-2-3 sheet-vert-bottom sheet-center sheet-small-label">Attack Stat</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label"> </div>
</div>
<div class="sheet-row">
<div class="sheet-col-2-3"><p class="sheet-small-note sheet-margin-top">Select the attack stat for the attack. This is normally your spellcasting stat from the class you gained the spell from.</p></div>
<div class="sheet-col-1-6 sheet-small-label sheet-center">
<select name="attr_attackstat">
<option value="0">None</option>
<option value="@{strength_mod}">STR</option>
<option value="@{dexterity_mod}">DEX</option>
<option value="@{constitution_mod}">CON</option>
<option value="@{intelligence_mod}">INT</option>
<option value="@{wisdom_mod}">WIS</option>
<option value="@{charisma_mod}">CHA</option>
</select>
</div>
</div>
</div>
<div class="sheet-spell-type-save">
<div class="sheet-row">
<div class="sheet-col-1-12 sheet-center sheet-small-label">Saving Stat</div>
<div class="sheet-col-1-6 sheet-center sheet-small-label">Save DC</div>
<div class="sheet-col-1-12 sheet-center sheet-small-label">Custom DC</div>
<div class="sheet-col-1-2 sheet-center sheet-small-label">On a successful save</div>
<div class="sheet-col-1-6 sheet-center sheet-small-label"> </div>
</div>
<div class="sheet-row">
<div class="sheet-col-1-12">
<select name="attr_savestat">
<option value="STR">STR</option>
<option value="DEX">DEX</option>
<option value="CON">CON</option>
<option value="INT">INT</option>
<option value="WIS">WIS</option>
<option value="CHA">CHA</option>
</select>
</div>
<div class="sheet-col-1-6" title="Pick the class that the save DC will be created from or set your own DC by selecting custom here and then entering the DC in the next field">
<select name="attr_spellsavedc">
<option value="0">Choose...</option>
<option value="@{arcane_trickster_spell_dc}">Arcane Trickster DC</option>
<option value="@{bard_spell_dc}">Bard DC</option>
<option value="@{cleric_spell_dc}">Cleric DC</option>
<option value="@{druid_spell_dc}">Druid DC</option>
<option value="@{eldritch_knight_spell_dc}">Eldritch Knight DC</option>
<option value="@{paladin_spell_dc}">Paladin DC</option>
<option value="@{ranger_spell_dc}">Ranger DC</option>
<option value="@{sorcerer_spell_dc}">Sorcerer DC</option>
<option value="@{warlock_spell_dc}">Warlock DC</option>
<option value="@{wizard_spell_dc}">Wizard DC</option>
<option value="0">Custom DC</option>
</select>
</div>
<div class="sheet-col-1-12"><input type="number" name="attr_customsavedc" value="0" min="0" step="1" title="Unless you have selected Custom in the previous field this should always be 0"></div>
<div class="sheet-col-1-2"><input type="text" class="sheet-center" name="attr_savesuccess"></div>
</div>
</div>
<div class="sheet-spell-type-heal">
<div class="sheet-row">
<div class="sheet-col-1-3 sheet-offset-1-4 sheet-vert-bottom sheet-center sheet-small-label">Heal amount</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Stat Bonus</div>
<div class="sheet-col-1-6 sheet-offset-1-12 sheet-vert-bottom sheet-center sheet-small-label"> </div>
</div>
<div class="sheet-row">
<div class="sheet-col-1-3 sheet-offset-1-4 sheet-small-label sheet-center"><input type="text" class="sheet-center" name="attr_spellhealamount" value="0"></div>
<div class="sheet-col-1-6 sheet-center">
<select name="attr_healstatbonus">
<option value="0">None</option>
<option value="@{strength_mod}">STR mod</option>
<option value="@{dexterity_mod}">DEX mod</option>
<option value="@{constitution_mod}">CON mod</option>
<option value="@{intelligence_mod}">INT mod</option>
<option value="@{wisdom_mod}">WIS mod</option>
<option value="@{charisma_mod}">CHA mod</option>
</select>
</div>
</div>
</div>
<div class="sheet-spell-type-damage">
<div class="sheet-row">
<div class="sheet-offset-1-12 sheet-col-1-12 sheet-vert-bottom sheet-center sheet-small-label">Can Crit?</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Damage Dice</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Stat Bonus</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Other Bonus</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label">Damage Type</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label"> </div>
</div>
<div class="sheet-row">
<div class=" sheet-offset-1-12 sheet-col-1-12 sheet-checkbox-row"><input type="checkbox" name="attr_spellcancrit" value="{{spellcancrit=1}} {{spellcritdamage=Additional [[@{damage}]] damage}}" checked="checked"/></div>
<div class="sheet-col-1-6 sheet-small-label sheet-center"><input type="text" class="sheet-center" name="attr_damage" value="0"></div>
<div class="sheet-col-1-6">
<select name="attr_damagestatbonus">
<option value="0">None</option>
<option value="@{strength_mod}">STR mod</option>
<option value="@{dexterity_mod}">DEX mod</option>
<option value="@{constitution_mod}">CON mod</option>
<option value="@{intelligence_mod}">INT mod</option>
<option value="@{wisdom_mod}">WIS mod</option>
<option value="@{charisma_mod}">CHA mod</option>
</select>
</div>
<div class="sheet-col-1-6 sheet-small-label sheet-center"><input type="number" class="sheet-center" name="attr_damagemiscbonus" value="0" step="1"></div>
<div class="sheet-col-1-6 sheet-small-label sheet-center"><input type="text" class="sheet-center" name="attr_damagetype"></div>
</div>
</div>
<div class="sheet-spell-type-effects">
<div class="sheet-row">
<div class="sheet-col-5-6 sheet-vert-bottom sheet-center sheet-small-label">Spell Effects</div>
<div class="sheet-col-1-6 sheet-vert-bottom sheet-center sheet-small-label"> </div>
</div>
<div class="sheet-row">
<div class="sheet-col-1 sheet-small-label sheet-center"><textarea name="attr_spelleffect" class="sheet-medium-textarea">None</textarea></div>
</div>
</div>
</div>
<!-- END spell row -->
</fieldset>
END;
$full_output = "";
for ($i=$start; $i<=$max; $i++)
{
// Reset current loop vars
$return_text = "";
if ($current_page == 0) $friendly_level = "Cantrip";
else $friendly_level = "Level ". $current_page;
// Add start of page wrapper
$return_text .= $wrapper_start;
// Add repeating section
$return_text .= $spell_row;
//Add end of page wrapper
$return_text .= $wrapper_end;
// Replace placeholders with correct values
$return_text = str_replace("PAGENUMBER", $current_page, $return_text);
$return_text = str_replace("SPELLLEVEL", $spell_level_array[$current_page], $return_text);
$return_text = str_replace("FRIENDLYLEVEL", $friendly_level, $return_text);
$return_text = str_replace("SPELLSHORTLEVEL", strtolower(str_replace(" ", "", $spell_level_array[$current_page])), $return_text);
if ($current_page == 0)
{
$return_text = str_replace("DISABLEPREP", ' disabled="disabled"', $return_text);
$return_text = str_replace("SELECTEDPREPNO", '', $return_text);
$return_text = str_replace("SELECTEDPREPALWAYS", ' selected="selected"', $return_text);
}
else
{
$return_text = str_replace("DISABLEPREP", '', $return_text);
$return_text = str_replace("SELECTEDPREPALWAYS", '', $return_text);
$return_text = str_replace("SELECTEDPREPNO", ' selected="selected"', $return_text);
}
$full_output .= $return_text;
$current_page++;
}
//echo $full_output;
$file = $full_output;
file_put_contents($filename, $file);
?>