@@ -4459,7 +4462,7 @@
-
+
diff --git a/ADnD_1E_Revised/src/package.json b/ADnD_1E_Revised/src/package.json
index 5741bf562b..101c9bf0a1 100644
--- a/ADnD_1E_Revised/src/package.json
+++ b/ADnD_1E_Revised/src/package.json
@@ -6,7 +6,7 @@
"scripts": {
"dev": "node bundle-process.js --dev",
"prod": "npm run bundle:js:prod && node bundle-process.js --prod",
- "bundle:js:prod": "esbuild index.js --bundle --minify --outfile=prod/index.js"
+ "bundle:js:prod": "esbuild index.js --bundle --platform=node --minify --outfile=prod/index.js"
},
"dependencies": {
"chokidar": "^4.0.3",
diff --git a/ADnD_1E_Revised/src/prod/index.js b/ADnD_1E_Revised/src/prod/index.js
index d8fd49135e..cfe3e233da 100644
--- a/ADnD_1E_Revised/src/prod/index.js
+++ b/ADnD_1E_Revised/src/prod/index.js
@@ -1 +1 @@
-(()=>{var q=(r,n=0)=>parseInt(r)||n,T=(r,n=0)=>parseFloat(r)||n,g=(r,n="green")=>{let e=`%c ${r}`;console.log(e,`color: ${n}; font-weight:bold`)},d=(r,n=0)=>typeof r<"u"&&r!==n,xe=(r,n)=>{let e=r;return _.each(Object.entries(n),([s,o])=>{e=e.replace(new RegExp(s.replace("{","{"),"gi"),o)}),e},kt=r=>/^[a-zA-Z0-9\s]+$/.test(r)?!0:!/[)|\}]/.test(r),At=r=>/^[-+]?[0-9]+$/.test(r)?1:0,Ta={},k=()=>{let r=generateRowID();for(;Ta[r]===!0;)g(`generateUniqueRowID: ${r} is not a unique ID, trying again.`),r=generateRowID();return Ta[r]=!0,r};on("change:character_name",r=>{getAttrs(["character_name"],n=>{let e={},s=n[`${r.sourceAttribute}`],o=kt(s);e[`${r.sourceAttribute}_error`]=o,setAttrs(e,{silent:!0})})});on("change:armortype_magic change:armortype2_magic change:armorshield_magic change:armorhelmet_magic change:armorother_magic change:armorother2_magic change:armorother3_magic change:armorother4_magic change:armorother5_magic change:armorother6_magic change:armorshield_mod change:armorother_mod change:armorother2_mod change:armorother3_mod change:armorother4_mod change:armorother5_mod change:armorother6_mod change:repeating_equipment:equipment_armor_mod change:repeating_equipment:equipment_armor_magic, change:hitpoints_1_class, change:hitpoints_2_class, change:hitpoints_3_class",r=>{let n=r.sourceAttribute.split("_")[2];getAttrs(["armortype_magic","armortype2_magic","armorshield_magic","armorhelmet_magic","armorother_magic","armorother2_magic","armorother3_magic","armorother4_magic","armorother5_magic","armorother6_magic","armorshield_mod","armorother_mod","armorother2_mod","armorother3_mod","armorother4_mod","armorother5_mod","armorother6_mod",`repeating_equipment_${n}_equipment_armor_magic`,`repeating_equipment_${n}_equipment_armor_mod`,"hitpoints_1_class","hitpoints_2_class","hitpoints_3_class"],e=>{let s={},o=e[`${r.sourceAttribute}`],a=At(o);s[`${r.sourceAttribute}_error`]=a,setAttrs(s,{silent:!0})})});var Se,La="",ja="",Ba="",V="",Ke="",Pa="",Ye="",Xe="",Qe="",Me="",Ze="",Je="",ve="",ea="",aa="",ta="",oa="",na="",ra="",_a="",Ua="",Ha="",Wa="",sa="",ia="",pa="",ca="",ma="",la="",ha="",ua="",ga="",y="",Va="",wa="",De=["unarmored_row_id","armortype1_row_id","armortype2_row_id","armorshield_row_id","armorhelmet_row_id","armorother1_row_id","armorother2_row_id","armorother3_row_id","armorother4_row_id","armorother5_row_id","armorother6_row_id"],ba=["unarmored_worn","unarmored","unarmored_ac","unarmored_base","unarmored_bulk","unarmored_carried","unarmored_weight","unarmored_cost","armortype_worn","armortype","armortype_ac","armortype_base","armortype_magic","armortype_bulk","armortype_carried","armor_weight","armor_cost","armortype2_worn","armortype2","armortype2_ac","armortype2_base","armortype2_magic","armortype2_bulk","armortype2_carried","armortype2_weight","armortype2_cost","armorshield_worn","armorshield","armorshield_ac","armorshield_base","armorshield_magic","armorshield_mod","armorshield_bulk","armorshield_carried","armorshield_weight","armorshield_cost","armorhelmet_worn","armorhelmet","armorhelmet_ac","armorhelmet_magic","armorhelmet_bulk","armorhelmet_carried","armorhelmet_weight","armorhelmet_cost","armorother_worn","armorother","armorother_ac","armorother_base","armorother_magic","armorother_mod","armorother2_worn","armorother2","armorother2_ac","armorother2_base","armorother2_magic","armorother2_mod","armorother3_worn","armorother3","armorother3_ac","armorother3_base","armorother3_magic","armorother3_mod","armorother4_worn","armorother4","armorother4_ac","armorother4_base","armorother4_magic","armorother4_mod","armorother5_worn","armorother5","armorother5_ac","armorother5_base","armorother5_magic","armorother5_mod","armorother6_worn","armorother6","armorother6_ac","armorother6_base","armorother6_magic","armorother6_mod"],i=(r,n,e)=>`repeating_${r}_${n}_${e}`,xt=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"DmgBonus")),s.push(i("weapon",o,"macro-text"))}),getAttrs([...s],o=>{let a={},t="&{template:attacks} {{name=@{character_name}}} {{subtag=@{WeaponName}}} {{attack1=[[1d20 + @{ToHitBonus}[BON] + @{MagicBonus}[MAG] + ?{To Hit Modifier?|0}[MOD] ]]}} {{damage1vsSM=[[@{DamageSmallMedium} + @{DmgBonus}[BON] + @{MagicBonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{DamageLarge} + @{DmgBonus}[BON] + @{MagicBonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{WeaponNotes}}} @{whisper_to-hit}";_.each(e,p=>{let c=o[i("weapon",p,"macro-text")]||t;a[i("weapon",p,"macro-text")]=c.replace(/@{DmgBonus}/g,"@{AttackDmgBonus}"),a[i("weapon",p,"AttackDmgBonus")]=+o[i("weapon",p,"DmgBonus")]||0}),a.sheet_version=r,g("VERSION UPDATE: dmgSwap completed"),setAttrs(a,{silent:!0},y(r,n))})})},St=(r,n)=>{getSectionIDs("repeating_ability",e=>{let s=[];_.each(e,o=>{s.push(i("ability",o,"max"))}),getAttrs([...s],o=>{let a={};_.each(e,t=>{a[i("ability",t,"current_max")]=+o[i("ability",t,"max")]||0}),a.sheet_version=r,g("VERSION UPDATE: maxSwap completed"),setAttrs(a,{silent:!0},y(r,n))})})},Mt=(r,n)=>{let e={};getSectionIDs("repeating_nonweaponproficiencies",s=>{let o=[];_.each(s,a=>{o.push(i("nonweaponproficiencies",a,"macro-text"))}),getAttrs([...o],a=>{let t={nwp_old:"&{template:general} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{name}}} {{=@{short_description}}}{{Success Amount=[[((@{rAttribute})+(@{rSlots}-1)-1d20)cs>1cf<-1]]}}",nwp_new:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{name}}} {{Proficiency Check=[[ 1d20 + [[@{rmodifier}]][MOD] + [[?{Additional modifier?|0}]][MOD] ]] vs [[ @{rAttribute}[ATTR] ]]}}{{freetext=@{short_description}}}"};_.each(s,p=>{a[i("nonweaponproficiencies",p,"macro-text")]&&(e[i("nonweaponproficiencies",p,"macro-text")]=a[i("nonweaponproficiencies",p,"macro-text")].replace(t.nwp_old,t.nwp_new))}),e.sheet_version=r,g("VERSION UPDATE: nwpMacroUpdate completed"),setAttrs(e,{silent:!0},y(r,n))})})},Dt=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"roll")),s.push(i("weapon",o,"weaponname")),s.push(i("weapon",o,"tohitbonus")),s.push(i("weapon",o,"magicbonus")),s.push(i("weapon",o,"attackdmgbonus")),s.push(i("weapon",o,"whisper_to-hit")),s.push(i("weapon",o,"macro-text")),s.push(i("weapon",o,"damagesmallmedium")),s.push(i("weapon",o,"damagelarge")),s.push(i("weapon",o,"rateoffire")),s.push(i("weapon",o,"range")),s.push(i("weapon",o,"quantity")),s.push(i("weapon",o,"weight")),s.push(i("weapon",o,"weaponspeed")),s.push(i("weapon",o,"cost")),s.push(i("weapon",o,"weaponnotes"))}),getAttrs([...s],o=>{let a={},t={"@{rateoffire}":"@{weapon_rateoffire}","@{weaponname}":"@{weapon_name}","@{tohitbonus}":"@{weapon_tohitbonus}","@{magicbonus}":"@{weapon_magicbonus}","@{attackdmgbonus}":"@{weapon_attackdmgbonus}","@{whisper_to-hit}":"@{weapon_whisper_to_hit}","@{damagesmallmedium}":"@{weapon_damagesmallmedium}","@{damagelarge}":"@{weapon_damagelarge}","@{range}":"@{weapon_range}","@{quantity}":"@{weapon_quantity}","@{weight}":"@{weapon_weight}","@{weaponspeed}":"@{weapon_speed}","@{cost}":"@{weapon_cost}","@{macro-text}":"@{weapon_macro_text}","@{weaponnotes}":"@{weapon_notes}"},p="&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{WeaponName}}} {{attack1=[[1d20 + @{ToHitBonus}[BON] + @{MagicBonus}[MAG] + ?{To Hit Modifier?|0}[MOD]) ]]}} {{damage1vsSM=[[@{DamageSmallMedium} + @{AttackDmgBonus}[BON] + @{MagicBonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{DamageLarge} + @{AttackDmgBonus}[BON] + @{MagicBonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{WeaponNotes}}} @{whisper_to-hit}";_.each(e,c=>{d(o[i("weapon",c,"rateoffire")])&&(a[i("weapon",c,"weapon_rateoffire")]=q(o[i("weapon",c,"rateoffire")])),d(o[i("weapon",c,"roll")])&&(a[i("weapon",c,"weapon_roll")]=o[i("weapon",c,"roll")]),d(o[i("weapon",c,"weaponname")])&&(a[i("weapon",c,"weapon_name")]=o[i("weapon",c,"weaponname")]),d(o[i("weapon",c,"tohitbonus")])&&(a[i("weapon",c,"weapon_tohitbonus")]=q(o[i("weapon",c,"tohitbonus")])),d(o[i("weapon",c,"magicbonus")])&&(a[i("weapon",c,"weapon_magicbonus")]=q(o[i("weapon",c,"magicbonus")])),d(o[i("weapon",c,"attackdmgbonus")])&&(a[i("weapon",c,"weapon_attackdmgbonus")]=q(o[i("weapon",c,"attackdmgbonus")])),d(o[i("weapon",c,"whisper_to-hit")])&&(a[i("weapon",c,"weapon_whisper_to_hit")]=o[i("weapon",c,"whisper_to-hit")]),d(o[i("weapon",c,"macro-text")],p)&&(a[i("weapon",c,"weapon_macro_text")]=xe(o[i("weapon",c,"macro-text")],t)),d(o[i("weapon",c,"damagesmallmedium")])&&(a[i("weapon",c,"weapon_damagesmallmedium")]=o[i("weapon",c,"damagesmallmedium")]),d(o[i("weapon",c,"damagelarge")])&&(a[i("weapon",c,"weapon_damagelarge")]=o[i("weapon",c,"damagelarge")]),d(o[i("weapon",c,"range")])&&(a[i("weapon",c,"weapon_range")]=o[i("weapon",c,"range")]),d(o[i("weapon",c,"quantity")])&&(a[i("weapon",c,"weapon_quantity")]=T(o[i("weapon",c,"quantity")])),d(o[i("weapon",c,"weight")])&&(a[i("weapon",c,"weapon_weight")]=T(o[i("weapon",c,"weight")])),d(o[i("weapon",c,"weaponspeed")])&&(a[i("weapon",c,"weapon_speed")]=q(o[i("weapon",c,"weaponspeed")])),d(o[i("weapon",c,"cost")])&&(a[i("weapon",c,"weapon_cost")]=T(o[i("weapon",c,"cost")])),d(o[i("weapon",c,"weaponnotes")])&&(a[i("weapon",c,"weapon_notes")]=o[i("weapon",c,"weaponnotes")])}),a.sheet_version=r,g("VERSION UPDATE: weaponNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},Ct=(r,n)=>{getSectionIDs("repeating_spells",e=>{let s=[];_.each(e,o=>{s.push(i("spells",o,"roll")),s.push(i("spells",o,"memorized")),s.push(i("spells",o,"level")),s.push(i("spells",o,"name")),s.push(i("spells",o,"school")),s.push(i("spells",o,"range")),s.push(i("spells",o,"duration")),s.push(i("spells",o,"aoe")),s.push(i("spells",o,"components")),s.push(i("spells",o,"ct")),s.push(i("spells",o,"save")),s.push(i("spells",o,"macro-text")),s.push(i("spells",o,"description")),s.push(i("spells",o,"description-show"))}),getAttrs([...s],o=>{let a={},t={"@{memorized}":"@{spell_memorized}","@{level}":"@{spell_level}","@{name}":"@{spell_name}","@{school}":"@{spell_school}","@{range}":"@{spell_range}","@{duration}":"@{spell_duration}","@{aoe}":"@{spell_aoe}","@{components}":"@{spell_components}","@{ct}":"@{spell_ct}","@{save}":"@{spell_save}","@{macro-text}":"@{spell_macro_text}","@{description}":"@{spell_description}"},p="&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{name}}} {{Level:=@{level}}} {{Range:=@{range}}} {{Duration:=@{duration}}} {{AOE:=@{aoe}}} {{Comp:=@{components}}} {{CT:=@{ct}}} {{Save:=@{save}}} {{freetext=@{description}}}";_.each(e,c=>{d(o[i("spells",c,"roll")])&&(a[i("spells",c,"spell_roll")]=o[i("spells",c,"roll")]),d(o[i("spells",c,"memorized")])&&(a[i("spells",c,"spell_memorized")]=q(o[i("spells",c,"memorized")])),d(o[i("spells",c,"level")])&&(a[i("spells",c,"spell_level")]=o[i("spells",c,"level")]),d(o[i("spells",c,"name")])&&(a[i("spells",c,"spell_name")]=o[i("spells",c,"name")]),d(o[i("spells",c,"school")])&&(a[i("spells",c,"spell_school")]=o[i("spells",c,"school")]),d(o[i("spells",c,"range")])&&(a[i("spells",c,"spell_range")]=o[i("spells",c,"range")]),d(o[i("spells",c,"duration")])&&(a[i("spells",c,"spell_duration")]=o[i("spells",c,"duration")]),d(o[i("spells",c,"aoe")])&&(a[i("spells",c,"spell_aoe")]=o[i("spells",c,"aoe")]),d(o[i("spells",c,"components")])&&(a[i("spells",c,"spell_components")]=o[i("spells",c,"components")]),d(o[i("spells",c,"ct")])&&(a[i("spells",c,"spell_ct")]=o[i("spells",c,"ct")]),d(o[i("spells",c,"save")])&&(a[i("spells",c,"spell_save")]=o[i("spells",c,"save")]),d(o[i("spells",c,"macro-text")],p)&&(a[i("spells",c,"spell_macro_text")]=xe(o[i("spells",c,"macro-text")],t)),d(o[i("spells",c,"description")])&&(a[i("spells",c,"spell_description")]=o[i("spells",c,"description")]),d(o[i("spells",c,"description-show")])&&(a[i("spells",c,"spell_description_show")]=q(o[i("spells",c,"description-show")]))}),a.sheet_version=r,g("VERSION UPDATE: spellNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},Et=(r,n)=>{getSectionIDs("repeating_equipment",e=>{let s=[];_.each(e,o=>{s.push(i("equipment",o,"item-show")),s.push(i("equipment",o,"item")),s.push(i("equipment",o,"location")),s.push(i("equipment",o,"carried")),s.push(i("equipment",o,"quantity")),s.push(i("equipment",o,"quantity_max")),s.push(i("equipment",o,"weight")),s.push(i("equipment",o,"cos"))}),getAttrs([...s],o=>{let a={};_.each(e,t=>{d(o[i("equipment",t,"item-show")])&&(a[i("equipment",t,"equipment_item_show")]=o[i("equipment",t,"item-show")]),d(o[i("equipment",t,"item")])&&(a[i("equipment",t,"equipment_item")]=o[i("equipment",t,"item")]),d(o[i("equipment",t,"location")])&&(a[i("equipment",t,"equipment_location")]=o[i("equipment",t,"location")]),d(o[i("equipment",t,"carried")])&&(a[i("equipment",t,"equipment_carried")]=o[i("equipment",t,"carried")]),d(o[i("equipment",t,"quantity")])&&(a[i("equipment",t,"equipment_quantity")]=T(o[i("equipment",t,"quantity")])),d(o[i("equipment",t,"quantity_max")])&&(a[i("equipment",t,"equipment_quantity_max")]=T(o[i("equipment",t,"quantity_max")])),d(o[i("equipment",t,"weight")])&&(a[i("equipment",t,"equipment_weight")]=T(o[i("equipment",t,"weight")])),d(o[i("equipment",t,"cost")])&&(a[i("equipment",t,"equipment_cost")]=T(o[i("equipment",t,"cost")]))}),a.sheet_version=r,g("VERSION UPDATE: equipmentNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},It=(r,n)=>{getSectionIDs("repeating_ability",e=>{let s=[];_.each(e,o=>{s.push(i("equipment",o,"roll")),s.push(i("equipment",o,"name")),s.push(i("equipment",o,"short_description")),s.push(i("equipment",o,"current")),s.push(i("equipment",o,"current_max")),s.push(i("equipment",o,"macro-text")),s.push(i("equipment",o,"description")),s.push(i("equipment",o,"description-show"))}),getAttrs([...s],o=>{let a={},t={"@{name}":"@{ability_name}","@{current}":"@{ability_current}","@{current_max}":"@{ability_current_max}","@{short_description}":"@{ability_short_description}","@{macro-text}":"@{ability_macro_text}","@{description}":"@{ability_description}"},p="&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{name}}} {{freetext=@{short_description} @{description}}}";_.each(e,c=>{d(o[i("equipment",c,"roll")])&&(a[i("equipment",c,"ability_roll")]=o[i("equipment",c,"roll")]),d(o[i("equipment",c,"name")])&&(a[i("equipment",c,"ability_name")]=o[i("equipment",c,"name")]),d(o[i("equipment",c,"short_description")])&&(a[i("equipment",c,"ability_short_description")]=o[i("equipment",c,"short_description")]),d(o[i("equipment",c,"current")])&&(a[i("equipment",c,"ability_current")]=q(o[i("equipment",c,"current")])),d(o[i("equipment",c,"current_max")])&&(a[i("equipment",c,"ability_current_max")]=q(o[i("equipment",c,"current_max")])),d(o[i("equipment",c,"macro-text")],p)&&(a[i("equipment",c,"ability_macro_text")]=xe(o[i("equipment",c,"macro-text")],t)),d(o[i("equipment",c,"description")])&&(a[i("equipment",c,"ability_description")]=o[i("equipment",c,"description")]),d(o[i("equipment",c,"description-show")])&&(a[i("equipment",c,"ability_description_show")]=q(o[i("equipment",c,"description-show")]))}),a.sheet_version=r,g("VERSION UPDATE: abilityNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},Ot=(r,n)=>{getSectionIDs("repeating_nonweaponproficiencies",e=>{let s=[];_.each(e,o=>{s.push(i("nonweaponproficiencies",o,"roll")),s.push(i("nonweaponproficiencies",o,"name")),s.push(i("nonweaponproficiencies",o,"rAttribute")),s.push(i("nonweaponproficiencies",o,"short_description")),s.push(i("nonweaponproficiencies",o,"rSlots")),s.push(i("nonweaponproficiencies",o,"rModifier")),s.push(i("nonweaponproficiencies",o,"macro-text")),s.push(i("nonweaponproficiencies",o,"description-show")),s.push(i("nonweaponproficiencies",o,"description"))}),getAttrs([...s],o=>{let a={},t={"@{name}":"@{nwp_name}","@{rAttribute}":"@{nwp_attribute}","@{rSlots}":"@{nwp_slots}","@{rModifier}":"@{nwp_modifier}","@{short_description}":"@{nwp_short_description}","@{macro-text}":"@{nwp_macro_text}","@{description}":"@{nwp_description}"},p="&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{name}}} {{Proficiency Check=[[ 1d20 + [[@{rmodifier}]][MOD] + [[?{Additional modifier?|0}]][MOD] ]] vs [[ @{rAttribute}[ATTR] ]]}}{{freetext=@{short_description}}}";_.each(e,c=>{d(o[i("nonweaponproficiencies",c,"roll")])&&(a[i("nonweaponproficiencies",c,"nwp_roll")]=o[i("nonweaponproficiencies",c,"roll")]),d(o[i("nonweaponproficiencies",c,"name")])&&(a[i("nonweaponproficiencies",c,"nwp_name")]=o[i("nonweaponproficiencies",c,"name")]),d(o[i("nonweaponproficiencies",c,"rAttribute")])&&(a[i("nonweaponproficiencies",c,"nwp_attribute")]=o[i("nonweaponproficiencies",c,"rAttribute")].toLowerCase()),d(o[i("nonweaponproficiencies",c,"short_description")])&&(a[i("nonweaponproficiencies",c,"nwp_short_description")]=o[i("nonweaponproficiencies",c,"short_description")]),d(o[i("nonweaponproficiencies",c,"rSlots")])&&(a[i("nonweaponproficiencies",c,"nwp_slots")]=q(o[i("nonweaponproficiencies",c,"rSlots")])),d(o[i("nonweaponproficiencies",c,"rModifier")])&&(a[i("nonweaponproficiencies",c,"nwp_modifier")]=q(o[i("nonweaponproficiencies",c,"rModifier")])),d(o[i("nonweaponproficiencies",c,"macro-text")],p)&&(a[i("nonweaponproficiencies",c,"nwp_macro_text")]=xe(o[i("nonweaponproficiencies",c,"macro-text")],t)),d(o[i("nonweaponproficiencies",c,"description-show")])&&(a[i("nonweaponproficiencies",c,"nwp_description_show")]=q(o[i("nonweaponproficiencies",c,"description-show")])),d(o[i("nonweaponproficiencies",c,"description")])&&(a[i("nonweaponproficiencies",c,"nwp_description")]=o[i("nonweaponproficiencies",c,"description")])}),a.sheet_version=r,g("VERSION UPDATE: nwpNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},Nt=(r,n)=>{let e={};getSectionIDs("repeating_nonweaponproficiencies",s=>{getSectionIDs("repeating_weapon",o=>{getSectionIDs("repeating_ability",a=>{getSectionIDs("repeating_spells",t=>{let p=[],c=[],l=[],u=[];_.each(s,h=>{p.push(i("nonweaponproficiencies",h,"nwp_macro_text"))}),_.each(o,h=>{c.push(i("weapon",h,"weapon_macro_text"))}),_.each(a,h=>{l.push(i("ability",h,"ability_macro_text"))}),_.each(t,h=>{u.push(i("spells",h,"spell_macro_text"))}),getAttrs([...p,...c,...l,...u],h=>{let m={nwp_old:"&{template:general} {{name=@{character_name}}}",nwp_new:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}}",wpn_old:"&{template:attacks} {{name=@{character_name}}}",wpn_new:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}}",abl_old:"&{template:general} {{name=@{character_name}}}",abl_new:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}}",spl_old:"&{template:general} {{name=@{character_name}}}",spl_new:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}}"};_.each(s,w=>{h[i("nonweaponproficiencies",w,"nwp_macro_text")]&&(e[i("nonweaponproficiencies",w,"nwp_macro_text")]=h[i("nonweaponproficiencies",w,"nwp_macro_text")].replace(m.nwp_old,m.nwp_new),g("VERSION UPDATE: colorUpdate completed"))}),_.each(o,w=>{h[i("weapon",w,"weapon_macro_text")]&&(e[i("weapon",w,"weapon_macro_text")]=h[i("weapon",w,"weapon_macro_text")].replace(m.wpn_old,m.wpn_new),g("VERSION UPDATE: colorUpdate completed"))}),_.each(a,w=>{h[i("ability",w,"ability_macro_text")]&&(e[i("ability",w,"ability_macro_text")]=h[i("ability",w,"ability_macro_text")].replace(m.abl_old,m.abl_new),g("VERSION UPDATE: colorUpdate completed"))}),_.each(t,w=>{h[i("spells",w,"spell_macro_text")]&&(e[i("spells",w,"spell_macro_text")]=h[i("spells",w,"spell_macro_text")].replace(m.spl_old,m.spl_new),g("VERSION UPDATE: colorUpdate completed"))}),e.sheet_version=r,setAttrs(e,{silent:!0},y(r,n))})})})})})},Fa=()=>{la(),aa(),wa(),Ze(),Qe(),Ye()};La=(r,n)=>{let e={};Fa(),e.sheet_version=r,g("VERSION UPDATE: autoCalcAbilityRows completed"),setAttrs(e,y(r,n))};ja=(r,n)=>{let e={};sa(1),ia(1),pa(1),_a(1),ca(1),e.sheet_version=r,g("VERSION UPDATE: autoCalcSaveRows(migrate) completed"),setAttrs(e,{silent:!0},y(r,n))};Ba=(r,n)=>{let e={};na(1),oa(1),Je(1),ta(1),ea(1),ve(1),Xe(1),ra(1),ga(),ha(),ua(),e.sheet_version=r,g("VERSION UPDATE: autoCalcThiefRows(migrate) completed"),setAttrs(e,{silent:!0},y(r,n))};var Tt=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"weapon_macro_text"))}),getAttrs([...s],o=>{let a={},t="&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{attack1=[[1d20 + @{weapon_tohitbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{To Hit Modifier?|0}[MOD] ]]}} {{damage1vsSM=[[@{weapon_damagesmallmedium} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{weapon_damagelarge} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{weapon_notes}}} @{weapon_whisper_to_hit}";_.each(e,p=>{let c=o[i("weapon",p,"weapon_macro_text")]||t;a[i("weapon",p,"weapon_macro_text")]=c.replace(/} @{weapon_whisper_to_hit}/g,"}")}),a.sheet_version=r,g("VERSION UPDATE: removeWhisper completed"),setAttrs(a,{silent:!0},y(r,n))})})},Rt=(r,n)=>{getAttrs(["hitpoints_max","hitpoints_1_class","hitpoints_2_class","hitpoints_3_class"],e=>{let s={},o=+e.hitpoints_max||0,a=+e.hitpoints_1_class||0,t=+e.hitpoints_2_class||0,p=+e.hitpoints_3_class||0;q(Math.max(0,a)+Math.max(0,t)+Math.max(0,p))===0&&o>0&&(s.hitpoints_1_class=o),s.sheet_version=r,g("VERSION UPDATE: migrate HP completed"),setAttrs(s,{silent:!0},y(r,n),Ke())})},Lt=(r,n)=>{getAttrs(["armorclass","armortype_ac","armorclass_total","armorbonus","armorshield"],e=>{let s={},a=+e.armorclass,t=-Math.abs(e.armorbonus)||0,p=+e.armorclass_total||0,c=+e.armortype_ac,l=e.armorshield;g(`armorShield:${l} armorClassTotal:${p} armorBonus:${t} armortypeAC:${c} armorClass:${a}`),l?c===10&&a<10&&(a+=1,s.armortype_ac=a,s.armortype_base=a,s.armortype_worn=1,s.armortype_carried=1,s.armorshield_ac=-1,s.armorshield_base=-1,s.armorshield_worn=1,s.armorshield_carried=1,g("new armor w/shield")):c===10&&a<10?(s.armortype_ac=a,s.armortype_base=a,s.armortype_worn=1,s.armortype_carried=1,g("new armor w/out shield")):g("NEW ARMOR CHECK AND SET FAILED"),s.sheet_version=r,g("VERSION UPDATE: Migrate AC completed"),setAttrs(s,{silent:!0},y(r,n),V(0))})},Be=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"weapon_macro_text"))}),getAttrs([...s],o=>{let a={},t={weapon_old:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{attack1=[[1d20 + @{weapon_tohitbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{To Hit Modifier?|0}[MOD] ]]}} {{damage1vsSM=[[@{weapon_damagesmallmedium} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{weapon_damagelarge} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{weapon_notes}}}",weapon_old_v2:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{attack1=[[1d20 + @{weapon_tohitbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{To Hit Modifier?|0}[MOD]) ]]}} {{damage1vsSM=[[@{weapon_damagesmallmedium} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{weapon_damagelarge} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{weapon_notes}}}",weapon_old_v3:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} @{weapon_tohitacadj}",weapon_old_v4:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{critdamagevsSMchatmenu=@{weapon_critdamagesmallmedium_chat_menu}}} {{critdamagevsLchatmenu=@{weapon_critdamagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} {{crit=@{toggle_critdamage}}} @{weapon_tohitacadj}",weapon_old_v5:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{critdamagevsSMchatmenu=@{weapon_critdamagesmallmedium_chat_menu}}} {{critdamagevsLchatmenu=@{weapon_critdamagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} {{ammo=[[ @{weapon_ammo} ]]/[[ @{weapon_ammo|max} ]]}} {{crit=@{toggle_critdamage}}} @{weapon_tohitacadj}",weapon_old_v6:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{critdamagevsSMchatmenu=@{weapon_critdamagesmallmedium_chat_menu}}} {{critdamagevsLchatmenu=@{weapon_critdamagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} {{ammo=[[ @{weapon_ammo} ]]/[[ @{weapon_ammo|max} ]]}} {{crit=[[ @{toggle_critdamage} ]]}} @{weapon_tohitacadj}",weapon_current:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + ( @{weapon_backstab_bonus}[BACKSTAB] ) + ( @{weapon_tohitbonus}[HIT_BON] ) + ( @{weapon_prof_pen}[PROF_PEN] ) + ( @{weapon_dual_pen}[DUAL_PEN] ) + ( @{weapon_magicbonus}[MAG_BON] ) + ( ?{To Hit Modifier?|0}[MISC_MOD] ) ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{critdamagevsSMchatmenu=@{weapon_critdamagesmallmedium_chat_menu}}} {{critdamagevsLchatmenu=@{weapon_critdamagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} {{ammo=[[ @{weapon_ammo} ]]/[[ @{weapon_ammo|max} ]]}} {{crit=[[ @{toggle_critdamage} ]]}} @{weapon_tohitacadj}"};_.each(e,p=>{o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v6?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v6,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v5?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v5,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v4?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v4,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v3?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v3,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v2?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v2,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old&&(a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old,t.weapon_current))}),a.sheet_version=r,g("VERSION UPDATE: weaponMacroUpdate completed"),setAttrs(a,{silent:!0},y(r,n))})})},Ra=(r,n)=>{getSectionIDs("repeating_ability",e=>{let s=[];_.each(e,o=>{s.push(i("ability",o,"ability_macro_text"))}),getAttrs([...s],o=>{let a={},t={ability_old:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{freetext=@{ability_short_description} @{ability_description}}}",ability_old_v2:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ @{ability_die} + @{ability_mod}[MOD] ]]}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=@{ability_current|max}}}",ability_old_v3:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ @{ability_die} + @{ability_mod}[MOD] ]]}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=[[ @{ability_current|max} ]]}} {{effect_type=@{ability_effect_type}}} {{spell_level=@{ability_level}}} {{casting_time=@{ability_ct}}} {{range=@{ability_range}}} {{saving_throw=@{ability_save}}} {{area_of_effect=@{ability_aoe}}} {{save_type=@{ability_save_type}}}",ability_old_v4:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ @{ability_die} + @{ability_mod}[MOD] ]]}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=[[ @{ability_current|max} ]]}} {{effect_type=@{ability_effect_type}}} {{spell_level=@{ability_level}}} {{casting_time=@{ability_ct}}} {{range=@{ability_range}}} {{duration=@{ability_duration}}} {{saving_throw=@{ability_save}}} {{area_of_effect=@{ability_aoe}}} {{save_type=@{ability_save_type}}}",ability_old_v5:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ @{ability_die} + @{ability_mod}[MOD] ]]}} {{link=@{ability_link}}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=[[@{ability_current|max}]]}} {{effect_type=@{ability_effect_type}}} {{spell_level=@{ability_level}}} {{casting_time=@{ability_ct}}} {{range=@{ability_range}}} {{duration=@{ability_duration}}} {{saving_throw=@{ability_save}}} {{area_of_effect=@{ability_aoe}}} {{save_type=@{ability_save_type}}}",ability_current:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ 0 + @{ability_die} + @{ability_mod}[MOD] ]]}} {{link=@{ability_link}}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=[[ 0 + @{ability_current|max} ]]}} {{effect_type=@{ability_effect_type}}} {{spell_level=@{ability_level}}} {{casting_time=@{ability_ct}}} {{range=@{ability_range}}} {{duration=@{ability_duration}}} {{saving_throw=@{ability_save}}} {{area_of_effect=@{ability_aoe}}} {{save_type=@{ability_save_type}}}"};_.each(e,p=>{o[i("ability",p,"ability_macro_text")]===t.ability_old_v5&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old_v5,t.ability_current)),o[i("ability",p,"ability_macro_text")]===t.ability_old_v4&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old_v4,t.ability_current)),o[i("ability",p,"ability_macro_text")]===t.ability_old_v3&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old_v3,t.ability_current)),o[i("ability",p,"ability_macro_text")]===t.ability_old_v2&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old_v2,t.ability_current)),o[i("ability",p,"ability_macro_text")]===t.ability_old&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old,t.ability_current))}),a.sheet_version=r,g("VERSION UPDATE: abilityMacroUpdate completed"),setAttrs(a,{silent:!0},y(r,n))})})},jt=(r,n)=>{getSectionIDs("repeating_nonweaponproficiencies",e=>{let s=[];_.each(e,o=>{s.push(i("nonweaponproficiencies",o,"nwp_macro_text"))}),getAttrs([...s],o=>{let a={},t={nwp_old:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{nwp_name}}} {{Proficiency Check=[[ 1d20 + [[@{nwp_modifier}]][MOD] + [[?{Additional modifier?|0}]][MOD] ]] vs [[ @{nwp_attribute}[ATTR] ]]}}{{freetext=@{nwp_short_description}}}",nwp_old_v2:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{nwp_name}}} {{roll_low=[[ 1d20 + [[ @{nwp_modifier} ]][MOD] + [[ ?{Modifier?|0} ]][MOD] ]]}} {{roll_target=[[ @{nwp_attribute}[ATTR] ]]}} {{mod_applied=[[ ?{Modifier?|0} ]]}} {{NWP Mod Applied=[[ @{nwp_modifier} ]]}} {{freetext=@{nwp_short_description}}}",nwp_current:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{nwp_name}}} {{roll_low=[[ 1d20 + [[ @{nwp_modifier} ]][MOD] + [[ ?{Modifier?|0} ]][MOD] ]]}} {{roll_target=[[ @{nwp_attribute}[ATTR] ]]}} {{mod_applied=[[ ?{Modifier?|0} ]]}} {{nwp_mod_applied=[[ @{nwp_modifier} ]]}} {{link=@{nwp_link}}} {{freetext=@{nwp_short_description} @{nwp_description}}}"};_.each(e,p=>{o[i("nonweaponproficiencies",p,"nwp_macro_text")]===t.nwp_old_2&&(a[i("nonweaponproficiencies",p,"nwp_macro_text")]=o[i("nonweaponproficiencies",p,"nwp_macro_text")].replace(t.nwp_old_2,t.nwp_current)),o[i("nonweaponproficiencies",p,"nwp_macro_text")]===t.nwp_old&&(a[i("nonweaponproficiencies",p,"nwp_macro_text")]=o[i("nonweaponproficiencies",p,"nwp_macro_text")].replace(t.nwp_old,t.nwp_current))}),a.sheet_version=r,g("VERSION UPDATE: nwpMacroUpdate2 completed"),setAttrs(a,{silent:!0},y(r,n))})})},Bt=(r,n)=>{getSectionIDs("repeating_spells",e=>{let s=[];_.each(e,o=>{s.push(i("spells",o,"spell_macro_text"))}),getAttrs([...s],o=>{let a={},t={spell_old:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{spell_name}}} {{Level:=@{spell_level}}} {{Range:=@{spell_range}}} {{Duration:=@{spell_duration}}} {{AOE:=@{spell_aoe}}} {{Comp:=@{spell_components}}} {{CT:=@{spell_ct}}} {{Save:=@{spell_save}}} {{freetext=@{spell_description}}}",spell_old_v2:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{spell_name}}} {{Range:=@{spell_range}}} {{Duration:=@{spell_duration}}} {{AOE:=@{spell_aoe}}} {{Save:=@{spell_save}}}",spell_old_v3:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{spell_name}}} {{school=@{spell_school}}} {{spell_level=@{spell_level}}} {{range=@{spell_range}}} {{duration=@{spell_duration}}} {{area_of_effect=@{spell_aoe}}} {{components=@{spell_components}}} {{casting_time=@{spell_ct}}} {{saving_throw=@{spell_save}}} {{freetext=@{spell_description}}}",spell_current:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{spell_name}}} {{school=@{spell_school}}} {{spell_level=@{spell_level}}} {{spell_class=@{spell_caster_class_name}}} {{spell_class_level=@{spell_caster_class_level}}} {{range=@{spell_range}}} {{duration=@{spell_duration}}} {{area_of_effect=@{spell_aoe}}} {{components=@{spell_components}}} {{casting_time=@{spell_ct}}} {{saving_throw=@{spell_save}}} {{save_type=@{spell_save_type}}} {{link=@{spell_link}}} {{freetext=@{spell_description}}}"};_.each(e,p=>{o[i("spells",p,"spell_macro_text")]===t.spell_old_v3&&(a[i("spells",p,"spell_macro_text")]=o[i("spells",p,"spell_macro_text")].replace(t.spell_old_v3,t.spell_current)),o[i("spells",p,"spell_macro_text")]===t.spell_old_v2&&(a[i("spells",p,"spell_macro_text")]=o[i("spells",p,"spell_macro_text")].replace(t.spell_old_v2,t.spell_current)),o[i("spells",p,"spell_macro_text")]===t.spell_old&&(a[i("spells",p,"spell_macro_text")]=o[i("spells",p,"spell_macro_text")].replace(t.spell_old,t.spell_current))}),a.sheet_version=r,g("VERSION UPDATE: spellsMacroUpdate completed"),setAttrs(a,{silent:!0},y(r,n))})})},Pt=(r,n)=>{getSectionIDs("repeating_equipment",e=>{let s=[];_.each(e,o=>{s.push(i("equipment",o,"equipment_macro_text"))}),getAttrs([...s],o=>{let a={},t={equipment_old:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Item/Equipment: @{equipment_item}}} {{freetext=@{equipment_description}}} {{quantity= @{equipment_quantity}}} {{quantity_max=@{equipment_quantity|max}}} {{uses=@{equipment_current}}} {{uses_max=[[ @{equipment_current|max} ]]}}",equipment_current:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Item/Equipment: @{equipment_item}}} {{link=@{equipment_link}}} {{freetext=@{equipment_description}}} {{quantity=@{equipment_quantity}}} {{quantity_max=@{equipment_quantity|max}}} {{uses=@{equipment_current}}} {{uses_max=[[ @{equipment_current|max} ]]}}"};_.each(e,p=>{o[i("equipment",p,"equipment_macro_text")]===t.equipment_old&&(a[i("equipment",p,"equipment_macro_text")]=o[i("equipment",p,"equipment_macro_text")].replace(t.equipment_old,t.equipment_current))}),a.sheet_version=r,g("VERSION UPDATE: equipmentMacroUpdate completed"),setAttrs(a,{silent:!0},y(r,n))})})},Ut=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s={},o=[];_.each(e,a=>{o.push(i("weapon",a,"weapon_range")),o.push(i("weapon",a,"weapon_range_short")),o.push(i("weapon",a,"weapon_range_medium")),o.push(i("weapon",a,"weapon_range_long")),o.push(i("weapon",a,"weapon_attack_type")),o.push(i("weapon",a,"weapon_range_error"))}),getAttrs(o,a=>{_.each(e,t=>{let p=+a[i("weapon",t,"weapon_attack_type")];if(p===0||p===2)return;let c=a[i("weapon",t,"weapon_range")];c=c.replace(/'/g,""),c=c.replace(/"/g,"");let l=c.split("/").join(",").split(" ").join(",").split("-").join(",").split(","),u=Number(l[0]),h=Number(l[1]),m=Number(l[2]);l.length===1&&u>=0&&!h&&!m&&(h=u,m=u),Number.isNaN(u)?(s[i("weapon",t,"weapon_range_short")]=0,s[i("weapon",t,"weapon_range_error")]=c===""?1:0):s[i("weapon",t,"weapon_range_short")]=u,Number.isNaN(h)?(s[i("weapon",t,"weapon_range_medium")]=0,s[i("weapon",t,"weapon_range_error")]=c===""?1:0):s[i("weapon",t,"weapon_range_medium")]=h,Number.isNaN(m)?(s[i("weapon",t,"weapon_range_long")]=0,s[i("weapon",t,"weapon_range_error")]=c===""?1:0):s[i("weapon",t,"weapon_range_long")]=m,!Number.isNaN(u)&&!Number.isNaN(h)&&!Number.isNaN(m)&&(s[i("weapon",t,"weapon_range_error")]=1)}),s.sheet_version=r,g("VERSION UPDATE: updateRange completed"),setAttrs(s,{silent:!0},y(r,n))})})},Ht=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"weapon_macro_text"))}),getAttrs([...s],o=>{let a={},t="&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} @{weapon_tohitacadj}";_.each(e,p=>{let c=o[i("weapon",p,"weapon_macro_text")]||t;a[i("weapon",p,"weapon_macro_text")]=c.replace(/@{weapon_attack_type_pen}/g,"@{weapon_dual_pen}"),a[i("weapon",p,"weapon_macro_text")]=c.replace(/{{attacktype=@{weapon_attack_type}}} /g,"")}),a.sheet_version=r,g("VERSION UPDATE: updateAttackTypeMacro completed"),setAttrs(a,{silent:!0},y(r,n))})})},Wt=(r,n)=>{getAttrs(["hitdice","monsterHD"],e=>{let s={},o=e.monsterHD,a=e.hitdice;o===""&&(s.monsterHD=a),s.monsterHD=o,s.sheet_version=r,g("VERSION UPDATE: monsterHD completed"),setAttrs(s,{silent:!0},y(r,n))})},Vt=(r,n)=>{let e={};e.armorother_cost=0,e.armorother2_cost=0,e.armorother3_cost=0,e.armorother4_cost=0,e.armorother5_cost=0,e.armorother6_cost=0,e.armorother_weight=0,e.armorother2_weight=0,e.armorother3_weight=0,e.armorother4_weight=0,e.armorother5_weight=0,e.armorother6_weight=0,e.armorother_carried=0,e.armorother2_carried=0,e.armorother3_carried=0,e.armorother4_carried=0,e.armorother5_carried=0,e.armorother6_carried=0,e.armorother_bulk=0,e.armorother2_bulk=0,e.armorother3_bulk=0,e.armorother4_bulk=0,e.armorother5_bulk=0,e.armorother6_bulk=0,g("VERSION UPDATE: clearArmorOther completed"),setAttrs(e,{silent:!0},y(r,n))},Ft=ba.concat(De);function da(r,n,e,s){getAttrs(Ft,o=>{let a={},t="",p=r;p=p!==null?r.toLowerCase():p;let c=o.unarmored_row_id.toString(),l=o.armortype1_row_id.toString(),u=o.armortype2_row_id.toString(),h=o.armorshield_row_id.toString(),m=o.armorhelmet_row_id.toString(),w=o.armorother1_row_id.toString(),A=o.armorother2_row_id.toString(),b=o.armorother3_row_id.toString(),M=o.armorother4_row_id.toString(),f=o.armorother5_row_id.toString(),R=o.armorother6_row_id.toString(),$=[c,l,u,h,m,w,A,b,M,f,R].map(G=>G?G.toString().toLowerCase():"0"),P=["unarmored_worn","unarmored","unarmored_ac","unarmored_base","unarmored_bulk","unarmored_carried","unarmored_weight","unarmored_cost"],U=["armortype_worn","armortype","armortype_ac","armortype_base","armortype_magic","armortype_bulk","armortype_carried","armor_weight","armor_cost"],oe=["armortype2_worn","armortype2","armortype2_ac","armortype2_base","armortype2_magic","armortype2_bulk","armortype2_carried","armortype2_weight","armortype2_cost"],K=["armorshield_worn","armorshield","armorshield_ac","armorshield_base","armorshield_magic","armorshield_mod","armorshield_bulk","armorshield_carried","armorshield_weight","armorshield_cost"],me=["armorhelmet_worn","armorhelmet","armorhelmet_ac","armorhelmet_magic","armorhelmet_bulk","armorhelmet_carried","armorhelmet_weight","armorhelmet_cost"],ne=["armorother_worn","armorother","armorother_ac","armorother_base","armorother_magic","armorother_mod"],re=["armorother2_worn","armorother2","armorother2_ac","armorother2_base","armorother2_magic","armorother2_mod"],Y=["armorother3_worn","armorother3","armorother3_ac","armorother3_base","armorother3_magic","armorother3_mod"],Ce=["armorother4_worn","armorother4","armorother4_ac","armorother4_base","armorother4_magic","armorother4_mod"],X=["armorother5_worn","armorother5","armorother5_ac","armorother5_base","armorother5_magic","armorother5_mod"],Q=["armorother6_worn","armorother6","armorother6_ac","armorother6_base","armorother6_magic","armorother6_mod"];function Z(G){let se=Object.entries({unarmoredAttrs:P,armor1Attrs:U,armor2Attrs:oe,shieldAttrs:K,helmetAttrs:me,other1Attrs:ne,other2Attrs:re,other3Attrs:Y,other4Attrs:Ce,other5Attrs:X,other6Attrs:Q}).find(([Oe,fe])=>fe.includes(G));return se?se[0]:null}let S=Z(n),J=o.unarmored,Ee=o.armortype,le=o.armortype2,L=o.armorshield,he=o.armorhelmet,ue=o.armorother,ge=o.armorother2,we=o.armorother3,be=o.armorother4,de=o.armorother5,qe=o.armorother6;(S==="unarmoredAttrs"||p===$[0]||s)&&(S==="unarmoredAttrs"||s?J?c.length===20?(t=c.toLowerCase(),a.unarmored_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=0,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.unarmored_worn,a[`repeating_equipment_${t}_equipment_item`]=o.unarmored,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.unarmored_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.unarmored_base,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.unarmored_bulk,+o.unarmored_worn==1&&+o.unarmored_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.unarmored_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.unarmored_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.unarmored_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.unarmored_cost||0):(t=k(),a.unarmored_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=0,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.unarmored_worn,a[`repeating_equipment_${t}_equipment_item`]=o.unarmored,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.unarmored_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.unarmored_base,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.unarmored_bulk,+o.unarmored_worn==1&&+o.unarmored_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.unarmored_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.unarmored_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.unarmored_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.unarmored_cost||0):c===$[0]&&(a.unarmored_row_id=0,a.unarmored_worn=+o.unarmored_worn,a.unarmored="",a.unarmored_ac=+o.unarmored_ac,a.unarmored_base=+o.unarmored_base,a.unarmored_bulk=+o.unarmored_bulk,a.unarmored_weight=+o.unarmored_weight||0,a.unarmored_cost=+o.unarmored_cost||0,+o.unarmored_worn==1&&+o.unarmored_carried==0?a.unarmored_carried=1:a.unarmored_carried=+o.unarmored_carried):(a.unarmored_row_id=0,a.unarmored_worn=1,a.unarmored="",a.unarmored_ac=10,a.unarmored_base=10,a.unarmored_bulk=0,a.unarmored_weight=0,a.unarmored_cost=0,a.unarmored_carried=1)),(S==="armor1Attrs"||p===$[1]||s)&&(S==="armor1Attrs"||s?Ee?l.length===20?(t=l.toLowerCase(),a.armortype1_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=1,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armortype_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armortype,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armortype_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armortype_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armortype_magic||0,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armortype_bulk,+o.armortype_worn==1&&+o.armortype_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.armortype_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armortype_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armor_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armor_cost||0):(t=k(),a.armortype1_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=1,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armortype_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armortype,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armortype_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armortype_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armortype_magic||0,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armortype_bulk,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armortype_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armor_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armor_cost||0):l===$[1]&&(a.armortype1_row_id=0,a.armortype_worn=0,a.armortype="",a.armortype_ac=10,a.armortype_base=10,a.armortype_magic=0,a.armortype_bulk=0,a.armortype_weight=0,a.armortype_cost=0,a.armortype_carried=1):(a.armortype1_row_id=0,a.armortype_worn=0,a.armortype="",a.armortype_ac=10,a.armortype_base=10,a.armortype_magic=0,a.armortype_bulk=0,a.armortype_weight=0,a.armortype_cost=0,a.armortype_carried=1)),(S==="armor2Attrs"||p===$[2]||s)&&(S==="armor2Attrs"||s?le?u.length===20?(t=u.toLowerCase(),a.armortype2_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=2,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armortype2_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armortype2,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armortype2_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armortype2_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armortype2_magic||0,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armortype2_bulk,+o.armortype2_worn==1&&+o.armortype2_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.armortype2_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armortype2_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armortype2_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armortype2_cost||0):(t=k(),a.armortype2_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=2,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armortype2_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armortype2,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armortype2_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armortype2_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armortype2_magic||0,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armortype2_bulk,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armortype2_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armortype2_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armortype2_cost||0):u===$[2]&&(a.armortype2_row_id=0,a.armortype2_worn=0,a.armortype2="",a.armortype2_ac=10,a.armortype2_base=10,a.armortype2_magic=0,a.armortype2_bulk=0,a.armortype2_weight=0,a.armortype2_cost=0,a.armortype2_carried=1):(a.armortype2_row_id=0,a.armortype2_worn=0,a.armortype2="",a.armortype2_ac=10,a.armortype2_base=10,a.armortype2_magic=0,a.armortype2_bulk=0,a.armortype2_weight=0,a.armortype2_cost=0,a.armortype2_carried=1)),(S==="shieldAttrs"||p===$[3]||s)&&(S==="shieldAttrs"||s?L?h.length===20?(t=h.toLowerCase(),a.armorshield_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=3,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorshield_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorshield,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorshield_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorshield_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=o.armorshield_magic,a[`repeating_equipment_${t}_equipment_armor_mod`]=o.armorshield_mod,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armorshield_bulk,+o.armorshield_worn==1&&+o.armorshield_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.armorshield_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorshield_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armorshield_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armorshield_cost||0):(t=k(),a.armorshield_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=3,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorshield_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorshield,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorshield_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorshield_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=o.armorshield_magic,a[`repeating_equipment_${t}_equipment_armor_mod`]=o.armorshield_mod,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armorshield_bulk,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorshield_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armorshield_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armorshield_cost||0):h===$[3]&&(a.armorshield_row_id=0,a.armorshield_worn=0,a.armorshield="",a.armorshield_ac=0,a.armorshield_base=0,a.armorshield_magic=0,a.armorshield_mod=0,a.armorshield_bulk=0,a.armorshield_weight=0,a.armorshield_cost=0,a.armorshield_carried=1):(a.armorshield_row_id=0,a.armorshield_worn=0,a.armorshield="",a.armorshield_ac=0,a.armorshield_base=0,a.armorshield_magic=0,a.armorshield_mod=0,a.armorshield_bulk=0,a.armorshield_weight=0,a.armorshield_cost=0,a.armorshield_carried=1)),(S==="helmetAttrs"||p===$[4]||s)&&(S==="helmetAttrs"||s?he?m.length===20?(t=m.toLowerCase(),a.armorhelmet_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=4,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorhelmet_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorhelmet,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorhelmet_ac,a[`repeating_equipment_${t}_equipment_armor_magic`]=o.armorhelmet_magic,+o.armorhelmet_worn==1&&+o.armorhelmet_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.armorhelmet_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorhelmet_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armorhelmet_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armorhelmet_cost||0):(t=k(),a.armorhelmet_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=4,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorhelmet_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorhelmet,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorhelmet_ac,a[`repeating_equipment_${t}_equipment_armor_magic`]=o.armorhelmet_magic,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorhelmet_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armorhelmet_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armorhelmet_cost||0):m===$[4]&&(a.armorhelmet_row_id=0,a.armorhelmet_worn=0,a.armorhelmet="",a.armorhelmet_ac=10,a.armorhelmet_base=10,a.armorhelmet_magic=0,a.armorhelmet_bulk=0,a.armorhelmet_weight=0,a.armorhelmet_cost=0,a.armorhelmet_carried=1):(a.armorhelmet_row_id=0,a.armorhelmet_worn=0,a.armorhelmet="",a.armorhelmet_ac=10,a.armorhelmet_base=10,a.armorhelmet_magic=0,a.armorhelmet_bulk=0,a.armorhelmet_weight=0,a.armorhelmet_cost=0,a.armorhelmet_carried=1)),(S==="other1Attrs"||p===$[5]||s)&&(S==="other1Attrs"||s?ue?w.length===20?(t=w.toLowerCase(),a.armorother1_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=5,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother_worn==1?1:0):(t=k(),a.armorother1_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=5,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother_mod||0):w===$[5]&&(a.armorother1_row_id=0,a.armorother_worn=0,a.armorother="",a.armorother_ac=10,a.armorother_base=10,a.armorother_magic=0,a.armorother_mod=0,a.armorother_bulk=0):(a.armorother1_row_id=0,a.armorother_worn=0,a.armorother="",a.armorother_ac=10,a.armorother_base=10,a.armorother_magic=0,a.armorother_mod=0,a.armorother_bulk=0)),(S==="other2Attrs"||p===$[6]||s)&&(S==="other2Attrs"||s?ge?A.length===20?(t=A.toLowerCase(),a.armorother2_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=6,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother2_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother2,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother2_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother2_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother2_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother2_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother2_worn==1?1:0):(t=k(),a.armorother2_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=6,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother2_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother2,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother2_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother2_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother2_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother2_mod||0):A===$[6]&&(a.armorother2_row_id=0,a.armorother2_worn=0,a.armorother2="",a.armorother2_ac=0,a.armorother2_base=0,a.armorother2_magic=0,a.armorother2_mod=0,a.armorother2_bulk=0):(a.armorother2_row_id=0,a.armorother2_worn=0,a.armorother2="",a.armorother2_ac=0,a.armorother2_base=0,a.armorother2_magic=0,a.armorother2_mod=0,a.armorother2_bulk=0)),(S==="other3Attrs"||p===$[7]||s)&&(S==="other3Attrs"||s?we?b.length===20?(t=b.toLowerCase(),a.armorother3_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=7,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother3_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother3,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother3_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother3_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother3_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother3_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother3_worn==1?1:0):(t=k(),a.armorother3_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=7,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother3_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother3,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother3_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother3_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother3_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother3_mod||0):b===$[7]&&(a.armorother3_row_id=0,a.armorother3_worn=0,a.armorother3="",a.armorother3_ac=0,a.armorother3_base=0,a.armorother3_magic=0,a.armorother3_mod=0,a.armorother3_bulk=0):(a.armorother3_row_id=0,a.armorother3_worn=0,a.armorother3="",a.armorother3_ac=0,a.armorother3_base=0,a.armorother3_magic=0,a.armorother3_mod=0,a.armorother3_bulk=0)),(S==="other4Attrs"||p===$[8]||s)&&(S==="other4Attrs"||s?be?M.length===20?(t=M.toLowerCase(),a.armorother4_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=8,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother4_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother4,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother4_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother4_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother4_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother4_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother4_worn==1?1:0):(t=k(),a.armorother4_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=8,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother4_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother4,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother4_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother4_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother4_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother4_mod||0):M===$[8]&&(a.armorother4_row_id=0,a.armorother4_worn=0,a.armorother4="",a.armorother4_ac=0,a.armorother4_base=0,a.armorother4_magic=0,a.armorother4_mod=0,a.armorother4_bulk=0):(a.armorother4_row_id=0,a.armorother4_worn=0,a.armorother4="",a.armorother4_ac=0,a.armorother4_base=0,a.armorother4_magic=0,a.armorother4_mod=0,a.armorother4_bulk=0)),(S==="other5Attrs"||p===$[9]||s)&&(S==="other5Attrs"||s?de?f.length===20?(t=f.toLowerCase(),a.armorother5_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=9,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother5_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother5,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother5_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother5_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother5_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother5_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother5_worn==1?1:0):(t=k(),a.armorother5_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=9,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother5_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother5,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother5_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother5_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother5_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother5_mod||0):f===$[9]&&(a.armorother5_row_id=0,a.armorother5_worn=0,a.armorother5="",a.armorother5_ac=0,a.armorother5_base=0,a.armorother5_magic=0,a.armorother5_mod=0,a.armorother5_bulk=0):(a.armorother5_row_id=0,a.armorother5_worn=0,a.armorother5="",a.armorother5_ac=0,a.armorother5_base=0,a.armorother5_magic=0,a.armorother5_mod=0,a.armorother5_bulk=0)),(S==="other6Attrs"||p===$[10]||s)&&(S==="other6Attrs"||s?qe?R.length===20?(t=R.toLowerCase(),a.armorother6_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=10,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother6_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother6,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother6_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother6_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother6_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother6_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother6_worn==1?1:0):(t=k(),a.armorother6_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=10,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother6_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother6,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother6_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother6_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother6_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother6_mod||0):R===$[10]&&(a.armorother6_row_id=0,a.armorother6_worn=0,a.armorother6="",a.armorother6_ac=0,a.armorother6_base=0,a.armorother6_magic=0,a.armorother6_mod=0,a.armorother6_bulk=0):(a.armorother6_row_id=0,a.armorother6_worn=0,a.armorother6="",a.armorother6_ac=0,a.armorother6_base=0,a.armorother6_magic=0,a.armorother6_mod=0,a.armorother6_bulk=0)),setAttrs(a,Se(),V())})}var Gt=(r,n)=>{let e={};da(null,null,0,1),e.sheet_version=r,g("VERSION UPDATE: migrateArmorDetails completed"),setAttrs(e,{silent:!0},y(r,n))},zt=(r,n)=>{getSectionIDs("repeating_equipment",e=>{let s={},o=[];_.each(e,a=>{o.push(i("equipment",a,"equipment_type")),o.push(i("equipment",a,"equipment_current")),o.push(i("equipment",a,"equipment_current_max")),o.push(i("equipment",a,"equipment_carried_select")),o.push(i("equipment",a,"equipment_carried")),o.push(i("equipment",a,"equipment_quantity")),o.push(i("equipment",a,"equipment_quantity_max")),o.push(i("equipment",a,"equipment_weight")),o.push(i("equipment",a,"equipment_cost")),o.push(i("equipment",a,"equipment_armor_type")),o.push(i("equipment",a,"equipment_armor_worn")),o.push(i("equipment",a,"equipment_armor_ac")),o.push(i("equipment",a,"equipment_armor_base")),o.push(i("equipment",a,"equipment_armor_magic")),o.push(i("equipment",a,"equipment_armor_mod")),o.push(i("equipment",a,"equipment_armor_bulk")),o.push(i("equipment",a,"equipment_macro_text"))}),getAttrs(o,a=>{_.each(e,t=>{s[i("equipment",t,"equipment_type")]=+a[i("equipment",t,"equipment_type")],s[i("equipment",t,"equipment_current")]=+a[i("equipment",t,"equipment_current")]||0,s[i("equipment",t,"equipment_current_max")]=+a[i("equipment",t,"equipment_current_max")]||0,s[i("equipment",t,"equipment_carried_select")]=+a[i("equipment",t,"equipment_carried")],s[i("equipment",t,"equipment_carried")]=+a[i("equipment",t,"equipment_carried")],s[i("equipment",t,"equipment_quantity")]=+a[i("equipment",t,"equipment_quantity")]||0,s[i("equipment",t,"equipment_quantity_max")]=+a[i("equipment",t,"equipment_quantity_max")]||0,s[i("equipment",t,"equipment_weight")]=+a[i("equipment",t,"equipment_weight")]||0,s[i("equipment",t,"equipment_cost")]=+a[i("equipment",t,"equipment_cost")]||0,s[i("equipment",t,"equipment_armor_type")]=+a[i("equipment",t,"equipment_armor_type")],s[i("equipment",t,"equipment_armor_worn")]=+a[i("equipment",t,"equipment_armor_worn")],s[i("equipment",t,"equipment_armor_ac")]=+a[i("equipment",t,"equipment_armor_ac")],s[i("equipment",t,"equipment_armor_base")]=+a[i("equipment",t,"equipment_armor_base")],s[i("equipment",t,"equipment_armor_magic")]=+a[i("equipment",t,"equipment_armor_magic")]||0,s[i("equipment",t,"equipment_armor_mod")]=+a[i("equipment",t,"equipment_armor_mod")]||0,s[i("equipment",t,"equipment_armor_bulk")]=+a[i("equipment",t,"equipment_armor_bulk")],s[i("equipment",t,"equipment_macro_text")]=a[i("equipment",t,"equipment_macro_text")]}),s.sheet_version=r,g("VERSION UPDATE: setEquipmentUpdate completed"),setAttrs(s,{silent:!0},y(r,n))})})},Kt=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s={},o=[];_.each(e,a=>{o.push(i("weapon",a,"weapon_attack_type")),o.push(i("weapon",a,"weapon_dual")),o.push(i("weapon",a,"weapon_whisper_to_hit")),o.push(i("weapon",a,"weapon_whisper_to_hit_select")),o.push(i("weapon",a,"weapon_dual_pen")),o.push(i("weapon",a,"weapon_backstab_var")),o.push(i("weapon",a,"weapon_tohitbonus")),o.push(i("weapon",a,"weapon_magicbonus")),o.push(i("weapon",a,"weapon_prof")),o.push(i("weapon",a,"weapon_backstab")),o.push(i("weapon",a,"weapon_backstab_bonus")),o.push(i("weapon",a,"weapon_backstab_mult")),o.push(i("weapon",a,"weapon_attackdmgbonus")),o.push(i("weapon",a,"weapon_num_attacks")),o.push(i("weapon",a,"weapon_quantity")),o.push(i("weapon",a,"weapon_ammo")),o.push(i("weapon",a,"weapon_ammo_max")),o.push(i("weapon",a,"weapon_weight")),o.push(i("weapon",a,"weapon_cost")),o.push(i("weapon",a,"weapon_range_short")),o.push(i("weapon",a,"weapon_range_medium")),o.push(i("weapon",a,"weapon_range_long")),o.push(i("weapon",a,"weapon_length")),o.push(i("weapon",a,"weapon_space")),o.push(i("weapon",a,"weapon_speed")),o.push(i("weapon",a,"weapon_misc")),o.push(i("weapon",a,"weapon_thac_adj0")),o.push(i("weapon",a,"weapon_thac_adj1")),o.push(i("weapon",a,"weapon_thac_adj2")),o.push(i("weapon",a,"weapon_thac_adj3")),o.push(i("weapon",a,"weapon_thac_adj4")),o.push(i("weapon",a,"weapon_thac_adj5")),o.push(i("weapon",a,"weapon_thac_adj6")),o.push(i("weapon",a,"weapon_thac_adj7")),o.push(i("weapon",a,"weapon_thac_adj8")),o.push(i("weapon",a,"weapon_thac_adj9")),o.push(i("weapon",a,"weapon_thac_adj10")),o.push(i("weapon",a,"weapon_macro_text")),o.push(i("weapon",a,"weapon_damagesmallmedium_chat_menu")),o.push(i("weapon",a,"weapon_damagelarge_chat_menu")),o.push(i("weapon",a,"weapon_damagesmallmedium_npc_chat_menu")),o.push(i("weapon",a,"weapon_damagelarge_npc_chat_menu")),o.push(i("weapon",a,"weapon_critdamagesmallmedium_chat_menu")),o.push(i("weapon",a,"weapon_critdamagelarge_chat_menu")),o.push(i("weapon",a,"weapon_critdamagesmallmedium_npc_chat_menu")),o.push(i("weapon",a,"weapon_critdamagelarge_npc_chat_menu")),o.push(i("weapon",a,"weapon_damage_chat_menu_npc"))}),getAttrs(o,a=>{_.each(e,t=>{s[`repeating_weapon_${t}_weapon_attack_type`]=+a[i("weapon",t,"weapon_attack_type")],s[`repeating_weapon_${t}_weapon_dual`]=a[i("weapon",t,"weapon_dual")],s[`repeating_weapon_${t}_weapon_whisper_to_hit`]=a[i("weapon",t,"weapon_whisper_to_hit")],s[`repeating_weapon_${t}_weapon_whisper_to_hit_select`]=+a[i("weapon",t,"weapon_whisper_to_hit_select")],s[`repeating_weapon_${t}_weapon_dual_pen`]=+a[i("weapon",t,"weapon_dual_pen")]||0,s[`repeating_weapon_${t}_weapon_backstab_var`]=+a[i("weapon",t,"weapon_backstab_var")]||0,s[`repeating_weapon_${t}_weapon_tohitbonus`]=+a[i("weapon",t,"weapon_tohitbonus")]||0,s[`repeating_weapon_${t}_weapon_magicbonus`]=+a[i("weapon",t,"weapon_magicbonus")]||0,s[`repeating_weapon_${t}_weapon_prof`]=+a[i("weapon",t,"weapon_prof")]||0,s[`repeating_weapon_${t}_weapon_backstab`]=+a[i("weapon",t,"weapon_backstab")]||0,s[`repeating_weapon_${t}_weapon_backstab_bonus`]=+a[i("weapon",t,"weapon_backstab_bonus")]||0,s[`repeating_weapon_${t}_weapon_backstab_mult`]=+a[i("weapon",t,"weapon_backstab_mult")]||0,s[`repeating_weapon_${t}_weapon_attackdmgbonus`]=+a[i("weapon",t,"weapon_attackdmgbonus")]||0,s[`repeating_weapon_${t}_weapon_num_attacks`]=+a[i("weapon",t,"weapon_num_attacks")]||0,s[`repeating_weapon_${t}_weapon_quantity`]=+a[i("weapon",t,"weapon_quantity")]||0,s[`repeating_weapon_${t}_weapon_ammo`]=+a[i("weapon",t,"weapon_ammo")]||0,s[`repeating_weapon_${t}_weapon_ammo_max`]=+a[i("weapon",t,"weapon_ammo_max")]||0,s[`repeating_weapon_${t}_weapon_weight`]=+a[i("weapon",t,"weapon_weight")]||0,s[`repeating_weapon_${t}_weapon_cost`]=+a[i("weapon",t,"weapon_cost")]||0,s[`repeating_weapon_${t}_weapon_range_short`]=+a[i("weapon",t,"weapon_range_short")]||0,s[`repeating_weapon_${t}_weapon_range_medium`]=+a[i("weapon",t,"weapon_range_medium")]||0,s[`repeating_weapon_${t}_weapon_range_long`]=+a[i("weapon",t,"weapon_range_long")]||0,s[`repeating_weapon_${t}_weapon_length`]=a[i("weapon",t,"weapon_length")],s[`repeating_weapon_${t}_weapon_space`]=a[i("weapon",t,"weapon_space")],s[`repeating_weapon_${t}_weapon_speed`]=a[i("weapon",t,"weapon_speed")],s[`repeating_weapon_${t}_weapon_misc`]=a[i("weapon",t,"weapon_misc")],s[`repeating_weapon_${t}_weapon_thac_adj0`]=+a[i("weapon",t,"weapon_thac_adj0")]||0,s[`repeating_weapon_${t}_weapon_thac_adj1`]=+a[i("weapon",t,"weapon_thac_adj1")]||0,s[`repeating_weapon_${t}_weapon_thac_adj2`]=+a[i("weapon",t,"weapon_thac_adj2")]||0,s[`repeating_weapon_${t}_weapon_thac_adj3`]=+a[i("weapon",t,"weapon_thac_adj3")]||0,s[`repeating_weapon_${t}_weapon_thac_adj4`]=+a[i("weapon",t,"weapon_thac_adj4")]||0,s[`repeating_weapon_${t}_weapon_thac_adj5`]=+a[i("weapon",t,"weapon_thac_adj5")]||0,s[`repeating_weapon_${t}_weapon_thac_adj6`]=+a[i("weapon",t,"weapon_thac_adj6")]||0,s[`repeating_weapon_${t}_weapon_thac_adj7`]=+a[i("weapon",t,"weapon_thac_adj7")]||0,s[`repeating_weapon_${t}_weapon_thac_adj8`]=+a[i("weapon",t,"weapon_thac_adj8")]||0,s[`repeating_weapon_${t}_weapon_thac_adj9`]=+a[i("weapon",t,"weapon_thac_adj9")]||0,s[`repeating_weapon_${t}_weapon_thac_adj10`]=+a[i("weapon",t,"weapon_thac_adj10")]||0,s[`repeating_weapon_${t}_weapon_macro_text`]=a[i("weapon",t,"weapon_macro_text")],s[`repeating_weapon_${t}_weapon_damagesmallmedium_chat_menu`]=a[i("weapon",t,"weapon_damagesmallmedium_chat_menu")],s[`repeating_weapon_${t}_weapon_damagelarge_chat_menu`]=a[i("weapon",t,"weapon_damagelarge_chat_menu")],s[`repeating_weapon_${t}_weapon_damagesmallmedium_npc_chat_menu`]=a[i("weapon",t,"weapon_damagesmallmedium_npc_chat_menu")],s[`repeating_weapon_${t}_weapon_damagelarge_npc_chat_menu`]=a[i("weapon",t,"weapon_damagelarge_npc_chat_menu")],s[`repeating_weapon_${t}_weapon_critdamagesmallmedium_chat_menu`]=a[i("weapon",t,"weapon_critdamagesmallmedium_chat_menu")],s[`repeating_weapon_${t}_weapon_critdamagelarge_chat_menu`]=a[i("weapon",t,"weapon_critdamagelarge_chat_menu")],s[`repeating_weapon_${t}_weapon_critdamagesmallmedium_npc_chat_menu`]=a[i("weapon",t,"weapon_critdamagesmallmedium_npc_chat_menu")],s[`repeating_weapon_${t}_weapon_critdamagelarge_npc_chat_menu`]=a[i("weapon",t,"weapon_critdamagelarge_npc_chat_menu")],s[`repeating_weapon_${t}_weapon_damage_chat_menu_npc`]=a[i("weapon",t,"weapon_damage_chat_menu_npc")]}),s.sheet_version=r,g("VERSION UPDATE: setWeaponsUpdate completed"),setAttrs(s,{silent:!0},y(r,n))})})},Yt=(r,n)=>{getSectionIDs("nonweaponproficiencies",e=>{let s={},o=[];_.each(e,a=>{o.push(i("nonweaponproficiencies",a,"nwp_attribute")),o.push(i("nonweaponproficiencies",a,"nwp_slots")),o.push(i("nonweaponproficiencies",a,"nwp_modifier")),o.push(i("nonweaponproficiencies",a,"nwp_macro_text"))}),getAttrs(o,a=>{_.each(e,t=>{s[`repeating_nonweaponproficiencies_${t}_attribute`]=a[i("nonweaponproficiencies",t,"nwp_attribute")],s[`repeating_nonweaponproficiencies_${t}_slots`]=+a[i("nonweaponproficiencies",t,"nwp_slots")]||0,s[`repeating_nonweaponproficiencies_${t}_modifier`]=+a[i("nonweaponproficiencies",t,"nwp_modifier")]||0,s[`repeating_nonweaponproficiencies_${t}_macro_text`]=a[i("nonweaponproficiencies",t,"nwp_macro_text")]||0}),s.sheet_version=r,g("VERSION UPDATE: setNWPUpdate completed"),setAttrs(s,{silent:!0},y(r,n))})})},Xt=()=>{getSectionIDs("repeating_weapon",r=>{let n={},e=[];_.each(r,s=>{e.push(i("weapon",s,"weapon_quantity")),e.push(i("weapon",s,"weapon_weight")),e.push(i("weapon",s,"weapon_cost"))}),getAttrs(e,s=>{_.each(r,o=>{n[i("weapon",o,"weapon_quantity")]=+s[i("weapon",o,"weapon_quantity")]||0,n[i("weapon",o,"weapon_weight")]=0,n[i("weapon",o,"weapon_cost")]=0}),setAttrs(n)})})},Qt=()=>{getSectionIDs("repeating_weapon",r=>{getSectionIDs("repeating_equipment",n=>{let e={},s=[],o=[],a=[...s,...o];_.each(r,t=>{a.push(i("weapon",t,"weapon_name")),a.push(i("weapon",t,"weapon_quantity")),a.push(i("weapon",t,"weapon_weight")),a.push(i("weapon",t,"weapon_cost"))}),_.each(n,t=>{a.push(i("equipment",t,"equipment_item")),a.push(i("equipment",t,"equipment_quantity")),a.push(i("equipment",t,"equipment_weight")),a.push(i("equipment",t,"equipment_cost"))}),getAttrs(a,t=>{let p=[],c=[],l=[],u=[],h="";_.each(r,m=>{let w=t[i("weapon",m,"weapon_name")],A=t[i("weapon",m,"weapon_quantity")],b=t[i("weapon",m,"weapon_weight")],M=t[i("weapon",m,"weapon_cost")];if(_.each(n,f=>{let R=f;u.push(R);let $=t[i("equipment",f,"equipment_item")];p.push($);let P=t[i("equipment",f,"equipment_weight")];c.push(P);let U=t[i("equipment",f,"equipment_cost")];l.push(U)}),b!==0||M!==0){g(`weaponName:${w} weaponWeight:${b} weaponCost:${M}`);let f=p.indexOf(w);f===-1?(g("NO MATCH || COPY TO NEW ROW ||"),h=k(),e[`repeating_equipment_${h}_equipment_type`]=1,e[`repeating_equipment_${h}_equipment_item`]=w,e[`repeating_equipment_${h}_equipment_quantity`]=A,e[`repeating_equipment_${h}_equipment_quantity_max`]=A,e[`repeating_equipment_${h}_equipment_weight`]=b,e[`repeating_equipment_${h}_equipment_cost`]=M):c[f]==="0"&&l[f]==="0"?(g(`MATCH w/weight & cost tracked on weapons. || UPDATE ROW || name:${w} weight:${c[f]} cost:${l[f]} at index:${f} id:${u[f]}`),h=u[f],e[`repeating_equipment_${h}_equipment_type`]=1,e[`repeating_equipment_${h}_equipment_quantity`]=A,e[`repeating_equipment_${h}_equipment_quantity_max`]=A,e[`repeating_equipment_${h}_equipment_weight`]=b,e[`repeating_equipment_${h}_equipment_cost`]=M):c[f]!=="0"&&l[f]==="0"?(g(`MATCH w/weight tracked on equipment. || UPDATE ROW || name:${w} weight:${c[f]} cost:${l[f]} at index:${f} id:${u[f]}`),h=u[f],e[`repeating_equipment_${h}_equipment_type`]=1,e[`repeating_equipment_${h}_equipment_cost`]=M):c[f]==="0"&&l[f]!=="0"?(g(`MATCH w/cost tracked on equipment. || UPDATE ROW || name:${w} weight:${c[f]} cost:${l[f]} at index:${f} id:${u[f]}`),h=u[f],e[`repeating_equipment_${h}_equipment_type`]=1,e[`repeating_equipment_${h}_equipment_weight`]=b):c[f]!=="0"&&l[f]!=="0"?g(`100% MATCH weight & cost tracked on equipment. || IGNORE ROW || name:${w} weight: ${c[f]} cost:${l[f]} at index:${f}`):g("No attribute data to migrate. || IGNORE ROW ||")}}),setAttrs(e,{silent:!0},Xt())})})})},Zt=(r,n)=>{let e={};Qt(),e.sheet_version=r,g("VERSION UPDATE: migrateWeaponWtCost completed"),setAttrs(e,{silent:!0},y(r,n))},Jt=(r,n)=>{getSectionIDs("repeating_equipment",e=>{let s={},o=[];_.each(e,a=>{o.push(i("equipment",a,"equipment_type"))}),getAttrs(o,a=>{_.each(e,t=>{let p=+a[i("equipment",t,"equipment_type")];p>=0||(s[i("equipment",t,"equipment_type")]=0,g(`equipType -1:${p} reset to Gear`))}),s.sheet_version=r,g("VERSION UPDATE: setEquipmentType completed"),setAttrs(s,{silent:!0},y(r,n))})})},vt=(r,n)=>{let e={};ma(),e.sheet_version=r,g("VERSION UPDATE: migrateSetSpellsCasterClass completed"),setAttrs(e,{silent:!0},y(r,n))},eo=(r,n)=>{let e={};V(0),e.sheet_version=r,g("VERSION UPDATE: recalcAC completed"),setAttrs(e,{silent:!0},y(r,n))},ao=(r,n)=>{let e={};e.init_macro_text="",e.sheet_version=r,g("VERSION UPDATE: recalcAC completed"),setAttrs(e,{silent:!0},y(r,n))},to=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"weapon_critdamagesmallmedium")),s.push(i("weapon",o,"weapon_critdamagelarge"))}),getAttrs([...s],o=>{let a={},t="(@{weapon_damagesmallmedium})*2",p="(@{weapon_damagelarge})*2";_.each(e,c=>{let l=o[i("weapon",c,"weapon_critdamagesmallmedium")]||t,u=o[i("weapon",c,"weapon_critdamagelarge")]||p;a[i("weapon",c,"weapon_critdamagesmallmedium")]=l.replace(/@{weapon_damagesmallmedium}*2/g,"(@{weapon_damagesmallmedium})*2"),a[i("weapon",c,"weapon_critdamagelarge")]=u.replace(/@{weapon_damagelarge}*2/g,"(@{weapon_damagelarge})*2")}),a.sheet_version=r,g("VERSION UPDATE: updateCriticalDamageMacro completed"),setAttrs(a,{silent:!0},y(r,n))})})},oo=()=>{getAttrs(["hitdice","armorclass","strength","intelligence","wisdom","dexterity","constitution","charisma","old_character"],r=>{let n={};if((+r.old_character||0)===1)return;let s=+r.hitdice,o=+r.armorclass,a=+r.strength,t=+r.intelligence,p=+r.wisdom,c=+r.dexterity,l=+r.constitution,u=+r.charisma,h=a+t+p+c+l+u;s===0&&o===10&&h===60?(n.strength=a===10?8:a,n.intelligence=t===10?8:t,n.wisdom=p===10?8:p,n.dexterity=c===10?8:c,n.constitution=l===10?8:l,n.charisma=u===10?8:u,n.old_character=1,Fa()):n.old_character=1,setAttrs(n,{silent:!0})})};y=(r,n)=>{r<.1?xt(.1,n):r<1.2?St(1.2,n):r<1.5?Mt(1.5,n):r<1.52?Dt(1.52,n):r<1.53?Ct(1.53,n):r<1.54?Et(1.54,n):r<1.55?It(1.55,n):r<1.56?Ot(1.56,n):r<1.57?Nt(1.57,n):r<1.591?La(1.591,n):r<1.592?ja(1.592,n):r<1.593?Ba(1.593,n):r<1.594?Tt(1.594,n):r<1.595?Be(1.595,n):r<1.596?Ra(1.596,n):r<1.597?jt(1.597,n):r<1.598?Bt(1.598,n):r<1.61?Ut(1.61,n):r<1.62?Ht(1.62,n):r<1.634?Be(1.634,n):r<1.635?Rt(1.635,n):r<1.636?Lt(1.636,n):r<1.637?Be(1.637,n):r<1.638?Wt(1.638,n):r<1.639?Vt(1.639,n):r<1.64?Gt(1.641,n):r<1.642?Pt(1.643,n):r<1.644?zt(1.644,n):r<1.645?Kt(1.645,n):r<1.646?Zt(1.646,n):r<1.648?Jt(1.648,n):r<1.65?vt(1.65,n):r<1.652?Ra(1.652,n):r<1.654?eo(1.654,n):r<1.656?ao(1.656,n):r<1.658?to(1.658,n):r<1.659?Yt(1.66,n):r
{getAttrs(["sheet_version","old_character"],n=>{let e={},s=T(n.sheet_version);+n.old_character==0&&s===0&&(s=1.68,e.sheet_version=1.68,setAttrs(e,{silent:!0})),g(`Current sheet data version:${s}, Sheet code version:${1.68}`),y(s,1.68)})});on("change:abilities_info_show change:toggle_exceptional change:intelligence change:wisdom change:dexterity change:constitution change:charisma change:comeliness",r=>{getAttrs(["intelligence","wisdom","dexterity","constitution","charisma","comeliness","toggle_exceptional"],n=>{let e={};+n.toggle_exceptional!==1&&(e.exceptional_intelligence_flag=1,e.exceptional_wisdom_flag=1,e.exceptional_dexterity_flag=1,e.exceptional_constitution_flag=1,e.exceptional_charisma_flag=1,e.exceptional_comeliness_flag=1,setAttrs(e,{silent:!0}))})});on("change:abilities_info_show change:toggle_exceptional change:strength",r=>{getAttrs(["strength"],n=>{let e={};e.exceptional_strength_flag=1,setAttrs(e,{silent:!0})})});on("change:is_npc",r=>{getAttrs(["is_npc","toggle_npc"],n=>{let e={},s=+n.is_npc,o=+n.toggle_npc;o=s===0?0:1,e.toggle_npc=o,setAttrs(e,{silent:!0})})});var no=()=>{getSectionIDs("repeating_equipment",r=>{let n={},e=[];_.each(r,s=>{e.push(i("equipment",s,"equipment_quantity")),e.push(i("equipment",s,"equipment_cost"))}),getAttrs(e,s=>{let o=[];_.each(r,t=>{let p=+s[i("equipment",t,"equipment_quantity")]||0,c=+s[i("equipment",t,"equipment_cost")]||0;c=p>0?c*p:0,o.push(c)});let a=o.reduce((t,p)=>t+p,0);n.total_equipment_cost=a.toFixed(2),n.total_cost=a.toFixed(2),setAttrs(n,{silent:!0})})})},ro=()=>{getSectionIDs("repeating_equipment",r=>{let n={},e=[];_.each(r,s=>{e.push(i("equipment",s,"equipment_type")),e.push(i("equipment",s,"equipment_armor_type")),e.push(i("equipment",s,"equipment_location")),e.push(i("equipment",s,"equipment_weight")),e.push(i("equipment",s,"equipment_quantity")),e.push(i("equipment",s,"equipment_carried")),e.push(i("equipment",s,"equipment_carried_select"))}),getAttrs(["total_coin_weight",...e],s=>{let o=[],a=[],t=[];_.each(r,m=>{let w=+s[i("equipment",m,"equipment_type")],A=0,b=+s[i("equipment",m,"equipment_carried_select")];n[i("equipment",m,"equipment_carried")]=b===1?1:0,A=b===1?1:0;let M=+s[i("equipment",m,"equipment_quantity")]||0,f=+s[i("equipment",m,"equipment_weight")]||0,R=0,$=0;f=f*M*A,w===1&&(R=f),w===2&&($=f),o.push(R),a.push($),t.push(f)});let p=o.reduce((m,w)=>m+w,0),c=a.reduce((m,w)=>m+w,0),l=t.reduce((m,w)=>m+w,0),u=l-c-p,h=Math.round(T(s.total_coin_weight)+T(l));n.total_weapon_weight=p.toFixed(2),n.total_armor_weight=c.toFixed(2),n.total_equipment_weight=l.toFixed(2),n.total_equipment_weight_adjusted=u.toFixed(2),n.total_weight=h,setAttrs(n,{silent:!0})})})};on("change:repeating_equipment:equipment_quantity change:repeating_equipment:equipment_cost remove:repeating_equipment",r=>{no()});on("change:repeating_equipment:equipment_weight change:repeating_equipment:equipment_quantity change:repeating_equipment:equipment_carried change:repeating_equipment:equipment_carried_select change:repeating_equipment:equipment_armor_worn change:total_coin_weight remove:repeating_equipment change:toggle_lbs",r=>{ro()});on("change:pp change:gp change:ep change:sp change:cp change:toggle_lbs",r=>{getAttrs(["pp","gp","ep","sp","cp","toggle_lbs"],n=>{let e=+(n.toggle_lbs||0)?10:1;setAttrs({total_coin_weight:(Math.round((T(n.pp)+T(n.gp)+T(n.ep)+T(n.sp)+T(n.cp))/1)/e).toFixed(2)})})});function _o(){getAttrs(["normal_load_adjusted","heavy_load","very_heavy_load","total_weight","autocalc_movement_flag","current_bulk","current_encumbrance_move"],r=>{let n={},e=+r.autocalc_movement_flag,s=+r.normal_load_adjusted||0,o=+r.heavy_load||0,a=+r.very_heavy_load||0,t=+r.total_weight||0,p=+r.current_bulk,c=0;t<=s?(n.current_encumbrance_label="Unencumbered",c=0,n.current_encumbrance=c,n.current_encumbrance_move=e===1?Math.max(c,p):r.current_encumbrance_move):t>s&&t<=o?(n.current_encumbrance_label="Heavy",c=1,n.current_encumbrance=c,n.current_encumbrance_move=e===1?Math.max(c,p):r.current_encumbrance_move):t>o&&t<=a?(n.current_encumbrance_label="Very Heavy",c=2,n.current_encumbrance=c,n.current_encumbrance_move=e===1?Math.max(c,p):r.current_encumbrance_move):(n.current_encumbrance_label="Encumbered",c=3,n.current_encumbrance=c,n.current_encumbrance_move=e===1?Math.max(c,p):r.current_encumbrance_move),setAttrs(n)})}on("sheet:opened change:encumbrancebonus change:normal_load change:total_weight change:autocalc_movement_flag change:current_bulk change:encumbrancebonus_lbs change:toggle_lbs",r=>{getAttrs(["encumbrancebonus","toggle_lbs"],n=>{let e={},s=+(n.toggle_lbs||0),o=s?.1:1,a=350*o,t=+n.encumbrancebonus||0,p=T(t*o),l=a+(s?p:t),u=l+a,h=u+a,m=h;e.encumbrancebonus_lbs=p,e.normal_load=a,e.normal_load_adjusted=l,e.heavy_load=u,e.very_heavy_load=h,e.max_load=m+1,setAttrs(e,{silent:!0},_o())})});function so(){getAttrs(["current_encumbrance_move","movement"],r=>{let n={},e=+r.movement.toString().replace(/[^0-9]/g,""),s=+r.current_encumbrance_move,o=0;s===0?o=e:s===1?o=q(e-3):s===2?o=q(e-6):o=q(e-9),n.movement_normal=o,n.movement_known=o*5,n.movement_run=o*10,setAttrs(n,{silent:!0})})}on("change:movement change:current_encumbrance change:current_encumbrance_move change:autocalc_movement_flag",r=>{getAttrs(["movement"],n=>{let e={},o=+n.movement.toString().replace(/[^0-9]/g,"");e.movement_heavy=Math.max(o-3,0),e.movement_load=Math.max(o-6,0),e.movement_max=Math.max(o-9,0),setAttrs(e,{silent:!0},so(),V(0))})});function io(){getAttrs(["unarmored_bulk","armortype_bulk","armortype2_bulk","armorshield_bulk","unarmored_worn","armortype_worn","armortype2_worn","armorshield_worn","armorshield_carried"],r=>{let n={},{unarmored_worn:e}=r,{armortype_worn:s}=r,{armortype2_worn:o}=r,{armorshield_worn:a}=r,{armorshield_carried:t}=r,p=Math.max(a,t),c=r.unarmored_bulk*e,l=r.armortype_bulk*s,u=r.armortype2_bulk*o,h=r.armorshield_bulk*p;switch(Math.max(c,l,u,h)){case 0:n.current_bulk_label="Not Bulky",n.current_bulk=0;break;case 1:n.current_bulk_label="Not Bulky/Light",n.current_bulk=0;break;case 2:n.current_bulk_label="Fairly/Moderate",n.current_bulk=1;break;case 3:n.current_bulk_label="Bulky/Heavy",n.current_bulk=2;break;default:g(">> failure in bulk calculation <<")}setAttrs(n)})}on("change:unarmored_bulk change:armortype_bulk change:armortype2_bulk change:armorshield_bulk change:armorhelmet_bulk change:unarmored_worn change:armortype_worn change:armortype2_worn change:armorshield_worn change:armorhelmet_worn change:armorshield_carried remove:repeating_equipment",r=>{io()});on("change:repeating_equipment:equipment_carried_select change:repeating_equipment:equipment_type change:repeating_equipment:equipment_carried_select",r=>{let n=r.sourceAttribute.split("_")[2],e=`${r.sourceAttribute}`,o=/equipment_type/.test(e),a=[i("equipment",n,"equipment_type"),i("equipment",n,"equipment_carried_select")];getAttrs(["equipment_tabs_type","equipment_tabs_carry",...a],t=>{let p={},c=+t.equipment_tabs_carry,l=+t.equipment_tabs_type,u=+t[i("equipment",n,"equipment_type")],h=+t[i("equipment",n,"equipment_carried_select")];p[i("equipment",n,"equipment_carried")]=h===1?1:0,p.equipment_tabs_type=l!==-1&&o?u:l,console.log(`Change detected: testCarrySelected:${c===-1||c===h?-1:h}`),p.equipment_tabs_carry=c===-1||c===h?-1:h,setAttrs(p)})});on("change:equipment_tabs_type change:equipment_tabs_carry change:repeating_equipment:equipment_magical",r=>{g(`Change Detected:${r.sourceAttribute}`),getSectionIDs("repeating_equipment",n=>{let e=[];_.each(n,s=>{e.push(i("equipment",s,"equipment_type")),e.push(i("equipment",s,"equipment_carried_select")),e.push(i("equipment",s,"equipment_magical"))}),getAttrs(["equipment_tabs_type","equipment_tabs_carry","equipment_magical",...e],s=>{let o={},a=+s.equipment_tabs_type,t=+s.equipment_tabs_carry;_.each(n,p=>{let c=+s[i("equipment",p,"equipment_magical")],l=+s[i("equipment",p,"equipment_type")],u=+s[i("equipment",p,"equipment_carried_select")];if(a===-1||a===l||a===3&&c)return o[i("equipment",p,"equipment_show_carry")]=t===-1||t===u?1:0,o[i("equipment",p,"equipment_show_type")]=1;o[i("equipment",p,"equipment_show_carry")]=t===-1||t===u?1:0,o[i("equipment",p,"equipment_show_type")]=0}),setAttrs(o)})})});var po=()=>{getSectionIDs("repeating_equipment",r=>{let n=r.reduce((e,s)=>[...e,`repeating_equipment_${s}_equipment_armor_type`],[]);getAttrs(["armordetails_array",...De,...n],e=>{let s={},o=e.unarmored_row_id.toString(),a=e.armortype1_row_id.toString(),t=e.armortype2_row_id.toString(),p=e.armorshield_row_id.toString(),c=e.armorhelmet_row_id.toString(),l=e.armorother1_row_id.toString(),u=e.armorother2_row_id.toString(),h=e.armorother3_row_id.toString(),m=e.armorother4_row_id.toString(),w=e.armorother5_row_id.toString(),A=e.armorother6_row_id.toString(),b=[o,a,t,p,c,l,u,h,m,w,A].map(M=>M?M.toString().toLowerCase():"0");_.each(r,M=>{let f=+e[`repeating_equipment_${M}_equipment_armor_type`];if(f===99)return;let R=b.map(($,P)=>$===M?`${Math.floor(P)+1}`:null).filter($=>$!==null);if(R.length>1){let U=R.join(",").split(",").filter(K=>K!==String(f));switch(U.length>0?U[0]:null){case"1":s.unarmored="",g(">> DELETE/RESET ROW 0 - Unarmored <<");break;case"2":s.armortype="",g(">> DELETE/RESET ROW 1 - Armor 1 <<");break;case"3":s.armortype2="",g(">> DELETE/RESET ROW 2 - Armor 2 <<");break;case"4":s.armorshield="",g(">> DELETE/RESET ROW 3 - Shield <<");break;case"5":s.armorhelmet="",g(">> DELETE/RESET ROW 4 - Helmet <<");break;case"6":s.armorother="",g(">> DELETE/RESET ROW 5 - Other <<");break;case"7":s.armorother2="",g(">> DELETE/RESET ROW 6 - Other 2 <<");break;case"8":s.armorother3="",g(">> DELETE/RESET ROW 7 - Other 3 <<");break;case"9":s.armorother4="",g(">> DELETE/RESET ROW 8 - Other 4 <<");break;case"10":s.armorother5="",g(">> DELETE/RESET ROW 9 - Other 5 <<");break;case"11":s.armorother6="",g(">> DELETE/RESET ROW 10 - Other 6 <<");break;default:g(">> NOTHING TO DELETE/RESET <<")}}}),setAttrs(s)})})},co=`${ba.map(r=>`change:${r}`).join(" ")}`;on(co,r=>{if(r.sourceType==="sheetworker")return;let n=r.sourceAttribute,e=r.previousValue,s=r.newValue,o=0;getAttrs(ba,a=>{let t={},p="";n==="unarmored"&&e===void 0&&(p=k(),t.unarmored_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=0,t[`repeating_equipment_${p}_equipment_armor_worn`]=1,t[`repeating_equipment_${p}_equipment_item`]=a.unarmored,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.unarmored_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.unarmored_base,t[`repeating_equipment_${p}_equipment_carried_select`]=1,g(`repeating armor does not exist. Creating unarmored: ${p}`)),n==="armortype"&&e===void 0&&(p=k(),t.armortype1_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=1,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armortype_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armortype,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armortype_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armortype_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armortype_magic||0,t[`repeating_equipment_${p}_equipment_armor_bulk`]=+a.armortype_bulk,t[`repeating_equipment_${p}_equipment_carried_select`]=+a.armortype_carried,t[`repeating_equipment_${p}_equipment_weight`]=+a.armor_weight||0,t[`repeating_equipment_${p}_equipment_cost`]=+a.armor_cost||0),n==="armortype2"&&e===void 0&&(p=k(),t.armortype2_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=2,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armortype2_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armortype2,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armortype2_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armortype2_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armortype2_magic||0,t[`repeating_equipment_${p}_equipment_armor_bulk`]=+a.armortype2_bulk,t[`repeating_equipment_${p}_equipment_carried_select`]=+a.armortype2_carried,t[`repeating_equipment_${p}_equipment_weight`]=+a.armortype2_weight||0,t[`repeating_equipment_${p}_equipment_cost`]=+a.armortype2_cost||0),n==="armorshield"&&e===void 0&&(p=k(),t.armorshield_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=3,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorshield_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorshield,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorshield_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorshield_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorshield_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorshield_mod||0,t[`repeating_equipment_${p}_equipment_armor_bulk`]=+a.armorshield_bulk,t[`repeating_equipment_${p}_equipment_carried_select`]=+a.armorshield_carried,t[`repeating_equipment_${p}_equipment_weight`]=+a.armorshield_weight||0,t[`repeating_equipment_${p}_equipment_cost`]=+a.armorshield_cost||0),n==="armorhelmet"&&e===void 0&&(p=k(),t.armorhelmet_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=4,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorhelmet_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorhelmet,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorhelmet_ac,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorhelmet_magic||0,t[`repeating_equipment_${p}_equipment_carried_select`]=+a.armorhelmet_carried,t[`repeating_equipment_${p}_equipment_weight`]=+a.armorhelmet_weight||0,t[`repeating_equipment_${p}_equipment_cost`]=+a.armorhelmet_cost||0),n==="armorother"&&e===void 0&&(p=k(),t.armorother1_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=5,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother_mod||0),n==="armorother2"&&e===void 0&&(p=k(),t.armorother2_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=6,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother2_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother2,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother2_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother2_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother2_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother2_mod||0),n==="armorother3"&&e===void 0&&(p=k(),t.armorother3_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=7,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother3_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother3,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother3_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother3_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother3_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother3_mod||0),n==="armorother4"&&e===void 0&&(p=k(),t.armorother4_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=8,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother4_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother4,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother4_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother4_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother4_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother4_mod||0),n==="armorother5"&&e===void 0&&(p=k(),t.armorother5_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=9,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother5_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother5,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother5_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother5_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother5_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother5_mod||0),n==="armorother6"&&e===void 0&&(p=k(),t.armorother6_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=10,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother6_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother6,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother6_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother6_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother6_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother6_mod||0),setAttrs(t,{silent:!0},Se()),da(null,n,o)})});function Ga(r,n){getAttrs([`repeating_equipment_${r}_equipment_armor_type`,`repeating_equipment_${r}_equipment_item`,`repeating_equipment_${r}_equipment_armor_worn`,`repeating_equipment_${r}_equipment_armor_ac`,`repeating_equipment_${r}_equipment_armor_base`,`repeating_equipment_${r}_equipment_armor_magic`,`repeating_equipment_${r}_equipment_armor_mod`,`repeating_equipment_${r}_equipment_armor_bulk`,`repeating_equipment_${r}_equipment_carried_select`,`repeating_equipment_${r}_equipment_carried`,`repeating_equipment_${r}_equipment_weight`,`repeating_equipment_${r}_equipment_cost`],e=>{let s={},a=+e[`repeating_equipment_${r}_equipment_armor_type`],t=e[`repeating_equipment_${r}_equipment_item`],p=+e[`repeating_equipment_${r}_equipment_armor_worn`],c=+e[`repeating_equipment_${r}_equipment_armor_ac`],l=+e[`repeating_equipment_${r}_equipment_armor_base`],u=+e[`repeating_equipment_${r}_equipment_armor_magic`]||0,h=+e[`repeating_equipment_${r}_equipment_armor_mod`]||0,m=+e[`repeating_equipment_${r}_equipment_armor_bulk`],w=+e[`repeating_equipment_${r}_equipment_carried_select`],A=+e[`repeating_equipment_${r}_equipment_weight`]||0,b=+e[`repeating_equipment_${r}_equipment_cost`]||0;p===1?(w=1,s[`repeating_equipment_${r}_equipment_carried_select`]=1):p===0&&(w===0||w===2)&&(s[`repeating_equipment_${r}_equipment_carried_select`]=w);let M=[`ID:${r} ITEM:${t} TYPE:${a} WORN:${p} AC:${c} BASE:${l} MAGIC:${u} MOD:${h} BULK:${m} CARRIED:${w} WEIGHT:${A} COST:${b} UPDATED:`];switch(a){case 99:g("Choose an armor row.");break;case 0:s.unarmored_worn=p,s.unarmored=t,s.unarmored_ac=c,s.unarmored_base=l,s.unarmored_bulk=m,s.unarmored_carried=w,s.unarmored_row_id=r;break;case 1:s.armortype_worn=p,s.armortype=t,s.armortype_ac=c,s.armortype_base=l,s.armortype_magic=u,s.armortype_bulk=m,s.armortype_carried=w,s.armor_weight=A,s.armor_cost=b,s.armortype1_row_id=r;break;case 2:s.armortype2_worn=p,s.armortype2=t,s.armortype2_ac=c,s.armortype2_base=l,s.armortype2_magic=u,s.armortype2_bulk=m,s.armortype2_carried=w,s.armortype2_weight=A,s.armortype2_cost=b,s.armortype2_row_id=r;break;case 3:s.armorshield_worn=p,s.armorshield=t,s.armorshield_ac=c>=0?0:-Math.abs(c),s.armorshield_base=l>=0?0:-Math.abs(l),s.armorshield_magic=u,s.armorshield_mod=h,s.armorshield_bulk=m,s.armorshield_carried=w,s.armorshield_weight=A,s.armorshield_cost=b,s.armorshield_row_id=r;break;case 4:s.armorhelmet_worn=p,s.armorhelmet=t,s.armorhelmet_base=l,s.armorhelmet_magic=u,s.armorhelmet_carried=w,s.armorhelmet_weight=A,s.armorhelmet_cost=b,s.armorhelmet_row_id=r;break;case 5:s.armorother_worn=p,s.armorother=t,s.armorother_ac=c,s.armorother_base=l,s.armorother_magic=u,s.armorother_mod=h,s.armorother1_row_id=r;break;case 6:s.armorother2_worn=p,s.armorother2=t,s.armorother2_ac=c>=0?0:-Math.abs(c),s.armorother2_base=l>=0?0:-Math.abs(l),s.armorother2_magic=u,s.armorother2_mod=h,s.armorother2_row_id=r;break;case 7:s.armorother3_worn=p,s.armorother3=t,s.armorother3_ac=c>=0?0:-Math.abs(c),s.armorother3_base=l>=0?0:-Math.abs(l),s.armorother3_magic=u,s.armorother3_mod=h,s.armorother3_row_id=r;break;case 8:s.armorother4_worn=p,s.armorother4=t,s.armorother4_ac=c>=0?0:-Math.abs(c),s.armorother4_base=l>=0?0:-Math.abs(l),s.armorother4_magic=u,s.armorother4_mod=h,s.armorother4_row_id=r;break;case 9:s.armorother5_worn=p,s.armorother5=t,s.armorother5_ac=c>=0?0:-Math.abs(c),s.armorother5_base=l>=0?0:-Math.abs(l),s.armorother5_magic=u,s.armorother5_mod=h,s.armorother5_row_id=r;break;case 10:s.armorother6_worn=p,s.armorother6=t,s.armorother6_ac=c>=0?0:-Math.abs(c),s.armorother6_base=l>=0?0:-Math.abs(l),s.armorother6_magic=u,s.armorother6_mod=h,s.armorother6_row_id=r;break;default:g("Armor row is out of range.")}n&&n(),setAttrs(s,V(0))})}function mo(r){let n={};getAttrs([`repeating_equipment_${r}_equipment_item`,`repeating_equipment_${r}_equipment_weapon_type`,`repeating_equipment_${r}_equipment_weapon_speed`,`repeating_equipment_${r}_equipment_weapon_length`,`repeating_equipment_${r}_equipment_weapon_space`,`repeating_equipment_${r}_equipment_weapon_misc`,`repeating_equipment_${r}_equipment_weapon_damagesmallmedium`,`repeating_equipment_${r}_equipment_weapon_damagelarge`,`repeating_equipment_${r}_equipment_weapon_attackdmgtype`,`repeating_equipment_${r}_equipment_weapon_rateoffire`,`repeating_equipment_${r}_equipment_weapon_range`,`repeating_equipment_${r}_equipment_quantity`,`repeating_equipment_${r}_equipment_description`],e=>{let s=k();n[`repeating_weapon_${s}_weapon_name`]=e[`repeating_equipment_${r}_equipment_item`],n[`repeating_weapon_${s}_weapon_type`]=+e[`repeating_equipment_${r}_equipment_weapon_type`],n[`repeating_weapon_${s}_weapon_speed`]=e[`repeating_equipment_${r}_equipment_weapon_speed`],n[`repeating_weapon_${s}_weapon_length`]=e[`repeating_equipment_${r}_equipment_weapon_length`],n[`repeating_weapon_${s}_weapon_space`]=e[`repeating_equipment_${r}_equipment_weapon_space`],n[`repeating_weapon_${s}_weapon_misc`]=e[`repeating_equipment_${r}_equipment_weapon_misc`],n[`repeating_weapon_${s}_weapon_damagesmallmedium`]=e[`repeating_equipment_${r}_equipment_weapon_damagesmallmedium`],n[`repeating_weapon_${s}_weapon_damagelarge`]=e[`repeating_equipment_${r}_equipment_weapon_damagelarge`],n[`repeating_weapon_${s}_weapon_attackdmgtype`]=e[`repeating_equipment_${r}_equipment_weapon_attackdmgtype`],n[`repeating_weapon_${s}_weapon_rateoffire`]=e[`repeating_equipment_${r}_equipment_weapon_rateoffire`],n[`repeating_weapon_${s}_weapon_range`]=e[`repeating_equipment_${r}_equipment_weapon_range`],n[`repeating_weapon_${s}_weapon_quantity`]=+e[`repeating_equipment_${r}_equipment_quantity`]||0,n[`repeating_weapon_${s}_weapon_notes`]=e[`repeating_equipment_${r}_equipment_description`],setAttrs(n,{silent:!0},za(r),Me(s))})}function qa(r,n){getAttrs(De,e=>{let s=e.unarmored_row_id.toString(),o=e.armortype1_row_id.toString(),a=e.armortype2_row_id.toString(),t=e.armorshield_row_id.toString(),p=e.armorhelmet_row_id.toString(),c=e.armorother1_row_id.toString(),l=e.armorother2_row_id.toString(),u=e.armorother3_row_id.toString(),h=e.armorother4_row_id.toString(),m=e.armorother5_row_id.toString(),w=e.armorother6_row_id.toString(),A=[s,o,a,t,p,c,l,u,h,m,w].map(M=>M?M.toString().toLowerCase():"0"),b="";b=A.includes(r)?1:0,typeof n=="function"&&n(b,A)})}Se=r=>{let n={};qa(r,(e,s)=>{n.armordetails_array=[`${s}`],setAttrs(n,{silent:!0})})};var lo=`${De.map(r=>`change:${r}`).join(" ")}`;on(lo,r=>{let n=r.sourceAttribute;r.sourceType!=="sheetworker"&&getAttrs(n,e=>{let s=e[`${r.sourceAttribute}`];g("Updating armordetails_array..."),Se(s)})});on("change:repeating_equipment:equipment_item change:repeating_equipment:equipment_armor_worn change:repeating_equipment:equipment_armor_ac change:repeating_equipment:equipment_armor_base change:repeating_equipment:equipment_armor_magic change:repeating_equipment:equipment_armor_mod change:repeating_equipment:equipment_armor_bulk change:repeating_equipment:equipment_carried_select change:repeating_equipment:equipment_weight change:repeating_equipment:equipment_cost",r=>{let n=r.sourceAttribute.split("_")[2].toLowerCase();r.sourceType!=="sheetworker"&&qa(n,e=>{e&&Ga(n)})});on("clicked:repeating_equipment:addarmor",r=>{let n=r.sourceAttribute.split("_")[2].toLowerCase();Ga(n,()=>{po()})});on("clicked:repeating_equipment:addattack",r=>{let n=r.sourceAttribute.split("_")[2];mo(n)});on("clicked:addturnundead",r=>{let n={},e=k();n[`repeating_ability_${e}_ability_name`]="Turn Undead by Type",n[`repeating_ability_${e}_ability_short_description`]="[Turn Undead by Type](~selected|turn_undead_roll)",setAttrs(n,{silent:!0})});on("clicked:addturnundead2",r=>{let n={},e=k();n[`repeating_ability_${e}_ability_name`]="Turn Undead by HD",n[`repeating_ability_${e}_ability_short_description`]="[Turn Undead by HD](~selected|turn_undead2_roll)",setAttrs(n,{silent:!0})});on("remove:repeating_equipment",r=>{let n=r.sourceAttribute.split("_")[2].toLowerCase(),e=1;qa(n,(s,o)=>{s&&da(n,null,e)})});on("change:spell_tabs change:toggle_show_memorized change:spell_caster_tabs change:toggle_caster2",r=>{getSectionIDs("repeating_spells",n=>{let e=[];_.each(n,s=>{e.push(i("spells",s,"spell_memorized")),e.push(i("spells",s,"spell_show_all")),e.push(i("spells",s,"spell_level")),e.push(i("spells",s,"spell_caster_class"))}),getAttrs(["spell_tabs","toggle_show_memorized","spell_caster_tabs","toggle_caster2",...e],s=>{let o={},a=+s.toggle_show_memorized,t=+s.spell_caster_tabs,p=+s.toggle_caster2,c=+s.spell_tabs;_.each(n,l=>{let u=+s[i("spells",l,"spell_memorized")]||0,h=+s[i("spells",l,"spell_caster_class")],m=+s[i("spells",l,"spell_level")]||0;o[i("spells",l,"spell_show_memorized")]=a===1&&u>0?1:0,o[i("spells",l,"spell_show_all")]=a===1?0:1,c===-1||c===m?p===1?o[i("spells",l,"spell_show")]=1:p===0&&(t===-1||h===0||t===0&&h===1||t===1&&h===2?o[i("spells",l,"spell_show")]=1:o[i("spells",l,"spell_show")]=0):o[i("spells",l,"spell_show")]=0}),setAttrs(o)})})});on("change:repeating_spells:spell_level change:repeating_spells:spell_caster_class",r=>{r.sourceType==="player"&&getAttrs(["repeating_spells_spell_level","repeating_spells_spell_caster_class","spell_caster_tabs","spell_tabs"],n=>{let e={},s=+n.spell_caster_tabs,o=+n.repeating_spells_spell_caster_class,a=+n.spell_tabs,t=n.repeating_spells_spell_level;e.spell_tabs=a>=0&&a!==t?t:a,e.spell_caster_tabs=s!==-1&&o<=1?0:1,setAttrs(e)})});ma=()=>{getSectionIDs("repeating_spells",r=>{let n={},e=["caster_class1_name","caster_class2_name","caster_class1_level","caster_class2_level"],s=[];_.each(r,a=>{s.push(i("spells",a,"spell_caster_class"))});let o=[...e,...s];getAttrs(o,a=>{_.each(r,t=>{let p=+a[i("spells",t,"spell_caster_class")];p===0?(n[i("spells",t,"spell_caster_class_name")]="",n[i("spells",t,"spell_caster_class")]=p):p===1?(n[i("spells",t,"spell_caster_class_name")]=a.caster_class1_name,n[i("spells",t,"spell_caster_class_level")]=+a.caster_class1_level||0,n[i("spells",t,"spell_caster_class")]=p):p===2&&(n[i("spells",t,"spell_caster_class_name")]=a.caster_class2_name,n[i("spells",t,"spell_caster_class_level")]=+a.caster_class2_level||0,n[i("spells",t,"spell_caster_class")]=p)}),setAttrs(n,{silent:!0})})})};on("change:caster_class1_name change:caster_class2_name change:caster_class1_level change:caster_class2_level",r=>{ma()});on("change:repeating_spells:spell_name change:repeating_spells:spell_caster_class",r=>{if(r.sourceType!=="player")return;let n=r.previousValue,e=r.sourceAttribute.split("_").slice(3).join("_"),s=r.sourceAttribute.split("_")[2],o=n===void 0&&e==="spell_name"?1:0;getAttrs(["repeating_spells_spell_caster_class","caster_class1_name","caster_class1_level","caster_class2_name","caster_class2_level","spell_caster_tabs","toggle_caster2"],a=>{let t={},p=+a.toggle_caster2,c=+a.spell_caster_tabs,l=+a[i("spells",s,"spell_caster_class")];console.log(`Change detected:PRE-CHECK Hide Caster2:${p} CasterTab:${c} thisClass:${l}`),p===0?o===1&&c!==-1&&(l=c===0?1:2):l=1,console.log(`Change detected:POST-CHECK Hide Caster2:${p} CasterTab:${c} thisClass:${l}`),l===0?(t[i("spells",s,"spell_caster_class_name")]="",t[i("spells",s,"spell_caster_class")]=l):l===1?(t[i("spells",s,"spell_caster_class_name")]=a.caster_class1_name,t[i("spells",s,"spell_caster_class_level")]=+a.caster_class1_level||0,t[i("spells",s,"spell_caster_class")]=l):l===2&&(t[i("spells",s,"spell_caster_class_name")]=a.caster_class2_name,t[i("spells",s,"spell_caster_class_level")]=+a.caster_class2_level||0,t[i("spells",s,"spell_caster_class")]=l),setAttrs(t,{silent:!0})})});on("change:repeating_spells:spell_name",r=>{if(r.sourceType!=="player")return;let n=r.sourceAttribute.split("_")[2];getAttrs([`repeating_spells_${n}_spell_level`,"spell_tabs"],e=>{let s={},o=+e.spell_tabs,a=e[i("spells",n,"spell_level")]||0;o===-1||a!="?"||(s[`repeating_spells_${n}_spell_level`]=o,setAttrs(s,{silent:!0}))})});on("change:repeating_weapon:weapon_tohitacadj_flag change:repeating_weapon:weapon_thac_adj0 change:repeating_weapon:weapon_thac_adj1 change:repeating_weapon:weapon_thac_adj2 change:repeating_weapon:weapon_thac_adj3 change:repeating_weapon:weapon_thac_adj4 change:repeating_weapon:weapon_thac_adj5 change:repeating_weapon:weapon_thac_adj6 change:repeating_weapon:weapon_thac_adj7 change:repeating_weapon:weapon_thac_adj8 change:repeating_weapon:weapon_thac_adj9 change:repeating_weapon:weapon_thac_adj10",r=>{getAttrs(["repeating_weapon_weapon_ToHitACadj_flag","repeating_weapon_weapon_ToHitACadj"],n=>{let e={},s=+n.repeating_weapon_weapon_ToHitACadj_flag;e.repeating_weapon_weapon_ToHitACadj=s===1?"{{ToHitACadj2to10=HitAdj:[[ @{weapon_thac_adj0} ]]|[[ @{weapon_thac_adj1} ]]|[[ @{weapon_thac_adj2} ]]|[[ @{weapon_thac_adj3} ]]|[[ @{weapon_thac_adj4} ]]|[[ @{weapon_thac_adj5} ]]|[[ @{weapon_thac_adj6} ]]|[[ @{weapon_thac_adj7} ]]|[[ @{weapon_thac_adj8} ]]|[[ @{weapon_thac_adj9} ]]|[[ @{weapon_thac_adj10} ]] }}":"{{ToHitACadj2to10}}",setAttrs(e,{silent:!0})})});on("change:toggle_to_hit_table change:repeating_weapon:weapon_name change:repeating_weapon:weapon_whisper_to_hit_select",r=>{getSectionIDs("repeating_weapon",n=>{let e=[];_.each(n,s=>{e.push(`repeating_weapon_${s}_weapon_whisper_to_hit_select`),e.push(`repeating_weapon_${s}_weapon_whisper_to_hit`)}),getAttrs(["toggle_to_hit_table",...e],s=>{let o={},a=+s.toggle_to_hit_table;_.each(n,t=>{let p=+s[`repeating_weapon_${t}_weapon_whisper_to_hit_select`],c=s[`repeating_weapon_${t}_weapon_whisper_to_hit`],l=" ",u="%NEWLINE%/w gm &{template:attacks-table} {{color=@{color_option}}} {{ToHitAC-10to0=ToHit:[[ @{thac-10} ]]|[[ @{thac-9} ]]|[[ @{thac-8} ]]|[[ @{thac-7} ]]|[[ @{thac-6} ]]|[[ @{thac-5} ]]|[[ @{thac-4} ]]|[[ @{thac-3} ]]|[[ @{thac-2} ]]|[[ @{thac-1} ]]|[[ @{thac0} ]]}} {{ToHitAC1to10=ToHit:[[ @{thac0} ]]|[[ @{thac1} ]]|[[ @{thac2} ]]|[[ @{thac3} ]]|[[ @{thac4} ]]|[[ @{thac5} ]]|[[ @{thac6} ]]|[[ @{thac7} ]]|[[ @{thac8} ]]|[[ @{thac9} ]]|[[ @{thac10} ]] }}",h="%NEWLINE%/w gm &{template:attacks-table} {{color=@{color_option}}} {{ToHitAC-10to0=ToHit:[[ @{thac0-10} ]]|[[ @{thac0-9} ]]|[[ @{thac0-8} ]]|[[ @{thac0-7} ]]|[[ @{thac0-6} ]]|[[ @{thac0-5} ]]|[[ @{thac0-4} ]]|[[ @{thac0-3} ]]|[[ @{thac0-2} ]]|[[ @{thac0-1} ]]|[[ @{thac00} ]]}} {{ToHitAC1to10=ToHit:[[ @{thac00} ]]|[[ @{thac01} ]]|[[ @{thac02} ]]|[[ @{thac03} ]]|[[ @{thac04} ]]|[[ @{thac05} ]]|[[ @{thac06} ]]|[[ @{thac07} ]]|[[ @{thac08} ]]|[[ @{thac09} ]]|[[ @{thac010} ]] }}";p===2?(c=l,p=2):(p===0||p===1)&&(a===0?(c=u,p=0):a===1&&(c=h,p=1)),o[`repeating_weapon_${t}_weapon_whisper_to_hit`]=c,o[`repeating_weapon_${t}_weapon_whisper_to_hit_select`]=p}),setAttrs(o,{silent:!0})})})});on("change:repeating_weapon:weapon_prof_flag change:weapon_proficiency_initial change:weapon_proficiency_added_per_level change:weapon_proficiency_penalty",r=>{getSectionIDs("repeating_weapon",n=>{let e=[];_.each(n,s=>{e.push(`repeating_weapon_${s}_weapon_prof_flag`)}),getAttrs(["weapon_proficiency_penalty",...e],s=>{let o={};_.each(n,a=>{let t=+s[`repeating_weapon_${a}_weapon_prof_flag`],p=+s.weapon_proficiency_penalty||0;o[`repeating_weapon_${a}_weapon_prof`]=p,o[`repeating_weapon_${a}_weapon_prof_pen`]=t===0?"0":p}),setAttrs(o,{silent:!0})})})});on("change:repeating_weapon:weapon_backstab_flag change:backstab change:backstab_bonus change:toggle_thief_skills",r=>{getSectionIDs("repeating_weapon",n=>{let e=[];_.each(n,s=>{e.push(`repeating_weapon_${s}_weapon_backstab_flag`)}),getAttrs(["backstab","backstab_bonus","toggle_thief_skills",...e],s=>{let o={},a=+s.toggle_thief_skills,t=+s.backstab,p=+s.backstab_bonus||0;_.each(n,c=>{let l=+s[`repeating_weapon_${c}_weapon_backstab_flag`];a===0&&(o[`repeating_weapon_${c}_weapon_backstab_var`]=l===0?0:`+${p}`,o[`repeating_weapon_${c}_weapon_backstab_bonus`]=l===0?0:p,o[`repeating_weapon_${c}_weapon_backstab`]=l===0?1:`x${t}`,o[`repeating_weapon_${c}_weapon_backstab_mult`]=l===0?1:t),a===1&&(o[`repeating_weapon_${c}_weapon_backstab_var`]=0,o[`repeating_weapon_${c}_weapon_backstab_bonus`]=0,o[`repeating_weapon_${c}_weapon_backstab`]=1,o[`repeating_weapon_${c}_weapon_backstab_mult`]=1)}),setAttrs(o,{silent:!0})})})});function ho(){getSectionIDs("repeating_weapon",r=>{let n={},e=[];_.each(r,s=>{e.push(i("weapon",s,"weapon_dual"))}),getAttrs(["dual_pen_primary","dual_pen_secondary",...e],s=>{let o=+s.dual_pen_primary||0,a=+s.dual_pen_secondary||0;_.each(r,t=>{let p=s[i("weapon",t,"weapon_dual")],c=0;p==="Normal"?c=0:p==="Primary"?c=o:p==="Secondary"&&(c=a);let l=Math.min(0,c);n[i("weapon",t,"weapon_dual_pen")]=l}),setAttrs(n,{silent:!0})})})}on("change:repeating_weapon:weapon_dual",r=>{let n={};getAttrs(["dual_pen_primary","dual_pen_secondary","repeating_weapon_weapon_dual"],e=>{let s=+e.dual_pen_primary||0,o=+e.dual_pen_secondary||0,a=e.repeating_weapon_weapon_dual,t=0;a==="Normal"?t=0:a==="Primary"?t=s:a==="Secondary"&&(t=o);let p=Math.min(0,t);n.repeating_weapon_weapon_dual_pen=p,setAttrs(n,{silent:!0})})});on("change:dual_pen_primary change:dual_pen_secondary change:dexterity",r=>{getAttrs(["dexterity"],n=>{let e={},s=+n.dexterity||0,o=0;s<6?o=Math.max(-3,s-6):s>=18?o=Math.min(5,Math.floor(s/3)-3):s>15&&(o=s-15);let a=Math.min(0,o-2),t=Math.min(0,o-4);e.dual_pen_primary=a,e.dual_pen_secondary=t,setAttrs(e,{silent:!0},ho())})});Pa=r=>{let n={},e=[i("weapon",r,"weapon_range"),i("weapon",r,"weapon_range_short"),i("weapon",r,"weapon_range_medium"),i("weapon",r,"weapon_range_long"),i("weapon",r,"weapon_attack_type"),i("weapon",r,"weapon_range_error")];getAttrs(e,s=>{let o=+s[i("weapon",r,"weapon_attack_type")];if(o===0||o===2)return;let a=s[i("weapon",r,"weapon_range")];a=a.replace(/'/g,""),a=a.replace(/"/g,"");let t=a.split("/").join(",").split(" ").join(",").split("-").join(",").split(","),p=Number(t[0]),c=Number(t[1]),l=Number(t[2]);t.length===1&&p>=0&&!c&&!l&&(c=p,l=p),Number.isNaN(p)?(n[i("weapon",r,"weapon_range_short")]=0,n[i("weapon",r,"weapon_range_error")]=a===""?1:0):n[i("weapon",r,"weapon_range_short")]=p,Number.isNaN(c)?(n[i("weapon",r,"weapon_range_medium")]=0,n[i("weapon",r,"weapon_range_error")]=a===""?1:0):n[i("weapon",r,"weapon_range_medium")]=c,Number.isNaN(l)?(n[i("weapon",r,"weapon_range_long")]=0,n[i("weapon",r,"weapon_range_error")]=a===""?1:0):n[i("weapon",r,"weapon_range_long")]=l,!Number.isNaN(p)&&!Number.isNaN(c)&&!Number.isNaN(l)&&(n[i("weapon",r,"weapon_range_error")]=1),setAttrs(n,{silent:!0})})};on("change:repeating_weapon:weapon_range change:repeating_weapon:weapon_attack_type",r=>{let n=r.sourceAttribute.split("_")[2];Pa(n)});on("change:repeating_weapon:weapon_attack_type",r=>{getAttrs(["repeating_weapon_weapon_attack_type","repeating_weapon_weapon_attack_type_flag"],n=>{let e={},s=+n.repeating_weapon_weapon_attack_type,o=+n.repeating_weapon_weapon_attack_type_flag;s!==o&&(e.repeating_weapon_weapon_attack_type_flag=s),setAttrs(e,{silent:!0})})});Ke=()=>{getAttrs(["hitpoints","hitpoints_max","sync_hp_flag","hitpoints_1_class","hitpoints_2_class","hitpoints_3_class"],r=>{let n={},e=+r.sync_hp_flag,s=+r.hitpoints_max||0,o=Math.max(0,+r.hitpoints_1_class||0),a=Math.max(0,+r.hitpoints_2_class||0),t=Math.max(0,+r.hitpoints_3_class||0),p=o!==0?1:0,c=a!==0?1:0,l=t!==0?1:0,u=p+c+l,h=q(o+a+t),m=T(h/u).toFixed(2);n.hitpoints_class_total=h,n.hp_quotient=u,n.hitpoints_total=m,n.hitpoints_max=e===1?q(m):s,setAttrs(n,{silent:!0})})};on("change:sync_hp_flag change:hitpoints change:hitpoints_max change:hitpoints_1_class change:hitpoints_2_class change:hitpoints_3_class",r=>{Ke()});V=r=>{getAttrs(["armorclass","armorclass_mod","armorclass_magic","armorbonus","armorbonus_toggle","armorbonus_inverted","unarmored_worn","armortype_worn","armortype2_worn","armorshield_worn","armorhelmet_worn","armorother_worn","armorother2_worn","armorother3_worn","armorother4_worn","armorother5_worn","armorother6_worn","unarmored_base","armortype_base","armortype2_base","armorshield_base","armorother_base","armorother2_base","armorother3_base","armorother4_base","armorother5_base","armorother6_base","unarmored_ac","armortype_ac","armortype2_ac","armorshield_ac","armorhelmet_ac","armorother_ac","armorother2_ac","armorother3_ac","armorother4_ac","armorother5_ac","armorother6_ac","armortype_magic","armortype2_magic","armorshield_magic","armorhelmet_magic","armorother_magic","armorother2_magic","armorother3_magic","armorother4_magic","armorother5_magic","armorother6_magic","armorshield_mod","armorother_mod","armorother2_mod","armorother3_mod","armorother4_mod","armorother5_mod","armorother6_mod","autocalc_ac","armor_rating_flag","current_encumbrance_move","sync_ac_flag"],n=>{if(+n.autocalc_ac+r===0)return;let s={},o=+n.armorclass,a=+n.sync_ac_flag,t=+n.armor_rating_flag,p=+n.armorshield_mod*-1||0,c=+n.armorother_mod*-1||0,l=+n.armorother2_mod*-1||0,u=+n.armorother3_mod*-1||0,h=+n.armorother4_mod*-1||0,m=+n.armorother5_mod*-1||0,w=+n.armorother6_mod*-1||0,A=+n.armortype_magic*-1||0,b=+n.armortype2_magic*-1||0,M=+n.armorshield_magic*-1||0,f=+n.armorhelmet_magic*-1||0,R=+n.armorother_magic*-1||0,$=+n.armorother2_magic*-1||0,P=+n.armorother3_magic*-1||0,U=+n.armorother4_magic*-1||0,oe=+n.armorother5_magic*-1||0,K=+n.armorother6_magic*-1||0,me=+n.unarmored_worn,ne=+n.armortype_worn,re=+n.armortype2_worn,Y=+n.armorshield_worn,Ce=+n.armorhelmet_worn,X=+n.armorother_worn,Q=+n.armorother2_worn,Z=+n.armorother3_worn,_e=+n.armorother4_worn,S=+n.armorother5_worn,J=+n.armorother6_worn,Ee=+n.current_encumbrance_move||0,le=+n.armorbonus_toggle||0,L=+n.armorbonus||0,he=0;Ee===3&&L<0?(le=0,L=0,he=1):L<0?L=+n.armorbonus*le||0:L=+n.armorbonus||0,s.encumbrance_flag=he;let ue=+n.unarmored_base,ge=+n.armortype_base,we=+n.armortype2_base,be=+n.armorshield_base,de=+n.armorother_base,qe=n.armorother2_base>=0?0:-Math.abs(n.armorother2_base)||0,G=n.armorother3_base>=0?0:-Math.abs(n.armorother3_base)||0,Ie=n.armorother4_base>=0?0:-Math.abs(n.armorother4_base)||0,se=n.armorother5_base>=0?0:-Math.abs(n.armorother5_base)||0,Oe=n.armorother6_base>=0?0:-Math.abs(n.armorother6_base)||0,fe=+n.unarmored_ac,fa=+n.armortype_ac,ya=+n.armortype2_ac,$a=+n.armorshield_ac,ka=+n.armorother_ac,Aa=n.armorother2_ac>=0?0:-Math.abs(n.armorother2_ac)||0,xa=n.armorother3_ac>=0?0:-Math.abs(n.armorother3_ac)||0,Sa=n.armorother4_ac>=0?0:-Math.abs(n.armorother4_ac)||0,Ma=n.armorother5_ac>=0?0:-Math.abs(n.armorother5_ac)||0,Da=n.armorother6_ac>=0?0:-Math.abs(n.armorother6_ac)||0,Xa=ne?ge:10,Qa=re?we:10,Za=Y?be:0,Ja=X?de:10,va=Q?qe:0,et=Z?G:0,at=_e?Ie:0,tt=S?se:0,ot=J?Oe:0,nt=me?ue:10,rt=ne?fa:10,_t=re?ya:10,Ca=Y?$a:0,st=X?ka:10,it=Q?Aa:0,pt=Z?xa:0,ct=_e?Sa:0,mt=S?Ma:0,lt=J?Da:0,ht=me?fe:10,ye=Y?p:0,$e=Y?M:0,ut=q(Math.min(ge,we,de,ue)+be+qe+G+Ie+se+Oe),gt=q(Math.min(fa,ya,ka,fe)+($a+Aa+xa+Sa+Ma+Da)),Ea=q(Math.min(Xa,Qa,Ja,nt)+(Za+va+et+at+tt+ot)),Ne=q(Math.min(rt,_t,st,ht)+(it+pt+ct+mt+lt)),Ia=q(A+b+f+R+$+P+U+oe+K+M),ie=q(ne*A+re*b+Ce*f+X*R+Q*$+Z*P+_e*U+S*oe+J*K),Oa=q(c+l+u+h+m+w+p)||0,pe=q(X*c+Q*l+Z*u+_e*h+S*m+J*w),Te=q(pe+ie),Re=q(Ne+pe+ie),Na=1;L>0&&Re>=10&&(Na=0);let Le=q(Re+L*Na),v=q(Ca+ye+$e),je=q(Le+v);L>0&&v>=10&&(je=q(Le+L+v));let wt=(-1*(ie+$e)<=0?"":"+")+-1*(ie+$e),bt=(-1*Ia<=0?"":"+")+-1*Ia,dt=(-1*(pe+ye)<=0?"":"+")+-1*(pe+ye),qt=(-1*Oa<=0?"":"+")+-1*Oa,ft=(-1*L<=0?"":"+")+-1*L,yt=(-1*Te<=0?"":"+")+-1*Te,$t=(-1*v<=0?"":"+")+-1*v;s.armorclass_rating_used=Ea,s.armorclass_rating=t===1?"-":Ea,s.armorclass_rating_best=ut,s.armorclass_base_used=Ne+Ca,s.armorclass_base=Ne,s.armorclass_base_best=gt,s.armorclass_magic=ie,s.armorclass_magic_with_shield=wt,s.armorclass_magic_total=bt,s.armorclass_mod=pe,s.armorclass_mod_with_shield=dt,s.armorclass_mod_total=qt,s.armorclass_combined_mod_magic=Te,s.armorclass_combined_mod_magic_inverted=yt,s.armorclass_rear=Re,s.armorbonus_inverted=ft,s.armorclass_shieldless=Le,s.armorclass_shield_magic=$e,s.armorclass_shield_mod=ye,s.armorclass_combined_shield_mod_magic=v,s.armorclass_combined_shield_mod_magic_inverted=$t,s.armorclass_total=je,s.armorclass=a?je:o,setAttrs(s,{silent:!0})})};on("change:armor_details_show change:armor_rating_flag change:sync_ac_flag change:autocalc_ac change:unarmored change:armortype change:armortype2 change:armorshield change:armorhelmet change:armorother change:armorother2 change:armorother3 change:armorother4 change:armorother5 change:armorother6 change:armorclass_mod change:armorclass_magic change:armorbonus change:armorbonus_toggle change:unarmored_worn change:armortype_worn change:armortype2_worn change:armorshield_worn change:armorhelmet_worn change:armorother_worn change:armorother2_worn change:armorother3_worn change:armorother4_worn change:armorother5_worn change:armorother6_worn change:armortype_base change:armortype2_base change:armorshield_base change:armorother_base change:armorother2_base change:armorother3_base change:armorother4_base change:armorother5_base change:armorother6_base change:unarmored_base change:armortype_ac change:armortype2_ac change:armorshield_ac change:armorhelmet_ac change:armorother_ac change:armorother2_ac change:armorother3_ac change:armorother4_ac change:armorother5_ac change:armorother6_ac change:unarmored_ac change:armorshield_mod change:armorother_mod change:armorother2_mod change:armorother3_mod change:armorother4_mod change:armorother5_mod change:armorother6_mod change:armortype_magic change:armortype2_magic change:armorshield_magic change:armorhelmet_magic change:armorother_magic change:armorother2_magic change:armorother3_magic change:armorother4_magic change:armorother5_magic change:armorother6_magic",r=>{V(0)});on("clicked:calcac",r=>{V(1)});Me=r=>{getAttrs(["toggle_auto_damage"],n=>{let e={},s=+n.toggle_auto_damage,o=`Damage vs S/M [[ (@{repeating_weapon_${r}_weapon_damagesmallmedium}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,a=` vs LG [[ (@{repeating_weapon_${r}_weapon_damagelarge}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,t=`Damage vs S/M [[ (@{repeating_weapon_${r}_weapon_damagesmallmedium}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,p=` vs LG [[ (@{repeating_weapon_${r}_weapon_damagelarge}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,c=`Damage vs S/M [[ (@{repeating_weapon_${r}_weapon_critdamagesmallmedium}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,l=` vs LG [[ (@{repeating_weapon_${r}_weapon_critdamagelarge}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,u=`Damage vs S/M [[ (@{repeating_weapon_${r}_weapon_critdamagesmallmedium}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]}}`,h=` vs LG [[ (@{repeating_weapon_${r}_weapon_critdamagelarge}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`;s===0?(e[`repeating_weapon_${r}_weapon_damagesmallmedium_chat_menu`]=`[Roll Damage](~@{character_id}|repeating_weapon_${r}_weapon_damagesmallmedium_roll)`,e[`repeating_weapon_${r}_weapon_damagelarge_chat_menu`]=`[Roll Damage vs LG](~@{character_id}|repeating_weapon_${r}_weapon_damagelarge_roll)`,e[`repeating_weapon_${r}_weapon_damagesmallmedium_npc_chat_menu`]=`[Damage](~@{character_id}|repeating_weapon_${r}_weapon_damagesmallmedium_npc_roll)`,e[`repeating_weapon_${r}_weapon_damagelarge_npc_chat_menu`]=`[Damage vs LG](~@{character_id}|repeating_weapon_${r}_weapon_damagelarge_npc_roll)`,e[`repeating_weapon_${r}_weapon_critdamagesmallmedium_chat_menu`]=`[Roll Damage](~@{character_id}|repeating_weapon_${r}_weapon_critdamagesmallmedium_roll)`,e[`repeating_weapon_${r}_weapon_critdamagelarge_chat_menu`]=`[Roll Damage vs LG](~@{character_id}|repeating_weapon_${r}_weapon_critdamagelarge_roll)`,e[`repeating_weapon_${r}_weapon_critdamagesmallmedium_npc_chat_menu`]=`[Damage](~@{character_id}|repeating_weapon_${r}_weapon_critdamagesmallmedium_npc_roll)`,e[`repeating_weapon_${r}_weapon_critdamagelarge_npc_chat_menu`]=`[Damage vs LG](~@{character_id}|repeating_weapon_${r}_weapon_critdamagelarge_npc_roll)`):(e[`repeating_weapon_${r}_weapon_damagesmallmedium_chat_menu`]=o,e[`repeating_weapon_${r}_weapon_damagelarge_chat_menu`]=a,e[`repeating_weapon_${r}_weapon_damagesmallmedium_npc_chat_menu`]=t,e[`repeating_weapon_${r}_weapon_damagelarge_npc_chat_menu`]=p,e[`repeating_weapon_${r}_weapon_critdamagesmallmedium_chat_menu`]=c,e[`repeating_weapon_${r}_weapon_critdamagelarge_chat_menu`]=l,e[`repeating_weapon_${r}_weapon_critdamagesmallmedium_npc_chat_menu`]=u,e[`repeating_weapon_${r}_weapon_critdamagelarge_npc_chat_menu`]=h),setAttrs(e,{silent:!0})})};on("change:repeating_weapon:weapon_name change:repeating_weapon:weapon_damagesmallmedium change:repeating_weapon:weapon_damagelarge change:repeating_weapon:weapon_critdamagesmallmedium change:repeating_weapon:weapon_critdamagelarge change:repeating_weapon:weapon_attackdmgbonus change:repeating_weapon:weapon_critdamage_flag",r=>{let n=r.sourceAttribute.split("_")[2];Me(n)});on("change:toggle_critdamage",r=>{getSectionIDs("repeating_weapon",n=>{let e={},s=[];_.each(n,o=>{s.push(i("weapon",o,"weapon_critdamage_flag"))}),getAttrs(s,o=>{n.forEach(a=>{let t=+o[i("weapon",a,"weapon_critdamage_flag")];e[i("weapon",a,"weapon_critdamage_flag")]=1-t}),setAttrs(e)})})});on("change:toggle_auto_damage change:toggle_critdamage",r=>{g(`Change Detected:${r.sourceAttribute}`),getSectionIDs("repeating_weapon",n=>{let e=[];getAttrs(e,s=>{n.forEach(o=>{Me(o)})})})});function za(r){let n={},e=[i("weapon",r,"weapon_use"),i("weapon",r,"weapon_attack_type"),i("weapon",r,"weapon_attack_type_flag"),i("weapon",r,"weapon_critdamage_flag"),i("weapon",r,"weapon_prof_pen"),i("weapon",r,"weapon_range_error"),i("weapon",r,"weapon_tohitacadj"),i("weapon",r,"weapon_dual"),i("weapon",r,"weapon_whisper_to_hit"),i("weapon",r,"weapon_whisper_to_hit_select"),i("weapon",r,"weapon_dual_pen"),i("weapon",r,"weapon_backstab_var"),i("weapon",r,"weapon_tohitbonus"),i("weapon",r,"weapon_magicbonus"),i("weapon",r,"weapon_prof"),i("weapon",r,"weapon_backstab"),i("weapon",r,"weapon_backstab_bonus"),i("weapon",r,"weapon_backstab_mult"),i("weapon",r,"weapon_attackdmgbonus"),i("weapon",r,"weapon_num_attacks"),i("weapon",r,"weapon_quantity"),i("weapon",r,"weapon_ammo"),i("weapon",r,"weapon_ammo_max"),i("weapon",r,"weapon_weight"),i("weapon",r,"weapon_cost"),i("weapon",r,"weapon_range_short"),i("weapon",r,"weapon_range_medium"),i("weapon",r,"weapon_range_long"),i("weapon",r,"weapon_length"),i("weapon",r,"weapon_space"),i("weapon",r,"weapon_speed"),i("weapon",r,"weapon_misc"),i("weapon",r,"weapon_thac_adj0"),i("weapon",r,"weapon_thac_adj1"),i("weapon",r,"weapon_thac_adj2"),i("weapon",r,"weapon_thac_adj3"),i("weapon",r,"weapon_thac_adj4"),i("weapon",r,"weapon_thac_adj5"),i("weapon",r,"weapon_thac_adj6"),i("weapon",r,"weapon_thac_adj7"),i("weapon",r,"weapon_thac_adj8"),i("weapon",r,"weapon_thac_adj9"),i("weapon",r,"weapon_thac_adj10"),i("weapon",r,"weapon_macro_text"),i("weapon",r,"weapon_damagesmallmedium_chat_menu"),i("weapon",r,"weapon_damagelarge_chat_menu"),i("weapon",r,"weapon_damagesmallmedium_npc_chat_menu"),i("weapon",r,"weapon_damagelarge_npc_chat_menu"),i("weapon",r,"weapon_critdamagesmallmedium_chat_menu"),i("weapon",r,"weapon_critdamagelarge_chat_menu"),i("weapon",r,"weapon_critdamagesmallmedium_npc_chat_menu"),i("weapon",r,"weapon_critdamagelarge_npc_chat_menu"),i("weapon",r,"weapon_damage_chat_menu_npc")];getAttrs(e,s=>{n.repeating_weapon_weapon_use=+s[i("weapon",r,"weapon_use")],n.repeating_weapon_weapon_attack_type_flag=+s[i("weapon",r,"weapon_attack_type_flag")],n.repeating_weapon_weapon_critdamage_flag=+s[i("weapon",r,"weapon_critdamage_flag")],n.repeating_weapon_weapon_prof_pen=+s[i("weapon",r,"weapon_prof_pen")],n.repeating_weapon_weapon_range_error=+s[i("weapon",r,"weapon_range_error")],n.repeating_weapon_weapon_tohitacadj=+s[i("weapon",r,"weapon_tohitacadj")],n.repeating_weapon_weapon_attack_type=+s[i("weapon",r,"weapon_attack_type")],n.repeating_weapon_weapon_dual=s[i("weapon",r,"weapon_dual")],n.repeating_weapon_weapon_whisper_to_hit=s[i("weapon",r,"weapon_whisper_to_hit")],n.repeating_weapon_weapon_whisper_to_hit_select=+s[i("weapon",r,"weapon_whisper_to_hit_select")],n.repeating_weapon_weapon_dual_pen=+s[i("weapon",r,"weapon_dual_pen")],n.repeating_weapon_weapon_backstab_var=+s[i("weapon",r,"weapon_backstab_var")],n.repeating_weapon_weapon_tohitbonus=+s[i("weapon",r,"weapon_tohitbonus")],n.repeating_weapon_weapon_magicbonus=+s[i("weapon",r,"weapon_magicbonus")],n.repeating_weapon_weapon_prof=+s[i("weapon",r,"weapon_prof")],n.repeating_weapon_weapon_backstab=+s[i("weapon",r,"weapon_backstab")],n.repeating_weapon_weapon_backstab_bonus=+s[i("weapon",r,"weapon_backstab_bonus")],n.repeating_weapon_weapon_backstab_mult=+s[i("weapon",r,"weapon_backstab_mult")],n.repeating_weapon_weapon_attackdmgbonus=+s[i("weapon",r,"weapon_attackdmgbonus")],n.repeating_weapon_weapon_num_attacks=+s[i("weapon",r,"weapon_num_attacks")],n.repeating_weapon_weapon_quantity=+s[i("weapon",r,"weapon_quantity")],n.repeating_weapon_weapon_ammo=+s[i("weapon",r,"weapon_ammo")],n.repeating_weapon_weapon_ammo_max=+s[i("weapon",r,"weapon_ammo_max")],n.repeating_weapon_weapon_weight=+s[i("weapon",r,"weapon_weight")],n.repeating_weapon_weapon_cost=+s[i("weapon",r,"weapon_cost")],n.repeating_weapon_weapon_range_short=+s[i("weapon",r,"weapon_range_short")],n.repeating_weapon_weapon_range_medium=+s[i("weapon",r,"weapon_range_medium")],n.repeating_weapon_weapon_range_long=+s[i("weapon",r,"weapon_range_long")],n.repeating_weapon_weapon_length=s[i("weapon",r,"weapon_length")],n.repeating_weapon_weapon_space=s[i("weapon",r,"weapon_space")],n.repeating_weapon_weapon_speed=s[i("weapon",r,"weapon_speed")],n.repeating_weapon_weapon_misc=s[i("weapon",r,"weapon_misc")],n.repeating_weapon_weapon_thac_adj0=+s[i("weapon",r,"weapon_thac_adj0")],n.repeating_weapon_weapon_thac_adj1=+s[i("weapon",r,"weapon_thac_adj1")],n.repeating_weapon_weapon_thac_adj2=+s[i("weapon",r,"weapon_thac_adj2")],n.repeating_weapon_weapon_thac_adj3=+s[i("weapon",r,"weapon_thac_adj3")],n.repeating_weapon_weapon_thac_adj4=+s[i("weapon",r,"weapon_thac_adj4")],n.repeating_weapon_weapon_thac_adj5=+s[i("weapon",r,"weapon_thac_adj5")],n.repeating_weapon_weapon_thac_adj6=+s[i("weapon",r,"weapon_thac_adj6")],n.repeating_weapon_weapon_thac_adj7=+s[i("weapon",r,"weapon_thac_adj7")],n.repeating_weapon_weapon_thac_adj8=+s[i("weapon",r,"weapon_thac_adj8")],n.repeating_weapon_weapon_thac_adj9=+s[i("weapon",r,"weapon_thac_adj9")],n.repeating_weapon_weapon_thac_adj10=+s[i("weapon",r,"weapon_thac_adj10")],n.repeating_weapon_weapon_macro_text=s[i("weapon",r,"weapon_macro_text")],n.repeating_weapon_weapon_damagesmallmedium_chat_menu=s[i("weapon",r,"weapon_damagesmallmedium_chat_menu")],n.repeating_weapon_weapon_damagelarge_chat_menu=s[i("weapon",r,"weapon_damagelarge_chat_menu")],n.repeating_weapon_weapon_damagesmallmedium_npc_chat_menu=s[i("weapon",r,"weapon_damagesmallmedium_npc_chat_menu")],n.repeating_weapon_weapon_damagelarge_npc_chat_menu=s[i("weapon",r,"weapon_damagelarge_npc_chat_menu")],n.repeating_weapon_weapon_critdamagesmallmedium_chat_menu=s[i("weapon",r,"weapon_critdamagesmallmedium_chat_menu")],n.repeating_weapon_weapon_critdamagelarge_chat_menu=s[i("weapon",r,"weapon_critdamagelarge_chat_menu")],n.repeating_weapon_weapon_critdamagesmallmedium_npc_chat_menu=s[i("weapon",r,"weapon_critdamagesmallmedium_npc_chat_menu")],n.repeating_weapon_weapon_critdamagelarge_npc_chat_menu=s[i("weapon",r,"weapon_critdamagelarge_npc_chat_menu")],n.repeating_weapon_weapon_damage_chat_menu_npc=s[i("weapon",r,"weapon_damage_chat_menu_npc")],setAttrs(n,{silent:!0})})}function uo(r){let n={},e=["equipment_tabs_type","equipment_tabs_carry"],s=[i("equipment",r,"equipment_type"),i("equipment",r,"equipment_magical"),i("equipment",r,"equipment_show_type"),i("equipment",r,"equipment_show_carry"),i("equipment",r,"equipment_current"),i("equipment",r,"equipment_current_max"),i("equipment",r,"equipment_carried_select"),i("equipment",r,"equipment_carried"),i("equipment",r,"equipment_quantity"),i("equipment",r,"equipment_quantity_max"),i("equipment",r,"equipment_weight"),i("equipment",r,"equipment_cost"),i("equipment",r,"equipment_armor_type"),i("equipment",r,"equipment_armor_worn"),i("equipment",r,"equipment_armor_ac"),i("equipment",r,"equipment_armor_base"),i("equipment",r,"equipment_armor_magic"),i("equipment",r,"equipment_armor_mod"),i("equipment",r,"equipment_armor_bulk"),i("equipment",r,"equipment_macro_text"),i("equipment",r,"equipment_weapon_type"),i("equipment",r,"equipment_weapon_speed"),i("equipment",r,"equipment_weapon_misc"),i("equipment",r,"equipment_weapon_length"),i("equipment",r,"equipment_weapon_space"),i("equipment",r,"equipment_weapon_damagesmallmedium"),i("equipment",r,"equipment_weapon_damagelarge"),i("equipment",r,"equipment_weapon_attackdmgtype"),i("equipment",r,"equipment_weapon_rateoffire"),i("equipment",r,"equipment_weapon_range")],o=[...e,...s];getAttrs(o,a=>{let t=+a.equipment_tabs_type,p=+a[i("equipment",r,"equipment_type")];n.repeating_equipment_equipment_type=p<=0||t===-1?0:p,n.repeating_equipment_equipment_magical=+a[i("equipment",r,"equipment_magical")],n.repeating_equipment_equipment_show_type=+a[i("equipment",r,"equipment_show_type")],n.repeating_equipment_equipment_current=+a[i("equipment",r,"equipment_current")],n.repeating_equipment_equipment_current_max=+a[i("equipment",r,"equipment_current_max")],n.repeating_equipment_equipment_carried_select=+a[i("equipment",r,"equipment_carried_select")],n.repeating_equipment_equipment_carried=+a[i("equipment",r,"equipment_carried")],n.repeating_equipment_equipment_quantity=+a[i("equipment",r,"equipment_quantity")],n.repeating_equipment_equipment_quantity_max=+a[i("equipment",r,"equipment_quantity_max")],n.repeating_equipment_equipment_weight=+a[i("equipment",r,"equipment_weight")],n.repeating_equipment_equipment_cost=+a[i("equipment",r,"equipment_cost")],n.repeating_equipment_equipment_armor_type=+a[i("equipment",r,"equipment_armor_type")],n.repeating_equipment_equipment_armor_worn=+a[i("equipment",r,"equipment_armor_worn")],n.repeating_equipment_equipment_armor_ac=+a[i("equipment",r,"equipment_armor_ac")],n.repeating_equipment_equipment_armor_base=+a[i("equipment",r,"equipment_armor_base")],n.repeating_equipment_equipment_armor_magic=+a[i("equipment",r,"equipment_armor_magic")],n.repeating_equipment_equipment_armor_mod=+a[i("equipment",r,"equipment_armor_mod")],n.repeating_equipment_equipment_armor_bulk=+a[i("equipment",r,"equipment_armor_bulk")],n.repeating_equipment_equipment_macro_text=a[i("equipment",r,"equipment_macro_text")],n.repeating_equipment_equipment_weapon_type=+a[i("equipment",r,"equipment_weapon_type")],n.repeating_equipment_equipment_weapon_speed=a[i("equipment",r,"equipment_weapon_speed")],n.repeating_equipment_equipment_weapon_misc=a[i("equipment",r,"equipment_weapon_misc")],n.repeating_equipment_equipment_weapon_length=a[i("equipment",r,"equipment_weapon_length")],n.repeating_equipment_equipment_weapon_space=a[i("equipment",r,"equipment_weapon_space")],n.repeating_equipment_equipment_weapon_damagesmallmedium=a[i("equipment",r,"equipment_weapon_damagesmallmedium")],n.repeating_equipment_equipment_weapon_damagelarge=a[i("equipment",r,"equipment_weapon_damagelarge")],n.repeating_equipment_equipment_weapon_attackdmgtype=a[i("equipment",r,"equipment_weapon_attackdmgtype")],n.repeating_equipment_equipment_weapon_rateoffire=a[i("equipment",r,"equipment_weapon_rateoffire")],n.repeating_equipment_equipment_weapon_range=a[i("equipment",r,"equipment_weapon_range")],setAttrs(n,{silent:!0})})}function go(r){let n={},e=[i("nonweaponproficiencies",r,"nwp_attribute"),i("nonweaponproficiencies",r,"nwp_slots"),i("nonweaponproficiencies",r,"nwp_modifier"),i("nonweaponproficiencies",r,"nwp_macro_text")];getAttrs(e,s=>{n.repeating_nonweaponproficiencies_attribute=+s[i("nonweaponproficiencies",r,"nwp_attribute")],n.repeating_nonweaponproficiencies_slots=+s[i("nonweaponproficiencies",r,"nwp_slots")],n.repeating_nonweaponproficiencies_modifier=+s[i("nonweaponproficiencies",r,"nwp_modifier")],n.repeating_nonweaponproficiencies_macro_text=s[i("nonweaponproficiencies",r,"nwp_macro_text")],setAttrs(n,{silent:!0})})}on("change:repeating_weapon:weapon_name change:repeating_equipment:equipment_item change:repeating_nonweaponproficiencies:nwp_name",r=>{let n=r.sourceAttribute.split("_")[2];r.sourceType==="player"&&r.previousValue===void 0&&(r.sourceAttribute.includes("equipment_item")&&uo(n),r.sourceAttribute.includes("weapon_name")&&za(n),r.sourceAttribute.includes("nwp_name")&&go(n))});on("sheet:opened",r=>{getSectionIDs("repeating_weapon",n=>{getSectionIDs("repeating_ability",e=>{getSectionIDs("repeating_nonweaponproficiencies",s=>{getSectionIDs("repeating_equipment",o=>{getSectionIDs("repeating_spells",a=>{let t={},p=n.length,c=e.length,l=s.length,u=o.length,h=a.length;if(p===0){let m=k();t[`repeating_weapon_${m}_weapon_value`]=1}if(c===0){let m=k();t[`repeating_ability_${m}_ability_value`]=1}if(l===0){let m=k();t[`repeating_nonweaponproficiencies_${m}_nwp_value`]=1}if(u===0){let m=k();t[`repeating_equipment_${m}_equipment_value`]=1}if(h===0){let m=k();t[`repeating_spells_${m}_spell_value`]=1}else return;setAttrs(t,{silent:!0})})})})})})});on("clicked:resetallmacros clicked:resetequipmentmacros clicked:resetweaponsmacros clicked:resetabilitiesmacros clicked:resetnwpsmacros clicked:resetspellsmacros",r=>{let e=r.triggerName.match(/clicked:(\w+)/),s=e?e[1]:null;getSectionIDs("repeating_equipment",o=>{getSectionIDs("repeating_weapon",a=>{getSectionIDs("repeating_ability",t=>{getSectionIDs("repeating_nonweaponproficiencies",p=>{getSectionIDs("repeating_spells",c=>{let l={},u=[],h=[],m=[],w=[],A=[];_.each(o,b=>{u.push(`repeating_equipment_${b}_equipment_macro_text`)}),_.each(a,b=>{h.push(`repeating_weapon_${b}_weapon_macro_text`)}),_.each(t,b=>{m.push(`repeating_ability_${b}_ability_macro_text`)}),_.each(p,b=>{w.push(`repeating_nonweaponproficiencies_${b}_nwp_macro_text`)}),_.each(c,b=>{A.push(`repeating_spells_${b}_spell_macro_text`)}),s==="resetallmacros"&&(l.surprise_macro_text="",l.surprise_others_macro_text="",l.init_macro_text="",_.each(o,b=>{l[`repeating_equipment_${b}_equipment_macro_text`]=""}),_.each(a,b=>{l[`repeating_weapon_${b}_weapon_macro_text`]=""}),_.each(t,b=>{l[`repeating_ability_${b}_ability_macro_text`]=""}),_.each(p,b=>{l[`repeating_nonweaponproficiencies_${b}_nwp_macro_text`]=""}),_.each(c,b=>{l[`repeating_spells_${b}_spell_macro_text`]=""})),s==="resetequipmentmacros"&&_.each(o,b=>{l[`repeating_equipment_${b}_equipment_macro_text`]=""}),s==="resetweaponsmacros"&&_.each(a,b=>{l[`repeating_weapon_${b}_weapon_macro_text`]=""}),s==="resetabilitiesmacros"&&_.each(t,b=>{l[`repeating_ability_${b}_ability_macro_text`]=""}),s==="resetnwpsmacros"&&_.each(p,b=>{l[`repeating_nonweaponproficiencies_${b}_nwp_macro_text`]=""}),s==="resetspellsmacros"&&_.each(c,b=>{l[`repeating_spells_${b}_spell_macro_text`]=""}),setAttrs(l,{silent:!0})})})})})})});na=r=>{getAttrs(["pickpockets","pickpockets_base","pickpockets_racial_mod","pickpockets_ability_mod","pickpockets_magic"],n=>{let e={},s=+n.pickpockets_base||0,o=+n.pickpockets_racial_mod||0,a=+n.pickpockets_ability_mod||0,t=+n.pickpockets_magic||0,p=+n.pickpockets||0,c=Math.max(0,q(s+o+a+t));r===1&&p>=0&&c===0?e.pickpockets_base=p:e.pickpockets=c,setAttrs(e,{silent:!0})})};oa=r=>{getAttrs(["openlocks","openlocks_base","openlocks_racial_mod","openlocks_ability_mod","openlocks_magic"],n=>{let e={},s=+n.openlocks_base||0,o=+n.openlocks_racial_mod||0,a=+n.openlocks_ability_mod||0,t=+n.openlocks_magic||0,p=+n.openlocks||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.openlocks_base=p:e.openlocks=c,setAttrs(e,{silent:!0})})};Je=r=>{getAttrs(["findtraps","findtraps_base","findtraps_racial_mod","findtraps_ability_mod","findtraps_magic"],n=>{let e={},s=+n.findtraps_base||0,o=+n.findtraps_racial_mod||0,a=+n.findtraps_ability_mod||0,t=+n.findtraps_magic||0,p=+n.findtraps||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.findtraps_base=p:e.findtraps=c,setAttrs(e,{silent:!0})})};ta=r=>{getAttrs(["movequietly","movequietly_base","movequietly_racial_mod","movequietly_ability_mod","movequietly_magic"],n=>{let e={},s=+n.movequietly_base||0,o=+n.movequietly_racial_mod||0,a=+n.movequietly_ability_mod||0,t=+n.movequietly_magic||0,p=+n.movequietly||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.movequietly_base=p:e.movequietly=c,setAttrs(e,{silent:!0})})};ea=r=>{getAttrs(["hideinshadows","hideinshadows_base","hideinshadows_racial_mod","hideinshadows_ability_mod","hideinshadows_magic"],n=>{let e={},s=+n.hideinshadows_base||0,o=+n.hideinshadows_racial_mod||0,a=+n.hideinshadows_ability_mod||0,t=+n.hideinshadows_magic||0,p=+n.hideinshadows||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.hideinshadows_base=p:e.hideinshadows=c,setAttrs(e,{silent:!0})})};ve=r=>{getAttrs(["hearnoise","hearnoise_base","hearnoise_racial_mod","hearnoise_ability_mod","hearnoise_magic"],n=>{let e={},s=+n.hearnoise_base||0,o=+n.hearnoise_racial_mod||0,a=+n.hearnoise_ability_mod||0,t=+n.hearnoise_magic||0,p=+n.hearnoise||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.hearnoise_base=p:e.hearnoise=c,setAttrs(e,{silent:!0})})};Xe=r=>{getAttrs(["climbwalls","climbwalls_base","climbwalls_racial_mod","climbwalls_ability_mod","climbwalls_magic"],n=>{let e={},s=+n.climbwalls_base||0;s=s>=99.1?s.toFixed(1):Math.floor(s);let o=+n.climbwalls_racial_mod||0,a=+n.climbwalls_ability_mod||0,t=+n.climbwalls_magic||0,p=+n.climbwalls||0,c=Math.max(0,Math.min(100,s+q(o+a+t))),l="@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Climb Walls}} {{roll_low=[[ 1d100 ]]%}} {{roll_target=[[ @{climbwalls} ]]%}}",u="@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Climb Walls}} {{roll_low=[[ 1d100 + [[1d10/10]] ]]%}} {{roll_target=[[ @{climbwalls} ]]%}}";r===1?p>=0&&c===0?e.climbwalls_base=p:e.climbwalls=c:(e.climbwalls=c,e.climbwalls_macro_text=c>=99.1?u:l),setAttrs(e,{silent:!0})})};ra=r=>{getAttrs(["readlanguages","readlanguages_base","readlanguages_racial_mod","readlanguages_ability_mod","readlanguages_magic"],n=>{let e={},s=+n.readlanguages_base||0,o=+n.readlanguages_racial_mod||0,a=+n.readlanguages_ability_mod||0,t=+n.readlanguages_magic||0,p=+n.readlanguages||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.readlanguages_base=p:e.readlanguages=c,setAttrs(e,{silent:!0})})};ga=()=>{getAttrs(["thiefmisc","thiefmisc_base","thiefmisc_racial_mod","thiefmisc_ability_mod","thiefmisc_magic"],r=>{let n={},e=+r.thiefmisc_base||0,s=+r.thiefmisc_racial_mod||0,o=+r.thiefmisc_ability_mod||0,a=+r.thiefmisc_magic||0,t=Math.max(0,Math.min(100,q(e+s+o+a)));n.thiefmisc=t,setAttrs(n,{silent:!0})})};ha=()=>{getAttrs(["thiefmisc1","thiefmisc1_base","thiefmisc1_racial_mod","thiefmisc1_ability_mod","thiefmisc1_magic"],r=>{let n={},e=+r.thiefmisc1_base||0,s=+r.thiefmisc1_racial_mod||0,o=+r.thiefmisc1_ability_mod||0,a=+r.thiefmisc1_magic||0,t=Math.max(0,Math.min(100,q(e+s+o+a)));n.thiefmisc1=t,setAttrs(n,{silent:!0})})};ua=()=>{getAttrs(["thiefmisc2","thiefmisc2_base","thiefmisc2_racial_mod","thiefmisc2_ability_mod","thiefmisc2_magic"],r=>{let n={},e=+r.thiefmisc2_base||0,s=+r.thiefmisc2_racial_mod||0,o=+r.thiefmisc2_ability_mod||0,a=+r.thiefmisc2_magic||0,t=Math.max(0,Math.min(100,q(e+s+o+a)));n.thiefmisc2=t,setAttrs(n,{silent:!0})})};on("change:pickpockets_base change:pickpockets_racial_mod change:pickpockets_ability_mod change:pickpockets_magic",r=>{na()});on("change:openlocks_base change:openlocks_racial_mod change:openlocks_ability_mod change:openlocks_magic",r=>{oa()});on("change:findtraps_base change:findtraps_racial_mod change:findtraps_ability_mod change:findtraps_magic",r=>{Je()});on("change:movequietly_base change:movequietly_racial_mod change:movequietly_ability_mod change:movequietly_magic",r=>{ta()});on("change:hideinshadows_base change:hideinshadows_racial_mod change:hideinshadows_ability_mod change:hideinshadows_magic",r=>{ea()});on("change:hearnoise_base change:hearnoise_racial_mod change:hearnoise_ability_mod change:hearnoise_magic",r=>{ve()});on("change:climbwalls_base change:climbwalls_racial_mod change:climbwalls_ability_mod change:climbwalls_magic",r=>{Xe()});on("change:readlanguages_base change:readlanguages_racial_mod change:readlanguages_ability_mod change:readlanguages_magic",r=>{ra()});on("change:thiefmisc_base change:thiefmisc_racial_mod change:thiefmisc_ability_mod change:thiefmisc_magic",r=>{ga()});on("change:thiefmisc1_base change:thiefmisc1_racial_mod change:thiefmisc1_ability_mod change:thiefmisc1_magic",r=>{ha()});on("change:thiefmisc2_base change:thiefmisc2_racial_mod change:thiefmisc2_ability_mod change:thiefmisc2_magic",r=>{ua()});on("change:thief_level change:autofill_thief change:sync_thief_class change:thief_class_selected change:class change:secondclass change:thirdclass change:level change:level_2 change:level_3",r=>{getAttrs(["thief_level","autofill_thief","sync_thief_class","thief_class_selected","class","secondclass","thirdclass","level","level_2","level_3"],n=>{let e={},s=+n.autofill_thief,o=+n.sync_thief_class;if(!s)return;let a=+n.thief_class_selected,t=+n.thief_level||0,p=(n.class||"").trim(),c=(n.secondclass||"").trim(),l=(n.thirdclass||"").trim(),u=h=>{h===0&&(e.pickpockets_base=0,e.openlocks_base=0,e.findtraps_base=0,e.movequietly_base=0,e.hideinshadows_base=0,e.hearnoise_base=0,e.climbwalls_base=0,e.readlanguages_base=0),h===1&&(e.pickpockets_base=30,e.openlocks_base=25,e.findtraps_base=20,e.movequietly_base=15,e.hideinshadows_base=10,e.hearnoise_base=10,e.climbwalls_base=85,e.readlanguages_base=0),h===2&&(e.pickpockets_base=35,e.openlocks_base=29,e.findtraps_base=25,e.movequietly_base=21,e.hideinshadows_base=15,e.hearnoise_base=10,e.climbwalls_base=86,e.readlanguages_base=0),h===3&&(e.pickpockets_base=40,e.openlocks_base=33,e.findtraps_base=30,e.movequietly_base=27,e.hideinshadows_base=20,e.hearnoise_base=15,e.climbwalls_base=87,e.readlanguages_base=0),h===4&&(e.pickpockets_base=45,e.openlocks_base=37,e.findtraps_base=35,e.movequietly_base=33,e.hideinshadows_base=25,e.hearnoise_base=15,e.climbwalls_base=88,e.readlanguages_base=20),h===5&&(e.pickpockets_base=50,e.openlocks_base=42,e.findtraps_base=40,e.movequietly_base=40,e.hideinshadows_base=31,e.hearnoise_base=20,e.climbwalls_base=90,e.readlanguages_base=25),h===6&&(e.pickpockets_base=55,e.openlocks_base=47,e.findtraps_base=45,e.movequietly_base=47,e.hideinshadows_base=37,e.hearnoise_base=20,e.climbwalls_base=92,e.readlanguages_base=30),h===7&&(e.pickpockets_base=60,e.openlocks_base=52,e.findtraps_base=50,e.movequietly_base=55,e.hideinshadows_base=43,e.hearnoise_base=25,e.climbwalls_base=94,e.readlanguages_base=35),h===8&&(e.pickpockets_base=65,e.openlocks_base=57,e.findtraps_base=55,e.movequietly_base=62,e.hideinshadows_base=49,e.hearnoise_base=25,e.climbwalls_base=96,e.readlanguages_base=40),h===9&&(e.pickpockets_base=70,e.openlocks_base=62,e.findtraps_base=60,e.movequietly_base=70,e.hideinshadows_base=56,e.hearnoise_base=30,e.climbwalls_base=98,e.readlanguages_base=45),h===10&&(e.pickpockets_base=80,e.openlocks_base=67,e.findtraps_base=65,e.movequietly_base=78,e.hideinshadows_base=63,e.hearnoise_base=30,e.climbwalls_base=99,e.readlanguages_base=50),h===11&&(e.pickpockets_base=90,e.openlocks_base=72,e.findtraps_base=70,e.movequietly_base=86,e.hideinshadows_base=70,e.hearnoise_base=35,e.climbwalls_base=99.1,e.readlanguages_base=55),h===12&&(e.pickpockets_base=100,e.openlocks_base=77,e.findtraps_base=75,e.movequietly_base=94,e.hideinshadows_base=77,e.hearnoise_base=35,e.climbwalls_base=99.2,e.readlanguages_base=60),h===13&&(e.pickpockets_base=105,e.openlocks_base=82,e.findtraps_base=80,e.movequietly_base=99,e.hideinshadows_base=85,e.hearnoise_base=40,e.climbwalls_base=99.3,e.readlanguages_base=65),h===14&&(e.pickpockets_base=110,e.openlocks_base=87,e.findtraps_base=85,e.movequietly_base=99,e.hideinshadows_base=93,e.hearnoise_base=40,e.climbwalls_base=99.4,e.readlanguages_base=70),h===15&&(e.pickpockets_base=115,e.openlocks_base=92,e.findtraps_base=90,e.movequietly_base=99,e.hideinshadows_base=99,e.hearnoise_base=50,e.climbwalls_base=99.5,e.readlanguages_base=75),h===16&&(e.pickpockets_base=125,e.openlocks_base=97,e.findtraps_base=95,e.movequietly_base=99,e.hideinshadows_base=99,e.hearnoise_base=50,e.climbwalls_base=99.6,e.readlanguages_base=80),h===17&&(e.pickpockets_base=125,e.openlocks_base=99,e.findtraps_base=99,e.movequietly_base=99,e.hideinshadows_base=99,e.hearnoise_base=55,e.climbwalls_base=99.7,e.readlanguages_base=80),h>17&&(e.pickpockets_base=125,e.openlocks_base=99,e.findtraps_base=99,e.movequietly_base=99,e.hideinshadows_base=99,e.hearnoise_base=55,e.climbwalls_base=99.7,e.readlanguages_base=80)};o===1?a===1?(classSelected=te(p),t=+n.level,g(`Linked Class is: ${p} ${classSelected} Current Level:${n.level}`),e.thief_level=classSelected===4?t:0,u(t)):a===2?(classSelected=te(c),t=+n.level_2,g(`Linked Class is: ${c} ${classSelected} Current Level:${n.level_2}`),e.thief_level=classSelected===4?t:0,u(t)):a===3&&(classSelected=te(l),t=+n.level_3,g(`Linked Class is: ${l} ${classSelected} Current Level:${n.level_3}`),e.thief_level=classSelected===4?t:0,u(t)):u(t),setAttrs(e)})});sa=r=>{getAttrs(["saveparalysispoisondeath","saveparalysispoisondeath_base","saveparalysispoisondeath_racial_mod","saveparalysispoisondeath_ability_mod","saveparalysispoisondeath_misc_mod","saveparalysispoisondeath_temp_mod"],n=>{let e={},s=+n.saveparalysispoisondeath_base,o=+n.saveparalysispoisondeath_racial_mod,a=+n.saveparalysispoisondeath_ability_mod,t=+n.saveparalysispoisondeath_misc_mod,p=+n.saveparalysispoisondeath_temp_mod,c=+n.saveparalysispoisondeath||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.saveparalysispoisondeath_base=c:e.saveparalysispoisondeath=l,setAttrs(e,{silent:!0})})};ia=r=>{getAttrs(["savepetrificationpolymorph","savepetrificationpolymorph_base","savepetrificationpolymorph_racial_mod","savepetrificationpolymorph_ability_mod","savepetrificationpolymorph_misc_mod","savepetrificationpolymorph_temp_mod"],n=>{let e={},s=+n.savepetrificationpolymorph_base,o=+n.savepetrificationpolymorph_racial_mod,a=+n.savepetrificationpolymorph_ability_mod,t=+n.savepetrificationpolymorph_misc_mod,p=+n.savepetrificationpolymorph_temp_mod,c=+n.savepetrificationpolymorph||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.savepetrificationpolymorph_base=c:e.savepetrificationpolymorph=l,setAttrs(e,{silent:!0})})};pa=r=>{getAttrs(["saverodsstaveswands","saverodsstaveswands_base","saverodsstaveswands_racial_mod","saverodsstaveswands_ability_mod","saverodsstaveswands_misc_mod","saverodsstaveswands_temp_mod"],n=>{let e={},s=+n.saverodsstaveswands_base,o=+n.saverodsstaveswands_racial_mod,a=+n.saverodsstaveswands_ability_mod,t=+n.saverodsstaveswands_misc_mod,p=+n.saverodsstaveswands_temp_mod,c=+n.saverodsstaveswands||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.saverodsstaveswands_base=c:e.saverodsstaveswands=l,setAttrs(e,{silent:!0})})};_a=r=>{getAttrs(["savebreathweapons","savebreathweapons_base","savebreathweapons_racial_mod","savebreathweapons_ability_mod","savebreathweapons_misc_mod","savebreathweapons_temp_mod"],n=>{let e={},s=+n.savebreathweapons_base,o=+n.savebreathweapons_racial_mod,a=+n.savebreathweapons_ability_mod,t=+n.savebreathweapons_misc_mod,p=+n.savebreathweapons_temp_mod,c=+n.savebreathweapons||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.savebreathweapons_base=c:e.savebreathweapons=l,setAttrs(e,{silent:!0})})};ca=r=>{getAttrs(["savespells","savespells_base","savespells_racial_mod","savespells_ability_mod","savespells_misc_mod","savespells_temp_mod"],n=>{let e={},s=+n.savespells_base,o=+n.savespells_racial_mod,a=+n.savespells_ability_mod,t=+n.savespells_misc_mod,p=+n.savespells_temp_mod,c=+n.savespells||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.savespells_base=c:e.savespells=l,setAttrs(e,{silent:!0})})};Wa=()=>{getAttrs(["savemisc","savemisc_base","savemisc_racial_mod","savemisc_ability_mod","savemisc_misc_mod","savemisc_temp_mod"],r=>{let n={},e=+r.savemisc_base,s=+r.savemisc_racial_mod,o=+r.savemisc_ability_mod,a=+r.savemisc_misc_mod,t=+r.savemisc_temp_mod,p=q(e+s+o+a+t);n.savemisc=p,setAttrs(n,{silent:!0})})};Ua=()=>{getAttrs(["savemisc1","savemisc1_base","savemisc1_racial_mod","savemisc1_ability_mod","savemisc1_misc_mod","savemisc1_temp_mod"],r=>{let n={},e=+r.savemisc1_base,s=+r.savemisc1_racial_mod,o=+r.savemisc1_ability_mod,a=+r.savemisc1_misc_mod,t=+r.savemisc1_temp_mod,p=q(e+s+o+a+t);n.savemisc1=p,setAttrs(n,{silent:!0})})};Ha=()=>{getAttrs(["savemisc2","savemisc2_base","savemisc2_racial_mod","savemisc2_ability_mod","savemisc2_misc_mod","savemisc2_temp_mod"],r=>{let n={},e=+r.savemisc2_base,s=+r.savemisc2_racial_mod,o=+r.savemisc2_ability_mod,a=+r.savemisc2_misc_mod,t=+r.savemisc2_temp_mod,p=q(e+s+o+a+t);n.savemisc2=p,setAttrs(n,{silent:!0})})};on("change:saveparalysispoisondeath_base change:saveparalysispoisondeath_racial_mod change:saveparalysispoisondeath_ability_mod change:saveparalysispoisondeath_misc_mod change:saveparalysispoisondeath_temp_mod",r=>{sa()});on("change:savepetrificationpolymorph_base change:savepetrificationpolymorph_racial_mod change:savepetrificationpolymorph_ability_mod change:savepetrificationpolymorph_misc_mod change:savepetrificationpolymorph_temp_mod",r=>{ia()});on("change:saverodsstaveswands_base change:saverodsstaveswands_racial_mod change:saverodsstaveswands_ability_mod change:saverodsstaveswands_misc_mod change:saverodsstaveswands_temp_mod",r=>{pa()});on("change:savebreathweapons_base change:savebreathweapons_racial_mod change:savebreathweapons_ability_mod change:savebreathweapons_misc_mod change:savebreathweapons_temp_mod",r=>{_a()});on("change:savespells_base change:savespells_racial_mod change:savespells_ability_mod change:savespells_misc_mod change:savespells_temp_mod",r=>{ca()});on("change:savemisc_base change:savemisc_racial_mod change:savemisc_ability_mod change:savemisc_misc_mod change:savemisc_temp_mod",r=>{Wa()});on("change:savemisc1_base change:savemisc1_racial_mod change:savemisc1_ability_mod change:savemisc1_misc_mod change:savemisc1_temp_mod",r=>{Ua()});on("change:savemisc2_base change:savemisc2_racial_mod change:savemisc2_ability_mod change:savemisc2_misc_mod change:savemisc2_temp_mod",r=>{Ha()});on("change:saves_class change:saves_level change:autofill_saves",r=>{g(`Saves Autofill Change Detected:${r.sourceAttribute}`),getAttrs(["saves_class","saves_level","autofill_saves"],n=>{let e={};if(!+n.autofill_saves)return;let o=+n.saves_class,a=+n.saves_level||0;g(`Class:${o} Level:${a}`),o!==0&&(o===1&&(a===0||(a<4?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=13,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<7?(e.saveparalysispoisondeath_base=9,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=13,e.savebreathweapons_base=15,e.savespells_base=14):a<10?(e.saveparalysispoisondeath_base=7,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=11,e.savebreathweapons_base=13,e.savespells_base=12):a<13?(e.saveparalysispoisondeath_base=6,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=10,e.savebreathweapons_base=12,e.savespells_base=11):a<16?(e.saveparalysispoisondeath_base=5,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=9,e.savebreathweapons_base=11,e.savespells_base=10):a<19?(e.saveparalysispoisondeath_base=4,e.savepetrificationpolymorph_base=7,e.saverodsstaveswands_base=8,e.savebreathweapons_base=10,e.savespells_base=9):a>=19&&(e.saveparalysispoisondeath_base=2,e.savepetrificationpolymorph_base=5,e.saverodsstaveswands_base=6,e.savebreathweapons_base=8,e.savespells_base=7))),o===2&&(a===0||(a<4?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=13,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<7?(e.saveparalysispoisondeath_base=9,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=13,e.savebreathweapons_base=15,e.savespells_base=14):a<10?(e.saveparalysispoisondeath_base=7,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=11,e.savebreathweapons_base=13,e.savespells_base=12):a<13?(e.saveparalysispoisondeath_base=6,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=10,e.savebreathweapons_base=12,e.savespells_base=11):(a<16||a>=16)&&(e.saveparalysispoisondeath_base=5,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=9,e.savebreathweapons_base=11,e.savespells_base=10))),(o===3||o===8)&&(a===0?(e.saveparalysispoisondeath_base=16,e.savepetrificationpolymorph_base=17,e.saverodsstaveswands_base=18,e.savebreathweapons_base=20,e.savespells_base=19):a<3?(e.saveparalysispoisondeath_base=14,e.savepetrificationpolymorph_base=15,e.saverodsstaveswands_base=16,e.savebreathweapons_base=17,e.savespells_base=17):a<5?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=14,e.saverodsstaveswands_base=15,e.savebreathweapons_base=16,e.savespells_base=16):a<7?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=13,e.savebreathweapons_base=13,e.savespells_base=14):a<9?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=12,e.savebreathweapons_base=12,e.savespells_base=13):a<11?(e.saveparalysispoisondeath_base=8,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=10,e.savebreathweapons_base=9,e.savespells_base=11):a<13?(e.saveparalysispoisondeath_base=7,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=9,e.savebreathweapons_base=8,e.savespells_base=10):a<15?(e.saveparalysispoisondeath_base=5,e.savepetrificationpolymorph_base=6,e.saverodsstaveswands_base=7,e.savebreathweapons_base=5,e.savespells_base=8):a<17?(e.saveparalysispoisondeath_base=4,e.savepetrificationpolymorph_base=5,e.saverodsstaveswands_base=6,e.savebreathweapons_base=4,e.savespells_base=7):a>=17&&(e.saveparalysispoisondeath_base=3,e.savepetrificationpolymorph_base=4,e.saverodsstaveswands_base=5,e.savebreathweapons_base=4,e.savespells_base=6)),o===4&&(a===0||(a<6?(e.saveparalysispoisondeath_base=14,e.savepetrificationpolymorph_base=13,e.saverodsstaveswands_base=11,e.savebreathweapons_base=15,e.savespells_base=12):a<11?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=9,e.savebreathweapons_base=13,e.savespells_base=10):a<16?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=7,e.savebreathweapons_base=11,e.savespells_base=8):a<21?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=7,e.saverodsstaveswands_base=5,e.savebreathweapons_base=9,e.savespells_base=6):a>=21&&(e.saveparalysispoisondeath_base=8,e.savepetrificationpolymorph_base=5,e.saverodsstaveswands_base=3,e.savebreathweapons_base=7,e.savespells_base=4))),o===5&&(a===0||(a<5?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<9?(e.saveparalysispoisondeath_base=12,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=12,e.savebreathweapons_base=15,e.savespells_base=13):a<13?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=10,e.savebreathweapons_base=14,e.savespells_base=11):a<17?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=8,e.savebreathweapons_base=13,e.savespells_base=9):a<21?(e.saveparalysispoisondeath_base=9,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=6,e.savebreathweapons_base=12,e.savespells_base=7):a>=21&&(e.saveparalysispoisondeath_base=8,e.savepetrificationpolymorph_base=7,e.saverodsstaveswands_base=4,e.savebreathweapons_base=11,e.savespells_base=5))),o===6&&(a===0||(a<5?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<9?(e.saveparalysispoisondeath_base=12,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=12,e.savebreathweapons_base=15,e.savespells_base=13):a<13?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=10,e.savebreathweapons_base=14,e.savespells_base=11):a<17?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=8,e.savebreathweapons_base=13,e.savespells_base=9):a>=17&&(e.saveparalysispoisondeath_base=9,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=6,e.savebreathweapons_base=12,e.savespells_base=7))),o===7&&(a===0||(a<5?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<9?(e.saveparalysispoisondeath_base=12,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=12,e.savebreathweapons_base=15,e.savespells_base=13):a<13?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=10,e.savebreathweapons_base=14,e.savespells_base=11):(a<16||a>=16)&&(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=8,e.savebreathweapons_base=13,e.savespells_base=9))),setAttrs(e))})});on("change:matrix_class",r=>{getAttrs(["matrix_class"],n=>{let e={},s=+n.matrix_class;e.toggle_matrixhd=s===5?1:0,setAttrs(e,{silent:!0})})});function te(r){let n=r.trim().toLowerCase();return/cleric|druid|monk/.test(n)?1:/fighter|paladin|ranger|bard|cavalier|barbarian/.test(n)?2:/magic-user|illusionist|magic|mage|wizard/.test(n)?3:/thief|assassin|rogue|thief-acrobat|acrobat/.test(n)?4:99}function Ka(){getAttrs(["thac00","autofill_matrix"],r=>{let n={};if(!+r.autofill_matrix)return;let s=+r.thac00;n["thac0-10"]=s+10,n["thac0-9"]=s+9,n["thac0-8"]=s+8,n["thac0-7"]=s+7,n["thac0-6"]=s+6,n["thac0-5"]=s+5,n["thac0-4"]=s+4,n["thac0-3"]=s+3,n["thac0-2"]=s+2,n["thac0-1"]=s+1,n.thac01=s-1,n.thac02=s-2,n.thac03=s-3,n.thac04=s-4,n.thac05=s-5,n.thac06=s-6,n.thac07=s-7,n.thac08=s-8,n.thac09=s-9,n.thac010=s-10,setAttrs(n,{silent:!0})})}on("change:matrix_class change:matrix_level change:matrix_hitdice change:autofill_matrix change:sync_matrix_class change:toggle_fighter5 change:class_selected change:class change:secondclass change:thirdclass change:level change:level_2 change:level_3",r=>{getAttrs(["matrix_class","matrix_level","matrix_hitdice","autofill_matrix","toggle_fighter5","sync_matrix_class","class_selected","class","secondclass","thirdclass","level","level_2","level_3"],n=>{let e={},s=+n.autofill_matrix,o=+n.sync_matrix_class;if(!s)return;let a=+n.class_selected,t=+n.matrix_level||0,p=+n.matrix_class,c=(n.class||"").trim(),l=(n.secondclass||"").trim(),u=(n.thirdclass||"").trim(),h=+n.matrix_hitdice||0,m=+n.toggle_fighter5;o===1&&(a===1&&(p=te(c),t=+n.level,e.matrix_level=t,e.matrix_class=p),a===2&&(p=te(l),t=+n.level_2,e.matrix_level=t,e.matrix_class=p),a===3&&(p=te(u),t=+n.level_3,e.matrix_level=t,e.matrix_class=p)),p!==0&&(p===1&&(t===0||(t<4?(e["thac-10"]=25,e["thac-9"]=24,e["thac-8"]=23,e["thac-7"]=22,e["thac-6"]=21,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=19,e.thac2=18,e.thac3=17,e.thac4=16,e.thac5=15,e.thac6=14,e.thac7=13,e.thac8=12,e.thac9=11,e.thac10=10):t<7?(e["thac-10"]=23,e["thac-9"]=22,e["thac-8"]=21,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=19,e.thac00=18,e.thac0=18,e.thac1=17,e.thac2=16,e.thac3=15,e.thac4=14,e.thac5=13,e.thac6=12,e.thac7=11,e.thac8=10,e.thac9=9,e.thac10=8):t<10?(e["thac-10"]=21,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=19,e["thac-2"]=18,e["thac-1"]=17,e.thac00=16,e.thac0=16,e.thac1=15,e.thac2=14,e.thac3=13,e.thac4=12,e.thac5=11,e.thac6=10,e.thac7=9,e.thac8=8,e.thac9=7,e.thac10=6):t<13?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=19,e["thac-4"]=18,e["thac-3"]=17,e["thac-2"]=16,e["thac-1"]=15,e.thac00=14,e.thac0=14,e.thac1=13,e.thac2=12,e.thac3=11,e.thac4=10,e.thac5=9,e.thac6=8,e.thac7=7,e.thac8=6,e.thac9=5,e.thac10=4):t<16?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=19,e["thac-6"]=18,e["thac-5"]=17,e["thac-4"]=16,e["thac-3"]=15,e["thac-2"]=14,e["thac-1"]=13,e.thac00=12,e.thac0=12,e.thac1=11,e.thac2=10,e.thac3=9,e.thac4=8,e.thac5=7,e.thac6=6,e.thac7=5,e.thac8=4,e.thac9=3,e.thac10=2):t<19?(e["thac-10"]=20,e["thac-9"]=19,e["thac-8"]=18,e["thac-7"]=17,e["thac-6"]=16,e["thac-5"]=15,e["thac-4"]=14,e["thac-3"]=13,e["thac-2"]=12,e["thac-1"]=11,e.thac00=10,e.thac0=10,e.thac1=9,e.thac2=8,e.thac3=7,e.thac4=6,e.thac5=5,e.thac6=4,e.thac7=3,e.thac8=2,e.thac9=1,e.thac10=0):t>=19&&(e["thac-10"]=19,e["thac-9"]=18,e["thac-8"]=17,e["thac-7"]=16,e["thac-6"]=15,e["thac-5"]=14,e["thac-4"]=13,e["thac-3"]=12,e["thac-2"]=11,e["thac-1"]=10,e.thac00=9,e.thac0=9,e.thac1=8,e.thac2=7,e.thac3=6,e.thac4=5,e.thac5=4,e.thac6=3,e.thac7=2,e.thac8=1,e.thac9=0,e.thac10=-1)),e.attack_matrix_flag=0),(p===2||p===6)&&(t===0?(e["thac-10"]=26,e["thac-9"]=25,e["thac-8"]=24,e["thac-7"]=23,e["thac-6"]=22,e["thac-5"]=21,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=19,e.thac3=18,e.thac4=17,e.thac5=16,e.thac6=15,e.thac7=14,e.thac8=13,e.thac9=12,e.thac10=11):t<3?(e["thac-10"]=25-m,e["thac-9"]=24-m,e["thac-8"]=23-m,e["thac-7"]=22-m,e["thac-6"]=21-m,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20-m,e.thac0=20-m,e.thac1=19-m,e.thac2=18-m,e.thac3=17-m,e.thac4=16-m,e.thac5=15-m,e.thac6=14-m,e.thac7=13-m,e.thac8=12-m,e.thac9=11-m,e.thac10=10-m):t<5?(e["thac-10"]=23-m,e["thac-9"]=22-m,e["thac-8"]=21-m,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20-m,e["thac-1"]=19-m,e.thac00=18-m,e.thac0=18-m,e.thac1=17-m,e.thac2=16-m,e.thac3=15-m,e.thac4=14-m,e.thac5=13-m,e.thac6=12-m,e.thac7=11-m,e.thac8=10-m,e.thac9=9-m,e.thac10=8-m):t<7?(e["thac-10"]=21-m,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20-m,e["thac-3"]=19-m,e["thac-2"]=18-m,e["thac-1"]=17-m,e.thac00=16-m,e.thac0=16-m,e.thac1=15-m,e.thac2=14-m,e.thac3=13-m,e.thac4=12-m,e.thac5=11-m,e.thac6=10-m,e.thac7=9-m,e.thac8=8-m,e.thac9=7-m,e.thac10=6-m):t<9?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20-m,e["thac-5"]=19-m,e["thac-4"]=18-m,e["thac-3"]=17-m,e["thac-2"]=16-m,e["thac-1"]=15-m,e.thac00=14-m,e.thac0=14-m,e.thac1=13-m,e.thac2=12-m,e.thac3=11-m,e.thac4=10-m,e.thac5=9-m,e.thac6=8-m,e.thac7=7-m,e.thac8=6-m,e.thac9=5-m,e.thac10=4-m):t<11?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20-m,e["thac-7"]=19-m,e["thac-6"]=18-m,e["thac-5"]=17-m,e["thac-4"]=16-m,e["thac-3"]=15-m,e["thac-2"]=14-m,e["thac-1"]=13-m,e.thac00=12-m,e.thac0=12-m,e.thac1=11-m,e.thac2=10-m,e.thac3=9-m,e.thac4=8-m,e.thac5=7-m,e.thac6=6-m,e.thac7=5-m,e.thac8=4-m,e.thac9=3-m,e.thac10=2-m):t<13?(e["thac-10"]=20-m,e["thac-9"]=19-m,e["thac-8"]=18-m,e["thac-7"]=17-m,e["thac-6"]=16-m,e["thac-5"]=15-m,e["thac-4"]=14-m,e["thac-3"]=13-m,e["thac-2"]=12-m,e["thac-1"]=11-m,e.thac00=10-m,e.thac0=10-m,e.thac1=9-m,e.thac2=8-m,e.thac3=7-m,e.thac4=6-m,e.thac5=5-m,e.thac6=4-m,e.thac7=3-m,e.thac8=2-m,e.thac9=1-m,e.thac10=0-m):t<15?(e["thac-10"]=18-m,e["thac-9"]=17-m,e["thac-8"]=16-m,e["thac-7"]=15-m,e["thac-6"]=14-m,e["thac-5"]=13-m,e["thac-4"]=12-m,e["thac-3"]=11-m,e["thac-2"]=10-m,e["thac-1"]=9-m,e.thac00=8-m,e.thac0=8-m,e.thac1=7-m,e.thac2=6-m,e.thac3=5-m,e.thac4=4-m,e.thac5=3-m,e.thac6=2-m,e.thac7=1-m,e.thac8=0-m,e.thac9=-1-m,e.thac10=-2-m):t<17?(e["thac-10"]=16-m,e["thac-9"]=15-m,e["thac-8"]=14-m,e["thac-7"]=13-m,e["thac-6"]=12-m,e["thac-5"]=11-m,e["thac-4"]=10-m,e["thac-3"]=9-m,e["thac-2"]=8-m,e["thac-1"]=7-m,e.thac00=6-m,e.thac0=6-m,e.thac1=5-m,e.thac2=4-m,e.thac3=3-m,e.thac4=2-m,e.thac5=1-m,e.thac6=0-m,e.thac7=-1-m,e.thac8=-2-m,e.thac9=-3-m,e.thac10=-4-m):t>=17&&(e["thac-10"]=14-m,e["thac-9"]=13-m,e["thac-8"]=12-m,e["thac-7"]=11-m,e["thac-6"]=10-m,e["thac-5"]=9-m,e["thac-4"]=8-m,e["thac-3"]=7-m,e["thac-2"]=6-m,e["thac-1"]=5-m,e.thac00=4-m,e.thac0=4-m,e.thac1=3-m,e.thac2=2-m,e.thac3=1-m,e.thac4=0-m,e.thac5=-1-m,e.thac6=-2-m,e.thac7=-3-m,e.thac8=-4-m,e.thac9=-5-m,e.thac10=-6-m),e.attack_matrix_flag=0),p===3&&(t===0||(t<6?(e["thac-10"]=26,e["thac-9"]=25,e["thac-8"]=24,e["thac-7"]=23,e["thac-6"]=22,e["thac-5"]=21,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=19,e.thac3=18,e.thac4=17,e.thac5=16,e.thac6=15,e.thac7=14,e.thac8=13,e.thac9=12,e.thac10=11):t<11?(e["thac-10"]=24,e["thac-9"]=23,e["thac-8"]=22,e["thac-7"]=21,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=19,e.thac0=19,e.thac1=18,e.thac2=17,e.thac3=16,e.thac4=15,e.thac5=14,e.thac6=13,e.thac7=12,e.thac8=11,e.thac9=10,e.thac10=9):t<16?(e["thac-10"]=21,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=19,e["thac-2"]=18,e["thac-1"]=17,e.thac00=16,e.thac0=16,e.thac1=15,e.thac2=14,e.thac3=13,e.thac4=12,e.thac5=11,e.thac6=10,e.thac7=9,e.thac8=8,e.thac9=7,e.thac10=6):t<21?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=19,e["thac-5"]=18,e["thac-4"]=17,e["thac-3"]=16,e["thac-2"]=15,e["thac-1"]=14,e.thac00=13,e.thac0=13,e.thac1=12,e.thac2=11,e.thac3=10,e.thac4=9,e.thac5=8,e.thac6=7,e.thac7=6,e.thac8=5,e.thac9=4,e.thac10=3):t>=21&&(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=19,e["thac-7"]=18,e["thac-6"]=17,e["thac-5"]=16,e["thac-4"]=15,e["thac-3"]=14,e["thac-2"]=13,e["thac-1"]=12,e.thac00=11,e.thac0=11,e.thac1=10,e.thac2=9,e.thac3=8,e.thac4=7,e.thac5=6,e.thac6=5,e.thac7=4,e.thac8=3,e.thac9=2,e.thac10=1)),e.attack_matrix_flag=0),p===4&&(t===0||(t<5?(e["thac-10"]=26,e["thac-9"]=25,e["thac-8"]=24,e["thac-7"]=23,e["thac-6"]=22,e["thac-5"]=21,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=19,e.thac3=18,e.thac4=17,e.thac5=16,e.thac6=15,e.thac7=14,e.thac8=13,e.thac9=12,e.thac10=11):t<9?(e["thac-10"]=24,e["thac-9"]=23,e["thac-8"]=22,e["thac-7"]=21,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=19,e.thac0=19,e.thac1=18,e.thac2=17,e.thac3=16,e.thac4=15,e.thac5=14,e.thac6=13,e.thac7=12,e.thac8=11,e.thac9=10,e.thac10=9):t<13?(e["thac-10"]=21,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=19,e["thac-2"]=18,e["thac-1"]=17,e.thac00=16,e.thac0=16,e.thac1=15,e.thac2=14,e.thac3=13,e.thac4=12,e.thac5=11,e.thac6=10,e.thac7=9,e.thac8=8,e.thac9=7,e.thac10=6):t<17?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=19,e["thac-4"]=18,e["thac-3"]=17,e["thac-2"]=16,e["thac-1"]=15,e.thac00=14,e.thac0=14,e.thac1=13,e.thac2=12,e.thac3=11,e.thac4=10,e.thac5=9,e.thac6=8,e.thac7=7,e.thac8=6,e.thac9=5,e.thac10=4):t<21?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=19,e["thac-6"]=18,e["thac-5"]=17,e["thac-4"]=16,e["thac-3"]=15,e["thac-2"]=14,e["thac-1"]=13,e.thac00=12,e.thac0=12,e.thac1=11,e.thac2=10,e.thac3=9,e.thac4=8,e.thac5=7,e.thac6=6,e.thac7=5,e.thac8=4,e.thac9=3,e.thac10=2):t>=21&&(e["thac-10"]=20,e["thac-9"]=19,e["thac-8"]=18,e["thac-7"]=17,e["thac-6"]=16,e["thac-5"]=15,e["thac-4"]=14,e["thac-3"]=13,e["thac-2"]=12,e["thac-1"]=11,e.thac00=10,e.thac0=10,e.thac1=9,e.thac2=8,e.thac3=7,e.thac4=6,e.thac5=5,e.thac6=4,e.thac7=3,e.thac8=2,e.thac9=1,e.thac10=0)),e.attack_matrix_flag=0),p===5&&(h===0||(h===1?(e["thac-10"]=26,e["thac-9"]=25,e["thac-8"]=24,e["thac-7"]=23,e["thac-6"]=22,e["thac-5"]=21,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=19,e.thac3=18,e.thac4=17,e.thac5=16,e.thac6=15,e.thac7=14,e.thac8=13,e.thac9=12,e.thac10=11):h===2?(e["thac-10"]=25,e["thac-9"]=24,e["thac-8"]=23,e["thac-7"]=22,e["thac-6"]=21,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=19,e.thac2=18,e.thac3=17,e.thac4=16,e.thac5=15,e.thac6=14,e.thac7=13,e.thac8=12,e.thac9=11,e.thac10=10):h===3?(e["thac-10"]=24,e["thac-9"]=23,e["thac-8"]=22,e["thac-7"]=21,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=19,e.thac0=19,e.thac1=18,e.thac2=17,e.thac3=16,e.thac4=15,e.thac5=14,e.thac6=13,e.thac7=12,e.thac8=11,e.thac9=10,e.thac10=9):h===4?(e["thac-10"]=23,e["thac-9"]=22,e["thac-8"]=21,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=19,e.thac00=18,e.thac0=18,e.thac1=17,e.thac2=16,e.thac3=15,e.thac4=14,e.thac5=13,e.thac6=12,e.thac7=11,e.thac8=10,e.thac9=9,e.thac10=8):h===5?(e["thac-10"]=21,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=19,e["thac-2"]=18,e["thac-1"]=17,e.thac00=16,e.thac0=16,e.thac1=15,e.thac2=14,e.thac3=13,e.thac4=12,e.thac5=11,e.thac6=10,e.thac7=9,e.thac8=8,e.thac9=7,e.thac10=6):h===6?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=19,e["thac-3"]=18,e["thac-2"]=17,e["thac-1"]=16,e.thac00=15,e.thac0=15,e.thac1=14,e.thac2=13,e.thac3=12,e.thac4=11,e.thac5=10,e.thac6=9,e.thac7=8,e.thac8=7,e.thac9=6,e.thac10=5):h===7?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=19,e["thac-5"]=18,e["thac-4"]=17,e["thac-3"]=16,e["thac-2"]=15,e["thac-1"]=14,e.thac00=13,e.thac0=13,e.thac1=12,e.thac2=11,e.thac3=10,e.thac4=9,e.thac5=8,e.thac6=7,e.thac7=6,e.thac8=5,e.thac9=4,e.thac10=3):h===8?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=19,e["thac-6"]=18,e["thac-5"]=17,e["thac-4"]=16,e["thac-3"]=15,e["thac-2"]=14,e["thac-1"]=13,e.thac00=12,e.thac0=12,e.thac1=11,e.thac2=10,e.thac3=9,e.thac4=8,e.thac5=7,e.thac6=6,e.thac7=5,e.thac8=4,e.thac9=3,e.thac10=2):h===9?(e["thac-10"]=20,e["thac-9"]=19,e["thac-8"]=18,e["thac-7"]=17,e["thac-6"]=16,e["thac-5"]=15,e["thac-4"]=14,e["thac-3"]=13,e["thac-2"]=12,e["thac-1"]=11,e.thac00=10,e.thac0=10,e.thac1=9,e.thac2=8,e.thac3=7,e.thac4=6,e.thac5=5,e.thac6=4,e.thac7=3,e.thac8=2,e.thac9=1,e.thac10=0):h===10?(e["thac-10"]=19,e["thac-9"]=18,e["thac-8"]=17,e["thac-7"]=16,e["thac-6"]=15,e["thac-5"]=14,e["thac-4"]=13,e["thac-3"]=12,e["thac-2"]=11,e["thac-1"]=10,e.thac00=9,e.thac0=9,e.thac1=8,e.thac2=7,e.thac3=6,e.thac4=5,e.thac5=4,e.thac6=3,e.thac7=2,e.thac8=1,e.thac9=0,e.thac10=-1):h===11?(e["thac-10"]=18,e["thac-9"]=17,e["thac-8"]=16,e["thac-7"]=15,e["thac-6"]=14,e["thac-5"]=13,e["thac-4"]=12,e["thac-3"]=11,e["thac-2"]=10,e["thac-1"]=9,e.thac00=8,e.thac0=8,e.thac1=7,e.thac2=6,e.thac3=5,e.thac4=4,e.thac5=3,e.thac6=2,e.thac7=1,e.thac8=0,e.thac9=-1,e.thac10=-2):h===12&&(e["thac-10"]=17,e["thac-9"]=16,e["thac-8"]=15,e["thac-7"]=14,e["thac-6"]=13,e["thac-5"]=12,e["thac-4"]=11,e["thac-3"]=10,e["thac-2"]=9,e["thac-1"]=8,e.thac00=7,e.thac0=7,e.thac1=6,e.thac2=5,e.thac3=4,e.thac4=3,e.thac5=2,e.thac6=1,e.thac7=0,e.thac8=-1,e.thac9=-2,e.thac10=-3)),e.attack_matrix_flag=0),p===99&&(g("Error: Class not recognized or class name is empty."),e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=20,e.thac3=20,e.thac4=20,e.thac5=20,e.thac6=20,e.thac7=20,e.thac8=20,e.thac9=20,e.thac10=20,e.attack_matrix_flag=0),setAttrs(e,{silent:!0}),Ka())})});on("sheet:opened change:thac0 change:thac00 change:autofill_matrix",r=>{getAttrs(["attack_matrix_flag","matrix_class","thac0","thac1","thac2","thac00","thac01","thac02","autofill_matrix"],n=>{let e={};if(!+n.autofill_matrix)return;let o=+n.attack_matrix_flag,a=+n.matrix_class;if(o===0||a>0)e.attack_matrix_flag=0;else{let t=+n.thac0,p=+n.thac1,c=+n.thac2,l=+n.thac00,u=+n.thac01,h=+n.thac02,m=t+p+c,w=l+u+h;e.attack_matrix_flag=m===60&&w===60?1:0}setAttrs(e,{silent:!0})})});on("change:thac00",r=>{Ka()});function F(r,n,e,s){return rs?(console.log(`Error: ${n} value is out of range. [${r}].\\nDefaulting to ${s}.`),s):Math.min(Math.max(r,e),s)}var x=class{constructor(n,e,s,o,a,t){this.meleebonus=n,this.dmgbonus=e,this.majorstrengthfeat=t,this.minorstrengthfeat=o,this.minorstrengthfeat_locked=a,this.encumbrancebonus=s}getMeleeAttackBonus(){return this.meleebonus}getMeleeDamageBonus(){return this.dmgbonus}getMajorStrengthCheck(){return this.majorstrengthfeat}getMinorStrengthCheck(n=!1){return n?this.minorstrengthfeat_locked:this.minorstrengthfeat}getEncumbranceBonus(){return this.encumbrancebonus}},Pe=class{constructor(){this.strength_dict={3:new x(-3,-1,-350,1,0,0),4:new x(-2,-1,-250,1,0,0),5:new x(-2,-1,-250,1,0,0),6:new x(-1,0,-150,1,0,0),7:new x(-1,0,-150,1,0,0),8:new x(0,0,0,2,0,1),9:new x(0,0,0,2,0,1),10:new x(0,0,0,2,0,2),11:new x(0,0,0,2,0,2),12:new x(0,0,100,2,0,4),13:new x(0,0,100,2,0,4),14:new x(0,0,200,2,0,7),15:new x(0,0,200,2,0,7),16:new x(0,1,350,3,0,10),17:new x(1,1,500,3,0,13),18:{None:new x(1,2,750,3,0,16),"01-50":new x(1,3,1e3,3,0,20),"51-75":new x(2,3,1250,4,0,25),"76-90":new x(2,4,1500,4,0,30),"91-99":new x(2,5,2e3,4,1,35),"00":new x(3,6,3e3,5,2,40)},19:new x(3,7,4500,7,3,50),20:new x(3,8,5e3,7,3,60),21:new x(4,9,6e3,9,4,70),22:new x(4,10,7500,11,4,80),23:new x(5,11,9e3,11,5,90),24:new x(6,12,12e3,19,7,100),25:new x(7,14,15e3,23,9,100)}}getEntry(n,e){let s=F(n,"strength",3,25);return s!==18?this.strength_dict[s]:e<=0?this.strength_dict[s].None:e<=50?this.strength_dict[s]["01-50"]:e<=75?this.strength_dict[s]["51-75"]:e<=90?this.strength_dict[s]["76-90"]:e<=99?this.strength_dict[s]["91-99"]:this.strength_dict[s]["00"]}getStrengthValue(n,e,s=0,o=!1){switch(n){case"Attack":return this.getEntry(e,s).getMeleeAttackBonus();case"Damage":return this.getEntry(e,s).getMeleeDamageBonus();case"Major":return this.getEntry(e,s).getMajorStrengthCheck();case"Minor":return this.getEntry(e,s).getMinorStrengthCheck(o);case"Encumbrance":return this.getEntry(e,s).getEncumbranceBonus();default:return"Invalid Test"}}},O=class{constructor(n,e,s,o){this.bonuslanguages=n,this.knowspell=e,this.minspells=s,this.maxspells=o}getBonusLanguages(){return this.bonuslanguages}getKnowSpell(){return this.knowspell}getMinSpells(){return this.minspells}getMaxSpells(){return this.maxspells}},Ue=class{constructor(){this.intelligence_dict={8:new O(1,0,0,0),9:new O(1,35,4,6),10:new O(2,45,5,7),11:new O(2,45,5,7),12:new O(3,45,5,7),13:new O(3,55,6,9),14:new O(4,55,6,9),15:new O(4,65,7,11),16:new O(5,65,7,11),17:new O(6,75,8,14),18:new O(7,85,9,18),19:new O(8,95,10,99),20:new O(9,96,11,99),21:new O(10,97,12,99),22:new O(11,98,13,99),23:new O(12,99,14,99),24:new O(13,100,15,99),25:new O(14,100,16,99)}}getEntry(n){return this.intelligence_dict[F(n,"intelligence",8,25)]}},D=class{constructor(n,e,s){this.mentalsavebonus=n,this.spellbonus=e,this.spellfailure=s}getMentalSaveBonus(){return this.mentalsavebonus}getSpellBonus(){return this.spellbonus}getSpellFailure(){return this.spellfailure}},He=class{constructor(){this.wisdom_dict={3:new D("-3","None",20),4:new D("-2","None",20),5:new D("-1","None",20),6:new D("-1","None",20),7:new D("-1","None",20),8:new D("0","None",20),9:new D("0","None",20),10:new D("0","None",15),11:new D("0","None",10),12:new D("0","None",5),13:new D("0","1/0/0/0/0/0/0",0),14:new D("0","2/0/0/0/0/0/0",0),15:new D("1","2/1/0/0/0/0/0",0),16:new D("2","2/2/0/0/0/0/0",0),17:new D("3","2/2/1/0/0/0/0",0),18:new D("4","2/2/1/1/0/0/0",0),19:new D("4","3/2/1/2/0/0/0",0),20:new D("4","3/3/1/3/0/0/0",0),21:new D("4","3/3/2/3/1/0/0",0),22:new D("4","3/3/2/4/2/0/0",0),23:new D("4","3/3/2/4/4/0/0",0),24:new D("4","3/3/2/4/4/2/1",0),25:new D("4","3/3/2/4/4/3/1",0)}}getEntry(n){return this.wisdom_dict[F(n,"wisdom",3,25)]}},C=class{constructor(n,e,s){this.surprisebonus=n,this.rangedbonus=e,this.armorbonus=s}getSurpriseBonus(){return this.surprisebonus}getRangedBonus(){return this.rangedbonus}getArmorBonus(){return this.armorbonus}},We=class{constructor(){this.dexterity_dict={3:new C(3,-3,4),4:new C(2,-2,3),5:new C(1,-1,2),6:new C(0,0,1),7:new C(0,0,0),8:new C(0,0,0),9:new C(0,0,0),10:new C(0,0,0),11:new C(0,0,0),12:new C(0,0,0),13:new C(0,0,0),14:new C(0,0,0),15:new C(0,0,-1),16:new C(-1,1,-2),17:new C(-2,2,-3),18:new C(-3,3,-4),19:new C(-3,3,-4),20:new C(-3,3,-4),21:new C(-4,4,-5),22:new C(-4,4,-5),23:new C(-4,4,-5),24:new C(-5,5,-6),25:new C(-5,5,-6)}}getEntry(n){return this.dexterity_dict[F(n,"dexterity",3,25)]}},E=class{constructor(n,e,s){this.hitpointbonus=n,this.systemshock=e,this.resurrectionsurvival=s}getHitpointBonus(){return this.hitpointbonus}getSystemShock(){return this.systemshock}getResurrectionSurvival(){return this.resurrectionsurvival}},Ve=class{constructor(){this.constitution_dict={3:new E("-2",35,40),4:new E("-1",40,45),5:new E("-1",45,50),6:new E("0",50,55),7:new E("0",55,60),8:new E("0",60,65),9:new E("0",65,70),10:new E("0",70,75),11:new E("0",75,80),12:new E("0",80,85),13:new E("0",85,90),14:new E("0",88,92),15:new E("1",91,94),16:new E("2",95,96),17:new E("3",97,98),18:new E("4",99,100),19:new E("5",99,100),20:new E("5",99,100),21:new E("6",99,100),22:new E("6",99,100),23:new E("6",99,100),24:new E("7",99,100),25:new E("7",99,100)}}getEntry(n){return this.constitution_dict[F(n,"constitution",3,25)]}},I=class{constructor(n,e,s,o){this.maximumhenchmen=n,this.loyaltybonus=e,this.reactionbonus=s,this.comeliness=o}MaximumHenchmen(){return this.maximumhenchmen}getLoyaltyBonus(){return this.loyaltybonus}getReactionBonus(){return this.reactionbonus}getComeliness(){return this.comeliness}},Fe=class{constructor(){this.charisma_dict={3:new I(1,-30,-25,-5),4:new I(1,-25,-20,-3),5:new I(2,-20,-15,-3),6:new I(2,-15,-10,-1),7:new I(3,-10,-5,-1),8:new I(3,-5,0,-1),9:new I(4,0,0,0),10:new I(4,0,0,0),11:new I(4,0,0,0),12:new I(5,0,0,0),13:new I(5,0,5,1),14:new I(6,5,10,1),15:new I(7,15,15,1),16:new I(8,20,25,2),17:new I(10,30,30,2),18:new I(15,40,35,3),19:new I(20,50,40,5),20:new I(25,60,45,5),21:new I(30,70,50,5),22:new I(35,80,55,5),23:new I(40,90,60,5),24:new I(45,100,65,5),25:new I(50,100,70,5)}}getEntry(n){return this.charisma_dict[F(n,"charisma",3,25)]}},N=class{constructor(n,e,s,o,a){this.pickPockets=n,this.openLocks=e,this.findRemoveTraps=s,this.moveSilently=o,this.hideInShadows=a}getPickPockets(){return this.pickPockets}getOpenLocks(){return this.openLocks}getFindRemoveTraps(){return this.findRemoveTraps}getMoveSilently(){return this.moveSilently}getHideInShadows(){return this.hideInShadows}},Ge=class{constructor(){this.dexterity_dict={9:new N(-15,-10,-10,-20,-10),10:new N(-10,-5,-10,-15,-5),11:new N(-5,0,-5,-10,0),12:new N(0,0,0,-5,0),13:new N(0,0,0,0,0),14:new N(0,0,0,0,0),15:new N(0,0,0,0,0),16:new N(0,5,0,0,0),17:new N(5,10,0,5,5),18:new N(10,15,5,10,10),19:new N(15,20,10,12,12),20:new N(20,25,15,15,15),21:new N(25,30,20,18,18),22:new N(30,35,25,20,20),23:new N(35,40,30,23,23),24:new N(40,45,35,25,25),25:new N(45,50,40,30,30)}}getEntry(n){return this.dexterity_dict[F(n,"dexterity",9,25)]}},B=class{constructor(n,e,s,o,a,t,p,c){this.pickPockets=n,this.openLocks=e,this.findRemoveTraps=s,this.moveSilently=o,this.hideInShadows=a,this.hearNoise=t,this.climbWalls=p,this.readLanguages=c}getPickPockets(){return this.pickPockets}getOpenLocks(){return this.openLocks}getFindRemoveTraps(){return this.findRemoveTraps}getMoveSilently(){return this.moveSilently}getHideInShadows(){return this.hideInShadows}getHearNoise(){return this.hearNoise}getClimbWalls(){return this.climbWalls}getReadLanguages(){return this.readLanguages}},ze=class{constructor(){this.dexterity_dict={0:new B(0,0,0,0,0,0,0,0),1:new B(0,0,0,0,0,0,0,0),2:new B(0,10,15,0,0,0,-10,-5),3:new B(5,-5,0,5,10,5,0,0),4:new B(0,5,10,5,5,10,-15,0),5:new B(10,0,0,0,5,0,0,0),6:new B(5,5,5,10,15,5,-15,-5),7:new B(-5,5,5,0,0,5,5,-10)}}getEntry(n){return this.dexterity_dict[F(n,"thief_race_selected",0,7)]}},H=new Pe,ke=new Ue,Ae=new He,ee=new We,ae=new Ve,z=new Fe,ce=new Ge,W=new ze,j=(r,n,e="int")=>e==="int"?parseInt(r[n])||0:e==="float"?parseFloat(r[n])||0:e==="str"?r[n]:null;la=()=>{getAttrs(["strength","exceptionalstrength"],r=>{let n={},e=j(r,"strength","int"),s=j(r,"exceptionalstrength");j(r,"exceptionalstrength","str")==="00"&&(s=100),n.exceptionalstrength=s,n.meleebonus=(H.getStrengthValue("Attack",e,s)<=0?"":"+")+H.getStrengthValue("Attack",e,s),n.dmgbonus=(H.getStrengthValue("Damage",e,s)<=0?"":"+")+H.getStrengthValue("Damage",e,s),n.majorstrengthfeat=H.getStrengthValue("Major",e,s),n.minorstrengthfeat=H.getStrengthValue("Minor",e,s),n.minorstrengthfeat_locked=H.getStrengthValue("Minor",e,s,!0),n.encumbrancebonus=(H.getStrengthValue("Encumbrance",e,s)<=0?"":"+")+H.getStrengthValue("Encumbrance",e,s),setAttrs(n)})};aa=()=>{getAttrs(["intelligence","bonuslanguages","race"],r=>{let n={},e=j(r,"intelligence","int"),s=j(r,"race","str"),o=+ke.getEntry(e).getBonusLanguages();/human/gi.test(s)?n.bonuslanguages=o:/dwarf/gi.test(s)||/gnome/gi.test(s)||/orc/gi.test(s)?n.bonuslanguages=Math.min(o,2):/half-elf/gi.test(s)||/halfling/gi.test(s)||/hobbit/gi.test(s)?(o<=5?o=0:o===6?o=1:o===7?o=2:o===8?o=3:o===9?o=4:o===10?o=5:o===11?o=6:o===12?o=7:o===13?o=8:o>=14&&(o=9),n.bonuslanguages=o):/elf/gi.test(s)?(o<=4?o=0:o===5?o=1:o==6?o=2:o===7?o=3:o===8?o=4:o===9?o=5:o===10?o=6:o===11?o=7:o===12?o=8:o===13?o=9:o>=14&&(o=10),n.bonuslanguages=o):n.bonuslanguages=0,n.knowspell=ke.getEntry(e).getKnowSpell(),n.minspells=ke.getEntry(e).getMinSpells(),n.maxspells=ke.getEntry(e).getMaxSpells(),setAttrs(n,{silent:!0})})};wa=()=>{getAttrs(["wisdom"],r=>{let n={},e=j(r,"wisdom","int");n.mentalsavebonus=(Ae.getEntry(e).getMentalSaveBonus()<=0?"":"+")+Ae.getEntry(e).getMentalSaveBonus(),n.spellbonus=Ae.getEntry(e).getSpellBonus(),n.spellfailure=Ae.getEntry(e).getSpellFailure(),setAttrs(n,{silent:!0})})};Ze=()=>{getAttrs(["dexterity"],r=>{let n={},e=j(r,"dexterity","int"),s=ee.getEntry(e).getSurpriseBonus(),o=(-1*s<=0?"":"+")+-1*s;n.surprisebonus=ee.getEntry(e).getSurpriseBonus(),n.surprisebonus_inverted=o,n.rangedbonus=(ee.getEntry(e).getRangedBonus()<=0?"":"+")+ee.getEntry(e).getRangedBonus(),n.armorbonus=(ee.getEntry(e).getArmorBonus()<=0?"":"+")+ee.getEntry(e).getArmorBonus(),setAttrs(n)})};Qe=()=>{getAttrs(["constitution","class","secondclass","thirdclass"],r=>{let n={},e=j(r,"constitution","int"),s=[r.class,r.secondclass,r.thirdclass];/fighter/gi.test(s)||/paladin/gi.test(s)||/ranger/gi.test(s)?n.hitpointbonus=(ae.getEntry(e).getHitpointBonus()<=0?"":"+")+ae.getEntry(e).getHitpointBonus():n.hitpointbonus=(Math.min(ae.getEntry(e).getHitpointBonus(),2)<=0?"":"+")+Math.min(ae.getEntry(e).getHitpointBonus(),2),n.systemshock=ae.getEntry(e).getSystemShock(),n.resurrectionsurvival=ae.getEntry(e).getResurrectionSurvival(),setAttrs(n)})};Ye=()=>{getAttrs(["charisma"],r=>{let n={},e=j(r,"charisma","int");n.maximumhenchmen=z.getEntry(e).MaximumHenchmen(),n.loyaltybonus=(z.getEntry(e).getLoyaltyBonus()<=0?"":"+")+z.getEntry(e).getLoyaltyBonus(),n.reactionbonus=(z.getEntry(e).getReactionBonus()<=0?"":"+")+z.getEntry(e).getReactionBonus(),n.comeliness_cha_adj=(z.getEntry(e).getComeliness()<=0?"":"+")+z.getEntry(e).getComeliness(),setAttrs(n,{silent:!0})})};thiefSkillsDexCalcs=r=>{getAttrs(["dexterity"],n=>{let e={},s=j(n,"dexterity","int"),o=ce.getEntry(s).getPickPockets(),a=ce.getEntry(s).getOpenLocks(),t=ce.getEntry(s).getFindRemoveTraps(),p=ce.getEntry(s).getMoveSilently(),c=ce.getEntry(s).getHideInShadows();e.pickpockets_ability_mod=r===1?o:0,e.openlocks_ability_mod=r===1?a:0,e.findtraps_ability_mod=r===1?t:0,e.movequietly_ability_mod=r===1?p:0,e.hideinshadows_ability_mod=r===1?c:0,setAttrs(e)})};thiefSkillsRacialCalcs=r=>{getAttrs(["thief_race_selected"],n=>{let e={},s=j(n,"thief_race_selected","int"),o=W.getEntry(s).getPickPockets(),a=W.getEntry(s).getOpenLocks(),t=W.getEntry(s).getFindRemoveTraps(),p=W.getEntry(s).getMoveSilently(),c=W.getEntry(s).getHideInShadows(),l=W.getEntry(s).getHearNoise(),u=W.getEntry(s).getClimbWalls(),h=W.getEntry(s).getReadLanguages();e.pickpockets_racial_mod=r===1?o:0,e.openlocks_racial_mod=r===1?a:0,e.findtraps_racial_mod=r===1?t:0,e.movequietly_racial_mod=r===1?p:0,e.hideinshadows_racial_mod=r===1?c:0,e.hearnoise_racial_mod=r===1?l:0,e.climbwalls_racial_mod=r===1?u:0,e.readlanguages_racial_mod=r===1?h:0,setAttrs(e)})};on("change:autofill_thief_dex change:dexterity",r=>{getAttrs(["autofill_thief_dex"],n=>{let e=+n.autofill_thief_dex;thiefSkillsDexCalcs(e)})});function wo(r){let n=r.trim().toLowerCase();return/human/.test(n)?1:/dwarf/.test(n)?2:/half-elf/.test(n)?5:/elf/.test(n)?3:/gnome/.test(n)?4:/halfling|hobbit/.test(n)?6:/half-orc/.test(n)?7:0}on("change:race change:autofill_thief_race change:thief_race_selected",r=>{let n=r.sourceAttribute;getAttrs(["race","autofill_thief_race"],e=>{let s={},o=+e.autofill_thief_race,a=(e.race||"human").trim();(n==="autofill_thief_race"||n==="race")&&(s.thief_race_selected=wo(a)),setAttrs(s,{silent:!0}),thiefSkillsRacialCalcs(o)})});on("change:strength change:exceptionalstrength",r=>{la()});on("change:intelligence change:race",r=>{aa()});on("change:wisdom",r=>{wa()});on("change:dexterity",r=>{Ze()});on("change:constitution change:class change:secondclass change:thirdclass",r=>{Qe()});on("change:charisma change:comeliness",r=>{Ye()});portraitUrlCalc=()=>{getAttrs(["character_avatar","sheet_image","sheet_image_url"],r=>{let n={},e=+r.sheet_image,s=(function(t){let p=/(\.png|\.jpg|\.gif)/i,c=t.match(p);return c?t.slice(0,c.index+c[0].length):t})(r.character_avatar),o=r.sheet_image_url||s;e===0&&(n.sheet_image_src=o),e===1&&(n.sheet_image_src=s),e===2&&(n.sheet_image_src=""),setAttrs(n,{silent:!0})})};on("change:character_avatar change:sheet_image change:sheet_image_url",r=>{portraitUrlCalc()});on("clicked:postimage",r=>{portraitUrlCalc(),startRoll("?{Display the portrait image?|YES,@{sheet_image_src}|NO, }",e=>{finishRoll(e.rollId)})});on("change:psionic_ability_strength_max change:psionic_attack change:psionic_defense",r=>{getAttrs(["psionic_ability_strength_max"],n=>{let e={},s=n.psionic_ability_strength_max;e.psionic_attack_max=T(s/2).toFixed(1),e.psionic_defense_max=T(s/2).toFixed(1),setAttrs(e,{silent:!0})})});Va=()=>{getSectionIDs("repeating_weapon",r=>{let n={},e=[],s=[];r.forEach(o=>{e.push(i("weapon",o,"weapon_name")),e.push(i("weapon",o,"weapon_use")),e.push(i("weapon",o,"weapon_speed")),e.push(i("weapon",o,"weapon_misc"))}),getAttrs(e,o=>{if(r.forEach(a=>{let t=+o[i("weapon",a,"weapon_use")]||0;if(t===0)return;let p=o[i("weapon",a,"weapon_name")],c=o[i("weapon",a,"weapon_speed")]||"0",l=parseInt(c.match(/\d+/)?.[0])||0,u=o[i("weapon",a,"weapon_misc")];s.push({id:a,name:p,inUse:t,speed:l,misc:u})}),s.length>0){let a=s[0];s.forEach(l=>{l.speed{Va()});var Ya=function(r,n){getAttrs([`_reporder_${r}`],function(e){getSectionIDs(r,function(s){let o=e[`_reporder_${r}`]?e[`_reporder_${r}`].toLowerCase().split(","):[],a=[...new Set(o.filter(t=>s.includes(t)).concat(s))];n(a)})})};on("clicked:spell-sort-alphabetical clicked:spell-sort-level",function(r){let n="repeating_spells";Ya(n,function(e){getSectionIDs(n,s=>{if(!s.length)return;let o=[],a=r.triggerName.replace("clicked:","");s.forEach(t=>{o.push(i("spells",t,"spell_caster_class")),o.push(i("spells",t,"spell_level")),o.push(i("spells",t,"spell_name"))}),getAttrs([...o],t=>{let p={},c=s.map(h=>({id:h,casterClass:t[i("spells",h,"spell_caster_class")]||0,level:t[i("spells",h,"spell_level")],name:(t[i("spells",h,"spell_name")]||"").trim()})),l=h=>h==="?"?-1:h||0;a==="spell-sort-alphabetical"?c.sort((h,m)=>h.name.localeCompare(m.name,void 0,{sensitivity:"base"})):a==="spell-sort-level"&&c.sort((h,m)=>{let w=l(h.level),A=l(m.level);return h.casterClass-m.casterClass||w-A||h.name.localeCompare(m.name,void 0,{sensitivity:"base"})});let u=c.map(h=>`${h.id}`);p.spells_previous_order_array=e.join(","),setAttrs(p,{silent:!0},setSectionOrder("spells",u))})})})});on("clicked:spell-sort-undo",r=>{getAttrs(["spells_previous_order_array"],n=>{let e=n.spells_previous_order_array;if(!e||typeof e!="string")return;let s=e.split(",");setSectionOrder("spells",s)})});on("clicked:equipment-sort-alphabetical clicked:equipment-sort-location",function(r){let n="repeating_equipment";Ya(n,function(e){getSectionIDs(n,s=>{if(!s.length)return;let o=[],a=r.triggerName.replace("clicked:","");s.forEach(t=>{o.push(i("equipment",t,"equipment_item")),o.push(i("equipment",t,"equipment_location"))}),getAttrs([...o],t=>{let p={},c=s.map(u=>({id:u,name:(t[i("equipment",u,"equipment_item")]||"").trim(),location:(t[i("equipment",u,"equipment_location")]||"").trim()}));a==="equipment-sort-alphabetical"?c.sort((u,h)=>u.name.localeCompare(h.name,void 0,{sensitivity:"base"})):a==="equipment-sort-location"&&c.sort((u,h)=>{let m=u.location.localeCompare(h.location,void 0,{sensitivity:"base"});return m!==0?m:u.name.localeCompare(h.name,void 0,{sensitivity:"base"})});let l=c.map(u=>`${u.id}`);p.equipment_previous_order_array=e.join(","),setAttrs(p,{silent:!0},setSectionOrder("equipment",l))})})})});on("clicked:equipment-sort-undo",r=>{getAttrs(["equipment_previous_order_array"],n=>{let e=n.equipment_previous_order_array;if(!e||typeof e!="string")return;let s=e.split(",");setSectionOrder("equipment",s)})});})();
+var q=(r,n=0)=>parseInt(r)||n,T=(r,n=0)=>parseFloat(r)||n,g=(r,n="green")=>{let e=`%c ${r}`;console.log(e,`color: ${n}; font-weight:bold`)},d=(r,n=0)=>typeof r<"u"&&r!==n,xe=(r,n)=>{let e=r;return _.each(Object.entries(n),([s,o])=>{e=e.replace(new RegExp(s.replace("{","{"),"gi"),o)}),e},kt=r=>/^[a-zA-Z0-9\s]+$/.test(r)?!0:!/[)|\}]/.test(r),At=r=>/^[-+]?[0-9]+$/.test(r)?1:0,Ta={},k=()=>{let r=generateRowID();for(;Ta[r]===!0;)g(`generateUniqueRowID: ${r} is not a unique ID, trying again.`),r=generateRowID();return Ta[r]=!0,r};on("change:character_name",r=>{getAttrs(["character_name"],n=>{let e={},s=n[`${r.sourceAttribute}`],o=kt(s);e[`${r.sourceAttribute}_error`]=o,setAttrs(e,{silent:!0})})});on("change:armortype_magic change:armortype2_magic change:armorshield_magic change:armorhelmet_magic change:armorother_magic change:armorother2_magic change:armorother3_magic change:armorother4_magic change:armorother5_magic change:armorother6_magic change:armorshield_mod change:armorother_mod change:armorother2_mod change:armorother3_mod change:armorother4_mod change:armorother5_mod change:armorother6_mod change:repeating_equipment:equipment_armor_mod change:repeating_equipment:equipment_armor_magic, change:hitpoints_1_class, change:hitpoints_2_class, change:hitpoints_3_class",r=>{let n=r.sourceAttribute.split("_")[2];getAttrs(["armortype_magic","armortype2_magic","armorshield_magic","armorhelmet_magic","armorother_magic","armorother2_magic","armorother3_magic","armorother4_magic","armorother5_magic","armorother6_magic","armorshield_mod","armorother_mod","armorother2_mod","armorother3_mod","armorother4_mod","armorother5_mod","armorother6_mod",`repeating_equipment_${n}_equipment_armor_magic`,`repeating_equipment_${n}_equipment_armor_mod`,"hitpoints_1_class","hitpoints_2_class","hitpoints_3_class"],e=>{let s={},o=e[`${r.sourceAttribute}`],a=At(o);s[`${r.sourceAttribute}_error`]=a,setAttrs(s,{silent:!0})})});var Se,La="",ja="",Ba="",V="",Ke="",Pa="",Ye="",Xe="",Qe="",Me="",Ze="",Je="",ve="",ea="",aa="",ta="",oa="",na="",ra="",_a="",Ua="",Ha="",Wa="",sa="",ia="",pa="",ca="",ma="",la="",ha="",ua="",ga="",y="",Va="",wa="",De=["unarmored_row_id","armortype1_row_id","armortype2_row_id","armorshield_row_id","armorhelmet_row_id","armorother1_row_id","armorother2_row_id","armorother3_row_id","armorother4_row_id","armorother5_row_id","armorother6_row_id"],ba=["unarmored_worn","unarmored","unarmored_ac","unarmored_base","unarmored_bulk","unarmored_carried","unarmored_weight","unarmored_cost","armortype_worn","armortype","armortype_ac","armortype_base","armortype_magic","armortype_bulk","armortype_carried","armor_weight","armor_cost","armortype2_worn","armortype2","armortype2_ac","armortype2_base","armortype2_magic","armortype2_bulk","armortype2_carried","armortype2_weight","armortype2_cost","armorshield_worn","armorshield","armorshield_ac","armorshield_base","armorshield_magic","armorshield_mod","armorshield_bulk","armorshield_carried","armorshield_weight","armorshield_cost","armorhelmet_worn","armorhelmet","armorhelmet_ac","armorhelmet_magic","armorhelmet_bulk","armorhelmet_carried","armorhelmet_weight","armorhelmet_cost","armorother_worn","armorother","armorother_ac","armorother_base","armorother_magic","armorother_mod","armorother2_worn","armorother2","armorother2_ac","armorother2_base","armorother2_magic","armorother2_mod","armorother3_worn","armorother3","armorother3_ac","armorother3_base","armorother3_magic","armorother3_mod","armorother4_worn","armorother4","armorother4_ac","armorother4_base","armorother4_magic","armorother4_mod","armorother5_worn","armorother5","armorother5_ac","armorother5_base","armorother5_magic","armorother5_mod","armorother6_worn","armorother6","armorother6_ac","armorother6_base","armorother6_magic","armorother6_mod"],i=(r,n,e)=>`repeating_${r}_${n}_${e}`,xt=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"DmgBonus")),s.push(i("weapon",o,"macro-text"))}),getAttrs([...s],o=>{let a={},t="&{template:attacks} {{name=@{character_name}}} {{subtag=@{WeaponName}}} {{attack1=[[1d20 + @{ToHitBonus}[BON] + @{MagicBonus}[MAG] + ?{To Hit Modifier?|0}[MOD] ]]}} {{damage1vsSM=[[@{DamageSmallMedium} + @{DmgBonus}[BON] + @{MagicBonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{DamageLarge} + @{DmgBonus}[BON] + @{MagicBonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{WeaponNotes}}} @{whisper_to-hit}";_.each(e,p=>{let c=o[i("weapon",p,"macro-text")]||t;a[i("weapon",p,"macro-text")]=c.replace(/@{DmgBonus}/g,"@{AttackDmgBonus}"),a[i("weapon",p,"AttackDmgBonus")]=+o[i("weapon",p,"DmgBonus")]||0}),a.sheet_version=r,g("VERSION UPDATE: dmgSwap completed"),setAttrs(a,{silent:!0},y(r,n))})})},St=(r,n)=>{getSectionIDs("repeating_ability",e=>{let s=[];_.each(e,o=>{s.push(i("ability",o,"max"))}),getAttrs([...s],o=>{let a={};_.each(e,t=>{a[i("ability",t,"current_max")]=+o[i("ability",t,"max")]||0}),a.sheet_version=r,g("VERSION UPDATE: maxSwap completed"),setAttrs(a,{silent:!0},y(r,n))})})},Mt=(r,n)=>{let e={};getSectionIDs("repeating_nonweaponproficiencies",s=>{let o=[];_.each(s,a=>{o.push(i("nonweaponproficiencies",a,"macro-text"))}),getAttrs([...o],a=>{let t={nwp_old:"&{template:general} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{name}}} {{=@{short_description}}}{{Success Amount=[[((@{rAttribute})+(@{rSlots}-1)-1d20)cs>1cf<-1]]}}",nwp_new:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{name}}} {{Proficiency Check=[[ 1d20 + [[@{rmodifier}]][MOD] + [[?{Additional modifier?|0}]][MOD] ]] vs [[ @{rAttribute}[ATTR] ]]}}{{freetext=@{short_description}}}"};_.each(s,p=>{a[i("nonweaponproficiencies",p,"macro-text")]&&(e[i("nonweaponproficiencies",p,"macro-text")]=a[i("nonweaponproficiencies",p,"macro-text")].replace(t.nwp_old,t.nwp_new))}),e.sheet_version=r,g("VERSION UPDATE: nwpMacroUpdate completed"),setAttrs(e,{silent:!0},y(r,n))})})},Dt=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"roll")),s.push(i("weapon",o,"weaponname")),s.push(i("weapon",o,"tohitbonus")),s.push(i("weapon",o,"magicbonus")),s.push(i("weapon",o,"attackdmgbonus")),s.push(i("weapon",o,"whisper_to-hit")),s.push(i("weapon",o,"macro-text")),s.push(i("weapon",o,"damagesmallmedium")),s.push(i("weapon",o,"damagelarge")),s.push(i("weapon",o,"rateoffire")),s.push(i("weapon",o,"range")),s.push(i("weapon",o,"quantity")),s.push(i("weapon",o,"weight")),s.push(i("weapon",o,"weaponspeed")),s.push(i("weapon",o,"cost")),s.push(i("weapon",o,"weaponnotes"))}),getAttrs([...s],o=>{let a={},t={"@{rateoffire}":"@{weapon_rateoffire}","@{weaponname}":"@{weapon_name}","@{tohitbonus}":"@{weapon_tohitbonus}","@{magicbonus}":"@{weapon_magicbonus}","@{attackdmgbonus}":"@{weapon_attackdmgbonus}","@{whisper_to-hit}":"@{weapon_whisper_to_hit}","@{damagesmallmedium}":"@{weapon_damagesmallmedium}","@{damagelarge}":"@{weapon_damagelarge}","@{range}":"@{weapon_range}","@{quantity}":"@{weapon_quantity}","@{weight}":"@{weapon_weight}","@{weaponspeed}":"@{weapon_speed}","@{cost}":"@{weapon_cost}","@{macro-text}":"@{weapon_macro_text}","@{weaponnotes}":"@{weapon_notes}"},p="&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{WeaponName}}} {{attack1=[[1d20 + @{ToHitBonus}[BON] + @{MagicBonus}[MAG] + ?{To Hit Modifier?|0}[MOD]) ]]}} {{damage1vsSM=[[@{DamageSmallMedium} + @{AttackDmgBonus}[BON] + @{MagicBonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{DamageLarge} + @{AttackDmgBonus}[BON] + @{MagicBonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{WeaponNotes}}} @{whisper_to-hit}";_.each(e,c=>{d(o[i("weapon",c,"rateoffire")])&&(a[i("weapon",c,"weapon_rateoffire")]=q(o[i("weapon",c,"rateoffire")])),d(o[i("weapon",c,"roll")])&&(a[i("weapon",c,"weapon_roll")]=o[i("weapon",c,"roll")]),d(o[i("weapon",c,"weaponname")])&&(a[i("weapon",c,"weapon_name")]=o[i("weapon",c,"weaponname")]),d(o[i("weapon",c,"tohitbonus")])&&(a[i("weapon",c,"weapon_tohitbonus")]=q(o[i("weapon",c,"tohitbonus")])),d(o[i("weapon",c,"magicbonus")])&&(a[i("weapon",c,"weapon_magicbonus")]=q(o[i("weapon",c,"magicbonus")])),d(o[i("weapon",c,"attackdmgbonus")])&&(a[i("weapon",c,"weapon_attackdmgbonus")]=q(o[i("weapon",c,"attackdmgbonus")])),d(o[i("weapon",c,"whisper_to-hit")])&&(a[i("weapon",c,"weapon_whisper_to_hit")]=o[i("weapon",c,"whisper_to-hit")]),d(o[i("weapon",c,"macro-text")],p)&&(a[i("weapon",c,"weapon_macro_text")]=xe(o[i("weapon",c,"macro-text")],t)),d(o[i("weapon",c,"damagesmallmedium")])&&(a[i("weapon",c,"weapon_damagesmallmedium")]=o[i("weapon",c,"damagesmallmedium")]),d(o[i("weapon",c,"damagelarge")])&&(a[i("weapon",c,"weapon_damagelarge")]=o[i("weapon",c,"damagelarge")]),d(o[i("weapon",c,"range")])&&(a[i("weapon",c,"weapon_range")]=o[i("weapon",c,"range")]),d(o[i("weapon",c,"quantity")])&&(a[i("weapon",c,"weapon_quantity")]=T(o[i("weapon",c,"quantity")])),d(o[i("weapon",c,"weight")])&&(a[i("weapon",c,"weapon_weight")]=T(o[i("weapon",c,"weight")])),d(o[i("weapon",c,"weaponspeed")])&&(a[i("weapon",c,"weapon_speed")]=q(o[i("weapon",c,"weaponspeed")])),d(o[i("weapon",c,"cost")])&&(a[i("weapon",c,"weapon_cost")]=T(o[i("weapon",c,"cost")])),d(o[i("weapon",c,"weaponnotes")])&&(a[i("weapon",c,"weapon_notes")]=o[i("weapon",c,"weaponnotes")])}),a.sheet_version=r,g("VERSION UPDATE: weaponNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},Ct=(r,n)=>{getSectionIDs("repeating_spells",e=>{let s=[];_.each(e,o=>{s.push(i("spells",o,"roll")),s.push(i("spells",o,"memorized")),s.push(i("spells",o,"level")),s.push(i("spells",o,"name")),s.push(i("spells",o,"school")),s.push(i("spells",o,"range")),s.push(i("spells",o,"duration")),s.push(i("spells",o,"aoe")),s.push(i("spells",o,"components")),s.push(i("spells",o,"ct")),s.push(i("spells",o,"save")),s.push(i("spells",o,"macro-text")),s.push(i("spells",o,"description")),s.push(i("spells",o,"description-show"))}),getAttrs([...s],o=>{let a={},t={"@{memorized}":"@{spell_memorized}","@{level}":"@{spell_level}","@{name}":"@{spell_name}","@{school}":"@{spell_school}","@{range}":"@{spell_range}","@{duration}":"@{spell_duration}","@{aoe}":"@{spell_aoe}","@{components}":"@{spell_components}","@{ct}":"@{spell_ct}","@{save}":"@{spell_save}","@{macro-text}":"@{spell_macro_text}","@{description}":"@{spell_description}"},p="&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{name}}} {{Level:=@{level}}} {{Range:=@{range}}} {{Duration:=@{duration}}} {{AOE:=@{aoe}}} {{Comp:=@{components}}} {{CT:=@{ct}}} {{Save:=@{save}}} {{freetext=@{description}}}";_.each(e,c=>{d(o[i("spells",c,"roll")])&&(a[i("spells",c,"spell_roll")]=o[i("spells",c,"roll")]),d(o[i("spells",c,"memorized")])&&(a[i("spells",c,"spell_memorized")]=q(o[i("spells",c,"memorized")])),d(o[i("spells",c,"level")])&&(a[i("spells",c,"spell_level")]=o[i("spells",c,"level")]),d(o[i("spells",c,"name")])&&(a[i("spells",c,"spell_name")]=o[i("spells",c,"name")]),d(o[i("spells",c,"school")])&&(a[i("spells",c,"spell_school")]=o[i("spells",c,"school")]),d(o[i("spells",c,"range")])&&(a[i("spells",c,"spell_range")]=o[i("spells",c,"range")]),d(o[i("spells",c,"duration")])&&(a[i("spells",c,"spell_duration")]=o[i("spells",c,"duration")]),d(o[i("spells",c,"aoe")])&&(a[i("spells",c,"spell_aoe")]=o[i("spells",c,"aoe")]),d(o[i("spells",c,"components")])&&(a[i("spells",c,"spell_components")]=o[i("spells",c,"components")]),d(o[i("spells",c,"ct")])&&(a[i("spells",c,"spell_ct")]=o[i("spells",c,"ct")]),d(o[i("spells",c,"save")])&&(a[i("spells",c,"spell_save")]=o[i("spells",c,"save")]),d(o[i("spells",c,"macro-text")],p)&&(a[i("spells",c,"spell_macro_text")]=xe(o[i("spells",c,"macro-text")],t)),d(o[i("spells",c,"description")])&&(a[i("spells",c,"spell_description")]=o[i("spells",c,"description")]),d(o[i("spells",c,"description-show")])&&(a[i("spells",c,"spell_description_show")]=q(o[i("spells",c,"description-show")]))}),a.sheet_version=r,g("VERSION UPDATE: spellNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},Et=(r,n)=>{getSectionIDs("repeating_equipment",e=>{let s=[];_.each(e,o=>{s.push(i("equipment",o,"item-show")),s.push(i("equipment",o,"item")),s.push(i("equipment",o,"location")),s.push(i("equipment",o,"carried")),s.push(i("equipment",o,"quantity")),s.push(i("equipment",o,"quantity_max")),s.push(i("equipment",o,"weight")),s.push(i("equipment",o,"cos"))}),getAttrs([...s],o=>{let a={};_.each(e,t=>{d(o[i("equipment",t,"item-show")])&&(a[i("equipment",t,"equipment_item_show")]=o[i("equipment",t,"item-show")]),d(o[i("equipment",t,"item")])&&(a[i("equipment",t,"equipment_item")]=o[i("equipment",t,"item")]),d(o[i("equipment",t,"location")])&&(a[i("equipment",t,"equipment_location")]=o[i("equipment",t,"location")]),d(o[i("equipment",t,"carried")])&&(a[i("equipment",t,"equipment_carried")]=o[i("equipment",t,"carried")]),d(o[i("equipment",t,"quantity")])&&(a[i("equipment",t,"equipment_quantity")]=T(o[i("equipment",t,"quantity")])),d(o[i("equipment",t,"quantity_max")])&&(a[i("equipment",t,"equipment_quantity_max")]=T(o[i("equipment",t,"quantity_max")])),d(o[i("equipment",t,"weight")])&&(a[i("equipment",t,"equipment_weight")]=T(o[i("equipment",t,"weight")])),d(o[i("equipment",t,"cost")])&&(a[i("equipment",t,"equipment_cost")]=T(o[i("equipment",t,"cost")]))}),a.sheet_version=r,g("VERSION UPDATE: equipmentNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},It=(r,n)=>{getSectionIDs("repeating_ability",e=>{let s=[];_.each(e,o=>{s.push(i("equipment",o,"roll")),s.push(i("equipment",o,"name")),s.push(i("equipment",o,"short_description")),s.push(i("equipment",o,"current")),s.push(i("equipment",o,"current_max")),s.push(i("equipment",o,"macro-text")),s.push(i("equipment",o,"description")),s.push(i("equipment",o,"description-show"))}),getAttrs([...s],o=>{let a={},t={"@{name}":"@{ability_name}","@{current}":"@{ability_current}","@{current_max}":"@{ability_current_max}","@{short_description}":"@{ability_short_description}","@{macro-text}":"@{ability_macro_text}","@{description}":"@{ability_description}"},p="&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{name}}} {{freetext=@{short_description} @{description}}}";_.each(e,c=>{d(o[i("equipment",c,"roll")])&&(a[i("equipment",c,"ability_roll")]=o[i("equipment",c,"roll")]),d(o[i("equipment",c,"name")])&&(a[i("equipment",c,"ability_name")]=o[i("equipment",c,"name")]),d(o[i("equipment",c,"short_description")])&&(a[i("equipment",c,"ability_short_description")]=o[i("equipment",c,"short_description")]),d(o[i("equipment",c,"current")])&&(a[i("equipment",c,"ability_current")]=q(o[i("equipment",c,"current")])),d(o[i("equipment",c,"current_max")])&&(a[i("equipment",c,"ability_current_max")]=q(o[i("equipment",c,"current_max")])),d(o[i("equipment",c,"macro-text")],p)&&(a[i("equipment",c,"ability_macro_text")]=xe(o[i("equipment",c,"macro-text")],t)),d(o[i("equipment",c,"description")])&&(a[i("equipment",c,"ability_description")]=o[i("equipment",c,"description")]),d(o[i("equipment",c,"description-show")])&&(a[i("equipment",c,"ability_description_show")]=q(o[i("equipment",c,"description-show")]))}),a.sheet_version=r,g("VERSION UPDATE: abilityNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},Ot=(r,n)=>{getSectionIDs("repeating_nonweaponproficiencies",e=>{let s=[];_.each(e,o=>{s.push(i("nonweaponproficiencies",o,"roll")),s.push(i("nonweaponproficiencies",o,"name")),s.push(i("nonweaponproficiencies",o,"rAttribute")),s.push(i("nonweaponproficiencies",o,"short_description")),s.push(i("nonweaponproficiencies",o,"rSlots")),s.push(i("nonweaponproficiencies",o,"rModifier")),s.push(i("nonweaponproficiencies",o,"macro-text")),s.push(i("nonweaponproficiencies",o,"description-show")),s.push(i("nonweaponproficiencies",o,"description"))}),getAttrs([...s],o=>{let a={},t={"@{name}":"@{nwp_name}","@{rAttribute}":"@{nwp_attribute}","@{rSlots}":"@{nwp_slots}","@{rModifier}":"@{nwp_modifier}","@{short_description}":"@{nwp_short_description}","@{macro-text}":"@{nwp_macro_text}","@{description}":"@{nwp_description}"},p="&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{name}}} {{Proficiency Check=[[ 1d20 + [[@{rmodifier}]][MOD] + [[?{Additional modifier?|0}]][MOD] ]] vs [[ @{rAttribute}[ATTR] ]]}}{{freetext=@{short_description}}}";_.each(e,c=>{d(o[i("nonweaponproficiencies",c,"roll")])&&(a[i("nonweaponproficiencies",c,"nwp_roll")]=o[i("nonweaponproficiencies",c,"roll")]),d(o[i("nonweaponproficiencies",c,"name")])&&(a[i("nonweaponproficiencies",c,"nwp_name")]=o[i("nonweaponproficiencies",c,"name")]),d(o[i("nonweaponproficiencies",c,"rAttribute")])&&(a[i("nonweaponproficiencies",c,"nwp_attribute")]=o[i("nonweaponproficiencies",c,"rAttribute")].toLowerCase()),d(o[i("nonweaponproficiencies",c,"short_description")])&&(a[i("nonweaponproficiencies",c,"nwp_short_description")]=o[i("nonweaponproficiencies",c,"short_description")]),d(o[i("nonweaponproficiencies",c,"rSlots")])&&(a[i("nonweaponproficiencies",c,"nwp_slots")]=q(o[i("nonweaponproficiencies",c,"rSlots")])),d(o[i("nonweaponproficiencies",c,"rModifier")])&&(a[i("nonweaponproficiencies",c,"nwp_modifier")]=q(o[i("nonweaponproficiencies",c,"rModifier")])),d(o[i("nonweaponproficiencies",c,"macro-text")],p)&&(a[i("nonweaponproficiencies",c,"nwp_macro_text")]=xe(o[i("nonweaponproficiencies",c,"macro-text")],t)),d(o[i("nonweaponproficiencies",c,"description-show")])&&(a[i("nonweaponproficiencies",c,"nwp_description_show")]=q(o[i("nonweaponproficiencies",c,"description-show")])),d(o[i("nonweaponproficiencies",c,"description")])&&(a[i("nonweaponproficiencies",c,"nwp_description")]=o[i("nonweaponproficiencies",c,"description")])}),a.sheet_version=r,g("VERSION UPDATE: nwpNameFix completed"),setAttrs(a,{silent:!0},y(r,n))})})},Nt=(r,n)=>{let e={};getSectionIDs("repeating_nonweaponproficiencies",s=>{getSectionIDs("repeating_weapon",o=>{getSectionIDs("repeating_ability",a=>{getSectionIDs("repeating_spells",t=>{let p=[],c=[],l=[],u=[];_.each(s,h=>{p.push(i("nonweaponproficiencies",h,"nwp_macro_text"))}),_.each(o,h=>{c.push(i("weapon",h,"weapon_macro_text"))}),_.each(a,h=>{l.push(i("ability",h,"ability_macro_text"))}),_.each(t,h=>{u.push(i("spells",h,"spell_macro_text"))}),getAttrs([...p,...c,...l,...u],h=>{let m={nwp_old:"&{template:general} {{name=@{character_name}}}",nwp_new:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}}",wpn_old:"&{template:attacks} {{name=@{character_name}}}",wpn_new:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}}",abl_old:"&{template:general} {{name=@{character_name}}}",abl_new:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}}",spl_old:"&{template:general} {{name=@{character_name}}}",spl_new:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}}"};_.each(s,w=>{h[i("nonweaponproficiencies",w,"nwp_macro_text")]&&(e[i("nonweaponproficiencies",w,"nwp_macro_text")]=h[i("nonweaponproficiencies",w,"nwp_macro_text")].replace(m.nwp_old,m.nwp_new),g("VERSION UPDATE: colorUpdate completed"))}),_.each(o,w=>{h[i("weapon",w,"weapon_macro_text")]&&(e[i("weapon",w,"weapon_macro_text")]=h[i("weapon",w,"weapon_macro_text")].replace(m.wpn_old,m.wpn_new),g("VERSION UPDATE: colorUpdate completed"))}),_.each(a,w=>{h[i("ability",w,"ability_macro_text")]&&(e[i("ability",w,"ability_macro_text")]=h[i("ability",w,"ability_macro_text")].replace(m.abl_old,m.abl_new),g("VERSION UPDATE: colorUpdate completed"))}),_.each(t,w=>{h[i("spells",w,"spell_macro_text")]&&(e[i("spells",w,"spell_macro_text")]=h[i("spells",w,"spell_macro_text")].replace(m.spl_old,m.spl_new),g("VERSION UPDATE: colorUpdate completed"))}),e.sheet_version=r,setAttrs(e,{silent:!0},y(r,n))})})})})})},Fa=()=>{la(),aa(),wa(),Ze(),Qe(),Ye()};La=(r,n)=>{let e={};Fa(),e.sheet_version=r,g("VERSION UPDATE: autoCalcAbilityRows completed"),setAttrs(e,y(r,n))};ja=(r,n)=>{let e={};sa(1),ia(1),pa(1),_a(1),ca(1),e.sheet_version=r,g("VERSION UPDATE: autoCalcSaveRows(migrate) completed"),setAttrs(e,{silent:!0},y(r,n))};Ba=(r,n)=>{let e={};na(1),oa(1),Je(1),ta(1),ea(1),ve(1),Xe(1),ra(1),ga(),ha(),ua(),e.sheet_version=r,g("VERSION UPDATE: autoCalcThiefRows(migrate) completed"),setAttrs(e,{silent:!0},y(r,n))};var Tt=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"weapon_macro_text"))}),getAttrs([...s],o=>{let a={},t="&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{attack1=[[1d20 + @{weapon_tohitbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{To Hit Modifier?|0}[MOD] ]]}} {{damage1vsSM=[[@{weapon_damagesmallmedium} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{weapon_damagelarge} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{weapon_notes}}} @{weapon_whisper_to_hit}";_.each(e,p=>{let c=o[i("weapon",p,"weapon_macro_text")]||t;a[i("weapon",p,"weapon_macro_text")]=c.replace(/} @{weapon_whisper_to_hit}/g,"}")}),a.sheet_version=r,g("VERSION UPDATE: removeWhisper completed"),setAttrs(a,{silent:!0},y(r,n))})})},Rt=(r,n)=>{getAttrs(["hitpoints_max","hitpoints_1_class","hitpoints_2_class","hitpoints_3_class"],e=>{let s={},o=+e.hitpoints_max||0,a=+e.hitpoints_1_class||0,t=+e.hitpoints_2_class||0,p=+e.hitpoints_3_class||0;q(Math.max(0,a)+Math.max(0,t)+Math.max(0,p))===0&&o>0&&(s.hitpoints_1_class=o),s.sheet_version=r,g("VERSION UPDATE: migrate HP completed"),setAttrs(s,{silent:!0},y(r,n),Ke())})},Lt=(r,n)=>{getAttrs(["armorclass","armortype_ac","armorclass_total","armorbonus","armorshield"],e=>{let s={},a=+e.armorclass,t=-Math.abs(e.armorbonus)||0,p=+e.armorclass_total||0,c=+e.armortype_ac,l=e.armorshield;g(`armorShield:${l} armorClassTotal:${p} armorBonus:${t} armortypeAC:${c} armorClass:${a}`),l?c===10&&a<10&&(a+=1,s.armortype_ac=a,s.armortype_base=a,s.armortype_worn=1,s.armortype_carried=1,s.armorshield_ac=-1,s.armorshield_base=-1,s.armorshield_worn=1,s.armorshield_carried=1,g("new armor w/shield")):c===10&&a<10?(s.armortype_ac=a,s.armortype_base=a,s.armortype_worn=1,s.armortype_carried=1,g("new armor w/out shield")):g("NEW ARMOR CHECK AND SET FAILED"),s.sheet_version=r,g("VERSION UPDATE: Migrate AC completed"),setAttrs(s,{silent:!0},y(r,n),V(0))})},Be=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"weapon_macro_text"))}),getAttrs([...s],o=>{let a={},t={weapon_old:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{attack1=[[1d20 + @{weapon_tohitbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{To Hit Modifier?|0}[MOD] ]]}} {{damage1vsSM=[[@{weapon_damagesmallmedium} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{weapon_damagelarge} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{weapon_notes}}}",weapon_old_v2:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{attack1=[[1d20 + @{weapon_tohitbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{To Hit Modifier?|0}[MOD]) ]]}} {{damage1vsSM=[[@{weapon_damagesmallmedium} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{damage1vsL=[[@{weapon_damagelarge} + @{weapon_attackdmgbonus}[BON] + @{weapon_magicbonus}[MAG] + ?{Damage Modifier?|0}[MOD] ]]}} {{WeaponNotes=@{weapon_notes}}}",weapon_old_v3:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} @{weapon_tohitacadj}",weapon_old_v4:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{critdamagevsSMchatmenu=@{weapon_critdamagesmallmedium_chat_menu}}} {{critdamagevsLchatmenu=@{weapon_critdamagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} {{crit=@{toggle_critdamage}}} @{weapon_tohitacadj}",weapon_old_v5:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{critdamagevsSMchatmenu=@{weapon_critdamagesmallmedium_chat_menu}}} {{critdamagevsLchatmenu=@{weapon_critdamagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} {{ammo=[[ @{weapon_ammo} ]]/[[ @{weapon_ammo|max} ]]}} {{crit=@{toggle_critdamage}}} @{weapon_tohitacadj}",weapon_old_v6:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{critdamagevsSMchatmenu=@{weapon_critdamagesmallmedium_chat_menu}}} {{critdamagevsLchatmenu=@{weapon_critdamagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} {{ammo=[[ @{weapon_ammo} ]]/[[ @{weapon_ammo|max} ]]}} {{crit=[[ @{toggle_critdamage} ]]}} @{weapon_tohitacadj}",weapon_current:"&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + ( @{weapon_backstab_bonus}[BACKSTAB] ) + ( @{weapon_tohitbonus}[HIT_BON] ) + ( @{weapon_prof_pen}[PROF_PEN] ) + ( @{weapon_dual_pen}[DUAL_PEN] ) + ( @{weapon_magicbonus}[MAG_BON] ) + ( ?{To Hit Modifier?|0}[MISC_MOD] ) ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{critdamagevsSMchatmenu=@{weapon_critdamagesmallmedium_chat_menu}}} {{critdamagevsLchatmenu=@{weapon_critdamagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} {{ammo=[[ @{weapon_ammo} ]]/[[ @{weapon_ammo|max} ]]}} {{crit=[[ @{toggle_critdamage} ]]}} @{weapon_tohitacadj}"};_.each(e,p=>{o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v6?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v6,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v5?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v5,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v4?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v4,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v3?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v3,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old_v2?a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old_v2,t.weapon_current):o[i("weapon",p,"weapon_macro_text")]===t.weapon_old&&(a[i("weapon",p,"weapon_macro_text")]=o[i("weapon",p,"weapon_macro_text")].replace(t.weapon_old,t.weapon_current))}),a.sheet_version=r,g("VERSION UPDATE: weaponMacroUpdate completed"),setAttrs(a,{silent:!0},y(r,n))})})},Ra=(r,n)=>{getSectionIDs("repeating_ability",e=>{let s=[];_.each(e,o=>{s.push(i("ability",o,"ability_macro_text"))}),getAttrs([...s],o=>{let a={},t={ability_old:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{freetext=@{ability_short_description} @{ability_description}}}",ability_old_v2:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ @{ability_die} + @{ability_mod}[MOD] ]]}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=@{ability_current|max}}}",ability_old_v3:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ @{ability_die} + @{ability_mod}[MOD] ]]}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=[[ @{ability_current|max} ]]}} {{effect_type=@{ability_effect_type}}} {{spell_level=@{ability_level}}} {{casting_time=@{ability_ct}}} {{range=@{ability_range}}} {{saving_throw=@{ability_save}}} {{area_of_effect=@{ability_aoe}}} {{save_type=@{ability_save_type}}}",ability_old_v4:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ @{ability_die} + @{ability_mod}[MOD] ]]}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=[[ @{ability_current|max} ]]}} {{effect_type=@{ability_effect_type}}} {{spell_level=@{ability_level}}} {{casting_time=@{ability_ct}}} {{range=@{ability_range}}} {{duration=@{ability_duration}}} {{saving_throw=@{ability_save}}} {{area_of_effect=@{ability_aoe}}} {{save_type=@{ability_save_type}}}",ability_old_v5:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ @{ability_die} + @{ability_mod}[MOD] ]]}} {{link=@{ability_link}}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=[[@{ability_current|max}]]}} {{effect_type=@{ability_effect_type}}} {{spell_level=@{ability_level}}} {{casting_time=@{ability_ct}}} {{range=@{ability_range}}} {{duration=@{ability_duration}}} {{saving_throw=@{ability_save}}} {{area_of_effect=@{ability_aoe}}} {{save_type=@{ability_save_type}}}",ability_current:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Special Ability: @{ability_name}}} {{roll= [[ 0 + @{ability_die} + @{ability_mod}[MOD] ]]}} {{link=@{ability_link}}} {{freetext=@{ability_short_description} @{ability_description}}} {{uses=@{ability_current}}} {{uses_max=[[ 0 + @{ability_current|max} ]]}} {{effect_type=@{ability_effect_type}}} {{spell_level=@{ability_level}}} {{casting_time=@{ability_ct}}} {{range=@{ability_range}}} {{duration=@{ability_duration}}} {{saving_throw=@{ability_save}}} {{area_of_effect=@{ability_aoe}}} {{save_type=@{ability_save_type}}}"};_.each(e,p=>{o[i("ability",p,"ability_macro_text")]===t.ability_old_v5&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old_v5,t.ability_current)),o[i("ability",p,"ability_macro_text")]===t.ability_old_v4&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old_v4,t.ability_current)),o[i("ability",p,"ability_macro_text")]===t.ability_old_v3&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old_v3,t.ability_current)),o[i("ability",p,"ability_macro_text")]===t.ability_old_v2&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old_v2,t.ability_current)),o[i("ability",p,"ability_macro_text")]===t.ability_old&&(a[i("ability",p,"ability_macro_text")]=o[i("ability",p,"ability_macro_text")].replace(t.ability_old,t.ability_current))}),a.sheet_version=r,g("VERSION UPDATE: abilityMacroUpdate completed"),setAttrs(a,{silent:!0},y(r,n))})})},jt=(r,n)=>{getSectionIDs("repeating_nonweaponproficiencies",e=>{let s=[];_.each(e,o=>{s.push(i("nonweaponproficiencies",o,"nwp_macro_text"))}),getAttrs([...s],o=>{let a={},t={nwp_old:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{nwp_name}}} {{Proficiency Check=[[ 1d20 + [[@{nwp_modifier}]][MOD] + [[?{Additional modifier?|0}]][MOD] ]] vs [[ @{nwp_attribute}[ATTR] ]]}}{{freetext=@{nwp_short_description}}}",nwp_old_v2:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{nwp_name}}} {{roll_low=[[ 1d20 + [[ @{nwp_modifier} ]][MOD] + [[ ?{Modifier?|0} ]][MOD] ]]}} {{roll_target=[[ @{nwp_attribute}[ATTR] ]]}} {{mod_applied=[[ ?{Modifier?|0} ]]}} {{NWP Mod Applied=[[ @{nwp_modifier} ]]}} {{freetext=@{nwp_short_description}}}",nwp_current:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Non Weapon Proficiency: @{nwp_name}}} {{roll_low=[[ 1d20 + [[ @{nwp_modifier} ]][MOD] + [[ ?{Modifier?|0} ]][MOD] ]]}} {{roll_target=[[ @{nwp_attribute}[ATTR] ]]}} {{mod_applied=[[ ?{Modifier?|0} ]]}} {{nwp_mod_applied=[[ @{nwp_modifier} ]]}} {{link=@{nwp_link}}} {{freetext=@{nwp_short_description} @{nwp_description}}}"};_.each(e,p=>{o[i("nonweaponproficiencies",p,"nwp_macro_text")]===t.nwp_old_2&&(a[i("nonweaponproficiencies",p,"nwp_macro_text")]=o[i("nonweaponproficiencies",p,"nwp_macro_text")].replace(t.nwp_old_2,t.nwp_current)),o[i("nonweaponproficiencies",p,"nwp_macro_text")]===t.nwp_old&&(a[i("nonweaponproficiencies",p,"nwp_macro_text")]=o[i("nonweaponproficiencies",p,"nwp_macro_text")].replace(t.nwp_old,t.nwp_current))}),a.sheet_version=r,g("VERSION UPDATE: nwpMacroUpdate2 completed"),setAttrs(a,{silent:!0},y(r,n))})})},Bt=(r,n)=>{getSectionIDs("repeating_spells",e=>{let s=[];_.each(e,o=>{s.push(i("spells",o,"spell_macro_text"))}),getAttrs([...s],o=>{let a={},t={spell_old:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{spell_name}}} {{Level:=@{spell_level}}} {{Range:=@{spell_range}}} {{Duration:=@{spell_duration}}} {{AOE:=@{spell_aoe}}} {{Comp:=@{spell_components}}} {{CT:=@{spell_ct}}} {{Save:=@{spell_save}}} {{freetext=@{spell_description}}}",spell_old_v2:"&{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{spell_name}}} {{Range:=@{spell_range}}} {{Duration:=@{spell_duration}}} {{AOE:=@{spell_aoe}}} {{Save:=@{spell_save}}}",spell_old_v3:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{spell_name}}} {{school=@{spell_school}}} {{spell_level=@{spell_level}}} {{range=@{spell_range}}} {{duration=@{spell_duration}}} {{area_of_effect=@{spell_aoe}}} {{components=@{spell_components}}} {{casting_time=@{spell_ct}}} {{saving_throw=@{spell_save}}} {{freetext=@{spell_description}}}",spell_current:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Casts: @{spell_name}}} {{school=@{spell_school}}} {{spell_level=@{spell_level}}} {{spell_class=@{spell_caster_class_name}}} {{spell_class_level=@{spell_caster_class_level}}} {{range=@{spell_range}}} {{duration=@{spell_duration}}} {{area_of_effect=@{spell_aoe}}} {{components=@{spell_components}}} {{casting_time=@{spell_ct}}} {{saving_throw=@{spell_save}}} {{save_type=@{spell_save_type}}} {{link=@{spell_link}}} {{freetext=@{spell_description}}}"};_.each(e,p=>{o[i("spells",p,"spell_macro_text")]===t.spell_old_v3&&(a[i("spells",p,"spell_macro_text")]=o[i("spells",p,"spell_macro_text")].replace(t.spell_old_v3,t.spell_current)),o[i("spells",p,"spell_macro_text")]===t.spell_old_v2&&(a[i("spells",p,"spell_macro_text")]=o[i("spells",p,"spell_macro_text")].replace(t.spell_old_v2,t.spell_current)),o[i("spells",p,"spell_macro_text")]===t.spell_old&&(a[i("spells",p,"spell_macro_text")]=o[i("spells",p,"spell_macro_text")].replace(t.spell_old,t.spell_current))}),a.sheet_version=r,g("VERSION UPDATE: spellsMacroUpdate completed"),setAttrs(a,{silent:!0},y(r,n))})})},Pt=(r,n)=>{getSectionIDs("repeating_equipment",e=>{let s=[];_.each(e,o=>{s.push(i("equipment",o,"equipment_macro_text"))}),getAttrs([...s],o=>{let a={},t={equipment_old:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Item/Equipment: @{equipment_item}}} {{freetext=@{equipment_description}}} {{quantity= @{equipment_quantity}}} {{quantity_max=@{equipment_quantity|max}}} {{uses=@{equipment_current}}} {{uses_max=[[ @{equipment_current|max} ]]}}",equipment_current:"@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Item/Equipment: @{equipment_item}}} {{link=@{equipment_link}}} {{freetext=@{equipment_description}}} {{quantity=@{equipment_quantity}}} {{quantity_max=@{equipment_quantity|max}}} {{uses=@{equipment_current}}} {{uses_max=[[ @{equipment_current|max} ]]}}"};_.each(e,p=>{o[i("equipment",p,"equipment_macro_text")]===t.equipment_old&&(a[i("equipment",p,"equipment_macro_text")]=o[i("equipment",p,"equipment_macro_text")].replace(t.equipment_old,t.equipment_current))}),a.sheet_version=r,g("VERSION UPDATE: equipmentMacroUpdate completed"),setAttrs(a,{silent:!0},y(r,n))})})},Ut=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s={},o=[];_.each(e,a=>{o.push(i("weapon",a,"weapon_range")),o.push(i("weapon",a,"weapon_range_short")),o.push(i("weapon",a,"weapon_range_medium")),o.push(i("weapon",a,"weapon_range_long")),o.push(i("weapon",a,"weapon_attack_type")),o.push(i("weapon",a,"weapon_range_error"))}),getAttrs(o,a=>{_.each(e,t=>{let p=+a[i("weapon",t,"weapon_attack_type")];if(p===0||p===2)return;let c=a[i("weapon",t,"weapon_range")];c=c.replace(/'/g,""),c=c.replace(/"/g,"");let l=c.split("/").join(",").split(" ").join(",").split("-").join(",").split(","),u=Number(l[0]),h=Number(l[1]),m=Number(l[2]);l.length===1&&u>=0&&!h&&!m&&(h=u,m=u),Number.isNaN(u)?(s[i("weapon",t,"weapon_range_short")]=0,s[i("weapon",t,"weapon_range_error")]=c===""?1:0):s[i("weapon",t,"weapon_range_short")]=u,Number.isNaN(h)?(s[i("weapon",t,"weapon_range_medium")]=0,s[i("weapon",t,"weapon_range_error")]=c===""?1:0):s[i("weapon",t,"weapon_range_medium")]=h,Number.isNaN(m)?(s[i("weapon",t,"weapon_range_long")]=0,s[i("weapon",t,"weapon_range_error")]=c===""?1:0):s[i("weapon",t,"weapon_range_long")]=m,!Number.isNaN(u)&&!Number.isNaN(h)&&!Number.isNaN(m)&&(s[i("weapon",t,"weapon_range_error")]=1)}),s.sheet_version=r,g("VERSION UPDATE: updateRange completed"),setAttrs(s,{silent:!0},y(r,n))})})},Ht=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"weapon_macro_text"))}),getAttrs([...s],o=>{let a={},t="&{template:attacks} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=@{weapon_name}}} {{dual=@{weapon_dual}}} {{attack1=[[ 1d20 + @{weapon_backstab_bonus}[BACKSTAB] + @{weapon_tohitbonus}[HIT_BON] + @{weapon_prof_pen}[PROF_PEN] + @{weapon_dual_pen}[DUAL_PEN]+ @{weapon_magicbonus}[MAG_BON] + ?{To Hit Modifier?|0}[MISC_MOD] ]]}} {{damagevsSMchatmenu=@{weapon_damagesmallmedium_chat_menu}}} {{damagevsLchatmenu=@{weapon_damagelarge_chat_menu}}} {{WeaponNotes=@{weapon_notes}}} {{backstab=[[ @{weapon_backstab_mult} ]]}} {{damagetype=@{weapon_attackdmgtype}}} {{rate=@{weapon_rateoffire}}} {{range=@{weapon_range}}} {{length=@{weapon_length}}} {{space=@{weapon_space}}} {{speed=@{weapon_speed}}} @{weapon_tohitacadj}";_.each(e,p=>{let c=o[i("weapon",p,"weapon_macro_text")]||t;a[i("weapon",p,"weapon_macro_text")]=c.replace(/@{weapon_attack_type_pen}/g,"@{weapon_dual_pen}"),a[i("weapon",p,"weapon_macro_text")]=c.replace(/{{attacktype=@{weapon_attack_type}}} /g,"")}),a.sheet_version=r,g("VERSION UPDATE: updateAttackTypeMacro completed"),setAttrs(a,{silent:!0},y(r,n))})})},Wt=(r,n)=>{getAttrs(["hitdice","monsterHD"],e=>{let s={},o=e.monsterHD,a=e.hitdice;o===""&&(s.monsterHD=a),s.monsterHD=o,s.sheet_version=r,g("VERSION UPDATE: monsterHD completed"),setAttrs(s,{silent:!0},y(r,n))})},Vt=(r,n)=>{let e={};e.armorother_cost=0,e.armorother2_cost=0,e.armorother3_cost=0,e.armorother4_cost=0,e.armorother5_cost=0,e.armorother6_cost=0,e.armorother_weight=0,e.armorother2_weight=0,e.armorother3_weight=0,e.armorother4_weight=0,e.armorother5_weight=0,e.armorother6_weight=0,e.armorother_carried=0,e.armorother2_carried=0,e.armorother3_carried=0,e.armorother4_carried=0,e.armorother5_carried=0,e.armorother6_carried=0,e.armorother_bulk=0,e.armorother2_bulk=0,e.armorother3_bulk=0,e.armorother4_bulk=0,e.armorother5_bulk=0,e.armorother6_bulk=0,g("VERSION UPDATE: clearArmorOther completed"),setAttrs(e,{silent:!0},y(r,n))},Ft=ba.concat(De);function da(r,n,e,s){getAttrs(Ft,o=>{let a={},t="",p=r;p=p!==null?r.toLowerCase():p;let c=o.unarmored_row_id.toString(),l=o.armortype1_row_id.toString(),u=o.armortype2_row_id.toString(),h=o.armorshield_row_id.toString(),m=o.armorhelmet_row_id.toString(),w=o.armorother1_row_id.toString(),A=o.armorother2_row_id.toString(),b=o.armorother3_row_id.toString(),M=o.armorother4_row_id.toString(),f=o.armorother5_row_id.toString(),R=o.armorother6_row_id.toString(),$=[c,l,u,h,m,w,A,b,M,f,R].map(G=>G?G.toString().toLowerCase():"0"),P=["unarmored_worn","unarmored","unarmored_ac","unarmored_base","unarmored_bulk","unarmored_carried","unarmored_weight","unarmored_cost"],U=["armortype_worn","armortype","armortype_ac","armortype_base","armortype_magic","armortype_bulk","armortype_carried","armor_weight","armor_cost"],oe=["armortype2_worn","armortype2","armortype2_ac","armortype2_base","armortype2_magic","armortype2_bulk","armortype2_carried","armortype2_weight","armortype2_cost"],K=["armorshield_worn","armorshield","armorshield_ac","armorshield_base","armorshield_magic","armorshield_mod","armorshield_bulk","armorshield_carried","armorshield_weight","armorshield_cost"],me=["armorhelmet_worn","armorhelmet","armorhelmet_ac","armorhelmet_magic","armorhelmet_bulk","armorhelmet_carried","armorhelmet_weight","armorhelmet_cost"],ne=["armorother_worn","armorother","armorother_ac","armorother_base","armorother_magic","armorother_mod"],re=["armorother2_worn","armorother2","armorother2_ac","armorother2_base","armorother2_magic","armorother2_mod"],Y=["armorother3_worn","armorother3","armorother3_ac","armorother3_base","armorother3_magic","armorother3_mod"],Ce=["armorother4_worn","armorother4","armorother4_ac","armorother4_base","armorother4_magic","armorother4_mod"],X=["armorother5_worn","armorother5","armorother5_ac","armorother5_base","armorother5_magic","armorother5_mod"],Q=["armorother6_worn","armorother6","armorother6_ac","armorother6_base","armorother6_magic","armorother6_mod"];function Z(G){let se=Object.entries({unarmoredAttrs:P,armor1Attrs:U,armor2Attrs:oe,shieldAttrs:K,helmetAttrs:me,other1Attrs:ne,other2Attrs:re,other3Attrs:Y,other4Attrs:Ce,other5Attrs:X,other6Attrs:Q}).find(([Oe,fe])=>fe.includes(G));return se?se[0]:null}let S=Z(n),J=o.unarmored,Ee=o.armortype,le=o.armortype2,L=o.armorshield,he=o.armorhelmet,ue=o.armorother,ge=o.armorother2,we=o.armorother3,be=o.armorother4,de=o.armorother5,qe=o.armorother6;(S==="unarmoredAttrs"||p===$[0]||s)&&(S==="unarmoredAttrs"||s?J?c.length===20?(t=c.toLowerCase(),a.unarmored_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=0,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.unarmored_worn,a[`repeating_equipment_${t}_equipment_item`]=o.unarmored,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.unarmored_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.unarmored_base,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.unarmored_bulk,+o.unarmored_worn==1&&+o.unarmored_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.unarmored_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.unarmored_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.unarmored_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.unarmored_cost||0):(t=k(),a.unarmored_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=0,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.unarmored_worn,a[`repeating_equipment_${t}_equipment_item`]=o.unarmored,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.unarmored_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.unarmored_base,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.unarmored_bulk,+o.unarmored_worn==1&&+o.unarmored_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.unarmored_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.unarmored_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.unarmored_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.unarmored_cost||0):c===$[0]&&(a.unarmored_row_id=0,a.unarmored_worn=+o.unarmored_worn,a.unarmored="",a.unarmored_ac=+o.unarmored_ac,a.unarmored_base=+o.unarmored_base,a.unarmored_bulk=+o.unarmored_bulk,a.unarmored_weight=+o.unarmored_weight||0,a.unarmored_cost=+o.unarmored_cost||0,+o.unarmored_worn==1&&+o.unarmored_carried==0?a.unarmored_carried=1:a.unarmored_carried=+o.unarmored_carried):(a.unarmored_row_id=0,a.unarmored_worn=1,a.unarmored="",a.unarmored_ac=10,a.unarmored_base=10,a.unarmored_bulk=0,a.unarmored_weight=0,a.unarmored_cost=0,a.unarmored_carried=1)),(S==="armor1Attrs"||p===$[1]||s)&&(S==="armor1Attrs"||s?Ee?l.length===20?(t=l.toLowerCase(),a.armortype1_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=1,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armortype_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armortype,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armortype_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armortype_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armortype_magic||0,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armortype_bulk,+o.armortype_worn==1&&+o.armortype_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.armortype_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armortype_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armor_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armor_cost||0):(t=k(),a.armortype1_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=1,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armortype_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armortype,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armortype_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armortype_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armortype_magic||0,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armortype_bulk,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armortype_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armor_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armor_cost||0):l===$[1]&&(a.armortype1_row_id=0,a.armortype_worn=0,a.armortype="",a.armortype_ac=10,a.armortype_base=10,a.armortype_magic=0,a.armortype_bulk=0,a.armortype_weight=0,a.armortype_cost=0,a.armortype_carried=1):(a.armortype1_row_id=0,a.armortype_worn=0,a.armortype="",a.armortype_ac=10,a.armortype_base=10,a.armortype_magic=0,a.armortype_bulk=0,a.armortype_weight=0,a.armortype_cost=0,a.armortype_carried=1)),(S==="armor2Attrs"||p===$[2]||s)&&(S==="armor2Attrs"||s?le?u.length===20?(t=u.toLowerCase(),a.armortype2_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=2,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armortype2_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armortype2,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armortype2_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armortype2_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armortype2_magic||0,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armortype2_bulk,+o.armortype2_worn==1&&+o.armortype2_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.armortype2_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armortype2_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armortype2_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armortype2_cost||0):(t=k(),a.armortype2_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=2,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armortype2_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armortype2,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armortype2_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armortype2_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armortype2_magic||0,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armortype2_bulk,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armortype2_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armortype2_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armortype2_cost||0):u===$[2]&&(a.armortype2_row_id=0,a.armortype2_worn=0,a.armortype2="",a.armortype2_ac=10,a.armortype2_base=10,a.armortype2_magic=0,a.armortype2_bulk=0,a.armortype2_weight=0,a.armortype2_cost=0,a.armortype2_carried=1):(a.armortype2_row_id=0,a.armortype2_worn=0,a.armortype2="",a.armortype2_ac=10,a.armortype2_base=10,a.armortype2_magic=0,a.armortype2_bulk=0,a.armortype2_weight=0,a.armortype2_cost=0,a.armortype2_carried=1)),(S==="shieldAttrs"||p===$[3]||s)&&(S==="shieldAttrs"||s?L?h.length===20?(t=h.toLowerCase(),a.armorshield_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=3,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorshield_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorshield,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorshield_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorshield_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=o.armorshield_magic,a[`repeating_equipment_${t}_equipment_armor_mod`]=o.armorshield_mod,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armorshield_bulk,+o.armorshield_worn==1&&+o.armorshield_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.armorshield_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorshield_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armorshield_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armorshield_cost||0):(t=k(),a.armorshield_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=3,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorshield_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorshield,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorshield_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorshield_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=o.armorshield_magic,a[`repeating_equipment_${t}_equipment_armor_mod`]=o.armorshield_mod,a[`repeating_equipment_${t}_equipment_armor_bulk`]=+o.armorshield_bulk,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorshield_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armorshield_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armorshield_cost||0):h===$[3]&&(a.armorshield_row_id=0,a.armorshield_worn=0,a.armorshield="",a.armorshield_ac=0,a.armorshield_base=0,a.armorshield_magic=0,a.armorshield_mod=0,a.armorshield_bulk=0,a.armorshield_weight=0,a.armorshield_cost=0,a.armorshield_carried=1):(a.armorshield_row_id=0,a.armorshield_worn=0,a.armorshield="",a.armorshield_ac=0,a.armorshield_base=0,a.armorshield_magic=0,a.armorshield_mod=0,a.armorshield_bulk=0,a.armorshield_weight=0,a.armorshield_cost=0,a.armorshield_carried=1)),(S==="helmetAttrs"||p===$[4]||s)&&(S==="helmetAttrs"||s?he?m.length===20?(t=m.toLowerCase(),a.armorhelmet_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=4,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorhelmet_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorhelmet,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorhelmet_ac,a[`repeating_equipment_${t}_equipment_armor_magic`]=o.armorhelmet_magic,+o.armorhelmet_worn==1&&+o.armorhelmet_carried==0?(a[`repeating_equipment_${t}_equipment_carried_select`]=1,a.armorhelmet_carried=1):a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorhelmet_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armorhelmet_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armorhelmet_cost||0):(t=k(),a.armorhelmet_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=4,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorhelmet_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorhelmet,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorhelmet_ac,a[`repeating_equipment_${t}_equipment_armor_magic`]=o.armorhelmet_magic,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorhelmet_carried,a[`repeating_equipment_${t}_equipment_weight`]=+o.armorhelmet_weight||0,a[`repeating_equipment_${t}_equipment_cost`]=+o.armorhelmet_cost||0):m===$[4]&&(a.armorhelmet_row_id=0,a.armorhelmet_worn=0,a.armorhelmet="",a.armorhelmet_ac=10,a.armorhelmet_base=10,a.armorhelmet_magic=0,a.armorhelmet_bulk=0,a.armorhelmet_weight=0,a.armorhelmet_cost=0,a.armorhelmet_carried=1):(a.armorhelmet_row_id=0,a.armorhelmet_worn=0,a.armorhelmet="",a.armorhelmet_ac=10,a.armorhelmet_base=10,a.armorhelmet_magic=0,a.armorhelmet_bulk=0,a.armorhelmet_weight=0,a.armorhelmet_cost=0,a.armorhelmet_carried=1)),(S==="other1Attrs"||p===$[5]||s)&&(S==="other1Attrs"||s?ue?w.length===20?(t=w.toLowerCase(),a.armorother1_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=5,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother_worn==1?1:0):(t=k(),a.armorother1_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=5,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother_mod||0):w===$[5]&&(a.armorother1_row_id=0,a.armorother_worn=0,a.armorother="",a.armorother_ac=10,a.armorother_base=10,a.armorother_magic=0,a.armorother_mod=0,a.armorother_bulk=0):(a.armorother1_row_id=0,a.armorother_worn=0,a.armorother="",a.armorother_ac=10,a.armorother_base=10,a.armorother_magic=0,a.armorother_mod=0,a.armorother_bulk=0)),(S==="other2Attrs"||p===$[6]||s)&&(S==="other2Attrs"||s?ge?A.length===20?(t=A.toLowerCase(),a.armorother2_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=6,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother2_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother2,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother2_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother2_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother2_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother2_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother2_worn==1?1:0):(t=k(),a.armorother2_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=6,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother2_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother2,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother2_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother2_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother2_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother2_mod||0):A===$[6]&&(a.armorother2_row_id=0,a.armorother2_worn=0,a.armorother2="",a.armorother2_ac=0,a.armorother2_base=0,a.armorother2_magic=0,a.armorother2_mod=0,a.armorother2_bulk=0):(a.armorother2_row_id=0,a.armorother2_worn=0,a.armorother2="",a.armorother2_ac=0,a.armorother2_base=0,a.armorother2_magic=0,a.armorother2_mod=0,a.armorother2_bulk=0)),(S==="other3Attrs"||p===$[7]||s)&&(S==="other3Attrs"||s?we?b.length===20?(t=b.toLowerCase(),a.armorother3_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=7,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother3_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother3,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother3_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother3_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother3_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother3_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother3_worn==1?1:0):(t=k(),a.armorother3_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=7,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother3_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother3,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother3_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother3_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother3_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother3_mod||0):b===$[7]&&(a.armorother3_row_id=0,a.armorother3_worn=0,a.armorother3="",a.armorother3_ac=0,a.armorother3_base=0,a.armorother3_magic=0,a.armorother3_mod=0,a.armorother3_bulk=0):(a.armorother3_row_id=0,a.armorother3_worn=0,a.armorother3="",a.armorother3_ac=0,a.armorother3_base=0,a.armorother3_magic=0,a.armorother3_mod=0,a.armorother3_bulk=0)),(S==="other4Attrs"||p===$[8]||s)&&(S==="other4Attrs"||s?be?M.length===20?(t=M.toLowerCase(),a.armorother4_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=8,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother4_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother4,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother4_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother4_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother4_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother4_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother4_worn==1?1:0):(t=k(),a.armorother4_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=8,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother4_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother4,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother4_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother4_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother4_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother4_mod||0):M===$[8]&&(a.armorother4_row_id=0,a.armorother4_worn=0,a.armorother4="",a.armorother4_ac=0,a.armorother4_base=0,a.armorother4_magic=0,a.armorother4_mod=0,a.armorother4_bulk=0):(a.armorother4_row_id=0,a.armorother4_worn=0,a.armorother4="",a.armorother4_ac=0,a.armorother4_base=0,a.armorother4_magic=0,a.armorother4_mod=0,a.armorother4_bulk=0)),(S==="other5Attrs"||p===$[9]||s)&&(S==="other5Attrs"||s?de?f.length===20?(t=f.toLowerCase(),a.armorother5_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=9,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother5_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother5,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother5_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother5_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother5_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother5_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother5_worn==1?1:0):(t=k(),a.armorother5_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=9,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother5_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother5,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother5_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother5_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother5_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother5_mod||0):f===$[9]&&(a.armorother5_row_id=0,a.armorother5_worn=0,a.armorother5="",a.armorother5_ac=0,a.armorother5_base=0,a.armorother5_magic=0,a.armorother5_mod=0,a.armorother5_bulk=0):(a.armorother5_row_id=0,a.armorother5_worn=0,a.armorother5="",a.armorother5_ac=0,a.armorother5_base=0,a.armorother5_magic=0,a.armorother5_mod=0,a.armorother5_bulk=0)),(S==="other6Attrs"||p===$[10]||s)&&(S==="other6Attrs"||s?qe?R.length===20?(t=R.toLowerCase(),a.armorother6_row_id=t,a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=10,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother6_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother6,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother6_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother6_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother6_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother6_mod||0,a[`repeating_equipment_${t}_equipment_carried_select`]=+o.armorother6_worn==1?1:0):(t=k(),a.armorother6_row_id=t.toLowerCase(),a[`repeating_equipment_${t}_equipment_type`]=2,a[`repeating_equipment_${t}_equipment_armor_type`]=10,a[`repeating_equipment_${t}_equipment_armor_worn`]=+o.armorother6_worn,a[`repeating_equipment_${t}_equipment_item`]=o.armorother6,a[`repeating_equipment_${t}_equipment_armor_ac`]=+o.armorother6_ac,a[`repeating_equipment_${t}_equipment_armor_base`]=+o.armorother6_base,a[`repeating_equipment_${t}_equipment_armor_magic`]=+o.armorother6_magic||0,a[`repeating_equipment_${t}_equipment_armor_mod`]=+o.armorother6_mod||0):R===$[10]&&(a.armorother6_row_id=0,a.armorother6_worn=0,a.armorother6="",a.armorother6_ac=0,a.armorother6_base=0,a.armorother6_magic=0,a.armorother6_mod=0,a.armorother6_bulk=0):(a.armorother6_row_id=0,a.armorother6_worn=0,a.armorother6="",a.armorother6_ac=0,a.armorother6_base=0,a.armorother6_magic=0,a.armorother6_mod=0,a.armorother6_bulk=0)),setAttrs(a,Se(),V())})}var Gt=(r,n)=>{let e={};da(null,null,0,1),e.sheet_version=r,g("VERSION UPDATE: migrateArmorDetails completed"),setAttrs(e,{silent:!0},y(r,n))},zt=(r,n)=>{getSectionIDs("repeating_equipment",e=>{let s={},o=[];_.each(e,a=>{o.push(i("equipment",a,"equipment_type")),o.push(i("equipment",a,"equipment_current")),o.push(i("equipment",a,"equipment_current_max")),o.push(i("equipment",a,"equipment_carried_select")),o.push(i("equipment",a,"equipment_carried")),o.push(i("equipment",a,"equipment_quantity")),o.push(i("equipment",a,"equipment_quantity_max")),o.push(i("equipment",a,"equipment_weight")),o.push(i("equipment",a,"equipment_cost")),o.push(i("equipment",a,"equipment_armor_type")),o.push(i("equipment",a,"equipment_armor_worn")),o.push(i("equipment",a,"equipment_armor_ac")),o.push(i("equipment",a,"equipment_armor_base")),o.push(i("equipment",a,"equipment_armor_magic")),o.push(i("equipment",a,"equipment_armor_mod")),o.push(i("equipment",a,"equipment_armor_bulk")),o.push(i("equipment",a,"equipment_macro_text"))}),getAttrs(o,a=>{_.each(e,t=>{s[i("equipment",t,"equipment_type")]=+a[i("equipment",t,"equipment_type")],s[i("equipment",t,"equipment_current")]=+a[i("equipment",t,"equipment_current")]||0,s[i("equipment",t,"equipment_current_max")]=+a[i("equipment",t,"equipment_current_max")]||0,s[i("equipment",t,"equipment_carried_select")]=+a[i("equipment",t,"equipment_carried")],s[i("equipment",t,"equipment_carried")]=+a[i("equipment",t,"equipment_carried")],s[i("equipment",t,"equipment_quantity")]=+a[i("equipment",t,"equipment_quantity")]||0,s[i("equipment",t,"equipment_quantity_max")]=+a[i("equipment",t,"equipment_quantity_max")]||0,s[i("equipment",t,"equipment_weight")]=+a[i("equipment",t,"equipment_weight")]||0,s[i("equipment",t,"equipment_cost")]=+a[i("equipment",t,"equipment_cost")]||0,s[i("equipment",t,"equipment_armor_type")]=+a[i("equipment",t,"equipment_armor_type")],s[i("equipment",t,"equipment_armor_worn")]=+a[i("equipment",t,"equipment_armor_worn")],s[i("equipment",t,"equipment_armor_ac")]=+a[i("equipment",t,"equipment_armor_ac")],s[i("equipment",t,"equipment_armor_base")]=+a[i("equipment",t,"equipment_armor_base")],s[i("equipment",t,"equipment_armor_magic")]=+a[i("equipment",t,"equipment_armor_magic")]||0,s[i("equipment",t,"equipment_armor_mod")]=+a[i("equipment",t,"equipment_armor_mod")]||0,s[i("equipment",t,"equipment_armor_bulk")]=+a[i("equipment",t,"equipment_armor_bulk")],s[i("equipment",t,"equipment_macro_text")]=a[i("equipment",t,"equipment_macro_text")]}),s.sheet_version=r,g("VERSION UPDATE: setEquipmentUpdate completed"),setAttrs(s,{silent:!0},y(r,n))})})},Kt=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s={},o=[];_.each(e,a=>{o.push(i("weapon",a,"weapon_attack_type")),o.push(i("weapon",a,"weapon_dual")),o.push(i("weapon",a,"weapon_whisper_to_hit")),o.push(i("weapon",a,"weapon_whisper_to_hit_select")),o.push(i("weapon",a,"weapon_dual_pen")),o.push(i("weapon",a,"weapon_backstab_var")),o.push(i("weapon",a,"weapon_tohitbonus")),o.push(i("weapon",a,"weapon_magicbonus")),o.push(i("weapon",a,"weapon_prof")),o.push(i("weapon",a,"weapon_backstab")),o.push(i("weapon",a,"weapon_backstab_bonus")),o.push(i("weapon",a,"weapon_backstab_mult")),o.push(i("weapon",a,"weapon_attackdmgbonus")),o.push(i("weapon",a,"weapon_num_attacks")),o.push(i("weapon",a,"weapon_quantity")),o.push(i("weapon",a,"weapon_ammo")),o.push(i("weapon",a,"weapon_ammo_max")),o.push(i("weapon",a,"weapon_weight")),o.push(i("weapon",a,"weapon_cost")),o.push(i("weapon",a,"weapon_range_short")),o.push(i("weapon",a,"weapon_range_medium")),o.push(i("weapon",a,"weapon_range_long")),o.push(i("weapon",a,"weapon_length")),o.push(i("weapon",a,"weapon_space")),o.push(i("weapon",a,"weapon_speed")),o.push(i("weapon",a,"weapon_misc")),o.push(i("weapon",a,"weapon_thac_adj0")),o.push(i("weapon",a,"weapon_thac_adj1")),o.push(i("weapon",a,"weapon_thac_adj2")),o.push(i("weapon",a,"weapon_thac_adj3")),o.push(i("weapon",a,"weapon_thac_adj4")),o.push(i("weapon",a,"weapon_thac_adj5")),o.push(i("weapon",a,"weapon_thac_adj6")),o.push(i("weapon",a,"weapon_thac_adj7")),o.push(i("weapon",a,"weapon_thac_adj8")),o.push(i("weapon",a,"weapon_thac_adj9")),o.push(i("weapon",a,"weapon_thac_adj10")),o.push(i("weapon",a,"weapon_macro_text")),o.push(i("weapon",a,"weapon_damagesmallmedium_chat_menu")),o.push(i("weapon",a,"weapon_damagelarge_chat_menu")),o.push(i("weapon",a,"weapon_damagesmallmedium_npc_chat_menu")),o.push(i("weapon",a,"weapon_damagelarge_npc_chat_menu")),o.push(i("weapon",a,"weapon_critdamagesmallmedium_chat_menu")),o.push(i("weapon",a,"weapon_critdamagelarge_chat_menu")),o.push(i("weapon",a,"weapon_critdamagesmallmedium_npc_chat_menu")),o.push(i("weapon",a,"weapon_critdamagelarge_npc_chat_menu")),o.push(i("weapon",a,"weapon_damage_chat_menu_npc"))}),getAttrs(o,a=>{_.each(e,t=>{s[`repeating_weapon_${t}_weapon_attack_type`]=+a[i("weapon",t,"weapon_attack_type")],s[`repeating_weapon_${t}_weapon_dual`]=a[i("weapon",t,"weapon_dual")],s[`repeating_weapon_${t}_weapon_whisper_to_hit`]=a[i("weapon",t,"weapon_whisper_to_hit")],s[`repeating_weapon_${t}_weapon_whisper_to_hit_select`]=+a[i("weapon",t,"weapon_whisper_to_hit_select")],s[`repeating_weapon_${t}_weapon_dual_pen`]=+a[i("weapon",t,"weapon_dual_pen")]||0,s[`repeating_weapon_${t}_weapon_backstab_var`]=+a[i("weapon",t,"weapon_backstab_var")]||0,s[`repeating_weapon_${t}_weapon_tohitbonus`]=+a[i("weapon",t,"weapon_tohitbonus")]||0,s[`repeating_weapon_${t}_weapon_magicbonus`]=+a[i("weapon",t,"weapon_magicbonus")]||0,s[`repeating_weapon_${t}_weapon_prof`]=+a[i("weapon",t,"weapon_prof")]||0,s[`repeating_weapon_${t}_weapon_backstab`]=+a[i("weapon",t,"weapon_backstab")]||0,s[`repeating_weapon_${t}_weapon_backstab_bonus`]=+a[i("weapon",t,"weapon_backstab_bonus")]||0,s[`repeating_weapon_${t}_weapon_backstab_mult`]=+a[i("weapon",t,"weapon_backstab_mult")]||0,s[`repeating_weapon_${t}_weapon_attackdmgbonus`]=+a[i("weapon",t,"weapon_attackdmgbonus")]||0,s[`repeating_weapon_${t}_weapon_num_attacks`]=+a[i("weapon",t,"weapon_num_attacks")]||0,s[`repeating_weapon_${t}_weapon_quantity`]=+a[i("weapon",t,"weapon_quantity")]||0,s[`repeating_weapon_${t}_weapon_ammo`]=+a[i("weapon",t,"weapon_ammo")]||0,s[`repeating_weapon_${t}_weapon_ammo_max`]=+a[i("weapon",t,"weapon_ammo_max")]||0,s[`repeating_weapon_${t}_weapon_weight`]=+a[i("weapon",t,"weapon_weight")]||0,s[`repeating_weapon_${t}_weapon_cost`]=+a[i("weapon",t,"weapon_cost")]||0,s[`repeating_weapon_${t}_weapon_range_short`]=+a[i("weapon",t,"weapon_range_short")]||0,s[`repeating_weapon_${t}_weapon_range_medium`]=+a[i("weapon",t,"weapon_range_medium")]||0,s[`repeating_weapon_${t}_weapon_range_long`]=+a[i("weapon",t,"weapon_range_long")]||0,s[`repeating_weapon_${t}_weapon_length`]=a[i("weapon",t,"weapon_length")],s[`repeating_weapon_${t}_weapon_space`]=a[i("weapon",t,"weapon_space")],s[`repeating_weapon_${t}_weapon_speed`]=a[i("weapon",t,"weapon_speed")],s[`repeating_weapon_${t}_weapon_misc`]=a[i("weapon",t,"weapon_misc")],s[`repeating_weapon_${t}_weapon_thac_adj0`]=+a[i("weapon",t,"weapon_thac_adj0")]||0,s[`repeating_weapon_${t}_weapon_thac_adj1`]=+a[i("weapon",t,"weapon_thac_adj1")]||0,s[`repeating_weapon_${t}_weapon_thac_adj2`]=+a[i("weapon",t,"weapon_thac_adj2")]||0,s[`repeating_weapon_${t}_weapon_thac_adj3`]=+a[i("weapon",t,"weapon_thac_adj3")]||0,s[`repeating_weapon_${t}_weapon_thac_adj4`]=+a[i("weapon",t,"weapon_thac_adj4")]||0,s[`repeating_weapon_${t}_weapon_thac_adj5`]=+a[i("weapon",t,"weapon_thac_adj5")]||0,s[`repeating_weapon_${t}_weapon_thac_adj6`]=+a[i("weapon",t,"weapon_thac_adj6")]||0,s[`repeating_weapon_${t}_weapon_thac_adj7`]=+a[i("weapon",t,"weapon_thac_adj7")]||0,s[`repeating_weapon_${t}_weapon_thac_adj8`]=+a[i("weapon",t,"weapon_thac_adj8")]||0,s[`repeating_weapon_${t}_weapon_thac_adj9`]=+a[i("weapon",t,"weapon_thac_adj9")]||0,s[`repeating_weapon_${t}_weapon_thac_adj10`]=+a[i("weapon",t,"weapon_thac_adj10")]||0,s[`repeating_weapon_${t}_weapon_macro_text`]=a[i("weapon",t,"weapon_macro_text")],s[`repeating_weapon_${t}_weapon_damagesmallmedium_chat_menu`]=a[i("weapon",t,"weapon_damagesmallmedium_chat_menu")],s[`repeating_weapon_${t}_weapon_damagelarge_chat_menu`]=a[i("weapon",t,"weapon_damagelarge_chat_menu")],s[`repeating_weapon_${t}_weapon_damagesmallmedium_npc_chat_menu`]=a[i("weapon",t,"weapon_damagesmallmedium_npc_chat_menu")],s[`repeating_weapon_${t}_weapon_damagelarge_npc_chat_menu`]=a[i("weapon",t,"weapon_damagelarge_npc_chat_menu")],s[`repeating_weapon_${t}_weapon_critdamagesmallmedium_chat_menu`]=a[i("weapon",t,"weapon_critdamagesmallmedium_chat_menu")],s[`repeating_weapon_${t}_weapon_critdamagelarge_chat_menu`]=a[i("weapon",t,"weapon_critdamagelarge_chat_menu")],s[`repeating_weapon_${t}_weapon_critdamagesmallmedium_npc_chat_menu`]=a[i("weapon",t,"weapon_critdamagesmallmedium_npc_chat_menu")],s[`repeating_weapon_${t}_weapon_critdamagelarge_npc_chat_menu`]=a[i("weapon",t,"weapon_critdamagelarge_npc_chat_menu")],s[`repeating_weapon_${t}_weapon_damage_chat_menu_npc`]=a[i("weapon",t,"weapon_damage_chat_menu_npc")]}),s.sheet_version=r,g("VERSION UPDATE: setWeaponsUpdate completed"),setAttrs(s,{silent:!0},y(r,n))})})},Yt=(r,n)=>{getSectionIDs("nonweaponproficiencies",e=>{let s={},o=[];_.each(e,a=>{o.push(i("nonweaponproficiencies",a,"nwp_attribute")),o.push(i("nonweaponproficiencies",a,"nwp_slots")),o.push(i("nonweaponproficiencies",a,"nwp_modifier")),o.push(i("nonweaponproficiencies",a,"nwp_macro_text"))}),getAttrs(o,a=>{_.each(e,t=>{s[`repeating_nonweaponproficiencies_${t}_attribute`]=a[i("nonweaponproficiencies",t,"nwp_attribute")],s[`repeating_nonweaponproficiencies_${t}_slots`]=+a[i("nonweaponproficiencies",t,"nwp_slots")]||0,s[`repeating_nonweaponproficiencies_${t}_modifier`]=+a[i("nonweaponproficiencies",t,"nwp_modifier")]||0,s[`repeating_nonweaponproficiencies_${t}_macro_text`]=a[i("nonweaponproficiencies",t,"nwp_macro_text")]||0}),s.sheet_version=r,g("VERSION UPDATE: setNWPUpdate completed"),setAttrs(s,{silent:!0},y(r,n))})})},Xt=()=>{getSectionIDs("repeating_weapon",r=>{let n={},e=[];_.each(r,s=>{e.push(i("weapon",s,"weapon_quantity")),e.push(i("weapon",s,"weapon_weight")),e.push(i("weapon",s,"weapon_cost"))}),getAttrs(e,s=>{_.each(r,o=>{n[i("weapon",o,"weapon_quantity")]=+s[i("weapon",o,"weapon_quantity")]||0,n[i("weapon",o,"weapon_weight")]=0,n[i("weapon",o,"weapon_cost")]=0}),setAttrs(n)})})},Qt=()=>{getSectionIDs("repeating_weapon",r=>{getSectionIDs("repeating_equipment",n=>{let e={},s=[],o=[],a=[...s,...o];_.each(r,t=>{a.push(i("weapon",t,"weapon_name")),a.push(i("weapon",t,"weapon_quantity")),a.push(i("weapon",t,"weapon_weight")),a.push(i("weapon",t,"weapon_cost"))}),_.each(n,t=>{a.push(i("equipment",t,"equipment_item")),a.push(i("equipment",t,"equipment_quantity")),a.push(i("equipment",t,"equipment_weight")),a.push(i("equipment",t,"equipment_cost"))}),getAttrs(a,t=>{let p=[],c=[],l=[],u=[],h="";_.each(r,m=>{let w=t[i("weapon",m,"weapon_name")],A=t[i("weapon",m,"weapon_quantity")],b=t[i("weapon",m,"weapon_weight")],M=t[i("weapon",m,"weapon_cost")];if(_.each(n,f=>{let R=f;u.push(R);let $=t[i("equipment",f,"equipment_item")];p.push($);let P=t[i("equipment",f,"equipment_weight")];c.push(P);let U=t[i("equipment",f,"equipment_cost")];l.push(U)}),b!==0||M!==0){g(`weaponName:${w} weaponWeight:${b} weaponCost:${M}`);let f=p.indexOf(w);f===-1?(g("NO MATCH || COPY TO NEW ROW ||"),h=k(),e[`repeating_equipment_${h}_equipment_type`]=1,e[`repeating_equipment_${h}_equipment_item`]=w,e[`repeating_equipment_${h}_equipment_quantity`]=A,e[`repeating_equipment_${h}_equipment_quantity_max`]=A,e[`repeating_equipment_${h}_equipment_weight`]=b,e[`repeating_equipment_${h}_equipment_cost`]=M):c[f]==="0"&&l[f]==="0"?(g(`MATCH w/weight & cost tracked on weapons. || UPDATE ROW || name:${w} weight:${c[f]} cost:${l[f]} at index:${f} id:${u[f]}`),h=u[f],e[`repeating_equipment_${h}_equipment_type`]=1,e[`repeating_equipment_${h}_equipment_quantity`]=A,e[`repeating_equipment_${h}_equipment_quantity_max`]=A,e[`repeating_equipment_${h}_equipment_weight`]=b,e[`repeating_equipment_${h}_equipment_cost`]=M):c[f]!=="0"&&l[f]==="0"?(g(`MATCH w/weight tracked on equipment. || UPDATE ROW || name:${w} weight:${c[f]} cost:${l[f]} at index:${f} id:${u[f]}`),h=u[f],e[`repeating_equipment_${h}_equipment_type`]=1,e[`repeating_equipment_${h}_equipment_cost`]=M):c[f]==="0"&&l[f]!=="0"?(g(`MATCH w/cost tracked on equipment. || UPDATE ROW || name:${w} weight:${c[f]} cost:${l[f]} at index:${f} id:${u[f]}`),h=u[f],e[`repeating_equipment_${h}_equipment_type`]=1,e[`repeating_equipment_${h}_equipment_weight`]=b):c[f]!=="0"&&l[f]!=="0"?g(`100% MATCH weight & cost tracked on equipment. || IGNORE ROW || name:${w} weight: ${c[f]} cost:${l[f]} at index:${f}`):g("No attribute data to migrate. || IGNORE ROW ||")}}),setAttrs(e,{silent:!0},Xt())})})})},Zt=(r,n)=>{let e={};Qt(),e.sheet_version=r,g("VERSION UPDATE: migrateWeaponWtCost completed"),setAttrs(e,{silent:!0},y(r,n))},Jt=(r,n)=>{getSectionIDs("repeating_equipment",e=>{let s={},o=[];_.each(e,a=>{o.push(i("equipment",a,"equipment_type"))}),getAttrs(o,a=>{_.each(e,t=>{let p=+a[i("equipment",t,"equipment_type")];p>=0||(s[i("equipment",t,"equipment_type")]=0,g(`equipType -1:${p} reset to Gear`))}),s.sheet_version=r,g("VERSION UPDATE: setEquipmentType completed"),setAttrs(s,{silent:!0},y(r,n))})})},vt=(r,n)=>{let e={};ma(),e.sheet_version=r,g("VERSION UPDATE: migrateSetSpellsCasterClass completed"),setAttrs(e,{silent:!0},y(r,n))},eo=(r,n)=>{let e={};V(0),e.sheet_version=r,g("VERSION UPDATE: recalcAC completed"),setAttrs(e,{silent:!0},y(r,n))},ao=(r,n)=>{let e={};e.init_macro_text="",e.sheet_version=r,g("VERSION UPDATE: recalcAC completed"),setAttrs(e,{silent:!0},y(r,n))},to=(r,n)=>{getSectionIDs("repeating_weapon",e=>{let s=[];_.each(e,o=>{s.push(i("weapon",o,"weapon_critdamagesmallmedium")),s.push(i("weapon",o,"weapon_critdamagelarge"))}),getAttrs([...s],o=>{let a={},t="(@{weapon_damagesmallmedium})*2",p="(@{weapon_damagelarge})*2";_.each(e,c=>{let l=o[i("weapon",c,"weapon_critdamagesmallmedium")]||t,u=o[i("weapon",c,"weapon_critdamagelarge")]||p;a[i("weapon",c,"weapon_critdamagesmallmedium")]=l.replace(/@{weapon_damagesmallmedium}*2/g,"(@{weapon_damagesmallmedium})*2"),a[i("weapon",c,"weapon_critdamagelarge")]=u.replace(/@{weapon_damagelarge}*2/g,"(@{weapon_damagelarge})*2")}),a.sheet_version=r,g("VERSION UPDATE: updateCriticalDamageMacro completed"),setAttrs(a,{silent:!0},y(r,n))})})},oo=()=>{getAttrs(["hitdice","armorclass","strength","intelligence","wisdom","dexterity","constitution","charisma","old_character"],r=>{let n={};if((+r.old_character||0)===1)return;let s=+r.hitdice,o=+r.armorclass,a=+r.strength,t=+r.intelligence,p=+r.wisdom,c=+r.dexterity,l=+r.constitution,u=+r.charisma,h=a+t+p+c+l+u;s===0&&o===10&&h===60?(n.strength=a===10?8:a,n.intelligence=t===10?8:t,n.wisdom=p===10?8:p,n.dexterity=c===10?8:c,n.constitution=l===10?8:l,n.charisma=u===10?8:u,n.old_character=1,Fa()):n.old_character=1,setAttrs(n,{silent:!0})})};y=(r,n)=>{r<.1?xt(.1,n):r<1.2?St(1.2,n):r<1.5?Mt(1.5,n):r<1.52?Dt(1.52,n):r<1.53?Ct(1.53,n):r<1.54?Et(1.54,n):r<1.55?It(1.55,n):r<1.56?Ot(1.56,n):r<1.57?Nt(1.57,n):r<1.591?La(1.591,n):r<1.592?ja(1.592,n):r<1.593?Ba(1.593,n):r<1.594?Tt(1.594,n):r<1.595?Be(1.595,n):r<1.596?Ra(1.596,n):r<1.597?jt(1.597,n):r<1.598?Bt(1.598,n):r<1.61?Ut(1.61,n):r<1.62?Ht(1.62,n):r<1.634?Be(1.634,n):r<1.635?Rt(1.635,n):r<1.636?Lt(1.636,n):r<1.637?Be(1.637,n):r<1.638?Wt(1.638,n):r<1.639?Vt(1.639,n):r<1.64?Gt(1.641,n):r<1.642?Pt(1.643,n):r<1.644?zt(1.644,n):r<1.645?Kt(1.645,n):r<1.646?Zt(1.646,n):r<1.648?Jt(1.648,n):r<1.65?vt(1.65,n):r<1.652?Ra(1.652,n):r<1.654?eo(1.654,n):r<1.656?ao(1.656,n):r<1.658?to(1.658,n):r<1.659?Yt(1.66,n):r{getAttrs(["sheet_version","old_character"],n=>{let e={},s=T(n.sheet_version);+n.old_character==0&&s===0&&(s=1.68,e.sheet_version=1.68,setAttrs(e,{silent:!0})),g(`Current sheet data version:${s}, Sheet code version:${1.68}`),y(s,1.68)})});on("change:abilities_info_show change:toggle_exceptional change:intelligence change:wisdom change:dexterity change:constitution change:charisma change:comeliness",r=>{getAttrs(["intelligence","wisdom","dexterity","constitution","charisma","comeliness","toggle_exceptional"],n=>{let e={};+n.toggle_exceptional!==1&&(e.exceptional_intelligence_flag=1,e.exceptional_wisdom_flag=1,e.exceptional_dexterity_flag=1,e.exceptional_constitution_flag=1,e.exceptional_charisma_flag=1,e.exceptional_comeliness_flag=1,setAttrs(e,{silent:!0}))})});on("change:abilities_info_show change:toggle_exceptional change:strength",r=>{getAttrs(["strength"],n=>{let e={};e.exceptional_strength_flag=1,setAttrs(e,{silent:!0})})});on("change:is_npc",r=>{getAttrs(["is_npc","toggle_npc"],n=>{let e={},s=+n.is_npc,o=+n.toggle_npc;o=s===0?0:1,e.toggle_npc=o,setAttrs(e,{silent:!0})})});var no=()=>{getSectionIDs("repeating_equipment",r=>{let n={},e=[];_.each(r,s=>{e.push(i("equipment",s,"equipment_quantity")),e.push(i("equipment",s,"equipment_cost"))}),getAttrs(e,s=>{let o=[];_.each(r,t=>{let p=+s[i("equipment",t,"equipment_quantity")]||0,c=+s[i("equipment",t,"equipment_cost")]||0;c=p>0?c*p:0,o.push(c)});let a=o.reduce((t,p)=>t+p,0);n.total_equipment_cost=a.toFixed(2),n.total_cost=a.toFixed(2),setAttrs(n,{silent:!0})})})},ro=()=>{getSectionIDs("repeating_equipment",r=>{let n={},e=[];_.each(r,s=>{e.push(i("equipment",s,"equipment_type")),e.push(i("equipment",s,"equipment_armor_type")),e.push(i("equipment",s,"equipment_location")),e.push(i("equipment",s,"equipment_weight")),e.push(i("equipment",s,"equipment_quantity")),e.push(i("equipment",s,"equipment_carried")),e.push(i("equipment",s,"equipment_carried_select"))}),getAttrs(["total_coin_weight",...e],s=>{let o=[],a=[],t=[];_.each(r,m=>{let w=+s[i("equipment",m,"equipment_type")],A=0,b=+s[i("equipment",m,"equipment_carried_select")];n[i("equipment",m,"equipment_carried")]=b===1?1:0,A=b===1?1:0;let M=+s[i("equipment",m,"equipment_quantity")]||0,f=+s[i("equipment",m,"equipment_weight")]||0,R=0,$=0;f=f*M*A,w===1&&(R=f),w===2&&($=f),o.push(R),a.push($),t.push(f)});let p=o.reduce((m,w)=>m+w,0),c=a.reduce((m,w)=>m+w,0),l=t.reduce((m,w)=>m+w,0),u=l-c-p,h=Math.round(T(s.total_coin_weight)+T(l));n.total_weapon_weight=p.toFixed(2),n.total_armor_weight=c.toFixed(2),n.total_equipment_weight=l.toFixed(2),n.total_equipment_weight_adjusted=u.toFixed(2),n.total_weight=h,setAttrs(n,{silent:!0})})})};on("change:repeating_equipment:equipment_quantity change:repeating_equipment:equipment_cost remove:repeating_equipment",r=>{no()});on("change:repeating_equipment:equipment_weight change:repeating_equipment:equipment_quantity change:repeating_equipment:equipment_carried change:repeating_equipment:equipment_carried_select change:repeating_equipment:equipment_armor_worn change:total_coin_weight remove:repeating_equipment change:toggle_lbs",r=>{ro()});on("change:pp change:gp change:ep change:sp change:cp change:toggle_lbs",r=>{getAttrs(["pp","gp","ep","sp","cp","toggle_lbs"],n=>{let e=+(n.toggle_lbs||0)?10:1;setAttrs({total_coin_weight:(Math.round((T(n.pp)+T(n.gp)+T(n.ep)+T(n.sp)+T(n.cp))/1)/e).toFixed(2)})})});function _o(){getAttrs(["normal_load_adjusted","heavy_load","very_heavy_load","total_weight","autocalc_movement_flag","current_bulk","current_encumbrance_move"],r=>{let n={},e=+r.autocalc_movement_flag,s=+r.normal_load_adjusted||0,o=+r.heavy_load||0,a=+r.very_heavy_load||0,t=+r.total_weight||0,p=+r.current_bulk,c=0;t<=s?(n.current_encumbrance_label="Unencumbered",c=0,n.current_encumbrance=c,n.current_encumbrance_move=e===1?Math.max(c,p):r.current_encumbrance_move):t>s&&t<=o?(n.current_encumbrance_label="Heavy",c=1,n.current_encumbrance=c,n.current_encumbrance_move=e===1?Math.max(c,p):r.current_encumbrance_move):t>o&&t<=a?(n.current_encumbrance_label="Very Heavy",c=2,n.current_encumbrance=c,n.current_encumbrance_move=e===1?Math.max(c,p):r.current_encumbrance_move):(n.current_encumbrance_label="Encumbered",c=3,n.current_encumbrance=c,n.current_encumbrance_move=e===1?Math.max(c,p):r.current_encumbrance_move),setAttrs(n)})}on("sheet:opened change:encumbrancebonus change:normal_load change:total_weight change:autocalc_movement_flag change:current_bulk change:encumbrancebonus_lbs change:toggle_lbs",r=>{getAttrs(["encumbrancebonus","toggle_lbs"],n=>{let e={},s=+(n.toggle_lbs||0),o=s?.1:1,a=350*o,t=+n.encumbrancebonus||0,p=T(t*o),l=a+(s?p:t),u=l+a,h=u+a,m=h;e.encumbrancebonus_lbs=p,e.normal_load=a,e.normal_load_adjusted=l,e.heavy_load=u,e.very_heavy_load=h,e.max_load=m+1,setAttrs(e,{silent:!0},_o())})});function so(){getAttrs(["current_encumbrance_move","movement"],r=>{let n={},e=+r.movement.toString().replace(/[^0-9]/g,""),s=+r.current_encumbrance_move,o=0;s===0?o=e:s===1?o=q(e-3):s===2?o=q(e-6):o=q(e-9),n.movement_normal=o,n.movement_known=o*5,n.movement_run=o*10,setAttrs(n,{silent:!0})})}on("change:movement change:current_encumbrance change:current_encumbrance_move change:autocalc_movement_flag",r=>{getAttrs(["movement"],n=>{let e={},o=+n.movement.toString().replace(/[^0-9]/g,"");e.movement_heavy=Math.max(o-3,0),e.movement_load=Math.max(o-6,0),e.movement_max=Math.max(o-9,0),setAttrs(e,{silent:!0},so(),V(0))})});function io(){getAttrs(["unarmored_bulk","armortype_bulk","armortype2_bulk","armorshield_bulk","unarmored_worn","armortype_worn","armortype2_worn","armorshield_worn","armorshield_carried"],r=>{let n={},{unarmored_worn:e}=r,{armortype_worn:s}=r,{armortype2_worn:o}=r,{armorshield_worn:a}=r,{armorshield_carried:t}=r,p=Math.max(a,t),c=r.unarmored_bulk*e,l=r.armortype_bulk*s,u=r.armortype2_bulk*o,h=r.armorshield_bulk*p;switch(Math.max(c,l,u,h)){case 0:n.current_bulk_label="Not Bulky",n.current_bulk=0;break;case 1:n.current_bulk_label="Not Bulky/Light",n.current_bulk=0;break;case 2:n.current_bulk_label="Fairly/Moderate",n.current_bulk=1;break;case 3:n.current_bulk_label="Bulky/Heavy",n.current_bulk=2;break;default:g(">> failure in bulk calculation <<")}setAttrs(n)})}on("change:unarmored_bulk change:armortype_bulk change:armortype2_bulk change:armorshield_bulk change:armorhelmet_bulk change:unarmored_worn change:armortype_worn change:armortype2_worn change:armorshield_worn change:armorhelmet_worn change:armorshield_carried remove:repeating_equipment",r=>{io()});on("change:repeating_equipment:equipment_carried_select change:repeating_equipment:equipment_type change:repeating_equipment:equipment_carried_select",r=>{let n=r.sourceAttribute.split("_")[2],e=`${r.sourceAttribute}`,o=/equipment_type/.test(e),a=[i("equipment",n,"equipment_type"),i("equipment",n,"equipment_carried_select")];getAttrs(["equipment_tabs_type","equipment_tabs_carry",...a],t=>{let p={},c=+t.equipment_tabs_carry,l=+t.equipment_tabs_type,u=+t[i("equipment",n,"equipment_type")],h=+t[i("equipment",n,"equipment_carried_select")];p[i("equipment",n,"equipment_carried")]=h===1?1:0,p.equipment_tabs_type=l!==-1&&o?u:l,console.log(`Change detected: testCarrySelected:${c===-1||c===h?-1:h}`),p.equipment_tabs_carry=c===-1||c===h?-1:h,setAttrs(p)})});on("change:equipment_tabs_type change:equipment_tabs_carry change:repeating_equipment:equipment_magical",r=>{g(`Change Detected:${r.sourceAttribute}`),getSectionIDs("repeating_equipment",n=>{let e=[];_.each(n,s=>{e.push(i("equipment",s,"equipment_type")),e.push(i("equipment",s,"equipment_carried_select")),e.push(i("equipment",s,"equipment_magical"))}),getAttrs(["equipment_tabs_type","equipment_tabs_carry","equipment_magical",...e],s=>{let o={},a=+s.equipment_tabs_type,t=+s.equipment_tabs_carry;_.each(n,p=>{let c=+s[i("equipment",p,"equipment_magical")],l=+s[i("equipment",p,"equipment_type")],u=+s[i("equipment",p,"equipment_carried_select")];if(a===-1||a===l||a===3&&c)return o[i("equipment",p,"equipment_show_carry")]=t===-1||t===u?1:0,o[i("equipment",p,"equipment_show_type")]=1;o[i("equipment",p,"equipment_show_carry")]=t===-1||t===u?1:0,o[i("equipment",p,"equipment_show_type")]=0}),setAttrs(o)})})});var po=()=>{getSectionIDs("repeating_equipment",r=>{let n=r.reduce((e,s)=>[...e,`repeating_equipment_${s}_equipment_armor_type`],[]);getAttrs(["armordetails_array",...De,...n],e=>{let s={},o=e.unarmored_row_id.toString(),a=e.armortype1_row_id.toString(),t=e.armortype2_row_id.toString(),p=e.armorshield_row_id.toString(),c=e.armorhelmet_row_id.toString(),l=e.armorother1_row_id.toString(),u=e.armorother2_row_id.toString(),h=e.armorother3_row_id.toString(),m=e.armorother4_row_id.toString(),w=e.armorother5_row_id.toString(),A=e.armorother6_row_id.toString(),b=[o,a,t,p,c,l,u,h,m,w,A].map(M=>M?M.toString().toLowerCase():"0");_.each(r,M=>{let f=+e[`repeating_equipment_${M}_equipment_armor_type`];if(f===99)return;let R=b.map(($,P)=>$===M?`${Math.floor(P)+1}`:null).filter($=>$!==null);if(R.length>1){let U=R.join(",").split(",").filter(K=>K!==String(f));switch(U.length>0?U[0]:null){case"1":s.unarmored="",g(">> DELETE/RESET ROW 0 - Unarmored <<");break;case"2":s.armortype="",g(">> DELETE/RESET ROW 1 - Armor 1 <<");break;case"3":s.armortype2="",g(">> DELETE/RESET ROW 2 - Armor 2 <<");break;case"4":s.armorshield="",g(">> DELETE/RESET ROW 3 - Shield <<");break;case"5":s.armorhelmet="",g(">> DELETE/RESET ROW 4 - Helmet <<");break;case"6":s.armorother="",g(">> DELETE/RESET ROW 5 - Other <<");break;case"7":s.armorother2="",g(">> DELETE/RESET ROW 6 - Other 2 <<");break;case"8":s.armorother3="",g(">> DELETE/RESET ROW 7 - Other 3 <<");break;case"9":s.armorother4="",g(">> DELETE/RESET ROW 8 - Other 4 <<");break;case"10":s.armorother5="",g(">> DELETE/RESET ROW 9 - Other 5 <<");break;case"11":s.armorother6="",g(">> DELETE/RESET ROW 10 - Other 6 <<");break;default:g(">> NOTHING TO DELETE/RESET <<")}}}),setAttrs(s)})})},co=`${ba.map(r=>`change:${r}`).join(" ")}`;on(co,r=>{if(r.sourceType==="sheetworker")return;let n=r.sourceAttribute,e=r.previousValue,s=r.newValue,o=0;getAttrs(ba,a=>{let t={},p="";n==="unarmored"&&e===void 0&&(p=k(),t.unarmored_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=0,t[`repeating_equipment_${p}_equipment_armor_worn`]=1,t[`repeating_equipment_${p}_equipment_item`]=a.unarmored,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.unarmored_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.unarmored_base,t[`repeating_equipment_${p}_equipment_carried_select`]=1,g(`repeating armor does not exist. Creating unarmored: ${p}`)),n==="armortype"&&e===void 0&&(p=k(),t.armortype1_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=1,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armortype_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armortype,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armortype_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armortype_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armortype_magic||0,t[`repeating_equipment_${p}_equipment_armor_bulk`]=+a.armortype_bulk,t[`repeating_equipment_${p}_equipment_carried_select`]=+a.armortype_carried,t[`repeating_equipment_${p}_equipment_weight`]=+a.armor_weight||0,t[`repeating_equipment_${p}_equipment_cost`]=+a.armor_cost||0),n==="armortype2"&&e===void 0&&(p=k(),t.armortype2_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=2,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armortype2_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armortype2,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armortype2_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armortype2_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armortype2_magic||0,t[`repeating_equipment_${p}_equipment_armor_bulk`]=+a.armortype2_bulk,t[`repeating_equipment_${p}_equipment_carried_select`]=+a.armortype2_carried,t[`repeating_equipment_${p}_equipment_weight`]=+a.armortype2_weight||0,t[`repeating_equipment_${p}_equipment_cost`]=+a.armortype2_cost||0),n==="armorshield"&&e===void 0&&(p=k(),t.armorshield_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=3,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorshield_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorshield,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorshield_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorshield_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorshield_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorshield_mod||0,t[`repeating_equipment_${p}_equipment_armor_bulk`]=+a.armorshield_bulk,t[`repeating_equipment_${p}_equipment_carried_select`]=+a.armorshield_carried,t[`repeating_equipment_${p}_equipment_weight`]=+a.armorshield_weight||0,t[`repeating_equipment_${p}_equipment_cost`]=+a.armorshield_cost||0),n==="armorhelmet"&&e===void 0&&(p=k(),t.armorhelmet_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=4,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorhelmet_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorhelmet,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorhelmet_ac,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorhelmet_magic||0,t[`repeating_equipment_${p}_equipment_carried_select`]=+a.armorhelmet_carried,t[`repeating_equipment_${p}_equipment_weight`]=+a.armorhelmet_weight||0,t[`repeating_equipment_${p}_equipment_cost`]=+a.armorhelmet_cost||0),n==="armorother"&&e===void 0&&(p=k(),t.armorother1_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=5,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother_mod||0),n==="armorother2"&&e===void 0&&(p=k(),t.armorother2_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=6,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother2_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother2,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother2_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother2_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother2_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother2_mod||0),n==="armorother3"&&e===void 0&&(p=k(),t.armorother3_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=7,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother3_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother3,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother3_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother3_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother3_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother3_mod||0),n==="armorother4"&&e===void 0&&(p=k(),t.armorother4_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=8,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother4_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother4,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother4_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother4_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother4_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother4_mod||0),n==="armorother5"&&e===void 0&&(p=k(),t.armorother5_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=9,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother5_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother5,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother5_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother5_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother5_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother5_mod||0),n==="armorother6"&&e===void 0&&(p=k(),t.armorother6_row_id=p.toLowerCase(),t[`repeating_equipment_${p}_equipment_type`]=2,t[`repeating_equipment_${p}_equipment_armor_type`]=10,t[`repeating_equipment_${p}_equipment_armor_worn`]=+a.armorother6_worn,t[`repeating_equipment_${p}_equipment_item`]=a.armorother6,t[`repeating_equipment_${p}_equipment_armor_ac`]=+a.armorother6_ac,t[`repeating_equipment_${p}_equipment_armor_base`]=+a.armorother6_base,t[`repeating_equipment_${p}_equipment_armor_magic`]=+a.armorother6_magic||0,t[`repeating_equipment_${p}_equipment_armor_mod`]=+a.armorother6_mod||0),setAttrs(t,{silent:!0},Se()),da(null,n,o)})});function Ga(r,n){getAttrs([`repeating_equipment_${r}_equipment_armor_type`,`repeating_equipment_${r}_equipment_item`,`repeating_equipment_${r}_equipment_armor_worn`,`repeating_equipment_${r}_equipment_armor_ac`,`repeating_equipment_${r}_equipment_armor_base`,`repeating_equipment_${r}_equipment_armor_magic`,`repeating_equipment_${r}_equipment_armor_mod`,`repeating_equipment_${r}_equipment_armor_bulk`,`repeating_equipment_${r}_equipment_carried_select`,`repeating_equipment_${r}_equipment_carried`,`repeating_equipment_${r}_equipment_weight`,`repeating_equipment_${r}_equipment_cost`],e=>{let s={},a=+e[`repeating_equipment_${r}_equipment_armor_type`],t=e[`repeating_equipment_${r}_equipment_item`],p=+e[`repeating_equipment_${r}_equipment_armor_worn`],c=+e[`repeating_equipment_${r}_equipment_armor_ac`],l=+e[`repeating_equipment_${r}_equipment_armor_base`],u=+e[`repeating_equipment_${r}_equipment_armor_magic`]||0,h=+e[`repeating_equipment_${r}_equipment_armor_mod`]||0,m=+e[`repeating_equipment_${r}_equipment_armor_bulk`],w=+e[`repeating_equipment_${r}_equipment_carried_select`],A=+e[`repeating_equipment_${r}_equipment_weight`]||0,b=+e[`repeating_equipment_${r}_equipment_cost`]||0;p===1?(w=1,s[`repeating_equipment_${r}_equipment_carried_select`]=1):p===0&&(w===0||w===2)&&(s[`repeating_equipment_${r}_equipment_carried_select`]=w);let M=[`ID:${r} ITEM:${t} TYPE:${a} WORN:${p} AC:${c} BASE:${l} MAGIC:${u} MOD:${h} BULK:${m} CARRIED:${w} WEIGHT:${A} COST:${b} UPDATED:`];switch(a){case 99:g("Choose an armor row.");break;case 0:s.unarmored_worn=p,s.unarmored=t,s.unarmored_ac=c,s.unarmored_base=l,s.unarmored_bulk=m,s.unarmored_carried=w,s.unarmored_row_id=r;break;case 1:s.armortype_worn=p,s.armortype=t,s.armortype_ac=c,s.armortype_base=l,s.armortype_magic=u,s.armortype_bulk=m,s.armortype_carried=w,s.armor_weight=A,s.armor_cost=b,s.armortype1_row_id=r;break;case 2:s.armortype2_worn=p,s.armortype2=t,s.armortype2_ac=c,s.armortype2_base=l,s.armortype2_magic=u,s.armortype2_bulk=m,s.armortype2_carried=w,s.armortype2_weight=A,s.armortype2_cost=b,s.armortype2_row_id=r;break;case 3:s.armorshield_worn=p,s.armorshield=t,s.armorshield_ac=c>=0?0:-Math.abs(c),s.armorshield_base=l>=0?0:-Math.abs(l),s.armorshield_magic=u,s.armorshield_mod=h,s.armorshield_bulk=m,s.armorshield_carried=w,s.armorshield_weight=A,s.armorshield_cost=b,s.armorshield_row_id=r;break;case 4:s.armorhelmet_worn=p,s.armorhelmet=t,s.armorhelmet_base=l,s.armorhelmet_magic=u,s.armorhelmet_carried=w,s.armorhelmet_weight=A,s.armorhelmet_cost=b,s.armorhelmet_row_id=r;break;case 5:s.armorother_worn=p,s.armorother=t,s.armorother_ac=c,s.armorother_base=l,s.armorother_magic=u,s.armorother_mod=h,s.armorother1_row_id=r;break;case 6:s.armorother2_worn=p,s.armorother2=t,s.armorother2_ac=c>=0?0:-Math.abs(c),s.armorother2_base=l>=0?0:-Math.abs(l),s.armorother2_magic=u,s.armorother2_mod=h,s.armorother2_row_id=r;break;case 7:s.armorother3_worn=p,s.armorother3=t,s.armorother3_ac=c>=0?0:-Math.abs(c),s.armorother3_base=l>=0?0:-Math.abs(l),s.armorother3_magic=u,s.armorother3_mod=h,s.armorother3_row_id=r;break;case 8:s.armorother4_worn=p,s.armorother4=t,s.armorother4_ac=c>=0?0:-Math.abs(c),s.armorother4_base=l>=0?0:-Math.abs(l),s.armorother4_magic=u,s.armorother4_mod=h,s.armorother4_row_id=r;break;case 9:s.armorother5_worn=p,s.armorother5=t,s.armorother5_ac=c>=0?0:-Math.abs(c),s.armorother5_base=l>=0?0:-Math.abs(l),s.armorother5_magic=u,s.armorother5_mod=h,s.armorother5_row_id=r;break;case 10:s.armorother6_worn=p,s.armorother6=t,s.armorother6_ac=c>=0?0:-Math.abs(c),s.armorother6_base=l>=0?0:-Math.abs(l),s.armorother6_magic=u,s.armorother6_mod=h,s.armorother6_row_id=r;break;default:g("Armor row is out of range.")}n&&n(),setAttrs(s,V(0))})}function mo(r){let n={};getAttrs([`repeating_equipment_${r}_equipment_item`,`repeating_equipment_${r}_equipment_weapon_type`,`repeating_equipment_${r}_equipment_weapon_speed`,`repeating_equipment_${r}_equipment_weapon_length`,`repeating_equipment_${r}_equipment_weapon_space`,`repeating_equipment_${r}_equipment_weapon_misc`,`repeating_equipment_${r}_equipment_weapon_damagesmallmedium`,`repeating_equipment_${r}_equipment_weapon_damagelarge`,`repeating_equipment_${r}_equipment_weapon_attackdmgtype`,`repeating_equipment_${r}_equipment_weapon_rateoffire`,`repeating_equipment_${r}_equipment_weapon_range`,`repeating_equipment_${r}_equipment_quantity`,`repeating_equipment_${r}_equipment_description`],e=>{let s=k();n[`repeating_weapon_${s}_weapon_name`]=e[`repeating_equipment_${r}_equipment_item`],n[`repeating_weapon_${s}_weapon_type`]=+e[`repeating_equipment_${r}_equipment_weapon_type`],n[`repeating_weapon_${s}_weapon_speed`]=e[`repeating_equipment_${r}_equipment_weapon_speed`],n[`repeating_weapon_${s}_weapon_length`]=e[`repeating_equipment_${r}_equipment_weapon_length`],n[`repeating_weapon_${s}_weapon_space`]=e[`repeating_equipment_${r}_equipment_weapon_space`],n[`repeating_weapon_${s}_weapon_misc`]=e[`repeating_equipment_${r}_equipment_weapon_misc`],n[`repeating_weapon_${s}_weapon_damagesmallmedium`]=e[`repeating_equipment_${r}_equipment_weapon_damagesmallmedium`],n[`repeating_weapon_${s}_weapon_damagelarge`]=e[`repeating_equipment_${r}_equipment_weapon_damagelarge`],n[`repeating_weapon_${s}_weapon_attackdmgtype`]=e[`repeating_equipment_${r}_equipment_weapon_attackdmgtype`],n[`repeating_weapon_${s}_weapon_rateoffire`]=e[`repeating_equipment_${r}_equipment_weapon_rateoffire`],n[`repeating_weapon_${s}_weapon_range`]=e[`repeating_equipment_${r}_equipment_weapon_range`],n[`repeating_weapon_${s}_weapon_quantity`]=+e[`repeating_equipment_${r}_equipment_quantity`]||0,n[`repeating_weapon_${s}_weapon_notes`]=e[`repeating_equipment_${r}_equipment_description`],setAttrs(n,{silent:!0},za(r),Me(s))})}function qa(r,n){getAttrs(De,e=>{let s=e.unarmored_row_id.toString(),o=e.armortype1_row_id.toString(),a=e.armortype2_row_id.toString(),t=e.armorshield_row_id.toString(),p=e.armorhelmet_row_id.toString(),c=e.armorother1_row_id.toString(),l=e.armorother2_row_id.toString(),u=e.armorother3_row_id.toString(),h=e.armorother4_row_id.toString(),m=e.armorother5_row_id.toString(),w=e.armorother6_row_id.toString(),A=[s,o,a,t,p,c,l,u,h,m,w].map(M=>M?M.toString().toLowerCase():"0"),b="";b=A.includes(r)?1:0,typeof n=="function"&&n(b,A)})}Se=r=>{let n={};qa(r,(e,s)=>{n.armordetails_array=[`${s}`],setAttrs(n,{silent:!0})})};var lo=`${De.map(r=>`change:${r}`).join(" ")}`;on(lo,r=>{let n=r.sourceAttribute;r.sourceType!=="sheetworker"&&getAttrs(n,e=>{let s=e[`${r.sourceAttribute}`];g("Updating armordetails_array..."),Se(s)})});on("change:repeating_equipment:equipment_item change:repeating_equipment:equipment_armor_worn change:repeating_equipment:equipment_armor_ac change:repeating_equipment:equipment_armor_base change:repeating_equipment:equipment_armor_magic change:repeating_equipment:equipment_armor_mod change:repeating_equipment:equipment_armor_bulk change:repeating_equipment:equipment_carried_select change:repeating_equipment:equipment_weight change:repeating_equipment:equipment_cost",r=>{let n=r.sourceAttribute.split("_")[2].toLowerCase();r.sourceType!=="sheetworker"&&qa(n,e=>{e&&Ga(n)})});on("clicked:repeating_equipment:addarmor",r=>{let n=r.sourceAttribute.split("_")[2].toLowerCase();Ga(n,()=>{po()})});on("clicked:repeating_equipment:addattack",r=>{let n=r.sourceAttribute.split("_")[2];mo(n)});on("clicked:addturnundead",r=>{let n={},e=k();n[`repeating_ability_${e}_ability_name`]="Turn Undead by Type",n[`repeating_ability_${e}_ability_short_description`]="[Turn Undead by Type](~selected|turn_undead_roll)",setAttrs(n,{silent:!0})});on("clicked:addturnundead2",r=>{let n={},e=k();n[`repeating_ability_${e}_ability_name`]="Turn Undead by HD",n[`repeating_ability_${e}_ability_short_description`]="[Turn Undead by HD](~selected|turn_undead2_roll)",setAttrs(n,{silent:!0})});on("remove:repeating_equipment",r=>{let n=r.sourceAttribute.split("_")[2].toLowerCase(),e=1;qa(n,(s,o)=>{s&&da(n,null,e)})});on("change:spell_tabs change:toggle_show_memorized change:spell_caster_tabs change:toggle_caster2",r=>{getSectionIDs("repeating_spells",n=>{let e=[];_.each(n,s=>{e.push(i("spells",s,"spell_memorized")),e.push(i("spells",s,"spell_show_all")),e.push(i("spells",s,"spell_level")),e.push(i("spells",s,"spell_caster_class"))}),getAttrs(["spell_tabs","toggle_show_memorized","spell_caster_tabs","toggle_caster2",...e],s=>{let o={},a=+s.toggle_show_memorized,t=+s.spell_caster_tabs,p=+s.toggle_caster2,c=+s.spell_tabs;_.each(n,l=>{let u=+s[i("spells",l,"spell_memorized")]||0,h=+s[i("spells",l,"spell_caster_class")],m=+s[i("spells",l,"spell_level")]||0;o[i("spells",l,"spell_show_memorized")]=a===1&&u>0?1:0,o[i("spells",l,"spell_show_all")]=a===1?0:1,c===-1||c===m?p===1?o[i("spells",l,"spell_show")]=1:p===0&&(t===-1||h===0||t===0&&h===1||t===1&&h===2?o[i("spells",l,"spell_show")]=1:o[i("spells",l,"spell_show")]=0):o[i("spells",l,"spell_show")]=0}),setAttrs(o)})})});on("change:repeating_spells:spell_level change:repeating_spells:spell_caster_class",r=>{r.sourceType==="player"&&getAttrs(["repeating_spells_spell_level","repeating_spells_spell_caster_class","spell_caster_tabs","spell_tabs"],n=>{let e={},s=+n.spell_caster_tabs,o=+n.repeating_spells_spell_caster_class,a=+n.spell_tabs,t=n.repeating_spells_spell_level;e.spell_tabs=a>=0&&a!==t?t:a,e.spell_caster_tabs=s!==-1&&o<=1?0:1,setAttrs(e)})});ma=()=>{getSectionIDs("repeating_spells",r=>{let n={},e=["caster_class1_name","caster_class2_name","caster_class1_level","caster_class2_level"],s=[];_.each(r,a=>{s.push(i("spells",a,"spell_caster_class"))});let o=[...e,...s];getAttrs(o,a=>{_.each(r,t=>{let p=+a[i("spells",t,"spell_caster_class")];p===0?(n[i("spells",t,"spell_caster_class_name")]="",n[i("spells",t,"spell_caster_class")]=p):p===1?(n[i("spells",t,"spell_caster_class_name")]=a.caster_class1_name,n[i("spells",t,"spell_caster_class_level")]=+a.caster_class1_level||0,n[i("spells",t,"spell_caster_class")]=p):p===2&&(n[i("spells",t,"spell_caster_class_name")]=a.caster_class2_name,n[i("spells",t,"spell_caster_class_level")]=+a.caster_class2_level||0,n[i("spells",t,"spell_caster_class")]=p)}),setAttrs(n,{silent:!0})})})};on("change:caster_class1_name change:caster_class2_name change:caster_class1_level change:caster_class2_level",r=>{ma()});on("change:repeating_spells:spell_name change:repeating_spells:spell_caster_class",r=>{if(r.sourceType!=="player")return;let n=r.previousValue,e=r.sourceAttribute.split("_").slice(3).join("_"),s=r.sourceAttribute.split("_")[2],o=n===void 0&&e==="spell_name"?1:0;getAttrs(["repeating_spells_spell_caster_class","caster_class1_name","caster_class1_level","caster_class2_name","caster_class2_level","spell_caster_tabs","toggle_caster2"],a=>{let t={},p=+a.toggle_caster2,c=+a.spell_caster_tabs,l=+a[i("spells",s,"spell_caster_class")];console.log(`Change detected:PRE-CHECK Hide Caster2:${p} CasterTab:${c} thisClass:${l}`),p===0?o===1&&c!==-1&&(l=c===0?1:2):l=1,console.log(`Change detected:POST-CHECK Hide Caster2:${p} CasterTab:${c} thisClass:${l}`),l===0?(t[i("spells",s,"spell_caster_class_name")]="",t[i("spells",s,"spell_caster_class")]=l):l===1?(t[i("spells",s,"spell_caster_class_name")]=a.caster_class1_name,t[i("spells",s,"spell_caster_class_level")]=+a.caster_class1_level||0,t[i("spells",s,"spell_caster_class")]=l):l===2&&(t[i("spells",s,"spell_caster_class_name")]=a.caster_class2_name,t[i("spells",s,"spell_caster_class_level")]=+a.caster_class2_level||0,t[i("spells",s,"spell_caster_class")]=l),setAttrs(t,{silent:!0})})});on("change:repeating_spells:spell_name",r=>{if(r.sourceType!=="player")return;let n=r.sourceAttribute.split("_")[2];getAttrs([`repeating_spells_${n}_spell_level`,"spell_tabs"],e=>{let s={},o=+e.spell_tabs,a=e[i("spells",n,"spell_level")]||0;o===-1||a!="?"||(s[`repeating_spells_${n}_spell_level`]=o,setAttrs(s,{silent:!0}))})});on("change:repeating_weapon:weapon_tohitacadj_flag change:repeating_weapon:weapon_thac_adj0 change:repeating_weapon:weapon_thac_adj1 change:repeating_weapon:weapon_thac_adj2 change:repeating_weapon:weapon_thac_adj3 change:repeating_weapon:weapon_thac_adj4 change:repeating_weapon:weapon_thac_adj5 change:repeating_weapon:weapon_thac_adj6 change:repeating_weapon:weapon_thac_adj7 change:repeating_weapon:weapon_thac_adj8 change:repeating_weapon:weapon_thac_adj9 change:repeating_weapon:weapon_thac_adj10",r=>{getAttrs(["repeating_weapon_weapon_ToHitACadj_flag","repeating_weapon_weapon_ToHitACadj"],n=>{let e={},s=+n.repeating_weapon_weapon_ToHitACadj_flag;e.repeating_weapon_weapon_ToHitACadj=s===1?"{{ToHitACadj2to10=HitAdj:[[ @{weapon_thac_adj0} ]]|[[ @{weapon_thac_adj1} ]]|[[ @{weapon_thac_adj2} ]]|[[ @{weapon_thac_adj3} ]]|[[ @{weapon_thac_adj4} ]]|[[ @{weapon_thac_adj5} ]]|[[ @{weapon_thac_adj6} ]]|[[ @{weapon_thac_adj7} ]]|[[ @{weapon_thac_adj8} ]]|[[ @{weapon_thac_adj9} ]]|[[ @{weapon_thac_adj10} ]] }}":"{{ToHitACadj2to10}}",setAttrs(e,{silent:!0})})});on("change:toggle_to_hit_table change:repeating_weapon:weapon_name change:repeating_weapon:weapon_whisper_to_hit_select",r=>{getSectionIDs("repeating_weapon",n=>{let e=[];_.each(n,s=>{e.push(`repeating_weapon_${s}_weapon_whisper_to_hit_select`),e.push(`repeating_weapon_${s}_weapon_whisper_to_hit`)}),getAttrs(["toggle_to_hit_table",...e],s=>{let o={},a=+s.toggle_to_hit_table;_.each(n,t=>{let p=+s[`repeating_weapon_${t}_weapon_whisper_to_hit_select`],c=s[`repeating_weapon_${t}_weapon_whisper_to_hit`],l=" ",u="%NEWLINE%/w gm &{template:attacks-table} {{color=@{color_option}}} {{ToHitAC-10to0=ToHit:[[ @{thac-10} ]]|[[ @{thac-9} ]]|[[ @{thac-8} ]]|[[ @{thac-7} ]]|[[ @{thac-6} ]]|[[ @{thac-5} ]]|[[ @{thac-4} ]]|[[ @{thac-3} ]]|[[ @{thac-2} ]]|[[ @{thac-1} ]]|[[ @{thac0} ]]}} {{ToHitAC1to10=ToHit:[[ @{thac0} ]]|[[ @{thac1} ]]|[[ @{thac2} ]]|[[ @{thac3} ]]|[[ @{thac4} ]]|[[ @{thac5} ]]|[[ @{thac6} ]]|[[ @{thac7} ]]|[[ @{thac8} ]]|[[ @{thac9} ]]|[[ @{thac10} ]] }}",h="%NEWLINE%/w gm &{template:attacks-table} {{color=@{color_option}}} {{ToHitAC-10to0=ToHit:[[ @{thac0-10} ]]|[[ @{thac0-9} ]]|[[ @{thac0-8} ]]|[[ @{thac0-7} ]]|[[ @{thac0-6} ]]|[[ @{thac0-5} ]]|[[ @{thac0-4} ]]|[[ @{thac0-3} ]]|[[ @{thac0-2} ]]|[[ @{thac0-1} ]]|[[ @{thac00} ]]}} {{ToHitAC1to10=ToHit:[[ @{thac00} ]]|[[ @{thac01} ]]|[[ @{thac02} ]]|[[ @{thac03} ]]|[[ @{thac04} ]]|[[ @{thac05} ]]|[[ @{thac06} ]]|[[ @{thac07} ]]|[[ @{thac08} ]]|[[ @{thac09} ]]|[[ @{thac010} ]] }}";p===2?(c=l,p=2):(p===0||p===1)&&(a===0?(c=u,p=0):a===1&&(c=h,p=1)),o[`repeating_weapon_${t}_weapon_whisper_to_hit`]=c,o[`repeating_weapon_${t}_weapon_whisper_to_hit_select`]=p}),setAttrs(o,{silent:!0})})})});on("change:repeating_weapon:weapon_prof_flag change:weapon_proficiency_initial change:weapon_proficiency_added_per_level change:weapon_proficiency_penalty",r=>{getSectionIDs("repeating_weapon",n=>{let e=[];_.each(n,s=>{e.push(`repeating_weapon_${s}_weapon_prof_flag`)}),getAttrs(["weapon_proficiency_penalty",...e],s=>{let o={};_.each(n,a=>{let t=+s[`repeating_weapon_${a}_weapon_prof_flag`],p=+s.weapon_proficiency_penalty||0;o[`repeating_weapon_${a}_weapon_prof`]=p,o[`repeating_weapon_${a}_weapon_prof_pen`]=t===0?"0":p}),setAttrs(o,{silent:!0})})})});on("change:repeating_weapon:weapon_backstab_flag change:backstab change:backstab_bonus change:toggle_thief_skills",r=>{getSectionIDs("repeating_weapon",n=>{let e=[];_.each(n,s=>{e.push(`repeating_weapon_${s}_weapon_backstab_flag`)}),getAttrs(["backstab","backstab_bonus","toggle_thief_skills",...e],s=>{let o={},a=+s.toggle_thief_skills,t=+s.backstab,p=+s.backstab_bonus||0;_.each(n,c=>{let l=+s[`repeating_weapon_${c}_weapon_backstab_flag`];a===0&&(o[`repeating_weapon_${c}_weapon_backstab_var`]=l===0?0:`+${p}`,o[`repeating_weapon_${c}_weapon_backstab_bonus`]=l===0?0:p,o[`repeating_weapon_${c}_weapon_backstab`]=l===0?1:`x${t}`,o[`repeating_weapon_${c}_weapon_backstab_mult`]=l===0?1:t),a===1&&(o[`repeating_weapon_${c}_weapon_backstab_var`]=0,o[`repeating_weapon_${c}_weapon_backstab_bonus`]=0,o[`repeating_weapon_${c}_weapon_backstab`]=1,o[`repeating_weapon_${c}_weapon_backstab_mult`]=1)}),setAttrs(o,{silent:!0})})})});function ho(){getSectionIDs("repeating_weapon",r=>{let n={},e=[];_.each(r,s=>{e.push(i("weapon",s,"weapon_dual"))}),getAttrs(["dual_pen_primary","dual_pen_secondary",...e],s=>{let o=+s.dual_pen_primary||0,a=+s.dual_pen_secondary||0;_.each(r,t=>{let p=s[i("weapon",t,"weapon_dual")],c=0;p==="Normal"?c=0:p==="Primary"?c=o:p==="Secondary"&&(c=a);let l=Math.min(0,c);n[i("weapon",t,"weapon_dual_pen")]=l}),setAttrs(n,{silent:!0})})})}on("change:repeating_weapon:weapon_dual",r=>{let n={};getAttrs(["dual_pen_primary","dual_pen_secondary","repeating_weapon_weapon_dual"],e=>{let s=+e.dual_pen_primary||0,o=+e.dual_pen_secondary||0,a=e.repeating_weapon_weapon_dual,t=0;a==="Normal"?t=0:a==="Primary"?t=s:a==="Secondary"&&(t=o);let p=Math.min(0,t);n.repeating_weapon_weapon_dual_pen=p,setAttrs(n,{silent:!0})})});on("change:dual_pen_primary change:dual_pen_secondary change:dexterity",r=>{getAttrs(["dexterity"],n=>{let e={},s=+n.dexterity||0,o=0;s<6?o=Math.max(-3,s-6):s>=18?o=Math.min(5,Math.floor(s/3)-3):s>15&&(o=s-15);let a=Math.min(0,o-2),t=Math.min(0,o-4);e.dual_pen_primary=a,e.dual_pen_secondary=t,setAttrs(e,{silent:!0},ho())})});Pa=r=>{let n={},e=[i("weapon",r,"weapon_range"),i("weapon",r,"weapon_range_short"),i("weapon",r,"weapon_range_medium"),i("weapon",r,"weapon_range_long"),i("weapon",r,"weapon_attack_type"),i("weapon",r,"weapon_range_error")];getAttrs(e,s=>{let o=+s[i("weapon",r,"weapon_attack_type")];if(o===0||o===2)return;let a=s[i("weapon",r,"weapon_range")];a=a.replace(/'/g,""),a=a.replace(/"/g,"");let t=a.split("/").join(",").split(" ").join(",").split("-").join(",").split(","),p=Number(t[0]),c=Number(t[1]),l=Number(t[2]);t.length===1&&p>=0&&!c&&!l&&(c=p,l=p),Number.isNaN(p)?(n[i("weapon",r,"weapon_range_short")]=0,n[i("weapon",r,"weapon_range_error")]=a===""?1:0):n[i("weapon",r,"weapon_range_short")]=p,Number.isNaN(c)?(n[i("weapon",r,"weapon_range_medium")]=0,n[i("weapon",r,"weapon_range_error")]=a===""?1:0):n[i("weapon",r,"weapon_range_medium")]=c,Number.isNaN(l)?(n[i("weapon",r,"weapon_range_long")]=0,n[i("weapon",r,"weapon_range_error")]=a===""?1:0):n[i("weapon",r,"weapon_range_long")]=l,!Number.isNaN(p)&&!Number.isNaN(c)&&!Number.isNaN(l)&&(n[i("weapon",r,"weapon_range_error")]=1),setAttrs(n,{silent:!0})})};on("change:repeating_weapon:weapon_range change:repeating_weapon:weapon_attack_type",r=>{let n=r.sourceAttribute.split("_")[2];Pa(n)});on("change:repeating_weapon:weapon_attack_type",r=>{getAttrs(["repeating_weapon_weapon_attack_type","repeating_weapon_weapon_attack_type_flag"],n=>{let e={},s=+n.repeating_weapon_weapon_attack_type,o=+n.repeating_weapon_weapon_attack_type_flag;s!==o&&(e.repeating_weapon_weapon_attack_type_flag=s),setAttrs(e,{silent:!0})})});Ke=()=>{getAttrs(["hitpoints","hitpoints_max","sync_hp_flag","hitpoints_1_class","hitpoints_2_class","hitpoints_3_class"],r=>{let n={},e=+r.sync_hp_flag,s=+r.hitpoints_max||0,o=Math.max(0,+r.hitpoints_1_class||0),a=Math.max(0,+r.hitpoints_2_class||0),t=Math.max(0,+r.hitpoints_3_class||0),p=o!==0?1:0,c=a!==0?1:0,l=t!==0?1:0,u=p+c+l,h=q(o+a+t),m=T(h/u).toFixed(2);n.hitpoints_class_total=h,n.hp_quotient=u,n.hitpoints_total=m,n.hitpoints_max=e===1?q(m):s,setAttrs(n,{silent:!0})})};on("change:sync_hp_flag change:hitpoints change:hitpoints_max change:hitpoints_1_class change:hitpoints_2_class change:hitpoints_3_class",r=>{Ke()});V=r=>{getAttrs(["armorclass","armorclass_mod","armorclass_magic","armorbonus","armorbonus_toggle","armorbonus_inverted","unarmored_worn","armortype_worn","armortype2_worn","armorshield_worn","armorhelmet_worn","armorother_worn","armorother2_worn","armorother3_worn","armorother4_worn","armorother5_worn","armorother6_worn","unarmored_base","armortype_base","armortype2_base","armorshield_base","armorother_base","armorother2_base","armorother3_base","armorother4_base","armorother5_base","armorother6_base","unarmored_ac","armortype_ac","armortype2_ac","armorshield_ac","armorhelmet_ac","armorother_ac","armorother2_ac","armorother3_ac","armorother4_ac","armorother5_ac","armorother6_ac","armortype_magic","armortype2_magic","armorshield_magic","armorhelmet_magic","armorother_magic","armorother2_magic","armorother3_magic","armorother4_magic","armorother5_magic","armorother6_magic","armorshield_mod","armorother_mod","armorother2_mod","armorother3_mod","armorother4_mod","armorother5_mod","armorother6_mod","autocalc_ac","armor_rating_flag","current_encumbrance_move","sync_ac_flag"],n=>{if(+n.autocalc_ac+r===0)return;let s={},o=+n.armorclass,a=+n.sync_ac_flag,t=+n.armor_rating_flag,p=+n.armorshield_mod*-1||0,c=+n.armorother_mod*-1||0,l=+n.armorother2_mod*-1||0,u=+n.armorother3_mod*-1||0,h=+n.armorother4_mod*-1||0,m=+n.armorother5_mod*-1||0,w=+n.armorother6_mod*-1||0,A=+n.armortype_magic*-1||0,b=+n.armortype2_magic*-1||0,M=+n.armorshield_magic*-1||0,f=+n.armorhelmet_magic*-1||0,R=+n.armorother_magic*-1||0,$=+n.armorother2_magic*-1||0,P=+n.armorother3_magic*-1||0,U=+n.armorother4_magic*-1||0,oe=+n.armorother5_magic*-1||0,K=+n.armorother6_magic*-1||0,me=+n.unarmored_worn,ne=+n.armortype_worn,re=+n.armortype2_worn,Y=+n.armorshield_worn,Ce=+n.armorhelmet_worn,X=+n.armorother_worn,Q=+n.armorother2_worn,Z=+n.armorother3_worn,_e=+n.armorother4_worn,S=+n.armorother5_worn,J=+n.armorother6_worn,Ee=+n.current_encumbrance_move||0,le=+n.armorbonus_toggle||0,L=+n.armorbonus||0,he=0;Ee===3&&L<0?(le=0,L=0,he=1):L<0?L=+n.armorbonus*le||0:L=+n.armorbonus||0,s.encumbrance_flag=he;let ue=+n.unarmored_base,ge=+n.armortype_base,we=+n.armortype2_base,be=+n.armorshield_base,de=+n.armorother_base,qe=n.armorother2_base>=0?0:-Math.abs(n.armorother2_base)||0,G=n.armorother3_base>=0?0:-Math.abs(n.armorother3_base)||0,Ie=n.armorother4_base>=0?0:-Math.abs(n.armorother4_base)||0,se=n.armorother5_base>=0?0:-Math.abs(n.armorother5_base)||0,Oe=n.armorother6_base>=0?0:-Math.abs(n.armorother6_base)||0,fe=+n.unarmored_ac,fa=+n.armortype_ac,ya=+n.armortype2_ac,$a=+n.armorshield_ac,ka=+n.armorother_ac,Aa=n.armorother2_ac>=0?0:-Math.abs(n.armorother2_ac)||0,xa=n.armorother3_ac>=0?0:-Math.abs(n.armorother3_ac)||0,Sa=n.armorother4_ac>=0?0:-Math.abs(n.armorother4_ac)||0,Ma=n.armorother5_ac>=0?0:-Math.abs(n.armorother5_ac)||0,Da=n.armorother6_ac>=0?0:-Math.abs(n.armorother6_ac)||0,Xa=ne?ge:10,Qa=re?we:10,Za=Y?be:0,Ja=X?de:10,va=Q?qe:0,et=Z?G:0,at=_e?Ie:0,tt=S?se:0,ot=J?Oe:0,nt=me?ue:10,rt=ne?fa:10,_t=re?ya:10,Ca=Y?$a:0,st=X?ka:10,it=Q?Aa:0,pt=Z?xa:0,ct=_e?Sa:0,mt=S?Ma:0,lt=J?Da:0,ht=me?fe:10,ye=Y?p:0,$e=Y?M:0,ut=q(Math.min(ge,we,de,ue)+be+qe+G+Ie+se+Oe),gt=q(Math.min(fa,ya,ka,fe)+($a+Aa+xa+Sa+Ma+Da)),Ea=q(Math.min(Xa,Qa,Ja,nt)+(Za+va+et+at+tt+ot)),Ne=q(Math.min(rt,_t,st,ht)+(it+pt+ct+mt+lt)),Ia=q(A+b+f+R+$+P+U+oe+K+M),ie=q(ne*A+re*b+Ce*f+X*R+Q*$+Z*P+_e*U+S*oe+J*K),Oa=q(c+l+u+h+m+w+p)||0,pe=q(X*c+Q*l+Z*u+_e*h+S*m+J*w),Te=q(pe+ie),Re=q(Ne+pe+ie),Na=1;L>0&&Re>=10&&(Na=0);let Le=q(Re+L*Na),v=q(Ca+ye+$e),je=q(Le+v);L>0&&v>=10&&(je=q(Le+L+v));let wt=(-1*(ie+$e)<=0?"":"+")+-1*(ie+$e),bt=(-1*Ia<=0?"":"+")+-1*Ia,dt=(-1*(pe+ye)<=0?"":"+")+-1*(pe+ye),qt=(-1*Oa<=0?"":"+")+-1*Oa,ft=(-1*L<=0?"":"+")+-1*L,yt=(-1*Te<=0?"":"+")+-1*Te,$t=(-1*v<=0?"":"+")+-1*v;s.armorclass_rating_used=Ea,s.armorclass_rating=t===1?"-":Ea,s.armorclass_rating_best=ut,s.armorclass_base_used=Ne+Ca,s.armorclass_base=Ne,s.armorclass_base_best=gt,s.armorclass_magic=ie,s.armorclass_magic_with_shield=wt,s.armorclass_magic_total=bt,s.armorclass_mod=pe,s.armorclass_mod_with_shield=dt,s.armorclass_mod_total=qt,s.armorclass_combined_mod_magic=Te,s.armorclass_combined_mod_magic_inverted=yt,s.armorclass_rear=Re,s.armorbonus_inverted=ft,s.armorclass_shieldless=Le,s.armorclass_shield_magic=$e,s.armorclass_shield_mod=ye,s.armorclass_combined_shield_mod_magic=v,s.armorclass_combined_shield_mod_magic_inverted=$t,s.armorclass_total=je,s.armorclass=a?je:o,setAttrs(s,{silent:!0})})};on("change:armor_details_show change:armor_rating_flag change:sync_ac_flag change:autocalc_ac change:unarmored change:armortype change:armortype2 change:armorshield change:armorhelmet change:armorother change:armorother2 change:armorother3 change:armorother4 change:armorother5 change:armorother6 change:armorclass_mod change:armorclass_magic change:armorbonus change:armorbonus_toggle change:unarmored_worn change:armortype_worn change:armortype2_worn change:armorshield_worn change:armorhelmet_worn change:armorother_worn change:armorother2_worn change:armorother3_worn change:armorother4_worn change:armorother5_worn change:armorother6_worn change:armortype_base change:armortype2_base change:armorshield_base change:armorother_base change:armorother2_base change:armorother3_base change:armorother4_base change:armorother5_base change:armorother6_base change:unarmored_base change:armortype_ac change:armortype2_ac change:armorshield_ac change:armorhelmet_ac change:armorother_ac change:armorother2_ac change:armorother3_ac change:armorother4_ac change:armorother5_ac change:armorother6_ac change:unarmored_ac change:armorshield_mod change:armorother_mod change:armorother2_mod change:armorother3_mod change:armorother4_mod change:armorother5_mod change:armorother6_mod change:armortype_magic change:armortype2_magic change:armorshield_magic change:armorhelmet_magic change:armorother_magic change:armorother2_magic change:armorother3_magic change:armorother4_magic change:armorother5_magic change:armorother6_magic",r=>{V(0)});on("clicked:calcac",r=>{V(1)});Me=r=>{getAttrs(["toggle_auto_damage"],n=>{let e={},s=+n.toggle_auto_damage,o=`Damage vs S/M [[ (@{repeating_weapon_${r}_weapon_damagesmallmedium}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,a=` vs LG [[ (@{repeating_weapon_${r}_weapon_damagelarge}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,t=`Damage vs S/M [[ (@{repeating_weapon_${r}_weapon_damagesmallmedium}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,p=` vs LG [[ (@{repeating_weapon_${r}_weapon_damagelarge}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,c=`Damage vs S/M [[ (@{repeating_weapon_${r}_weapon_critdamagesmallmedium}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,l=` vs LG [[ (@{repeating_weapon_${r}_weapon_critdamagelarge}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`,u=`Damage vs S/M [[ (@{repeating_weapon_${r}_weapon_critdamagesmallmedium}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]}}`,h=` vs LG [[ (@{repeating_weapon_${r}_weapon_critdamagelarge}) * @{repeating_weapon_${r}_weapon_backstab_mult}[MULT] + ( @{repeating_weapon_${r}_weapon_attackdmgbonus}[DMG_BON] ) + ( @{repeating_weapon_${r}_weapon_magicbonus}[MAG_BON] ) + ( ?{Damage Modifier?|0}[MISC_MOD] ) ]]`;s===0?(e[`repeating_weapon_${r}_weapon_damagesmallmedium_chat_menu`]=`[Roll Damage](~@{character_id}|repeating_weapon_${r}_weapon_damagesmallmedium_roll)`,e[`repeating_weapon_${r}_weapon_damagelarge_chat_menu`]=`[Roll Damage vs LG](~@{character_id}|repeating_weapon_${r}_weapon_damagelarge_roll)`,e[`repeating_weapon_${r}_weapon_damagesmallmedium_npc_chat_menu`]=`[Damage](~@{character_id}|repeating_weapon_${r}_weapon_damagesmallmedium_npc_roll)`,e[`repeating_weapon_${r}_weapon_damagelarge_npc_chat_menu`]=`[Damage vs LG](~@{character_id}|repeating_weapon_${r}_weapon_damagelarge_npc_roll)`,e[`repeating_weapon_${r}_weapon_critdamagesmallmedium_chat_menu`]=`[Roll Damage](~@{character_id}|repeating_weapon_${r}_weapon_critdamagesmallmedium_roll)`,e[`repeating_weapon_${r}_weapon_critdamagelarge_chat_menu`]=`[Roll Damage vs LG](~@{character_id}|repeating_weapon_${r}_weapon_critdamagelarge_roll)`,e[`repeating_weapon_${r}_weapon_critdamagesmallmedium_npc_chat_menu`]=`[Damage](~@{character_id}|repeating_weapon_${r}_weapon_critdamagesmallmedium_npc_roll)`,e[`repeating_weapon_${r}_weapon_critdamagelarge_npc_chat_menu`]=`[Damage vs LG](~@{character_id}|repeating_weapon_${r}_weapon_critdamagelarge_npc_roll)`):(e[`repeating_weapon_${r}_weapon_damagesmallmedium_chat_menu`]=o,e[`repeating_weapon_${r}_weapon_damagelarge_chat_menu`]=a,e[`repeating_weapon_${r}_weapon_damagesmallmedium_npc_chat_menu`]=t,e[`repeating_weapon_${r}_weapon_damagelarge_npc_chat_menu`]=p,e[`repeating_weapon_${r}_weapon_critdamagesmallmedium_chat_menu`]=c,e[`repeating_weapon_${r}_weapon_critdamagelarge_chat_menu`]=l,e[`repeating_weapon_${r}_weapon_critdamagesmallmedium_npc_chat_menu`]=u,e[`repeating_weapon_${r}_weapon_critdamagelarge_npc_chat_menu`]=h),setAttrs(e,{silent:!0})})};on("change:repeating_weapon:weapon_name change:repeating_weapon:weapon_damagesmallmedium change:repeating_weapon:weapon_damagelarge change:repeating_weapon:weapon_critdamagesmallmedium change:repeating_weapon:weapon_critdamagelarge change:repeating_weapon:weapon_attackdmgbonus change:repeating_weapon:weapon_critdamage_flag",r=>{let n=r.sourceAttribute.split("_")[2];Me(n)});on("change:toggle_critdamage",r=>{getSectionIDs("repeating_weapon",n=>{let e={},s=[];_.each(n,o=>{s.push(i("weapon",o,"weapon_critdamage_flag"))}),getAttrs(s,o=>{n.forEach(a=>{let t=+o[i("weapon",a,"weapon_critdamage_flag")];e[i("weapon",a,"weapon_critdamage_flag")]=1-t}),setAttrs(e)})})});on("change:toggle_auto_damage change:toggle_critdamage",r=>{g(`Change Detected:${r.sourceAttribute}`),getSectionIDs("repeating_weapon",n=>{let e=[];getAttrs(e,s=>{n.forEach(o=>{Me(o)})})})});function za(r){let n={},e=[i("weapon",r,"weapon_use"),i("weapon",r,"weapon_attack_type"),i("weapon",r,"weapon_attack_type_flag"),i("weapon",r,"weapon_critdamage_flag"),i("weapon",r,"weapon_prof_pen"),i("weapon",r,"weapon_range_error"),i("weapon",r,"weapon_tohitacadj"),i("weapon",r,"weapon_dual"),i("weapon",r,"weapon_whisper_to_hit"),i("weapon",r,"weapon_whisper_to_hit_select"),i("weapon",r,"weapon_dual_pen"),i("weapon",r,"weapon_backstab_var"),i("weapon",r,"weapon_tohitbonus"),i("weapon",r,"weapon_magicbonus"),i("weapon",r,"weapon_prof"),i("weapon",r,"weapon_backstab"),i("weapon",r,"weapon_backstab_bonus"),i("weapon",r,"weapon_backstab_mult"),i("weapon",r,"weapon_attackdmgbonus"),i("weapon",r,"weapon_num_attacks"),i("weapon",r,"weapon_quantity"),i("weapon",r,"weapon_ammo"),i("weapon",r,"weapon_ammo_max"),i("weapon",r,"weapon_weight"),i("weapon",r,"weapon_cost"),i("weapon",r,"weapon_range_short"),i("weapon",r,"weapon_range_medium"),i("weapon",r,"weapon_range_long"),i("weapon",r,"weapon_length"),i("weapon",r,"weapon_space"),i("weapon",r,"weapon_speed"),i("weapon",r,"weapon_misc"),i("weapon",r,"weapon_thac_adj0"),i("weapon",r,"weapon_thac_adj1"),i("weapon",r,"weapon_thac_adj2"),i("weapon",r,"weapon_thac_adj3"),i("weapon",r,"weapon_thac_adj4"),i("weapon",r,"weapon_thac_adj5"),i("weapon",r,"weapon_thac_adj6"),i("weapon",r,"weapon_thac_adj7"),i("weapon",r,"weapon_thac_adj8"),i("weapon",r,"weapon_thac_adj9"),i("weapon",r,"weapon_thac_adj10"),i("weapon",r,"weapon_macro_text"),i("weapon",r,"weapon_damagesmallmedium_chat_menu"),i("weapon",r,"weapon_damagelarge_chat_menu"),i("weapon",r,"weapon_damagesmallmedium_npc_chat_menu"),i("weapon",r,"weapon_damagelarge_npc_chat_menu"),i("weapon",r,"weapon_critdamagesmallmedium_chat_menu"),i("weapon",r,"weapon_critdamagelarge_chat_menu"),i("weapon",r,"weapon_critdamagesmallmedium_npc_chat_menu"),i("weapon",r,"weapon_critdamagelarge_npc_chat_menu"),i("weapon",r,"weapon_damage_chat_menu_npc")];getAttrs(e,s=>{n.repeating_weapon_weapon_use=+s[i("weapon",r,"weapon_use")],n.repeating_weapon_weapon_attack_type_flag=+s[i("weapon",r,"weapon_attack_type_flag")],n.repeating_weapon_weapon_critdamage_flag=+s[i("weapon",r,"weapon_critdamage_flag")],n.repeating_weapon_weapon_prof_pen=+s[i("weapon",r,"weapon_prof_pen")],n.repeating_weapon_weapon_range_error=+s[i("weapon",r,"weapon_range_error")],n.repeating_weapon_weapon_tohitacadj=+s[i("weapon",r,"weapon_tohitacadj")],n.repeating_weapon_weapon_attack_type=+s[i("weapon",r,"weapon_attack_type")],n.repeating_weapon_weapon_dual=s[i("weapon",r,"weapon_dual")],n.repeating_weapon_weapon_whisper_to_hit=s[i("weapon",r,"weapon_whisper_to_hit")],n.repeating_weapon_weapon_whisper_to_hit_select=+s[i("weapon",r,"weapon_whisper_to_hit_select")],n.repeating_weapon_weapon_dual_pen=+s[i("weapon",r,"weapon_dual_pen")],n.repeating_weapon_weapon_backstab_var=+s[i("weapon",r,"weapon_backstab_var")],n.repeating_weapon_weapon_tohitbonus=+s[i("weapon",r,"weapon_tohitbonus")],n.repeating_weapon_weapon_magicbonus=+s[i("weapon",r,"weapon_magicbonus")],n.repeating_weapon_weapon_prof=+s[i("weapon",r,"weapon_prof")],n.repeating_weapon_weapon_backstab=+s[i("weapon",r,"weapon_backstab")],n.repeating_weapon_weapon_backstab_bonus=+s[i("weapon",r,"weapon_backstab_bonus")],n.repeating_weapon_weapon_backstab_mult=+s[i("weapon",r,"weapon_backstab_mult")],n.repeating_weapon_weapon_attackdmgbonus=+s[i("weapon",r,"weapon_attackdmgbonus")],n.repeating_weapon_weapon_num_attacks=+s[i("weapon",r,"weapon_num_attacks")],n.repeating_weapon_weapon_quantity=+s[i("weapon",r,"weapon_quantity")],n.repeating_weapon_weapon_ammo=+s[i("weapon",r,"weapon_ammo")],n.repeating_weapon_weapon_ammo_max=+s[i("weapon",r,"weapon_ammo_max")],n.repeating_weapon_weapon_weight=+s[i("weapon",r,"weapon_weight")],n.repeating_weapon_weapon_cost=+s[i("weapon",r,"weapon_cost")],n.repeating_weapon_weapon_range_short=+s[i("weapon",r,"weapon_range_short")],n.repeating_weapon_weapon_range_medium=+s[i("weapon",r,"weapon_range_medium")],n.repeating_weapon_weapon_range_long=+s[i("weapon",r,"weapon_range_long")],n.repeating_weapon_weapon_length=s[i("weapon",r,"weapon_length")],n.repeating_weapon_weapon_space=s[i("weapon",r,"weapon_space")],n.repeating_weapon_weapon_speed=s[i("weapon",r,"weapon_speed")],n.repeating_weapon_weapon_misc=s[i("weapon",r,"weapon_misc")],n.repeating_weapon_weapon_thac_adj0=+s[i("weapon",r,"weapon_thac_adj0")],n.repeating_weapon_weapon_thac_adj1=+s[i("weapon",r,"weapon_thac_adj1")],n.repeating_weapon_weapon_thac_adj2=+s[i("weapon",r,"weapon_thac_adj2")],n.repeating_weapon_weapon_thac_adj3=+s[i("weapon",r,"weapon_thac_adj3")],n.repeating_weapon_weapon_thac_adj4=+s[i("weapon",r,"weapon_thac_adj4")],n.repeating_weapon_weapon_thac_adj5=+s[i("weapon",r,"weapon_thac_adj5")],n.repeating_weapon_weapon_thac_adj6=+s[i("weapon",r,"weapon_thac_adj6")],n.repeating_weapon_weapon_thac_adj7=+s[i("weapon",r,"weapon_thac_adj7")],n.repeating_weapon_weapon_thac_adj8=+s[i("weapon",r,"weapon_thac_adj8")],n.repeating_weapon_weapon_thac_adj9=+s[i("weapon",r,"weapon_thac_adj9")],n.repeating_weapon_weapon_thac_adj10=+s[i("weapon",r,"weapon_thac_adj10")],n.repeating_weapon_weapon_macro_text=s[i("weapon",r,"weapon_macro_text")],n.repeating_weapon_weapon_damagesmallmedium_chat_menu=s[i("weapon",r,"weapon_damagesmallmedium_chat_menu")],n.repeating_weapon_weapon_damagelarge_chat_menu=s[i("weapon",r,"weapon_damagelarge_chat_menu")],n.repeating_weapon_weapon_damagesmallmedium_npc_chat_menu=s[i("weapon",r,"weapon_damagesmallmedium_npc_chat_menu")],n.repeating_weapon_weapon_damagelarge_npc_chat_menu=s[i("weapon",r,"weapon_damagelarge_npc_chat_menu")],n.repeating_weapon_weapon_critdamagesmallmedium_chat_menu=s[i("weapon",r,"weapon_critdamagesmallmedium_chat_menu")],n.repeating_weapon_weapon_critdamagelarge_chat_menu=s[i("weapon",r,"weapon_critdamagelarge_chat_menu")],n.repeating_weapon_weapon_critdamagesmallmedium_npc_chat_menu=s[i("weapon",r,"weapon_critdamagesmallmedium_npc_chat_menu")],n.repeating_weapon_weapon_critdamagelarge_npc_chat_menu=s[i("weapon",r,"weapon_critdamagelarge_npc_chat_menu")],n.repeating_weapon_weapon_damage_chat_menu_npc=s[i("weapon",r,"weapon_damage_chat_menu_npc")],setAttrs(n,{silent:!0})})}function uo(r){let n={},e=["equipment_tabs_type","equipment_tabs_carry"],s=[i("equipment",r,"equipment_type"),i("equipment",r,"equipment_magical"),i("equipment",r,"equipment_show_type"),i("equipment",r,"equipment_show_carry"),i("equipment",r,"equipment_current"),i("equipment",r,"equipment_current_max"),i("equipment",r,"equipment_carried_select"),i("equipment",r,"equipment_carried"),i("equipment",r,"equipment_quantity"),i("equipment",r,"equipment_quantity_max"),i("equipment",r,"equipment_weight"),i("equipment",r,"equipment_cost"),i("equipment",r,"equipment_armor_type"),i("equipment",r,"equipment_armor_worn"),i("equipment",r,"equipment_armor_ac"),i("equipment",r,"equipment_armor_base"),i("equipment",r,"equipment_armor_magic"),i("equipment",r,"equipment_armor_mod"),i("equipment",r,"equipment_armor_bulk"),i("equipment",r,"equipment_macro_text"),i("equipment",r,"equipment_weapon_type"),i("equipment",r,"equipment_weapon_speed"),i("equipment",r,"equipment_weapon_misc"),i("equipment",r,"equipment_weapon_length"),i("equipment",r,"equipment_weapon_space"),i("equipment",r,"equipment_weapon_damagesmallmedium"),i("equipment",r,"equipment_weapon_damagelarge"),i("equipment",r,"equipment_weapon_attackdmgtype"),i("equipment",r,"equipment_weapon_rateoffire"),i("equipment",r,"equipment_weapon_range")],o=[...e,...s];getAttrs(o,a=>{let t=+a.equipment_tabs_type,p=+a[i("equipment",r,"equipment_type")];n.repeating_equipment_equipment_type=p<=0||t===-1?0:p,n.repeating_equipment_equipment_magical=+a[i("equipment",r,"equipment_magical")],n.repeating_equipment_equipment_show_type=+a[i("equipment",r,"equipment_show_type")],n.repeating_equipment_equipment_current=+a[i("equipment",r,"equipment_current")],n.repeating_equipment_equipment_current_max=+a[i("equipment",r,"equipment_current_max")],n.repeating_equipment_equipment_carried_select=+a[i("equipment",r,"equipment_carried_select")],n.repeating_equipment_equipment_carried=+a[i("equipment",r,"equipment_carried")],n.repeating_equipment_equipment_quantity=+a[i("equipment",r,"equipment_quantity")],n.repeating_equipment_equipment_quantity_max=+a[i("equipment",r,"equipment_quantity_max")],n.repeating_equipment_equipment_weight=+a[i("equipment",r,"equipment_weight")],n.repeating_equipment_equipment_cost=+a[i("equipment",r,"equipment_cost")],n.repeating_equipment_equipment_armor_type=+a[i("equipment",r,"equipment_armor_type")],n.repeating_equipment_equipment_armor_worn=+a[i("equipment",r,"equipment_armor_worn")],n.repeating_equipment_equipment_armor_ac=+a[i("equipment",r,"equipment_armor_ac")],n.repeating_equipment_equipment_armor_base=+a[i("equipment",r,"equipment_armor_base")],n.repeating_equipment_equipment_armor_magic=+a[i("equipment",r,"equipment_armor_magic")],n.repeating_equipment_equipment_armor_mod=+a[i("equipment",r,"equipment_armor_mod")],n.repeating_equipment_equipment_armor_bulk=+a[i("equipment",r,"equipment_armor_bulk")],n.repeating_equipment_equipment_macro_text=a[i("equipment",r,"equipment_macro_text")],n.repeating_equipment_equipment_weapon_type=+a[i("equipment",r,"equipment_weapon_type")],n.repeating_equipment_equipment_weapon_speed=a[i("equipment",r,"equipment_weapon_speed")],n.repeating_equipment_equipment_weapon_misc=a[i("equipment",r,"equipment_weapon_misc")],n.repeating_equipment_equipment_weapon_length=a[i("equipment",r,"equipment_weapon_length")],n.repeating_equipment_equipment_weapon_space=a[i("equipment",r,"equipment_weapon_space")],n.repeating_equipment_equipment_weapon_damagesmallmedium=a[i("equipment",r,"equipment_weapon_damagesmallmedium")],n.repeating_equipment_equipment_weapon_damagelarge=a[i("equipment",r,"equipment_weapon_damagelarge")],n.repeating_equipment_equipment_weapon_attackdmgtype=a[i("equipment",r,"equipment_weapon_attackdmgtype")],n.repeating_equipment_equipment_weapon_rateoffire=a[i("equipment",r,"equipment_weapon_rateoffire")],n.repeating_equipment_equipment_weapon_range=a[i("equipment",r,"equipment_weapon_range")],setAttrs(n,{silent:!0})})}function go(r){let n={},e=[i("nonweaponproficiencies",r,"nwp_attribute"),i("nonweaponproficiencies",r,"nwp_slots"),i("nonweaponproficiencies",r,"nwp_modifier"),i("nonweaponproficiencies",r,"nwp_macro_text")];getAttrs(e,s=>{n.repeating_nonweaponproficiencies_attribute=+s[i("nonweaponproficiencies",r,"nwp_attribute")],n.repeating_nonweaponproficiencies_slots=+s[i("nonweaponproficiencies",r,"nwp_slots")],n.repeating_nonweaponproficiencies_modifier=+s[i("nonweaponproficiencies",r,"nwp_modifier")],n.repeating_nonweaponproficiencies_macro_text=s[i("nonweaponproficiencies",r,"nwp_macro_text")],setAttrs(n,{silent:!0})})}on("change:repeating_weapon:weapon_name change:repeating_equipment:equipment_item change:repeating_nonweaponproficiencies:nwp_name",r=>{let n=r.sourceAttribute.split("_")[2];r.sourceType==="player"&&r.previousValue===void 0&&(r.sourceAttribute.includes("equipment_item")&&uo(n),r.sourceAttribute.includes("weapon_name")&&za(n),r.sourceAttribute.includes("nwp_name")&&go(n))});on("sheet:opened",r=>{getSectionIDs("repeating_weapon",n=>{getSectionIDs("repeating_ability",e=>{getSectionIDs("repeating_nonweaponproficiencies",s=>{getSectionIDs("repeating_equipment",o=>{getSectionIDs("repeating_spells",a=>{let t={},p=n.length,c=e.length,l=s.length,u=o.length,h=a.length;if(p===0){let m=k();t[`repeating_weapon_${m}_weapon_value`]=1}if(c===0){let m=k();t[`repeating_ability_${m}_ability_value`]=1}if(l===0){let m=k();t[`repeating_nonweaponproficiencies_${m}_nwp_value`]=1}if(u===0){let m=k();t[`repeating_equipment_${m}_equipment_value`]=1}if(h===0){let m=k();t[`repeating_spells_${m}_spell_value`]=1}else return;setAttrs(t,{silent:!0})})})})})})});on("clicked:resetallmacros clicked:resetequipmentmacros clicked:resetweaponsmacros clicked:resetabilitiesmacros clicked:resetnwpsmacros clicked:resetspellsmacros",r=>{let e=r.triggerName.match(/clicked:(\w+)/),s=e?e[1]:null;getSectionIDs("repeating_equipment",o=>{getSectionIDs("repeating_weapon",a=>{getSectionIDs("repeating_ability",t=>{getSectionIDs("repeating_nonweaponproficiencies",p=>{getSectionIDs("repeating_spells",c=>{let l={},u=[],h=[],m=[],w=[],A=[];_.each(o,b=>{u.push(`repeating_equipment_${b}_equipment_macro_text`)}),_.each(a,b=>{h.push(`repeating_weapon_${b}_weapon_macro_text`)}),_.each(t,b=>{m.push(`repeating_ability_${b}_ability_macro_text`)}),_.each(p,b=>{w.push(`repeating_nonweaponproficiencies_${b}_nwp_macro_text`)}),_.each(c,b=>{A.push(`repeating_spells_${b}_spell_macro_text`)}),s==="resetallmacros"&&(l.surprise_macro_text="",l.surprise_others_macro_text="",l.init_macro_text="",_.each(o,b=>{l[`repeating_equipment_${b}_equipment_macro_text`]=""}),_.each(a,b=>{l[`repeating_weapon_${b}_weapon_macro_text`]=""}),_.each(t,b=>{l[`repeating_ability_${b}_ability_macro_text`]=""}),_.each(p,b=>{l[`repeating_nonweaponproficiencies_${b}_nwp_macro_text`]=""}),_.each(c,b=>{l[`repeating_spells_${b}_spell_macro_text`]=""})),s==="resetequipmentmacros"&&_.each(o,b=>{l[`repeating_equipment_${b}_equipment_macro_text`]=""}),s==="resetweaponsmacros"&&_.each(a,b=>{l[`repeating_weapon_${b}_weapon_macro_text`]=""}),s==="resetabilitiesmacros"&&_.each(t,b=>{l[`repeating_ability_${b}_ability_macro_text`]=""}),s==="resetnwpsmacros"&&_.each(p,b=>{l[`repeating_nonweaponproficiencies_${b}_nwp_macro_text`]=""}),s==="resetspellsmacros"&&_.each(c,b=>{l[`repeating_spells_${b}_spell_macro_text`]=""}),setAttrs(l,{silent:!0})})})})})})});na=r=>{getAttrs(["pickpockets","pickpockets_base","pickpockets_racial_mod","pickpockets_ability_mod","pickpockets_magic"],n=>{let e={},s=+n.pickpockets_base||0,o=+n.pickpockets_racial_mod||0,a=+n.pickpockets_ability_mod||0,t=+n.pickpockets_magic||0,p=+n.pickpockets||0,c=Math.max(0,q(s+o+a+t));r===1&&p>=0&&c===0?e.pickpockets_base=p:e.pickpockets=c,setAttrs(e,{silent:!0})})};oa=r=>{getAttrs(["openlocks","openlocks_base","openlocks_racial_mod","openlocks_ability_mod","openlocks_magic"],n=>{let e={},s=+n.openlocks_base||0,o=+n.openlocks_racial_mod||0,a=+n.openlocks_ability_mod||0,t=+n.openlocks_magic||0,p=+n.openlocks||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.openlocks_base=p:e.openlocks=c,setAttrs(e,{silent:!0})})};Je=r=>{getAttrs(["findtraps","findtraps_base","findtraps_racial_mod","findtraps_ability_mod","findtraps_magic"],n=>{let e={},s=+n.findtraps_base||0,o=+n.findtraps_racial_mod||0,a=+n.findtraps_ability_mod||0,t=+n.findtraps_magic||0,p=+n.findtraps||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.findtraps_base=p:e.findtraps=c,setAttrs(e,{silent:!0})})};ta=r=>{getAttrs(["movequietly","movequietly_base","movequietly_racial_mod","movequietly_ability_mod","movequietly_magic"],n=>{let e={},s=+n.movequietly_base||0,o=+n.movequietly_racial_mod||0,a=+n.movequietly_ability_mod||0,t=+n.movequietly_magic||0,p=+n.movequietly||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.movequietly_base=p:e.movequietly=c,setAttrs(e,{silent:!0})})};ea=r=>{getAttrs(["hideinshadows","hideinshadows_base","hideinshadows_racial_mod","hideinshadows_ability_mod","hideinshadows_magic"],n=>{let e={},s=+n.hideinshadows_base||0,o=+n.hideinshadows_racial_mod||0,a=+n.hideinshadows_ability_mod||0,t=+n.hideinshadows_magic||0,p=+n.hideinshadows||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.hideinshadows_base=p:e.hideinshadows=c,setAttrs(e,{silent:!0})})};ve=r=>{getAttrs(["hearnoise","hearnoise_base","hearnoise_racial_mod","hearnoise_ability_mod","hearnoise_magic"],n=>{let e={},s=+n.hearnoise_base||0,o=+n.hearnoise_racial_mod||0,a=+n.hearnoise_ability_mod||0,t=+n.hearnoise_magic||0,p=+n.hearnoise||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.hearnoise_base=p:e.hearnoise=c,setAttrs(e,{silent:!0})})};Xe=r=>{getAttrs(["climbwalls","climbwalls_base","climbwalls_racial_mod","climbwalls_ability_mod","climbwalls_magic"],n=>{let e={},s=+n.climbwalls_base||0;s=s>=99.1?s.toFixed(1):Math.floor(s);let o=+n.climbwalls_racial_mod||0,a=+n.climbwalls_ability_mod||0,t=+n.climbwalls_magic||0,p=+n.climbwalls||0,c=Math.max(0,Math.min(100,s+q(o+a+t))),l="@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Climb Walls}} {{roll_low=[[ 1d100 ]]%}} {{roll_target=[[ @{climbwalls} ]]%}}",u="@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Climb Walls}} {{roll_low=[[ 1d100 + [[1d10/10]] ]]%}} {{roll_target=[[ @{climbwalls} ]]%}}";r===1?p>=0&&c===0?e.climbwalls_base=p:e.climbwalls=c:(e.climbwalls=c,e.climbwalls_macro_text=c>=99.1?u:l),setAttrs(e,{silent:!0})})};ra=r=>{getAttrs(["readlanguages","readlanguages_base","readlanguages_racial_mod","readlanguages_ability_mod","readlanguages_magic"],n=>{let e={},s=+n.readlanguages_base||0,o=+n.readlanguages_racial_mod||0,a=+n.readlanguages_ability_mod||0,t=+n.readlanguages_magic||0,p=+n.readlanguages||0,c=Math.max(0,Math.min(100,q(s+o+a+t)));r===1&&p>=0&&c===0?e.readlanguages_base=p:e.readlanguages=c,setAttrs(e,{silent:!0})})};ga=()=>{getAttrs(["thiefmisc","thiefmisc_base","thiefmisc_racial_mod","thiefmisc_ability_mod","thiefmisc_magic"],r=>{let n={},e=+r.thiefmisc_base||0,s=+r.thiefmisc_racial_mod||0,o=+r.thiefmisc_ability_mod||0,a=+r.thiefmisc_magic||0,t=Math.max(0,Math.min(100,q(e+s+o+a)));n.thiefmisc=t,setAttrs(n,{silent:!0})})};ha=()=>{getAttrs(["thiefmisc1","thiefmisc1_base","thiefmisc1_racial_mod","thiefmisc1_ability_mod","thiefmisc1_magic"],r=>{let n={},e=+r.thiefmisc1_base||0,s=+r.thiefmisc1_racial_mod||0,o=+r.thiefmisc1_ability_mod||0,a=+r.thiefmisc1_magic||0,t=Math.max(0,Math.min(100,q(e+s+o+a)));n.thiefmisc1=t,setAttrs(n,{silent:!0})})};ua=()=>{getAttrs(["thiefmisc2","thiefmisc2_base","thiefmisc2_racial_mod","thiefmisc2_ability_mod","thiefmisc2_magic"],r=>{let n={},e=+r.thiefmisc2_base||0,s=+r.thiefmisc2_racial_mod||0,o=+r.thiefmisc2_ability_mod||0,a=+r.thiefmisc2_magic||0,t=Math.max(0,Math.min(100,q(e+s+o+a)));n.thiefmisc2=t,setAttrs(n,{silent:!0})})};on("change:pickpockets_base change:pickpockets_racial_mod change:pickpockets_ability_mod change:pickpockets_magic",r=>{na()});on("change:openlocks_base change:openlocks_racial_mod change:openlocks_ability_mod change:openlocks_magic",r=>{oa()});on("change:findtraps_base change:findtraps_racial_mod change:findtraps_ability_mod change:findtraps_magic",r=>{Je()});on("change:movequietly_base change:movequietly_racial_mod change:movequietly_ability_mod change:movequietly_magic",r=>{ta()});on("change:hideinshadows_base change:hideinshadows_racial_mod change:hideinshadows_ability_mod change:hideinshadows_magic",r=>{ea()});on("change:hearnoise_base change:hearnoise_racial_mod change:hearnoise_ability_mod change:hearnoise_magic",r=>{ve()});on("change:climbwalls_base change:climbwalls_racial_mod change:climbwalls_ability_mod change:climbwalls_magic",r=>{Xe()});on("change:readlanguages_base change:readlanguages_racial_mod change:readlanguages_ability_mod change:readlanguages_magic",r=>{ra()});on("change:thiefmisc_base change:thiefmisc_racial_mod change:thiefmisc_ability_mod change:thiefmisc_magic",r=>{ga()});on("change:thiefmisc1_base change:thiefmisc1_racial_mod change:thiefmisc1_ability_mod change:thiefmisc1_magic",r=>{ha()});on("change:thiefmisc2_base change:thiefmisc2_racial_mod change:thiefmisc2_ability_mod change:thiefmisc2_magic",r=>{ua()});on("change:thief_level change:autofill_thief change:sync_thief_class change:thief_class_selected change:class change:secondclass change:thirdclass change:level change:level_2 change:level_3",r=>{getAttrs(["thief_level","autofill_thief","sync_thief_class","thief_class_selected","class","secondclass","thirdclass","level","level_2","level_3"],n=>{let e={},s=+n.autofill_thief,o=+n.sync_thief_class;if(!s)return;let a=+n.thief_class_selected,t=+n.thief_level||0,p=(n.class||"").trim(),c=(n.secondclass||"").trim(),l=(n.thirdclass||"").trim(),u=h=>{h===0&&(e.pickpockets_base=0,e.openlocks_base=0,e.findtraps_base=0,e.movequietly_base=0,e.hideinshadows_base=0,e.hearnoise_base=0,e.climbwalls_base=0,e.readlanguages_base=0),h===1&&(e.pickpockets_base=30,e.openlocks_base=25,e.findtraps_base=20,e.movequietly_base=15,e.hideinshadows_base=10,e.hearnoise_base=10,e.climbwalls_base=85,e.readlanguages_base=0),h===2&&(e.pickpockets_base=35,e.openlocks_base=29,e.findtraps_base=25,e.movequietly_base=21,e.hideinshadows_base=15,e.hearnoise_base=10,e.climbwalls_base=86,e.readlanguages_base=0),h===3&&(e.pickpockets_base=40,e.openlocks_base=33,e.findtraps_base=30,e.movequietly_base=27,e.hideinshadows_base=20,e.hearnoise_base=15,e.climbwalls_base=87,e.readlanguages_base=0),h===4&&(e.pickpockets_base=45,e.openlocks_base=37,e.findtraps_base=35,e.movequietly_base=33,e.hideinshadows_base=25,e.hearnoise_base=15,e.climbwalls_base=88,e.readlanguages_base=20),h===5&&(e.pickpockets_base=50,e.openlocks_base=42,e.findtraps_base=40,e.movequietly_base=40,e.hideinshadows_base=31,e.hearnoise_base=20,e.climbwalls_base=90,e.readlanguages_base=25),h===6&&(e.pickpockets_base=55,e.openlocks_base=47,e.findtraps_base=45,e.movequietly_base=47,e.hideinshadows_base=37,e.hearnoise_base=20,e.climbwalls_base=92,e.readlanguages_base=30),h===7&&(e.pickpockets_base=60,e.openlocks_base=52,e.findtraps_base=50,e.movequietly_base=55,e.hideinshadows_base=43,e.hearnoise_base=25,e.climbwalls_base=94,e.readlanguages_base=35),h===8&&(e.pickpockets_base=65,e.openlocks_base=57,e.findtraps_base=55,e.movequietly_base=62,e.hideinshadows_base=49,e.hearnoise_base=25,e.climbwalls_base=96,e.readlanguages_base=40),h===9&&(e.pickpockets_base=70,e.openlocks_base=62,e.findtraps_base=60,e.movequietly_base=70,e.hideinshadows_base=56,e.hearnoise_base=30,e.climbwalls_base=98,e.readlanguages_base=45),h===10&&(e.pickpockets_base=80,e.openlocks_base=67,e.findtraps_base=65,e.movequietly_base=78,e.hideinshadows_base=63,e.hearnoise_base=30,e.climbwalls_base=99,e.readlanguages_base=50),h===11&&(e.pickpockets_base=90,e.openlocks_base=72,e.findtraps_base=70,e.movequietly_base=86,e.hideinshadows_base=70,e.hearnoise_base=35,e.climbwalls_base=99.1,e.readlanguages_base=55),h===12&&(e.pickpockets_base=100,e.openlocks_base=77,e.findtraps_base=75,e.movequietly_base=94,e.hideinshadows_base=77,e.hearnoise_base=35,e.climbwalls_base=99.2,e.readlanguages_base=60),h===13&&(e.pickpockets_base=105,e.openlocks_base=82,e.findtraps_base=80,e.movequietly_base=99,e.hideinshadows_base=85,e.hearnoise_base=40,e.climbwalls_base=99.3,e.readlanguages_base=65),h===14&&(e.pickpockets_base=110,e.openlocks_base=87,e.findtraps_base=85,e.movequietly_base=99,e.hideinshadows_base=93,e.hearnoise_base=40,e.climbwalls_base=99.4,e.readlanguages_base=70),h===15&&(e.pickpockets_base=115,e.openlocks_base=92,e.findtraps_base=90,e.movequietly_base=99,e.hideinshadows_base=99,e.hearnoise_base=50,e.climbwalls_base=99.5,e.readlanguages_base=75),h===16&&(e.pickpockets_base=125,e.openlocks_base=97,e.findtraps_base=95,e.movequietly_base=99,e.hideinshadows_base=99,e.hearnoise_base=50,e.climbwalls_base=99.6,e.readlanguages_base=80),h===17&&(e.pickpockets_base=125,e.openlocks_base=99,e.findtraps_base=99,e.movequietly_base=99,e.hideinshadows_base=99,e.hearnoise_base=55,e.climbwalls_base=99.7,e.readlanguages_base=80),h>17&&(e.pickpockets_base=125,e.openlocks_base=99,e.findtraps_base=99,e.movequietly_base=99,e.hideinshadows_base=99,e.hearnoise_base=55,e.climbwalls_base=99.7,e.readlanguages_base=80)};o===1?a===1?(classSelected=te(p),t=+n.level,g(`Linked Class is: ${p} ${classSelected} Current Level:${n.level}`),e.thief_level=classSelected===4?t:0,u(t)):a===2?(classSelected=te(c),t=+n.level_2,g(`Linked Class is: ${c} ${classSelected} Current Level:${n.level_2}`),e.thief_level=classSelected===4?t:0,u(t)):a===3&&(classSelected=te(l),t=+n.level_3,g(`Linked Class is: ${l} ${classSelected} Current Level:${n.level_3}`),e.thief_level=classSelected===4?t:0,u(t)):u(t),setAttrs(e)})});sa=r=>{getAttrs(["saveparalysispoisondeath","saveparalysispoisondeath_base","saveparalysispoisondeath_racial_mod","saveparalysispoisondeath_ability_mod","saveparalysispoisondeath_misc_mod","saveparalysispoisondeath_temp_mod"],n=>{let e={},s=+n.saveparalysispoisondeath_base,o=+n.saveparalysispoisondeath_racial_mod,a=+n.saveparalysispoisondeath_ability_mod,t=+n.saveparalysispoisondeath_misc_mod,p=+n.saveparalysispoisondeath_temp_mod,c=+n.saveparalysispoisondeath||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.saveparalysispoisondeath_base=c:e.saveparalysispoisondeath=l,setAttrs(e,{silent:!0})})};ia=r=>{getAttrs(["savepetrificationpolymorph","savepetrificationpolymorph_base","savepetrificationpolymorph_racial_mod","savepetrificationpolymorph_ability_mod","savepetrificationpolymorph_misc_mod","savepetrificationpolymorph_temp_mod"],n=>{let e={},s=+n.savepetrificationpolymorph_base,o=+n.savepetrificationpolymorph_racial_mod,a=+n.savepetrificationpolymorph_ability_mod,t=+n.savepetrificationpolymorph_misc_mod,p=+n.savepetrificationpolymorph_temp_mod,c=+n.savepetrificationpolymorph||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.savepetrificationpolymorph_base=c:e.savepetrificationpolymorph=l,setAttrs(e,{silent:!0})})};pa=r=>{getAttrs(["saverodsstaveswands","saverodsstaveswands_base","saverodsstaveswands_racial_mod","saverodsstaveswands_ability_mod","saverodsstaveswands_misc_mod","saverodsstaveswands_temp_mod"],n=>{let e={},s=+n.saverodsstaveswands_base,o=+n.saverodsstaveswands_racial_mod,a=+n.saverodsstaveswands_ability_mod,t=+n.saverodsstaveswands_misc_mod,p=+n.saverodsstaveswands_temp_mod,c=+n.saverodsstaveswands||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.saverodsstaveswands_base=c:e.saverodsstaveswands=l,setAttrs(e,{silent:!0})})};_a=r=>{getAttrs(["savebreathweapons","savebreathweapons_base","savebreathweapons_racial_mod","savebreathweapons_ability_mod","savebreathweapons_misc_mod","savebreathweapons_temp_mod"],n=>{let e={},s=+n.savebreathweapons_base,o=+n.savebreathweapons_racial_mod,a=+n.savebreathweapons_ability_mod,t=+n.savebreathweapons_misc_mod,p=+n.savebreathweapons_temp_mod,c=+n.savebreathweapons||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.savebreathweapons_base=c:e.savebreathweapons=l,setAttrs(e,{silent:!0})})};ca=r=>{getAttrs(["savespells","savespells_base","savespells_racial_mod","savespells_ability_mod","savespells_misc_mod","savespells_temp_mod"],n=>{let e={},s=+n.savespells_base,o=+n.savespells_racial_mod,a=+n.savespells_ability_mod,t=+n.savespells_misc_mod,p=+n.savespells_temp_mod,c=+n.savespells||0,l=q(s+o+a+t+p);r===1&&c<=20&&l===20?e.savespells_base=c:e.savespells=l,setAttrs(e,{silent:!0})})};Wa=()=>{getAttrs(["savemisc","savemisc_base","savemisc_racial_mod","savemisc_ability_mod","savemisc_misc_mod","savemisc_temp_mod"],r=>{let n={},e=+r.savemisc_base,s=+r.savemisc_racial_mod,o=+r.savemisc_ability_mod,a=+r.savemisc_misc_mod,t=+r.savemisc_temp_mod,p=q(e+s+o+a+t);n.savemisc=p,setAttrs(n,{silent:!0})})};Ua=()=>{getAttrs(["savemisc1","savemisc1_base","savemisc1_racial_mod","savemisc1_ability_mod","savemisc1_misc_mod","savemisc1_temp_mod"],r=>{let n={},e=+r.savemisc1_base,s=+r.savemisc1_racial_mod,o=+r.savemisc1_ability_mod,a=+r.savemisc1_misc_mod,t=+r.savemisc1_temp_mod,p=q(e+s+o+a+t);n.savemisc1=p,setAttrs(n,{silent:!0})})};Ha=()=>{getAttrs(["savemisc2","savemisc2_base","savemisc2_racial_mod","savemisc2_ability_mod","savemisc2_misc_mod","savemisc2_temp_mod"],r=>{let n={},e=+r.savemisc2_base,s=+r.savemisc2_racial_mod,o=+r.savemisc2_ability_mod,a=+r.savemisc2_misc_mod,t=+r.savemisc2_temp_mod,p=q(e+s+o+a+t);n.savemisc2=p,setAttrs(n,{silent:!0})})};on("change:saveparalysispoisondeath_base change:saveparalysispoisondeath_racial_mod change:saveparalysispoisondeath_ability_mod change:saveparalysispoisondeath_misc_mod change:saveparalysispoisondeath_temp_mod",r=>{sa()});on("change:savepetrificationpolymorph_base change:savepetrificationpolymorph_racial_mod change:savepetrificationpolymorph_ability_mod change:savepetrificationpolymorph_misc_mod change:savepetrificationpolymorph_temp_mod",r=>{ia()});on("change:saverodsstaveswands_base change:saverodsstaveswands_racial_mod change:saverodsstaveswands_ability_mod change:saverodsstaveswands_misc_mod change:saverodsstaveswands_temp_mod",r=>{pa()});on("change:savebreathweapons_base change:savebreathweapons_racial_mod change:savebreathweapons_ability_mod change:savebreathweapons_misc_mod change:savebreathweapons_temp_mod",r=>{_a()});on("change:savespells_base change:savespells_racial_mod change:savespells_ability_mod change:savespells_misc_mod change:savespells_temp_mod",r=>{ca()});on("change:savemisc_base change:savemisc_racial_mod change:savemisc_ability_mod change:savemisc_misc_mod change:savemisc_temp_mod",r=>{Wa()});on("change:savemisc1_base change:savemisc1_racial_mod change:savemisc1_ability_mod change:savemisc1_misc_mod change:savemisc1_temp_mod",r=>{Ua()});on("change:savemisc2_base change:savemisc2_racial_mod change:savemisc2_ability_mod change:savemisc2_misc_mod change:savemisc2_temp_mod",r=>{Ha()});on("change:saves_class change:saves_level change:autofill_saves",r=>{g(`Saves Autofill Change Detected:${r.sourceAttribute}`),getAttrs(["saves_class","saves_level","autofill_saves"],n=>{let e={};if(!+n.autofill_saves)return;let o=+n.saves_class,a=+n.saves_level||0;g(`Class:${o} Level:${a}`),o!==0&&(o===1&&(a===0||(a<4?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=13,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<7?(e.saveparalysispoisondeath_base=9,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=13,e.savebreathweapons_base=15,e.savespells_base=14):a<10?(e.saveparalysispoisondeath_base=7,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=11,e.savebreathweapons_base=13,e.savespells_base=12):a<13?(e.saveparalysispoisondeath_base=6,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=10,e.savebreathweapons_base=12,e.savespells_base=11):a<16?(e.saveparalysispoisondeath_base=5,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=9,e.savebreathweapons_base=11,e.savespells_base=10):a<19?(e.saveparalysispoisondeath_base=4,e.savepetrificationpolymorph_base=7,e.saverodsstaveswands_base=8,e.savebreathweapons_base=10,e.savespells_base=9):a>=19&&(e.saveparalysispoisondeath_base=2,e.savepetrificationpolymorph_base=5,e.saverodsstaveswands_base=6,e.savebreathweapons_base=8,e.savespells_base=7))),o===2&&(a===0||(a<4?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=13,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<7?(e.saveparalysispoisondeath_base=9,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=13,e.savebreathweapons_base=15,e.savespells_base=14):a<10?(e.saveparalysispoisondeath_base=7,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=11,e.savebreathweapons_base=13,e.savespells_base=12):a<13?(e.saveparalysispoisondeath_base=6,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=10,e.savebreathweapons_base=12,e.savespells_base=11):(a<16||a>=16)&&(e.saveparalysispoisondeath_base=5,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=9,e.savebreathweapons_base=11,e.savespells_base=10))),(o===3||o===8)&&(a===0?(e.saveparalysispoisondeath_base=16,e.savepetrificationpolymorph_base=17,e.saverodsstaveswands_base=18,e.savebreathweapons_base=20,e.savespells_base=19):a<3?(e.saveparalysispoisondeath_base=14,e.savepetrificationpolymorph_base=15,e.saverodsstaveswands_base=16,e.savebreathweapons_base=17,e.savespells_base=17):a<5?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=14,e.saverodsstaveswands_base=15,e.savebreathweapons_base=16,e.savespells_base=16):a<7?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=13,e.savebreathweapons_base=13,e.savespells_base=14):a<9?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=12,e.savebreathweapons_base=12,e.savespells_base=13):a<11?(e.saveparalysispoisondeath_base=8,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=10,e.savebreathweapons_base=9,e.savespells_base=11):a<13?(e.saveparalysispoisondeath_base=7,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=9,e.savebreathweapons_base=8,e.savespells_base=10):a<15?(e.saveparalysispoisondeath_base=5,e.savepetrificationpolymorph_base=6,e.saverodsstaveswands_base=7,e.savebreathweapons_base=5,e.savespells_base=8):a<17?(e.saveparalysispoisondeath_base=4,e.savepetrificationpolymorph_base=5,e.saverodsstaveswands_base=6,e.savebreathweapons_base=4,e.savespells_base=7):a>=17&&(e.saveparalysispoisondeath_base=3,e.savepetrificationpolymorph_base=4,e.saverodsstaveswands_base=5,e.savebreathweapons_base=4,e.savespells_base=6)),o===4&&(a===0||(a<6?(e.saveparalysispoisondeath_base=14,e.savepetrificationpolymorph_base=13,e.saverodsstaveswands_base=11,e.savebreathweapons_base=15,e.savespells_base=12):a<11?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=9,e.savebreathweapons_base=13,e.savespells_base=10):a<16?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=7,e.savebreathweapons_base=11,e.savespells_base=8):a<21?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=7,e.saverodsstaveswands_base=5,e.savebreathweapons_base=9,e.savespells_base=6):a>=21&&(e.saveparalysispoisondeath_base=8,e.savepetrificationpolymorph_base=5,e.saverodsstaveswands_base=3,e.savebreathweapons_base=7,e.savespells_base=4))),o===5&&(a===0||(a<5?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<9?(e.saveparalysispoisondeath_base=12,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=12,e.savebreathweapons_base=15,e.savespells_base=13):a<13?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=10,e.savebreathweapons_base=14,e.savespells_base=11):a<17?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=8,e.savebreathweapons_base=13,e.savespells_base=9):a<21?(e.saveparalysispoisondeath_base=9,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=6,e.savebreathweapons_base=12,e.savespells_base=7):a>=21&&(e.saveparalysispoisondeath_base=8,e.savepetrificationpolymorph_base=7,e.saverodsstaveswands_base=4,e.savebreathweapons_base=11,e.savespells_base=5))),o===6&&(a===0||(a<5?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<9?(e.saveparalysispoisondeath_base=12,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=12,e.savebreathweapons_base=15,e.savespells_base=13):a<13?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=10,e.savebreathweapons_base=14,e.savespells_base=11):a<17?(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=8,e.savebreathweapons_base=13,e.savespells_base=9):a>=17&&(e.saveparalysispoisondeath_base=9,e.savepetrificationpolymorph_base=8,e.saverodsstaveswands_base=6,e.savebreathweapons_base=12,e.savespells_base=7))),o===7&&(a===0||(a<5?(e.saveparalysispoisondeath_base=13,e.savepetrificationpolymorph_base=12,e.saverodsstaveswands_base=14,e.savebreathweapons_base=16,e.savespells_base=15):a<9?(e.saveparalysispoisondeath_base=12,e.savepetrificationpolymorph_base=11,e.saverodsstaveswands_base=12,e.savebreathweapons_base=15,e.savespells_base=13):a<13?(e.saveparalysispoisondeath_base=11,e.savepetrificationpolymorph_base=10,e.saverodsstaveswands_base=10,e.savebreathweapons_base=14,e.savespells_base=11):(a<16||a>=16)&&(e.saveparalysispoisondeath_base=10,e.savepetrificationpolymorph_base=9,e.saverodsstaveswands_base=8,e.savebreathweapons_base=13,e.savespells_base=9))),setAttrs(e))})});on("change:matrix_class",r=>{getAttrs(["matrix_class"],n=>{let e={},s=+n.matrix_class;e.toggle_matrixhd=s===5?1:0,setAttrs(e,{silent:!0})})});function te(r){let n=r.trim().toLowerCase();return/cleric|druid|monk/.test(n)?1:/fighter|paladin|ranger|bard|cavalier|barbarian/.test(n)?2:/magic-user|illusionist|magic|mage|wizard/.test(n)?3:/thief|assassin|rogue|thief-acrobat|acrobat/.test(n)?4:99}function Ka(){getAttrs(["thac00","autofill_matrix"],r=>{let n={};if(!+r.autofill_matrix)return;let s=+r.thac00;n["thac0-10"]=s+10,n["thac0-9"]=s+9,n["thac0-8"]=s+8,n["thac0-7"]=s+7,n["thac0-6"]=s+6,n["thac0-5"]=s+5,n["thac0-4"]=s+4,n["thac0-3"]=s+3,n["thac0-2"]=s+2,n["thac0-1"]=s+1,n.thac01=s-1,n.thac02=s-2,n.thac03=s-3,n.thac04=s-4,n.thac05=s-5,n.thac06=s-6,n.thac07=s-7,n.thac08=s-8,n.thac09=s-9,n.thac010=s-10,setAttrs(n,{silent:!0})})}on("change:matrix_class change:matrix_level change:matrix_hitdice change:autofill_matrix change:sync_matrix_class change:toggle_fighter5 change:class_selected change:class change:secondclass change:thirdclass change:level change:level_2 change:level_3",r=>{getAttrs(["matrix_class","matrix_level","matrix_hitdice","autofill_matrix","toggle_fighter5","sync_matrix_class","class_selected","class","secondclass","thirdclass","level","level_2","level_3"],n=>{let e={},s=+n.autofill_matrix,o=+n.sync_matrix_class;if(!s)return;let a=+n.class_selected,t=+n.matrix_level||0,p=+n.matrix_class,c=(n.class||"").trim(),l=(n.secondclass||"").trim(),u=(n.thirdclass||"").trim(),h=+n.matrix_hitdice||0,m=+n.toggle_fighter5;o===1&&(a===1&&(p=te(c),t=+n.level,e.matrix_level=t,e.matrix_class=p),a===2&&(p=te(l),t=+n.level_2,e.matrix_level=t,e.matrix_class=p),a===3&&(p=te(u),t=+n.level_3,e.matrix_level=t,e.matrix_class=p)),p!==0&&(p===1&&(t===0||(t<4?(e["thac-10"]=25,e["thac-9"]=24,e["thac-8"]=23,e["thac-7"]=22,e["thac-6"]=21,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=19,e.thac2=18,e.thac3=17,e.thac4=16,e.thac5=15,e.thac6=14,e.thac7=13,e.thac8=12,e.thac9=11,e.thac10=10):t<7?(e["thac-10"]=23,e["thac-9"]=22,e["thac-8"]=21,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=19,e.thac00=18,e.thac0=18,e.thac1=17,e.thac2=16,e.thac3=15,e.thac4=14,e.thac5=13,e.thac6=12,e.thac7=11,e.thac8=10,e.thac9=9,e.thac10=8):t<10?(e["thac-10"]=21,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=19,e["thac-2"]=18,e["thac-1"]=17,e.thac00=16,e.thac0=16,e.thac1=15,e.thac2=14,e.thac3=13,e.thac4=12,e.thac5=11,e.thac6=10,e.thac7=9,e.thac8=8,e.thac9=7,e.thac10=6):t<13?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=19,e["thac-4"]=18,e["thac-3"]=17,e["thac-2"]=16,e["thac-1"]=15,e.thac00=14,e.thac0=14,e.thac1=13,e.thac2=12,e.thac3=11,e.thac4=10,e.thac5=9,e.thac6=8,e.thac7=7,e.thac8=6,e.thac9=5,e.thac10=4):t<16?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=19,e["thac-6"]=18,e["thac-5"]=17,e["thac-4"]=16,e["thac-3"]=15,e["thac-2"]=14,e["thac-1"]=13,e.thac00=12,e.thac0=12,e.thac1=11,e.thac2=10,e.thac3=9,e.thac4=8,e.thac5=7,e.thac6=6,e.thac7=5,e.thac8=4,e.thac9=3,e.thac10=2):t<19?(e["thac-10"]=20,e["thac-9"]=19,e["thac-8"]=18,e["thac-7"]=17,e["thac-6"]=16,e["thac-5"]=15,e["thac-4"]=14,e["thac-3"]=13,e["thac-2"]=12,e["thac-1"]=11,e.thac00=10,e.thac0=10,e.thac1=9,e.thac2=8,e.thac3=7,e.thac4=6,e.thac5=5,e.thac6=4,e.thac7=3,e.thac8=2,e.thac9=1,e.thac10=0):t>=19&&(e["thac-10"]=19,e["thac-9"]=18,e["thac-8"]=17,e["thac-7"]=16,e["thac-6"]=15,e["thac-5"]=14,e["thac-4"]=13,e["thac-3"]=12,e["thac-2"]=11,e["thac-1"]=10,e.thac00=9,e.thac0=9,e.thac1=8,e.thac2=7,e.thac3=6,e.thac4=5,e.thac5=4,e.thac6=3,e.thac7=2,e.thac8=1,e.thac9=0,e.thac10=-1)),e.attack_matrix_flag=0),(p===2||p===6)&&(t===0?(e["thac-10"]=26,e["thac-9"]=25,e["thac-8"]=24,e["thac-7"]=23,e["thac-6"]=22,e["thac-5"]=21,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=19,e.thac3=18,e.thac4=17,e.thac5=16,e.thac6=15,e.thac7=14,e.thac8=13,e.thac9=12,e.thac10=11):t<3?(e["thac-10"]=25-m,e["thac-9"]=24-m,e["thac-8"]=23-m,e["thac-7"]=22-m,e["thac-6"]=21-m,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20-m,e.thac0=20-m,e.thac1=19-m,e.thac2=18-m,e.thac3=17-m,e.thac4=16-m,e.thac5=15-m,e.thac6=14-m,e.thac7=13-m,e.thac8=12-m,e.thac9=11-m,e.thac10=10-m):t<5?(e["thac-10"]=23-m,e["thac-9"]=22-m,e["thac-8"]=21-m,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20-m,e["thac-1"]=19-m,e.thac00=18-m,e.thac0=18-m,e.thac1=17-m,e.thac2=16-m,e.thac3=15-m,e.thac4=14-m,e.thac5=13-m,e.thac6=12-m,e.thac7=11-m,e.thac8=10-m,e.thac9=9-m,e.thac10=8-m):t<7?(e["thac-10"]=21-m,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20-m,e["thac-3"]=19-m,e["thac-2"]=18-m,e["thac-1"]=17-m,e.thac00=16-m,e.thac0=16-m,e.thac1=15-m,e.thac2=14-m,e.thac3=13-m,e.thac4=12-m,e.thac5=11-m,e.thac6=10-m,e.thac7=9-m,e.thac8=8-m,e.thac9=7-m,e.thac10=6-m):t<9?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20-m,e["thac-5"]=19-m,e["thac-4"]=18-m,e["thac-3"]=17-m,e["thac-2"]=16-m,e["thac-1"]=15-m,e.thac00=14-m,e.thac0=14-m,e.thac1=13-m,e.thac2=12-m,e.thac3=11-m,e.thac4=10-m,e.thac5=9-m,e.thac6=8-m,e.thac7=7-m,e.thac8=6-m,e.thac9=5-m,e.thac10=4-m):t<11?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20-m,e["thac-7"]=19-m,e["thac-6"]=18-m,e["thac-5"]=17-m,e["thac-4"]=16-m,e["thac-3"]=15-m,e["thac-2"]=14-m,e["thac-1"]=13-m,e.thac00=12-m,e.thac0=12-m,e.thac1=11-m,e.thac2=10-m,e.thac3=9-m,e.thac4=8-m,e.thac5=7-m,e.thac6=6-m,e.thac7=5-m,e.thac8=4-m,e.thac9=3-m,e.thac10=2-m):t<13?(e["thac-10"]=20-m,e["thac-9"]=19-m,e["thac-8"]=18-m,e["thac-7"]=17-m,e["thac-6"]=16-m,e["thac-5"]=15-m,e["thac-4"]=14-m,e["thac-3"]=13-m,e["thac-2"]=12-m,e["thac-1"]=11-m,e.thac00=10-m,e.thac0=10-m,e.thac1=9-m,e.thac2=8-m,e.thac3=7-m,e.thac4=6-m,e.thac5=5-m,e.thac6=4-m,e.thac7=3-m,e.thac8=2-m,e.thac9=1-m,e.thac10=0-m):t<15?(e["thac-10"]=18-m,e["thac-9"]=17-m,e["thac-8"]=16-m,e["thac-7"]=15-m,e["thac-6"]=14-m,e["thac-5"]=13-m,e["thac-4"]=12-m,e["thac-3"]=11-m,e["thac-2"]=10-m,e["thac-1"]=9-m,e.thac00=8-m,e.thac0=8-m,e.thac1=7-m,e.thac2=6-m,e.thac3=5-m,e.thac4=4-m,e.thac5=3-m,e.thac6=2-m,e.thac7=1-m,e.thac8=0-m,e.thac9=-1-m,e.thac10=-2-m):t<17?(e["thac-10"]=16-m,e["thac-9"]=15-m,e["thac-8"]=14-m,e["thac-7"]=13-m,e["thac-6"]=12-m,e["thac-5"]=11-m,e["thac-4"]=10-m,e["thac-3"]=9-m,e["thac-2"]=8-m,e["thac-1"]=7-m,e.thac00=6-m,e.thac0=6-m,e.thac1=5-m,e.thac2=4-m,e.thac3=3-m,e.thac4=2-m,e.thac5=1-m,e.thac6=0-m,e.thac7=-1-m,e.thac8=-2-m,e.thac9=-3-m,e.thac10=-4-m):t>=17&&(e["thac-10"]=14-m,e["thac-9"]=13-m,e["thac-8"]=12-m,e["thac-7"]=11-m,e["thac-6"]=10-m,e["thac-5"]=9-m,e["thac-4"]=8-m,e["thac-3"]=7-m,e["thac-2"]=6-m,e["thac-1"]=5-m,e.thac00=4-m,e.thac0=4-m,e.thac1=3-m,e.thac2=2-m,e.thac3=1-m,e.thac4=0-m,e.thac5=-1-m,e.thac6=-2-m,e.thac7=-3-m,e.thac8=-4-m,e.thac9=-5-m,e.thac10=-6-m),e.attack_matrix_flag=0),p===3&&(t===0||(t<6?(e["thac-10"]=26,e["thac-9"]=25,e["thac-8"]=24,e["thac-7"]=23,e["thac-6"]=22,e["thac-5"]=21,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=19,e.thac3=18,e.thac4=17,e.thac5=16,e.thac6=15,e.thac7=14,e.thac8=13,e.thac9=12,e.thac10=11):t<11?(e["thac-10"]=24,e["thac-9"]=23,e["thac-8"]=22,e["thac-7"]=21,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=19,e.thac0=19,e.thac1=18,e.thac2=17,e.thac3=16,e.thac4=15,e.thac5=14,e.thac6=13,e.thac7=12,e.thac8=11,e.thac9=10,e.thac10=9):t<16?(e["thac-10"]=21,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=19,e["thac-2"]=18,e["thac-1"]=17,e.thac00=16,e.thac0=16,e.thac1=15,e.thac2=14,e.thac3=13,e.thac4=12,e.thac5=11,e.thac6=10,e.thac7=9,e.thac8=8,e.thac9=7,e.thac10=6):t<21?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=19,e["thac-5"]=18,e["thac-4"]=17,e["thac-3"]=16,e["thac-2"]=15,e["thac-1"]=14,e.thac00=13,e.thac0=13,e.thac1=12,e.thac2=11,e.thac3=10,e.thac4=9,e.thac5=8,e.thac6=7,e.thac7=6,e.thac8=5,e.thac9=4,e.thac10=3):t>=21&&(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=19,e["thac-7"]=18,e["thac-6"]=17,e["thac-5"]=16,e["thac-4"]=15,e["thac-3"]=14,e["thac-2"]=13,e["thac-1"]=12,e.thac00=11,e.thac0=11,e.thac1=10,e.thac2=9,e.thac3=8,e.thac4=7,e.thac5=6,e.thac6=5,e.thac7=4,e.thac8=3,e.thac9=2,e.thac10=1)),e.attack_matrix_flag=0),p===4&&(t===0||(t<5?(e["thac-10"]=26,e["thac-9"]=25,e["thac-8"]=24,e["thac-7"]=23,e["thac-6"]=22,e["thac-5"]=21,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=19,e.thac3=18,e.thac4=17,e.thac5=16,e.thac6=15,e.thac7=14,e.thac8=13,e.thac9=12,e.thac10=11):t<9?(e["thac-10"]=24,e["thac-9"]=23,e["thac-8"]=22,e["thac-7"]=21,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=19,e.thac0=19,e.thac1=18,e.thac2=17,e.thac3=16,e.thac4=15,e.thac5=14,e.thac6=13,e.thac7=12,e.thac8=11,e.thac9=10,e.thac10=9):t<13?(e["thac-10"]=21,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=19,e["thac-2"]=18,e["thac-1"]=17,e.thac00=16,e.thac0=16,e.thac1=15,e.thac2=14,e.thac3=13,e.thac4=12,e.thac5=11,e.thac6=10,e.thac7=9,e.thac8=8,e.thac9=7,e.thac10=6):t<17?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=19,e["thac-4"]=18,e["thac-3"]=17,e["thac-2"]=16,e["thac-1"]=15,e.thac00=14,e.thac0=14,e.thac1=13,e.thac2=12,e.thac3=11,e.thac4=10,e.thac5=9,e.thac6=8,e.thac7=7,e.thac8=6,e.thac9=5,e.thac10=4):t<21?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=19,e["thac-6"]=18,e["thac-5"]=17,e["thac-4"]=16,e["thac-3"]=15,e["thac-2"]=14,e["thac-1"]=13,e.thac00=12,e.thac0=12,e.thac1=11,e.thac2=10,e.thac3=9,e.thac4=8,e.thac5=7,e.thac6=6,e.thac7=5,e.thac8=4,e.thac9=3,e.thac10=2):t>=21&&(e["thac-10"]=20,e["thac-9"]=19,e["thac-8"]=18,e["thac-7"]=17,e["thac-6"]=16,e["thac-5"]=15,e["thac-4"]=14,e["thac-3"]=13,e["thac-2"]=12,e["thac-1"]=11,e.thac00=10,e.thac0=10,e.thac1=9,e.thac2=8,e.thac3=7,e.thac4=6,e.thac5=5,e.thac6=4,e.thac7=3,e.thac8=2,e.thac9=1,e.thac10=0)),e.attack_matrix_flag=0),p===5&&(h===0||(h===1?(e["thac-10"]=26,e["thac-9"]=25,e["thac-8"]=24,e["thac-7"]=23,e["thac-6"]=22,e["thac-5"]=21,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=19,e.thac3=18,e.thac4=17,e.thac5=16,e.thac6=15,e.thac7=14,e.thac8=13,e.thac9=12,e.thac10=11):h===2?(e["thac-10"]=25,e["thac-9"]=24,e["thac-8"]=23,e["thac-7"]=22,e["thac-6"]=21,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=19,e.thac2=18,e.thac3=17,e.thac4=16,e.thac5=15,e.thac6=14,e.thac7=13,e.thac8=12,e.thac9=11,e.thac10=10):h===3?(e["thac-10"]=24,e["thac-9"]=23,e["thac-8"]=22,e["thac-7"]=21,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=19,e.thac0=19,e.thac1=18,e.thac2=17,e.thac3=16,e.thac4=15,e.thac5=14,e.thac6=13,e.thac7=12,e.thac8=11,e.thac9=10,e.thac10=9):h===4?(e["thac-10"]=23,e["thac-9"]=22,e["thac-8"]=21,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=19,e.thac00=18,e.thac0=18,e.thac1=17,e.thac2=16,e.thac3=15,e.thac4=14,e.thac5=13,e.thac6=12,e.thac7=11,e.thac8=10,e.thac9=9,e.thac10=8):h===5?(e["thac-10"]=21,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=19,e["thac-2"]=18,e["thac-1"]=17,e.thac00=16,e.thac0=16,e.thac1=15,e.thac2=14,e.thac3=13,e.thac4=12,e.thac5=11,e.thac6=10,e.thac7=9,e.thac8=8,e.thac9=7,e.thac10=6):h===6?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=19,e["thac-3"]=18,e["thac-2"]=17,e["thac-1"]=16,e.thac00=15,e.thac0=15,e.thac1=14,e.thac2=13,e.thac3=12,e.thac4=11,e.thac5=10,e.thac6=9,e.thac7=8,e.thac8=7,e.thac9=6,e.thac10=5):h===7?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=19,e["thac-5"]=18,e["thac-4"]=17,e["thac-3"]=16,e["thac-2"]=15,e["thac-1"]=14,e.thac00=13,e.thac0=13,e.thac1=12,e.thac2=11,e.thac3=10,e.thac4=9,e.thac5=8,e.thac6=7,e.thac7=6,e.thac8=5,e.thac9=4,e.thac10=3):h===8?(e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=19,e["thac-6"]=18,e["thac-5"]=17,e["thac-4"]=16,e["thac-3"]=15,e["thac-2"]=14,e["thac-1"]=13,e.thac00=12,e.thac0=12,e.thac1=11,e.thac2=10,e.thac3=9,e.thac4=8,e.thac5=7,e.thac6=6,e.thac7=5,e.thac8=4,e.thac9=3,e.thac10=2):h===9?(e["thac-10"]=20,e["thac-9"]=19,e["thac-8"]=18,e["thac-7"]=17,e["thac-6"]=16,e["thac-5"]=15,e["thac-4"]=14,e["thac-3"]=13,e["thac-2"]=12,e["thac-1"]=11,e.thac00=10,e.thac0=10,e.thac1=9,e.thac2=8,e.thac3=7,e.thac4=6,e.thac5=5,e.thac6=4,e.thac7=3,e.thac8=2,e.thac9=1,e.thac10=0):h===10?(e["thac-10"]=19,e["thac-9"]=18,e["thac-8"]=17,e["thac-7"]=16,e["thac-6"]=15,e["thac-5"]=14,e["thac-4"]=13,e["thac-3"]=12,e["thac-2"]=11,e["thac-1"]=10,e.thac00=9,e.thac0=9,e.thac1=8,e.thac2=7,e.thac3=6,e.thac4=5,e.thac5=4,e.thac6=3,e.thac7=2,e.thac8=1,e.thac9=0,e.thac10=-1):h===11?(e["thac-10"]=18,e["thac-9"]=17,e["thac-8"]=16,e["thac-7"]=15,e["thac-6"]=14,e["thac-5"]=13,e["thac-4"]=12,e["thac-3"]=11,e["thac-2"]=10,e["thac-1"]=9,e.thac00=8,e.thac0=8,e.thac1=7,e.thac2=6,e.thac3=5,e.thac4=4,e.thac5=3,e.thac6=2,e.thac7=1,e.thac8=0,e.thac9=-1,e.thac10=-2):h===12&&(e["thac-10"]=17,e["thac-9"]=16,e["thac-8"]=15,e["thac-7"]=14,e["thac-6"]=13,e["thac-5"]=12,e["thac-4"]=11,e["thac-3"]=10,e["thac-2"]=9,e["thac-1"]=8,e.thac00=7,e.thac0=7,e.thac1=6,e.thac2=5,e.thac3=4,e.thac4=3,e.thac5=2,e.thac6=1,e.thac7=0,e.thac8=-1,e.thac9=-2,e.thac10=-3)),e.attack_matrix_flag=0),p===99&&(g("Error: Class not recognized or class name is empty."),e["thac-10"]=20,e["thac-9"]=20,e["thac-8"]=20,e["thac-7"]=20,e["thac-6"]=20,e["thac-5"]=20,e["thac-4"]=20,e["thac-3"]=20,e["thac-2"]=20,e["thac-1"]=20,e.thac00=20,e.thac0=20,e.thac1=20,e.thac2=20,e.thac3=20,e.thac4=20,e.thac5=20,e.thac6=20,e.thac7=20,e.thac8=20,e.thac9=20,e.thac10=20,e.attack_matrix_flag=0),setAttrs(e,{silent:!0}),Ka())})});on("sheet:opened change:thac0 change:thac00 change:autofill_matrix",r=>{getAttrs(["attack_matrix_flag","matrix_class","thac0","thac1","thac2","thac00","thac01","thac02","autofill_matrix"],n=>{let e={};if(!+n.autofill_matrix)return;let o=+n.attack_matrix_flag,a=+n.matrix_class;if(o===0||a>0)e.attack_matrix_flag=0;else{let t=+n.thac0,p=+n.thac1,c=+n.thac2,l=+n.thac00,u=+n.thac01,h=+n.thac02,m=t+p+c,w=l+u+h;e.attack_matrix_flag=m===60&&w===60?1:0}setAttrs(e,{silent:!0})})});on("change:thac00",r=>{Ka()});function F(r,n,e,s){return rs?(console.log(`Error: ${n} value is out of range. [${r}].\\nDefaulting to ${s}.`),s):Math.min(Math.max(r,e),s)}var x=class{constructor(n,e,s,o,a,t){this.meleebonus=n,this.dmgbonus=e,this.majorstrengthfeat=t,this.minorstrengthfeat=o,this.minorstrengthfeat_locked=a,this.encumbrancebonus=s}getMeleeAttackBonus(){return this.meleebonus}getMeleeDamageBonus(){return this.dmgbonus}getMajorStrengthCheck(){return this.majorstrengthfeat}getMinorStrengthCheck(n=!1){return n?this.minorstrengthfeat_locked:this.minorstrengthfeat}getEncumbranceBonus(){return this.encumbrancebonus}},Pe=class{constructor(){this.strength_dict={3:new x(-3,-1,-350,1,0,0),4:new x(-2,-1,-250,1,0,0),5:new x(-2,-1,-250,1,0,0),6:new x(-1,0,-150,1,0,0),7:new x(-1,0,-150,1,0,0),8:new x(0,0,0,2,0,1),9:new x(0,0,0,2,0,1),10:new x(0,0,0,2,0,2),11:new x(0,0,0,2,0,2),12:new x(0,0,100,2,0,4),13:new x(0,0,100,2,0,4),14:new x(0,0,200,2,0,7),15:new x(0,0,200,2,0,7),16:new x(0,1,350,3,0,10),17:new x(1,1,500,3,0,13),18:{None:new x(1,2,750,3,0,16),"01-50":new x(1,3,1e3,3,0,20),"51-75":new x(2,3,1250,4,0,25),"76-90":new x(2,4,1500,4,0,30),"91-99":new x(2,5,2e3,4,1,35),"00":new x(3,6,3e3,5,2,40)},19:new x(3,7,4500,7,3,50),20:new x(3,8,5e3,7,3,60),21:new x(4,9,6e3,9,4,70),22:new x(4,10,7500,11,4,80),23:new x(5,11,9e3,11,5,90),24:new x(6,12,12e3,19,7,100),25:new x(7,14,15e3,23,9,100)}}getEntry(n,e){let s=F(n,"strength",3,25);return s!==18?this.strength_dict[s]:e<=0?this.strength_dict[s].None:e<=50?this.strength_dict[s]["01-50"]:e<=75?this.strength_dict[s]["51-75"]:e<=90?this.strength_dict[s]["76-90"]:e<=99?this.strength_dict[s]["91-99"]:this.strength_dict[s]["00"]}getStrengthValue(n,e,s=0,o=!1){switch(n){case"Attack":return this.getEntry(e,s).getMeleeAttackBonus();case"Damage":return this.getEntry(e,s).getMeleeDamageBonus();case"Major":return this.getEntry(e,s).getMajorStrengthCheck();case"Minor":return this.getEntry(e,s).getMinorStrengthCheck(o);case"Encumbrance":return this.getEntry(e,s).getEncumbranceBonus();default:return"Invalid Test"}}},O=class{constructor(n,e,s,o){this.bonuslanguages=n,this.knowspell=e,this.minspells=s,this.maxspells=o}getBonusLanguages(){return this.bonuslanguages}getKnowSpell(){return this.knowspell}getMinSpells(){return this.minspells}getMaxSpells(){return this.maxspells}},Ue=class{constructor(){this.intelligence_dict={8:new O(1,0,0,0),9:new O(1,35,4,6),10:new O(2,45,5,7),11:new O(2,45,5,7),12:new O(3,45,5,7),13:new O(3,55,6,9),14:new O(4,55,6,9),15:new O(4,65,7,11),16:new O(5,65,7,11),17:new O(6,75,8,14),18:new O(7,85,9,18),19:new O(8,95,10,99),20:new O(9,96,11,99),21:new O(10,97,12,99),22:new O(11,98,13,99),23:new O(12,99,14,99),24:new O(13,100,15,99),25:new O(14,100,16,99)}}getEntry(n){return this.intelligence_dict[F(n,"intelligence",8,25)]}},D=class{constructor(n,e,s){this.mentalsavebonus=n,this.spellbonus=e,this.spellfailure=s}getMentalSaveBonus(){return this.mentalsavebonus}getSpellBonus(){return this.spellbonus}getSpellFailure(){return this.spellfailure}},He=class{constructor(){this.wisdom_dict={3:new D("-3","None",20),4:new D("-2","None",20),5:new D("-1","None",20),6:new D("-1","None",20),7:new D("-1","None",20),8:new D("0","None",20),9:new D("0","None",20),10:new D("0","None",15),11:new D("0","None",10),12:new D("0","None",5),13:new D("0","1/0/0/0/0/0/0",0),14:new D("0","2/0/0/0/0/0/0",0),15:new D("1","2/1/0/0/0/0/0",0),16:new D("2","2/2/0/0/0/0/0",0),17:new D("3","2/2/1/0/0/0/0",0),18:new D("4","2/2/1/1/0/0/0",0),19:new D("4","3/2/1/2/0/0/0",0),20:new D("4","3/3/1/3/0/0/0",0),21:new D("4","3/3/2/3/1/0/0",0),22:new D("4","3/3/2/4/2/0/0",0),23:new D("4","3/3/2/4/4/0/0",0),24:new D("4","3/3/2/4/4/2/1",0),25:new D("4","3/3/2/4/4/3/1",0)}}getEntry(n){return this.wisdom_dict[F(n,"wisdom",3,25)]}},C=class{constructor(n,e,s){this.surprisebonus=n,this.rangedbonus=e,this.armorbonus=s}getSurpriseBonus(){return this.surprisebonus}getRangedBonus(){return this.rangedbonus}getArmorBonus(){return this.armorbonus}},We=class{constructor(){this.dexterity_dict={3:new C(3,-3,4),4:new C(2,-2,3),5:new C(1,-1,2),6:new C(0,0,1),7:new C(0,0,0),8:new C(0,0,0),9:new C(0,0,0),10:new C(0,0,0),11:new C(0,0,0),12:new C(0,0,0),13:new C(0,0,0),14:new C(0,0,0),15:new C(0,0,-1),16:new C(-1,1,-2),17:new C(-2,2,-3),18:new C(-3,3,-4),19:new C(-3,3,-4),20:new C(-3,3,-4),21:new C(-4,4,-5),22:new C(-4,4,-5),23:new C(-4,4,-5),24:new C(-5,5,-6),25:new C(-5,5,-6)}}getEntry(n){return this.dexterity_dict[F(n,"dexterity",3,25)]}},E=class{constructor(n,e,s){this.hitpointbonus=n,this.systemshock=e,this.resurrectionsurvival=s}getHitpointBonus(){return this.hitpointbonus}getSystemShock(){return this.systemshock}getResurrectionSurvival(){return this.resurrectionsurvival}},Ve=class{constructor(){this.constitution_dict={3:new E("-2",35,40),4:new E("-1",40,45),5:new E("-1",45,50),6:new E("0",50,55),7:new E("0",55,60),8:new E("0",60,65),9:new E("0",65,70),10:new E("0",70,75),11:new E("0",75,80),12:new E("0",80,85),13:new E("0",85,90),14:new E("0",88,92),15:new E("1",91,94),16:new E("2",95,96),17:new E("3",97,98),18:new E("4",99,100),19:new E("5",99,100),20:new E("5",99,100),21:new E("6",99,100),22:new E("6",99,100),23:new E("6",99,100),24:new E("7",99,100),25:new E("7",99,100)}}getEntry(n){return this.constitution_dict[F(n,"constitution",3,25)]}},I=class{constructor(n,e,s,o){this.maximumhenchmen=n,this.loyaltybonus=e,this.reactionbonus=s,this.comeliness=o}MaximumHenchmen(){return this.maximumhenchmen}getLoyaltyBonus(){return this.loyaltybonus}getReactionBonus(){return this.reactionbonus}getComeliness(){return this.comeliness}},Fe=class{constructor(){this.charisma_dict={3:new I(1,-30,-25,-5),4:new I(1,-25,-20,-3),5:new I(2,-20,-15,-3),6:new I(2,-15,-10,-1),7:new I(3,-10,-5,-1),8:new I(3,-5,0,-1),9:new I(4,0,0,0),10:new I(4,0,0,0),11:new I(4,0,0,0),12:new I(5,0,0,0),13:new I(5,0,5,1),14:new I(6,5,10,1),15:new I(7,15,15,1),16:new I(8,20,25,2),17:new I(10,30,30,2),18:new I(15,40,35,3),19:new I(20,50,40,5),20:new I(25,60,45,5),21:new I(30,70,50,5),22:new I(35,80,55,5),23:new I(40,90,60,5),24:new I(45,100,65,5),25:new I(50,100,70,5)}}getEntry(n){return this.charisma_dict[F(n,"charisma",3,25)]}},N=class{constructor(n,e,s,o,a){this.pickPockets=n,this.openLocks=e,this.findRemoveTraps=s,this.moveSilently=o,this.hideInShadows=a}getPickPockets(){return this.pickPockets}getOpenLocks(){return this.openLocks}getFindRemoveTraps(){return this.findRemoveTraps}getMoveSilently(){return this.moveSilently}getHideInShadows(){return this.hideInShadows}},Ge=class{constructor(){this.dexterity_dict={9:new N(-15,-10,-10,-20,-10),10:new N(-10,-5,-10,-15,-5),11:new N(-5,0,-5,-10,0),12:new N(0,0,0,-5,0),13:new N(0,0,0,0,0),14:new N(0,0,0,0,0),15:new N(0,0,0,0,0),16:new N(0,5,0,0,0),17:new N(5,10,0,5,5),18:new N(10,15,5,10,10),19:new N(15,20,10,12,12),20:new N(20,25,15,15,15),21:new N(25,30,20,18,18),22:new N(30,35,25,20,20),23:new N(35,40,30,23,23),24:new N(40,45,35,25,25),25:new N(45,50,40,30,30)}}getEntry(n){return this.dexterity_dict[F(n,"dexterity",9,25)]}},B=class{constructor(n,e,s,o,a,t,p,c){this.pickPockets=n,this.openLocks=e,this.findRemoveTraps=s,this.moveSilently=o,this.hideInShadows=a,this.hearNoise=t,this.climbWalls=p,this.readLanguages=c}getPickPockets(){return this.pickPockets}getOpenLocks(){return this.openLocks}getFindRemoveTraps(){return this.findRemoveTraps}getMoveSilently(){return this.moveSilently}getHideInShadows(){return this.hideInShadows}getHearNoise(){return this.hearNoise}getClimbWalls(){return this.climbWalls}getReadLanguages(){return this.readLanguages}},ze=class{constructor(){this.dexterity_dict={0:new B(0,0,0,0,0,0,0,0),1:new B(0,0,0,0,0,0,0,0),2:new B(0,10,15,0,0,0,-10,-5),3:new B(5,-5,0,5,10,5,0,0),4:new B(0,5,10,5,5,10,-15,0),5:new B(10,0,0,0,5,0,0,0),6:new B(5,5,5,10,15,5,-15,-5),7:new B(-5,5,5,0,0,5,5,-10)}}getEntry(n){return this.dexterity_dict[F(n,"thief_race_selected",0,7)]}},H=new Pe,ke=new Ue,Ae=new He,ee=new We,ae=new Ve,z=new Fe,ce=new Ge,W=new ze,j=(r,n,e="int")=>e==="int"?parseInt(r[n])||0:e==="float"?parseFloat(r[n])||0:e==="str"?r[n]:null;la=()=>{getAttrs(["strength","exceptionalstrength"],r=>{let n={},e=j(r,"strength","int"),s=j(r,"exceptionalstrength");j(r,"exceptionalstrength","str")==="00"&&(s=100),n.exceptionalstrength=s,n.meleebonus=(H.getStrengthValue("Attack",e,s)<=0?"":"+")+H.getStrengthValue("Attack",e,s),n.dmgbonus=(H.getStrengthValue("Damage",e,s)<=0?"":"+")+H.getStrengthValue("Damage",e,s),n.majorstrengthfeat=H.getStrengthValue("Major",e,s),n.minorstrengthfeat=H.getStrengthValue("Minor",e,s),n.minorstrengthfeat_locked=H.getStrengthValue("Minor",e,s,!0),n.encumbrancebonus=(H.getStrengthValue("Encumbrance",e,s)<=0?"":"+")+H.getStrengthValue("Encumbrance",e,s),setAttrs(n)})};aa=()=>{getAttrs(["intelligence","bonuslanguages","race"],r=>{let n={},e=j(r,"intelligence","int"),s=j(r,"race","str"),o=+ke.getEntry(e).getBonusLanguages();/human/gi.test(s)?n.bonuslanguages=o:/dwarf/gi.test(s)||/gnome/gi.test(s)||/orc/gi.test(s)?n.bonuslanguages=Math.min(o,2):/half-elf/gi.test(s)||/halfling/gi.test(s)||/hobbit/gi.test(s)?(o<=5?o=0:o===6?o=1:o===7?o=2:o===8?o=3:o===9?o=4:o===10?o=5:o===11?o=6:o===12?o=7:o===13?o=8:o>=14&&(o=9),n.bonuslanguages=o):/elf/gi.test(s)?(o<=4?o=0:o===5?o=1:o==6?o=2:o===7?o=3:o===8?o=4:o===9?o=5:o===10?o=6:o===11?o=7:o===12?o=8:o===13?o=9:o>=14&&(o=10),n.bonuslanguages=o):n.bonuslanguages=0,n.knowspell=ke.getEntry(e).getKnowSpell(),n.minspells=ke.getEntry(e).getMinSpells(),n.maxspells=ke.getEntry(e).getMaxSpells(),setAttrs(n,{silent:!0})})};wa=()=>{getAttrs(["wisdom"],r=>{let n={},e=j(r,"wisdom","int");n.mentalsavebonus=(Ae.getEntry(e).getMentalSaveBonus()<=0?"":"+")+Ae.getEntry(e).getMentalSaveBonus(),n.spellbonus=Ae.getEntry(e).getSpellBonus(),n.spellfailure=Ae.getEntry(e).getSpellFailure(),setAttrs(n,{silent:!0})})};Ze=()=>{getAttrs(["dexterity"],r=>{let n={},e=j(r,"dexterity","int"),s=ee.getEntry(e).getSurpriseBonus(),o=(-1*s<=0?"":"+")+-1*s;n.surprisebonus=ee.getEntry(e).getSurpriseBonus(),n.surprisebonus_inverted=o,n.rangedbonus=(ee.getEntry(e).getRangedBonus()<=0?"":"+")+ee.getEntry(e).getRangedBonus(),n.armorbonus=(ee.getEntry(e).getArmorBonus()<=0?"":"+")+ee.getEntry(e).getArmorBonus(),setAttrs(n)})};Qe=()=>{getAttrs(["constitution","class","secondclass","thirdclass"],r=>{let n={},e=j(r,"constitution","int"),s=[r.class,r.secondclass,r.thirdclass];/fighter/gi.test(s)||/paladin/gi.test(s)||/ranger/gi.test(s)?n.hitpointbonus=(ae.getEntry(e).getHitpointBonus()<=0?"":"+")+ae.getEntry(e).getHitpointBonus():n.hitpointbonus=(Math.min(ae.getEntry(e).getHitpointBonus(),2)<=0?"":"+")+Math.min(ae.getEntry(e).getHitpointBonus(),2),n.systemshock=ae.getEntry(e).getSystemShock(),n.resurrectionsurvival=ae.getEntry(e).getResurrectionSurvival(),setAttrs(n)})};Ye=()=>{getAttrs(["charisma"],r=>{let n={},e=j(r,"charisma","int");n.maximumhenchmen=z.getEntry(e).MaximumHenchmen(),n.loyaltybonus=(z.getEntry(e).getLoyaltyBonus()<=0?"":"+")+z.getEntry(e).getLoyaltyBonus(),n.reactionbonus=(z.getEntry(e).getReactionBonus()<=0?"":"+")+z.getEntry(e).getReactionBonus(),n.comeliness_cha_adj=(z.getEntry(e).getComeliness()<=0?"":"+")+z.getEntry(e).getComeliness(),setAttrs(n,{silent:!0})})};thiefSkillsDexCalcs=r=>{getAttrs(["dexterity"],n=>{let e={},s=j(n,"dexterity","int"),o=ce.getEntry(s).getPickPockets(),a=ce.getEntry(s).getOpenLocks(),t=ce.getEntry(s).getFindRemoveTraps(),p=ce.getEntry(s).getMoveSilently(),c=ce.getEntry(s).getHideInShadows();e.pickpockets_ability_mod=r===1?o:0,e.openlocks_ability_mod=r===1?a:0,e.findtraps_ability_mod=r===1?t:0,e.movequietly_ability_mod=r===1?p:0,e.hideinshadows_ability_mod=r===1?c:0,setAttrs(e)})};thiefSkillsRacialCalcs=r=>{getAttrs(["thief_race_selected"],n=>{let e={},s=j(n,"thief_race_selected","int"),o=W.getEntry(s).getPickPockets(),a=W.getEntry(s).getOpenLocks(),t=W.getEntry(s).getFindRemoveTraps(),p=W.getEntry(s).getMoveSilently(),c=W.getEntry(s).getHideInShadows(),l=W.getEntry(s).getHearNoise(),u=W.getEntry(s).getClimbWalls(),h=W.getEntry(s).getReadLanguages();e.pickpockets_racial_mod=r===1?o:0,e.openlocks_racial_mod=r===1?a:0,e.findtraps_racial_mod=r===1?t:0,e.movequietly_racial_mod=r===1?p:0,e.hideinshadows_racial_mod=r===1?c:0,e.hearnoise_racial_mod=r===1?l:0,e.climbwalls_racial_mod=r===1?u:0,e.readlanguages_racial_mod=r===1?h:0,setAttrs(e)})};on("change:autofill_thief_dex change:dexterity",r=>{getAttrs(["autofill_thief_dex"],n=>{let e=+n.autofill_thief_dex;thiefSkillsDexCalcs(e)})});function wo(r){let n=r.trim().toLowerCase();return/human/.test(n)?1:/dwarf/.test(n)?2:/half-elf/.test(n)?5:/elf/.test(n)?3:/gnome/.test(n)?4:/halfling|hobbit/.test(n)?6:/half-orc/.test(n)?7:0}on("change:race change:autofill_thief_race change:thief_race_selected",r=>{let n=r.sourceAttribute;getAttrs(["race","autofill_thief_race"],e=>{let s={},o=+e.autofill_thief_race,a=(e.race||"human").trim();(n==="autofill_thief_race"||n==="race")&&(s.thief_race_selected=wo(a)),setAttrs(s,{silent:!0}),thiefSkillsRacialCalcs(o)})});on("change:strength change:exceptionalstrength",r=>{la()});on("change:intelligence change:race",r=>{aa()});on("change:wisdom",r=>{wa()});on("change:dexterity",r=>{Ze()});on("change:constitution change:class change:secondclass change:thirdclass",r=>{Qe()});on("change:charisma change:comeliness",r=>{Ye()});portraitUrlCalc=()=>{getAttrs(["character_avatar","sheet_image","sheet_image_url"],r=>{let n={},e=+r.sheet_image,s=(function(t){let p=/(\.png|\.jpg|\.gif)/i,c=t.match(p);return c?t.slice(0,c.index+c[0].length):t})(r.character_avatar),o=r.sheet_image_url||s;e===0&&(n.sheet_image_src=o),e===1&&(n.sheet_image_src=s),e===2&&(n.sheet_image_src=""),setAttrs(n,{silent:!0})})};on("change:character_avatar change:sheet_image change:sheet_image_url",r=>{portraitUrlCalc()});on("clicked:postimage",r=>{portraitUrlCalc(),startRoll("?{Display the portrait image?|YES,@{sheet_image_src}|NO, }",e=>{finishRoll(e.rollId)})});on("change:psionic_ability_strength_max change:psionic_attack change:psionic_defense",r=>{getAttrs(["psionic_ability_strength_max"],n=>{let e={},s=n.psionic_ability_strength_max;e.psionic_attack_max=T(s/2).toFixed(1),e.psionic_defense_max=T(s/2).toFixed(1),setAttrs(e,{silent:!0})})});Va=()=>{getSectionIDs("repeating_weapon",r=>{let n={},e=[],s=[];r.forEach(o=>{e.push(i("weapon",o,"weapon_name")),e.push(i("weapon",o,"weapon_use")),e.push(i("weapon",o,"weapon_speed")),e.push(i("weapon",o,"weapon_misc"))}),getAttrs(e,o=>{if(r.forEach(a=>{let t=+o[i("weapon",a,"weapon_use")]||0;if(t===0)return;let p=o[i("weapon",a,"weapon_name")],c=o[i("weapon",a,"weapon_speed")]||"0",l=parseInt(c.match(/\d+/)?.[0])||0,u=o[i("weapon",a,"weapon_misc")];s.push({id:a,name:p,inUse:t,speed:l,misc:u})}),s.length>0){let a=s[0];s.forEach(l=>{l.speed{Va()});var Ya=function(r,n){getAttrs([`_reporder_${r}`],function(e){getSectionIDs(r,function(s){let o=e[`_reporder_${r}`]?e[`_reporder_${r}`].toLowerCase().split(","):[],a=[...new Set(o.filter(t=>s.includes(t)).concat(s))];n(a)})})};on("clicked:spell-sort-alphabetical clicked:spell-sort-level",function(r){let n="repeating_spells";Ya(n,function(e){getSectionIDs(n,s=>{if(!s.length)return;let o=[],a=r.triggerName.replace("clicked:","");s.forEach(t=>{o.push(i("spells",t,"spell_caster_class")),o.push(i("spells",t,"spell_level")),o.push(i("spells",t,"spell_name"))}),getAttrs([...o],t=>{let p={},c=s.map(h=>({id:h,casterClass:t[i("spells",h,"spell_caster_class")]||0,level:t[i("spells",h,"spell_level")],name:(t[i("spells",h,"spell_name")]||"").trim()})),l=h=>h==="?"?-1:h||0;a==="spell-sort-alphabetical"?c.sort((h,m)=>h.name.localeCompare(m.name,void 0,{sensitivity:"base"})):a==="spell-sort-level"&&c.sort((h,m)=>{let w=l(h.level),A=l(m.level);return h.casterClass-m.casterClass||w-A||h.name.localeCompare(m.name,void 0,{sensitivity:"base"})});let u=c.map(h=>`${h.id}`);p.spells_previous_order_array=e.join(","),setAttrs(p,{silent:!0},setSectionOrder("spells",u))})})})});on("clicked:spell-sort-undo",r=>{getAttrs(["spells_previous_order_array"],n=>{let e=n.spells_previous_order_array;if(!e||typeof e!="string")return;let s=e.split(",");setSectionOrder("spells",s)})});on("clicked:equipment-sort-alphabetical clicked:equipment-sort-location",function(r){let n="repeating_equipment";Ya(n,function(e){getSectionIDs(n,s=>{if(!s.length)return;let o=[],a=r.triggerName.replace("clicked:","");s.forEach(t=>{o.push(i("equipment",t,"equipment_item")),o.push(i("equipment",t,"equipment_location"))}),getAttrs([...o],t=>{let p={},c=s.map(u=>({id:u,name:(t[i("equipment",u,"equipment_item")]||"").trim(),location:(t[i("equipment",u,"equipment_location")]||"").trim()}));a==="equipment-sort-alphabetical"?c.sort((u,h)=>u.name.localeCompare(h.name,void 0,{sensitivity:"base"})):a==="equipment-sort-location"&&c.sort((u,h)=>{let m=u.location.localeCompare(h.location,void 0,{sensitivity:"base"});return m!==0?m:u.name.localeCompare(h.name,void 0,{sensitivity:"base"})});let l=c.map(u=>`${u.id}`);p.equipment_previous_order_array=e.join(","),setAttrs(p,{silent:!0},setSectionOrder("equipment",l))})})})});on("clicked:equipment-sort-undo",r=>{getAttrs(["equipment_previous_order_array"],n=>{let e=n.equipment_previous_order_array;if(!e||typeof e!="string")return;let s=e.split(",");setSectionOrder("equipment",s)})});
diff --git a/ADnD_1E_Revised/src/readme.md b/ADnD_1E_Revised/src/readme.md
index c4ed065db5..d9a9388992 100644
--- a/ADnD_1E_Revised/src/readme.md
+++ b/ADnD_1E_Revised/src/readme.md
@@ -6,26 +6,23 @@ This is the community character sheet for AD&D1e Revised.
You need to have `nodejs` and `npm` installed.
-Then, run `npm install` from the 'src/' folder to install the package.json dependencies.
+Then, run `npm install` from the './src/' folder to install the package.json dependencies.
-Edit the sheet's HTML and JS/sheetworker files found in the 'src/' folder. (ie `src/index.html`, `src/index.js`)
-Sheet CSS can be edited directly using `1ESheet.css` located at root.
+Edit the sheet's HTML, CSS and JS/sheetworker files found in the './src/' folder. (ie `index.html`, `index.js`, `1ESheet.css`)
-With dependencies installed you can run `npm run dev` from within '/src' to render an un-minified version for development. `npm run dev` will also watch for any changes in the src files and automatically update.
-
-Output will be rendered as `1ESheet.html` located at root.
+With dependencies installed you can run `npm run dev` from within './src/' to render an un-minified version for development. `npm run dev` will also watch for any changes in the src files and automatically update copies in '.src/dev/'.
This is the version that should be used while developing and testing via the Roll20 Developer Sandbox or Custom game.
## Production
-With dependencies installed you can run `npm run prod` from within '/src' to build a finalized project (minified) for Roll20's live servers.
+With dependencies installed you can run `npm run prod` from within './src/' to build a finalized project (minified) for Roll20's live servers.
-Output will be rendered as `1ESheet.html` located at root.
+Output will be rendered to `./src/prod/1ESheet.html`.
-This is the version that should be used for Roll20's live servers.
+This is the version that should be used for Roll20's live servers. Copy `./src/prod/1ESheet.html` and `./src/prod/1ESheet.css` to the project root, overwriting the old files, before committing to your fork and ultimately submitting a pull request to Roll20 for approval.
## Custom Games
-If you want to use this code for a Roll20 Custom game; copy the raw text from `1ESheet.html` and `1ESheet.css` located at root and paste into the appropriate Game Settings editor tab.
+If you want to use this code for a Roll20 Custom game; copy the raw text from '1ESheet.html' and '1ESheet.css' from the root directory and paste into the appropriate Game Settings editor tab.
\ No newline at end of file