forked from suldae/Roll20-RMSS-Sheet-Working
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSheetWorkerTracing.txt
358 lines (278 loc) · 30.3 KB
/
SheetWorkerTracing.txt
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
// <!-- Stat Mod Calculation -->
function StatMod(stat)// Takes Stat total, returns bonus (base bonus).
// <!-- Stat Calculation -->
function StatCalc(base, racial, special)// Takes base stat, racial bonus, special bonus, returns total bonus.
// <!-- Generic Skill - Rank Bonus Calculation -->
function GenSkillMod(rank, prog0, prog10, prog20, prog30, prog31) // takes skill rank and progression and returns rank bonus
// <!-- Body Dev Progression Setup -->
function BodyDevProgMod(racialindex, pindex, currentval)// takes racial index (my value) and progression index and returns current rank modifier. Passes through the current value if the race is set to "custom" rather than one of the premades
// <!-- Set Realm -->
function SetRealm(rselect, intmod, empmod, premod)// takes realm selection, in mod, em mod, and pr mod and returns proper realm bonus depending upon selected realm and current stats.
// <!-- Power Point Dev Progression Setup -->
function PPDevProgMod(rselect, racialindex, pindex, currentval)// takes realm selection, racial index (my value), and progression index and returns current rank modifier. Passes through the current value if the race is set to "custom" rather than one of the premades
// <!-- Race Fixed Info (Stat, RR bonuses + Soul Departure/Recovery Multiplier) Setup -->
function RaceFixedInfoSetup(racialindex, index, currentval)// takes racial index and a value index for which stat/resistance/etc and returns the value for that race. Passes through the current value if race is set to a non-supported/custom race.
// <!-- Profession Bonus for Skill Categories Setup -->
function ProfessionInfoSetup(professionindex, index, currentval)// takes a profession index and an index for which skill category and returns Profession bonus for that skill/profession combo.
// <!---- Calc skill bonus from ranks/progression (use GenSkillMod to calc the actual value) ---->
function SkillChange(name)// takes skill name. <getAttrs/setAttrs> Sets skill bonus (calls GenSkillMod to calc that bonus)
// Update the dropdown stats for the skills since they got renamed and we don't want to lose data NYI
function FixDropdownStats(name)// takes the statname from the dropdown and figures out whati's real name and value are, then sets them. <getAttrs/setAttrs> (not currently called; the calls are not in.)
// <!---- Calc total skill bonus ------->
function CalcTotalBonus(name)//takes skill name. Calculates and sets total skill bonus. <getAttrs/setAttrs> **this one potentially fires a lot**
// <!-- change the skill stat when the skill dropdown changes -->
function DropdownStatChange(statname)// takes stat name. changes to new stat value when dropdown is changed. <getAttrs/setAttrs> *This one has some GiGs updates already though a todo listed still*
// <!---- Copy Offensive Bonus from skill to attack if you can find it ---->
function WeaponOBCopy(attack)// takes attack slot. If weapon copy is set, tries to find corresponding skill and copy it to attack Offensive bonus field. <big getAttrs/setAttrs at end w/ switch statement inbetween>
// <!---- Set up Attack type and Roll type ---->
function AttackTypeSetup(attack)// takes attack slot. fills out attack calculation, attack roll, and type fields for building the attack macros. <getAttrs/setAttrs at end w/ switch inbetween>
// <!---- Set up breakage number calculations for the attack macro ---->
function BreakageMacroSetup(attack)// takes attack slot. sets up breakage check for attack macros if breakage numbers are entered. <getAttrs (probably read more than needed)/setAttrs at end of switch>
// <!-- if the Breakage number for an Attack changes, change the breakage macro calculation -->
on ('sheet:opened', // setup the events to watch for the breakage numbers of an attack to change; if they do, run the BreakageMacroSetup function.
// <!-- if the type for an Attack changes, change the attack calculation -->
on ('sheet:opened', // set up events to watch for an attack type to change. if they do, run AttackTypeSetup function.
// <!-- if the name for an Attack changes, check if you can find an OB/skill to copy in for it -->
on ('sheet:opened', // set up events to watch for an attack (name) to change. If one does, run WeaponOBCopy function to try and copy the ob over.
// <!-- Update copied OB if the weapon/attack skill changes. Have to check them all since don't know if/where the attack might be -->
on ('change:<all handled attack skills> change:copyob', // if any of the handled attack skills change, getAttrs to see if we are allowed to copy the OB over, if are, then run WeaponOBCopy on all the attacks to see if that skill is in one of them/copy the ob over. ** I have a feeling there could be a better way to do this, but what it is?? **
// <!---- Copy Armor from Primary/Secondary/Tertiary to Worn ---->
on('change:activearmor', // If one of the armor-set checkboxes is clicked, copy over the information from that column to the worn (active) column. <getAttrs/setAttrs> fixed this; Gigs approved new code.
// <!-- Recalc skills -->
on('change:skillrecalc', // it clears the checkbox. a different function actually does the work. <getAttrs/setAttrs>
// <!-- Update stats for skills with stat dropdowns -->
on ('sheet:opened', // setup change events for skill which have custom skill options and stat changes to update the skills if either the skill or the stat changes. Also do it when the skill recalc button is clicked. runs DropDownStatChange for the actual change.
// <!-- Stat calculation/update for Categories (stat1+stat2) and skills (stat) -->
on('change:agbonus change:variablestatbonuscalc change:skillrecalc', // when the total agility bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff.
//Agility-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:cobonus change:variablestatbonuscalc change:skillrecalc', // when the total constitution bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff. //Constitution-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:embonus change:variablestatbonuscalc change:skillrecalc', // when the total empathy bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff.
//Empathy-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:inbonus change:variablestatbonuscalc change:skillrecalc', // when the total intuition bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff. //Intuition-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:mebonus change:variablestatbonuscalc change:skillrecalc', // when the total memory bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff. //Memory-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:prbonus change:variablestatbonuscalc change:skillrecalc', // when the total presence bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff. //Presence-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:qubonus change:variablestatbonuscalc change:skillrecalc', // when the total quickness bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff. //Quickness-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:rebonus change:variablestatbonuscalc change:skillrecalc', // when the total reasoning bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff. //Reasoning-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:sdbonus change:variablestatbonuscalc change:skillrecalc', // when the total self discipline bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff.
//Self Discipline-based Categories
// <!-- Stat calculation for Categories (stat1+stat2) -->
on('change:stbonus change:variablestatbonuscalc change:skillrecalc', // when the total strength bonus changes or the sheet is switched between skill/category 3rd stat or the recalc button is tripped, get al the relavant attributes and write out the appropriate stat bonus values. Both categories and skills. <getAttrs/setAttrs> needs some rewriting to fix the parseInt stuff. //Strength-based Categories
// <!-- if powerpoint development total changes, update powerpoints-->
on('change:ppdev change:ppmult', // if power point development or power point multiplier values change, recalculate the power points. <getAttrs/setAttrs>
// <!-- if realm (bonus) changes, update things-->
on('change:realm change:skillrecalc', // if the realm is changed or the recalc button clicked, the realm stat value needs to be propagated through powerpoint development and the various spell casting skills. <getAttrs/setAttrs>
// when a category changes, the total category bonus needs to be copied down to each of the skills in the category. <getAttrs/setAttrs>
// <!-- Copy over Armor-Heavy Category Bonus-->
on('change:cat-armor-heavy',
// <!-- Copy over Armor-Light Category Bonus-->
on('change:cat-armor-light',
// <!-- Copy over Armor-Medium Category Bonus-->
on('change:cat-armor-med',
// <!-- Copy over Artistic-Active Category Bonus-->
on('change:cat-artistic-active',
// <!-- Copy over Artistic-Passive Category Bonus-->
on('change:cat-artistic-passive',
// <!-- Copy over Athletic-Brawn Category Bonus-->
on('change:cat-athletic-brawn',
// <!-- Copy over Athletic-Endurance Category Bonus-->
on('change:cat-athletic-endur',
// <!-- Copy over Athletic-Gymnastics Category Bonus-->
on('change:cat-athletic-gym',
// <!-- Copy over Awareness-Perception Category Bonus-->
on('change:cat-aware-percept',
// <!-- Copy over Awareness-Searching Category Bonus-->
on('change:cat-aware-search',
// <!-- Copy over Awareness-Senses Category Bonus-->
on('change:cat-aware-senses',
// <!-- Copy over Combat-Maneuvers Category Bonus-->
on('change:cat-combat-maneuvers',
// <!-- Copy over Communications Category Bonus-->
on('change:cat-communications',
// <!-- Copy over Crafts Category Bonus-->
on('change:cat-crafts',
// <!-- Copy over Directed Spells Category Bonus-->
on('change:cat-directed-spells',
// <!-- Copy over Influence Category Bonus-->
on('change:cat-influence',
// <!-- Copy over Lore-General Category Bonus-->
on('change:cat-lore-general',
// <!-- Copy over Lore-Magical Category Bonus-->
on('change:cat-lore-magical',
// <!-- Copy over Lore-Obscure Category Bonus-->
on('change:cat-lore-obscure',
// <!-- Copy over Lore-Technical Category Bonus-->
on('change:cat-lore-technical',
// <!-- Copy over Martial Arts-Striking Category Bonus-->
on('change:cat-ma-striking',
// <!-- Copy over Martial Arts-Sweeps Category Bonus-->
on('change:cat-ma-sweeps',
// <!-- Copy over Outdoor-Animal Category Bonus-->
on('change:cat-outdoor-animal',
// <!-- Copy over Outdoor-Environmental Category Bonus-->
on('change:cat-outdoor-environ',
// <!-- Copy over Power Awareness Category Bonus-->
on('change:cat-power-awareness',
// <!-- Copy over Power Manipulation Category Bonus-->
on('change:cat-power-manipulation',
// <!-- Copy over Science-Basic Category Bonus-->
on('change:cat-science-basic',
// <!-- Copy over Science-Specialized Category Bonus-->
on('change:cat-science-specialized',
// <!-- Copy over Self-Control Category Bonus-->
on('change:cat-self-control',
// <!-- Copy over Special-Attacks Category Bonus-->
on('change:cat-special-attacks',
// <!-- Copy over Special-Defenses Category Bonus-->
on('change:cat-special-defenses',
// <!-- Copy over Subterfuge-Attack Category Bonus-->
on('change:cat-subterfuge-attack',
// <!-- Copy over Subterfuge-Mechanics Category Bonus-->
on('change:cat-subterfuge-mechanics',
// <!-- Copy over Subterfuge-Stealth Category Bonus-->
on('change:cat-subterfuge-stealth',
// <!-- Copy over Technical/Trade-General Category Bonus-->
on('change:cat-tech-general',
// <!-- Copy over Technical/Trade-Professional Category Bonus-->
on('change:cat-tech-professional',
// <!-- Copy over Technical/Trade-Vocational Category Bonus-->
on('change:cat-tech-vocational',
// <!-- Copy over Urban Category Bonus-->
on('change:cat-urban',
// <!-- Copy over Weapon-1-H Concussion Category Bonus-->
on('change:cat-weapon-1hconcussion',
// <!-- Copy over Weapon-1-H Edged Category Bonus-->
on('change:cat-weapon-1hedged',
// <!-- Copy over Weapon-2-Handed Category Bonus-->
on('change:cat-weapon-2handed',
// <!-- Copy over Weapon-Missile Category Bonus-->
on('change:cat-weapon-missile',
// <!-- Copy over Weapon-Missile Artillery Category Bonus-->
on('change:cat-weapon-missileartillery',
// <!-- Copy over Weapon-Pole Arms Category Bonus-->
on('change:cat-weapon-polearms',
// <!-- Copy over Weapon-Thrown Category Bonus-->
on('change:cat-weapon-thrown',
// <!-- Copy over Same Realm Own Base Spells Category Bonus-->
on('change:cat-srob',
// <!-- Copy over Same Realm Open Spells Category Bonus-->
on('change:cat-sropen',
// <!-- Copy over Same Realm Closed Spells Category Bonus-->
on('change:cat-srclosed',
// <!-- Copy over Same Realm Other Base Spells Category Bonus-->
on('change:cat-srotherb',
// <!-- Copy over Other Realm Open Spells Category Bonus-->
on('change:cat-oropen',
// <!-- Copy over Other Realm Closed Spells Category Bonus-->
on('change:cat-orclosed',
// <!-- Copy over Other Realm Base Spells Category Bonus-->
on('change:cat-orbase',
// <!-- Copy over Arcane Open Spells Category Bonus-->
on('change:cat-arcopen',
// <!-- Copy over Arcane Closed Spells Category Bonus-->
on('change:cat-arcclosed',
// <!-- Copy over Arcane Base Spells Category Bonus-->
on('change:cat-arcbase',
// <!-- Copy over Arcane Other Base Spells Category Bonus-->
on('change:cat-arcotherbase',
// <!---- Update bonus on current stat change. Do this for each stat ---->
// Calculate Base Bonus
on('change:agility change:statcalc', // if agility (Ag Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
// Calculate total bonus
on('sheet:opened change:agbasebonus change:agracial change:agspecial', // if the base stat bonus (Agility in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:constitution change:statcalc', // if constitution (Co Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:cobasebonus change:coracial change:cospecial', // if the base stat bonus (Constitution in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:memory change:statcalc', // if memory (Me Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:mebasebonus change:meracial change:mespecial', // if the base stat bonus (Memory in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:reasoning change:statcalc', // if reasoning (Re Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:rebasebonus change:reracial change:respecial', // if the base stat bonus (Reasoning in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:selfdiscipline change:statcalc', // if self discipline (SD Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:sdbasebonus change:sdracial change:sdspecial', // if the base stat bonus (Self Discipline in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:empathy change:statcalc', // if empathy (Em Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:embasebonus change:emracial change:emspecial', // if the base stat bonus (Empathy in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:intuition change:statcalc', // if intuition (In Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:inbasebonus change:inracial change:inspecial', // if the base stat bonus (Intuition in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:presence change:statcalc', // if presence (Pr Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:prbasebonus change:prracial change:prspecial', // if the base stat bonus (Presence in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:quickness change:statcalc', // if quickness (Qu Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:qubasebonus change:quracial change:quspecial', // if the base stat bonus (Quickness in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
on('change:strength change:statcalc', // if strength (St Temp) or the statcalc setup changes, then use StatMod to figure out what the base stat bonus should be. <getAttrs/setAttrs>
on('sheet:opened change:stbasebonus change:stracial change:stspecial', // if the base stat bonus (Strength in this case) or the racial or special bonuses for the stat change, then recalculate the total stat bonus. <getAttrs/setAttrs>
// Calculate developement points from top 5 stats (ag, co, me, re, sd) if any change. But only if devpointcalc is set.
on('change:devpointcalc change:agility change:constitution change:memory change:reasoning change:selfdiscipline', // <getAttrs/setAttrs>
// <!---- Calc experience for next level if level or levelexpcalc changes ------->
on('change:levelexpcalc change:level', // if a character's level changes or if xp calculation automation is added/removed, calculate what the next level will be and what the experience needed for it will be. <getAttrs/setAttrs>
// <!---- Update Body Dev progression,Racial bonuses for RR's and Stats etc when racialindex changes.---->
on('change:racialindex change:racialcalc', // if the race changes or the race calculation automation is toggled, use BodyDevProgMod, and RaceFixedInfoSetup, to set up body development progression, racial stat bonuses, racial resistance bonuses, and things like soul departure, recovery multiplier, etc. Does not yet set up skill bonuses for races. (probably should but how to do the nebulous things ie +to heat/cold resistance, etc?). <getAttrs/setAttrs>
// <!---- Then update Bodydev rank bonus ............ even if rank has not changed ----->
on('change:bodydevprog0 change:bodydevprog10 change:bodydevprog20 change:bodydevprog30 change:bodydevprog31 change:racialcalc change:skillcalc', // if the body dev progression changes or skill calc or racial calc is toggled, then recalculate the body developement rank bonus. Since it likely changed. <getAttrs/setAttrs>
// <!---- Update professionindex (skill category) bonuses when professionindex changes---->
on('change:professionindex change:professioncalc', // if the profession changes or the profession calc is toggled, use ProfessionInfoSetup to setup the profession category bonuses. <getAttrs/setAttrs>
// <!---- update realm stat when realm or realm stat changes---->
on('change:realmselect change:inbonus change:embonus change:prbonus ', // if the realm is changed or any one of the realm stats changes, use SetRealm to setup the realm stat. <getAttrs/setAttrs>
// <!---- update ppdev progression when realm or racialindex change---->
on('change:realmselect change:racialindex change:racialcalc', // if the realm or race changes or the racial calc is toggled, use PPDevProgMod to setup the powerpoint progression for that race/realm combo. <getAttrs/setAttrs>
// <!---- Then update PPdev rank bonus ........... even if rank has not changed ----->
on('change:realm change:ppdevranks change:ppdevprog0 change:ppdevprog10 change:ppdevprog20 change:ppdevprog30 change:ppdevprog31 change:skillcalc change:racialcalc change:inbonus change:embonus change:prbonus', // if realm, power point development ranks, progression, or realmstats change, or if the skill calc or racial calc setups are toggled, then calculate powerpoint development. <getAttrs/setAttrs>
// <!---- Do this for each skill to set up OnChange events ---->
on('sheet:opened', // for every non-repeating skill, skill category, and spell list, setup functions to watch for skill rank change and use SkillChange to calculate the rank bonus, and watch for changes in the skill rankbonus, stat, category bonus, special modifier, item modifier, profession bonus, stat bonus, special bonus, and itembonus and use CalcTotalBonus to calculate the new total bonus for the skill.
//<!---- Calc rank bonus for repeating skills ---->
on('change:repeating_skills', // if something in the repeating skills section changes, use SkillChange to calculate the skill rank bonus.
//<!---- Calc rank bonus for repeating languages ---->
on('change:repeating_langs', // if something in repeating languages changes, calculate the skill rank bonus. Have to call it for both spoken and written because they have different names.
// <!---- If repeating_langs_* changes, make a nice summary for the front page for me ---->
on('change:repeating_langs change:embonus change:mebonus change:rebonus change:cat-communications remove:repeating_langs', // when the communication category (rank bonus, profession bonus, special bonus, or item bonus), reasoning bonus, memory bonus, or empathy bonus change, then calculate the written and spoken language bonuses and create a summary of them for the front page. <getAttrs/setAttrs> Gigs has looked at/optimized this one.
// <!---- Calculate total experience ---->
on('change:repeating_exp remove:repeating_exp' // if a change is made in the repeating experience tab, recalculate the experience total. <getAttrs/setAttrs> Not part of a long cascade.
// <!---- Copy experience from totalexperience to expcurrent on PC/Char tab if wanted ---->
on('change:totalexperience change:xpcopy', // if totalexperience changes or the xp copy button is toggled, copy the xp to the front page if set for that. <getAttrs/setAttrs> don't need to open expcurrent and expcurrent_max.... Not part of a long cascade.
// <!---- Calculate total coin count and weight for each column ----> //gigs done
on('change:coinsperpound change:mithril1 change:platinum1 change:gold1 change:silver1 change:bronze1 change:copper1 change:tin1 change:iron1 change:mithril2 change:platinum2 change:gold2 change:silver2 change:bronze2 change:copper2 change:tin2 change:iron2 change:mithril3 change:platinum3 change:gold3 change:silver3 change:bronze3 change:copper3 change:tin3 change:iron3 change:coinlocationcat1 change:coinlocationcat2 change:coinlocationcat3', // <getAttrs/setAttrs> but ^^ Not part of a long cascade.
// <!----Calculates the total weight/row and total weight for each weight category. ---->
on('change:repeating_equipment:equipmentquantity change:repeating_equipment:equipmentweight change:repeating_equipment:equipmentlocationtype', // equipment is a repeating set. <getAttrs/setAttrs> Not part of a long cascade.
on('change:repeating_equipment:equipmentweighttotal change:repeating_equipment:equipmentlocationtype remove:repeating_equipment change:coinweight1 change:coinweight2 change:coinweight3 change:coinlocationcat1 change:coinlocationcat2 change:coinlocationcat3', // if weights change, then update the total weights for each location. <getAttrs/setAttrs> Gigs looked at this one too. Not part of a long cascade.
// <!---- Copy from equipment weights to totalweightcarried if wanted ---->
on('change:weightcarried change:weightcarriedcopy change:weightbackpack change:weightbackpackcopy change:weightstored1 change:weightstored2 change:weightstored1copy change:weightstored2copy', // use the checkboxes next to the total weights for each location to determine which are included in the encumbrance calculation. <getAttrs/setAttrs> Not part of a long cascade.
/* <!----- Close other skill categories when one is open to help with lag -----> */
const categories = ['armor', 'artistic', 'athletic', 'awareness', 'bodydev', 'combatman', 'communications', 'crafts', 'dirspells', 'influence',
'lore', 'martialarts', 'outdoor', 'power', 'powerpointdev', 'science', 'selfcontrol', 'special', 'spellsskills', 'subterfuge', 'technical',
'urban', 'weapon', 'other']; // <getAttrs/setAttrs> Gigs wrote this one. Not part of a cascade.
/* Setup for when a character sheet gets opened for the first time. -Calc ability and ability mods as well as encumbrance. */
function StartingSetup(version, cversion, calc, langsmoved) { /* this whole thing probably should be re-written and condensed. Should also get copies of the other code that I have running on sheetopen in other locations that was primarily to make certain that it got ran at least once. <getAttrs/setAttrs> in various places depending on old sheet version etc. for main drop down setup, probably won't need multiple version checks since the old dropdown sheet has none of this stuff... */
//gigs todo
// <!---- Setup Racial Index for autocalculations ---->
on('sheet:opened change:race', function() // Probably could combine this with where it's used? does it save processing to compare the race names once and then use numbers or just compare race names when I'm using it? <getAttrs/setAttrs>
// gigs todo
// <!---- Setup Profession Index for autocalculations ---->
on('sheet:opened change:profession', function() // Probably could combine this with where it's used? does it save processing to compare the profession names once and then use numbers or just compare profession names when I'm using it? <getAttrs/setAttrs>
// <!---- Run the setup if the sheet is opened or the recalc box is clicked ---->
on('sheet:opened change:skillcalc', function() // <getAttrs/setAttrs>
// <!---- Change checkboxes for statcalc, skillcalc, levelexpcalc, racialcalc, and professioncalc if allcalc is changed. ---->
on('change:allcalc', function() //<getAttr/setAttr>
// <!---- If skillcalc gets changed, check and update the skills. ---->
on('change:skillcalc', function() // when skill calc changes to 1, run SkillChange on all the skills including repeating skills and repeating languages to make sure they are calculated correctly.
// <!---- Run the setup to fix the npc Base Hits Code based on npchitscode (depreciated) once when the sheet is first opened ---->
on('sheet:opened', function() // this probably should be moved to the setup section rather than sheet:open. <setAttrs/getAttrs>
// <!---- Run the setup if the npc Base Hits code changes ---->
on('change:npcbasehitscode', function() // hopefully fixed, it works, anyway. <getAttrs/setAttrs> only runs when npc base hits code changes
// <!---- Run the setup if the npc Habitat code clear box is clicked ---->
on('change:habitatclear', function() // only runs if the habitat clear box is ticked. <setAttrs>
// <!---- Run the setup if the npc Environmental Special Features code clear box is clicked ---->
on('change:spfeaturesclear', function() // only runs if the environmental special clear box is ticked. <setAttrs>
// <!---- Run the setup if the npc Environmental Water Sources code clear box is clicked ---->
on('change:watersourcesclear', function() // only runs if the environment water clear box is ticked. <setAttrs>
// <!---- Run the setup if the npc Environmental Terrain code clear box is clicked ---->
on('change:terrainclear', function() // only runs if the environment terrain clear box is ticked. <setAttrs>
// <!---- Run the setup if the npc Environmental Vegetation code clear box is clicked ---->
on('change:vegetationclear', function() // only runs if the environment vegetation clear box is ticked. <setAttrs>
// <!---- Parse the treasures out of the treasure codes ---->
on('change:treasurecode', function() // lots of loops, but only one <getAttrs/setAttrs> also only runs when npc's treasure code changes.
// <!---- Parse the NPC JSON code to import an NPC ---->
on('change:npcimportcheckbox', function() // NPC inport only. not currently going to touch.... <getAttrs/setAttrs>