diff --git a/13th_Age-neovatar/13th_Age-neovatar.css b/13th_Age-neovatar/13th_Age-neovatar.css
index c1e587558e..3f9d703b0a 100644
--- a/13th_Age-neovatar/13th_Age-neovatar.css
+++ b/13th_Age-neovatar/13th_Age-neovatar.css
@@ -1,4 +1,4 @@
-/* version: 1.4.1 */
+/* version: 1.5.0 */
.sheet-13thAge {
padding-top: 10px;
diff --git a/13th_Age-neovatar/13th_Age-neovatar.html b/13th_Age-neovatar/13th_Age-neovatar.html
index 8810a66bdd..c822b68ad0 100644
--- a/13th_Age-neovatar/13th_Age-neovatar.html
+++ b/13th_Age-neovatar/13th_Age-neovatar.html
@@ -1,4 +1,4 @@
-
+
Attention:
@@ -102,7 +102,7 @@
-
+
@@ -160,7 +160,7 @@
-
+
@@ -276,12 +276,12 @@
+
-
@@ -292,7 +292,6 @@
Max.
Base
- Lvlmod.
Misc.
@@ -967,7 +966,7 @@
- Sheet Version: 1.4.1
+ Sheet Version: 1.5.0
@@ -1036,3 +1035,19 @@
{{/allprops() character_name character_id name_link}}
+
+
+
\ No newline at end of file
diff --git a/13th_Age-neovatar/README.md b/13th_Age-neovatar/README.md
index c80b30da35..58426ed884 100644
--- a/13th_Age-neovatar/README.md
+++ b/13th_Age-neovatar/README.md
@@ -93,6 +93,18 @@ grunt build
This will create `13th_Age-neovatar.[css|html]` that you can copy and paste into Roll 20 directly.
### Changelog
+
+**1.5.0:**
+* Sheet workers are used to calculate HP per level and removed HP lvlmod field
+
+**1.4.2:**
+
+* Pop-up asks for situational attack modifier on a basic attack roll
+
+**1.4.1:**
+
+* Inline formulas in roll results are now easier to read
+
**1.4.0:**
***Breaking changes:***
diff --git a/13th_Age-neovatar/package.json b/13th_Age-neovatar/package.json
index eb6ff83dd2..a46e73f0c6 100644
--- a/13th_Age-neovatar/package.json
+++ b/13th_Age-neovatar/package.json
@@ -1,6 +1,6 @@
{
"title": "13th Age Roll 20 Character Sheet - neovatar edition",
- "version": "1.4.1",
+ "version": "1.5.0",
"name": "roll20-13th_Age-neovatar",
"author": {
"name": "Thomas Seliger"
diff --git a/13th_Age-neovatar/sheet.json b/13th_Age-neovatar/sheet.json
index 8c5d811516..065e94efcf 100644
--- a/13th_Age-neovatar/sheet.json
+++ b/13th_Age-neovatar/sheet.json
@@ -4,5 +4,5 @@
"authors": "Thomas Seliger (neovatar)",
"roll20userid": "388327",
"preview": "13th_Age-neovatar.jpg",
- "instructions": "New edition of a 13th Age character sheet with some automation.\n\nVersion: 1.4.1\n\nIf you find bugs or have suggestions, please use the [Github issue tracker](https://github.com/neovatar/roll20-character-sheets/issues) for this sheet.\n\nFor changes in this version, please check the [CHANGELOG](https://github.com/Roll20/roll20-character-sheets/blob/master/13th_Age-neovatar/README.md#changelog) on Roll20.net Github repository."
+ "instructions": "New edition of a 13th Age character sheet with some automation.\n\nVersion: 1.5.0\n\nIf you find bugs or have suggestions, please use the [Github issue tracker](https://github.com/neovatar/roll20-character-sheets/issues) for this sheet.\n\nFor changes in this version, please check the [CHANGELOG](https://github.com/Roll20/roll20-character-sheets/blob/master/13th_Age-neovatar/README.md#changelog) on Roll20.net Github repository."
}
\ No newline at end of file
diff --git a/13th_Age-neovatar/src/13th_Age-neovatar.html b/13th_Age-neovatar/src/13th_Age-neovatar.html
index 00faaa88b6..acba237992 100644
--- a/13th_Age-neovatar/src/13th_Age-neovatar.html
+++ b/13th_Age-neovatar/src/13th_Age-neovatar.html
@@ -102,7 +102,7 @@
-
+
@@ -160,7 +160,7 @@
-
+
@@ -276,12 +276,12 @@
+
-
@@ -292,7 +292,6 @@
Max.
Base
- Lvlmod.
Misc.
@@ -1036,3 +1035,19 @@
{{/allprops() character_name character_id name_link}}
+
+
+
\ No newline at end of file
diff --git a/5th Edition OGL by Roll20/5th Edition OGL by Roll20.css b/5th Edition OGL by Roll20/5th Edition OGL by Roll20.css
index 8de41d1c9a..92d4966e62 100644
--- a/5th Edition OGL by Roll20/5th Edition OGL by Roll20.css
+++ b/5th Edition OGL by Roll20/5th Edition OGL by Roll20.css
@@ -39,6 +39,37 @@ input[type=radio].sheet-tab-button + span {
font-weight: bold;
}
+.sheet-advantagetoggle {
+ position: absolute;
+ top: 92px;
+ right: 200px;
+}
+
+.sheet-advantagetoggle input[type=radio] {
+ opacity: 0;
+ position: absolute;
+ top: 0px;
+ right: 0px;
+ width: 18px;
+ height: 18px;
+ z-index: 2;
+}
+
+.sheet-advantagetoggle input[type=radio] + span {
+ position: absolute;
+ top: 0px;
+ right: 0px;
+ width: 17px;
+ height: 17px;
+ border: 1px solid black;
+ border-radius: 5px;
+ background-color: #E8E8E8;
+ color: black;
+ text-align: center;
+ font-weight: bold;
+}
+
+.sheet-advantagetoggle input[type=radio]:checked + span,
input[type=radio].sheet-tab-button:checked + span {
color: #FFFFFF;
background-color: #EC2127;
@@ -356,11 +387,13 @@ button[type=roll] * {
.sheet-ac-init-speed-container input,
.sheet-hp input,
.sheet-hdice-dsaves-container input[type=text],
+.sheet-hdice-dsaves-container input[type=number],
.sheet-attacks input,
.sheet-equipment input,
.sheet-tool input,
.sheet-spell input,
-.sheet-options .sheet-body input
+.sheet-options .sheet-body input,
+.sheet-resources input[type=number]
{
width: 100%;
text-align: center;
@@ -375,6 +408,13 @@ button[type=roll] * {
color: black;
}
+.sheet-resources input[type=number],
+.sheet-hdice-dsaves-container input[type=number]
+{
+ padding-right: 0px;
+ padding-left: 10px;
+}
+
.sheet-saving-throw-container,
.sheet-skills-container
{
@@ -499,6 +539,12 @@ button[type=roll] * {
font-size: 30px;
}
+.sheet-hp input[type="number"] {
+ width: 100%;
+ padding-right: 0px;
+ padding-left: 20px;
+}
+
.sheet-hp span.sheet-label,
.sheet-hdice-dsaves-container span.sheet-label
{
@@ -682,22 +728,6 @@ button[type=roll] * {
font-weight: bold;
}
-.sheet-attacks .sheet-display button[type=roll],
-.sheet-npc .sheet-actions button[type=roll]
-{
- display: none;
-}
-
-.sheet-dflag[value="pick"] + .sheet-attacks .sheet-display .sheet-pickbase[value="pick"] ~ button[type=roll].sheet-pick,
-.sheet-dflag[value="pick"] + .sheet-attacks .sheet-display .sheet-pickbase[value="dmg"] ~ button[type=roll].sheet-dmg,
-.sheet-dflag[value="pick"] + .sheet-attacks .sheet-display .sheet-pickbase[value="empty"] ~ button[type=roll].sheet-empty,
-.sheet-dflag[value="full"] + .sheet-attacks .sheet-display button[type=roll].sheet-full,
-.sheet-dflag[value="pick"] + .sheet-actions .sheet-display button[type=roll].sheet-pick,
-.sheet-dflag[value="full"] + .sheet-actions .sheet-display button[type=roll].sheet-full
-{
- display: inline-block;
-}
-
.sheet-attacks .sheet-options-flag,
.sheet-spell .sheet-options-flag,
.sheet-tool .sheet-options-flag,
@@ -935,7 +965,7 @@ button[type=roll] * {
width: 100%;
}
-.repcontrol {
+/*.repcontrol {
display: none;
}
@@ -951,9 +981,75 @@ button[type=roll] * {
.sheet-traits:hover .repcontrol,
.sheet-actions:hover .repcontrol,
.sheet-equipment:hover .repcontrol,
-.sheet-resources:hover .repcontrol
+.sheet-col3:hover .repcontrol
{
display: block;
+}*/
+
+.repcontrol .btn {
+ /*visibility: hidden;*/
+ border: medium none;
+ color: white !important;
+ background: none;
+ box-shadow: none;
+}
+
+.repcontrol .btn:focus {
+ outline: 0;
+}
+
+.repcontrol .repcontrol_edit:after {
+ content: '#';
+ visibility: visible;
+ font-family: pictos;
+ background-color: #fff;
+ border: 1px solid black;
+ border-radius: 2px;
+ font-size: 12px;
+ height: 12px;
+ width: 12px;
+ padding: 2px 4px 2px 4px;
+ color: black;
+}
+
+.editmode ~ .repcontrol .repcontrol_edit:after {
+ content: '*';
+}
+
+.repcontrol .repcontrol_add:before {
+ content: '&';
+ visibility: visible;
+ font-family: pictos;
+ background-color: #fff;
+ border: 1px solid black;
+ border-radius: 2px;
+ font-size: 12px;
+ height: 12px;
+ width: 12px;
+ padding: 2px 4px 2px 4px;
+ color: black;
+}
+
+.repcontrol .repcontrol_edit:hover:after,
+.repcontrol .repcontrol_add:hover:before
+{
+ background-color: #EFEFEF;
+}
+
+.sheet-resources .repcontrol {
+ margin-top: -10px;
+}
+
+.itemcontrol {
+ z-index: 10;
+}
+
+.itemcontrol .repcontrol_del {
+ font-size: 10px;
+ margin-top: 3px;
+ padding: 0px;
+ height: 18px;
+ width: 18px;
}
.sheet-tool .sheet-options,
@@ -1292,7 +1388,11 @@ button[type=roll] * {
.sheet-rolltemplate-npcaction .sheet-grey,
.sheet-rolltemplate-npcaction .sheet-grey .inlinerollresult.fullcrit,
.sheet-rolltemplate-npcaction .sheet-grey .inlinerollresult.fullfail,
-.sheet-rolltemplate-npcaction .sheet-grey .inlinerollresult.importantroll
+.sheet-rolltemplate-npcaction .sheet-grey .inlinerollresult.importantroll,
+.sheet-rolltemplate-npcatk .sheet-grey,
+.sheet-rolltemplate-npcatk .sheet-grey .inlinerollresult.fullcrit,
+.sheet-rolltemplate-npcatk .sheet-grey .inlinerollresult.fullfail,
+.sheet-rolltemplate-npcatk .sheet-grey .inlinerollresult.importantroll
{
color: #A0A0A0;
border: 0px;
@@ -1541,7 +1641,7 @@ button[type=roll] * {
}
.sheet-rolltemplate-spell .sheet-container {
- width: 223px;
+ width: 263px;
background: url(https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/5th%20Edition%20OGL%20by%20Roll20/spellbg.jpg) center center;
background-size: auto;
background-repeat: repeat;
@@ -1669,7 +1769,9 @@ button[type=roll] * {
line-height: inherit;
}
-.sheet-npc .sheet-display input {
+.sheet-npc .sheet-display input,
+.sheet-npc .sheet-reaction input
+{
border: none;
background: none;
box-shadow: none;
@@ -1806,17 +1908,23 @@ button[type=roll] * {
min-height: 20px;
}
-.sheet-npc .sheet-display .sheet-traits .sheet-trait {
+.sheet-npc .sheet-display .sheet-traits .sheet-trait,
+.sheet-npc .sheet-reaction .sheet-trait
+{
position: relative;
}
-.sheet-npc .sheet-display .sheet-traits input {
+.sheet-npc .sheet-display .sheet-traits input,
+.sheet-npc .sheet-reaction input
+
+{
pointer-events: initial;
font-weight: bold;
width: 100%;
}
.sheet-npc .sheet-display .sheet-traits textarea,
+.sheet-npc .sheet-reaction textarea,
.sheet-attack textarea
{
resize: vertical;
@@ -1917,7 +2025,16 @@ button[type=roll] * {
margin-bottom: 15px;
}
-.sheet-legendary_flag[value="0"] ~ .sheet-legendary {
+.sheet-npcspelloptions {
+ display: inline-block;
+ margin-left: 17px;
+}
+
+.sheet-legendary_flag[value="0"] ~ .sheet-legendary,
+.sheet-reaction_flag[value="0"] ~ .sheet-reaction,
+.sheet-npcspell_flag[value="0"] ~ .sheet-npcspell,
+.sheet-npcspellcastingflag:not(:checked) ~ .sheet-npcspelloptions
+{
display: none;
}
@@ -2017,7 +2134,7 @@ button[type=roll] * {
.sheet-rolltemplate-npcatk .inlinerollresult.fullcrit,
.sheet-rolltemplate-npcdmg .inlinerollresult.fullcrit
{
- color: #3FB315;
+ color: #3FB315;
border: none;
}
@@ -2026,7 +2143,7 @@ button[type=roll] * {
.sheet-rolltemplate-npcatk .inlinerollresult.fullfail,
.sheet-rolltemplate-npcdmg .inlinerollresult.fullfail
{
- color: #B31515;
+ color: #B31515;
border: none;
}
@@ -2035,7 +2152,7 @@ button[type=roll] * {
.sheet-rolltemplate-npcatk .inlinerollresult.importantroll,
.sheet-rolltemplate-npcdmg .inlinerollresult.importantroll
{
- color: #4A57ED;
+ color: #4A57ED;
border: none;
}
@@ -2153,16 +2270,49 @@ button[type=roll] * {
display: block;
}
-.sheet-equipment .sheet-warning span {
+.sheet-equipment .sheet-warning span,
+.sheet-equipment .sheet-encumb
+{
color: red;
}
+.sheet-equipment .sheet-encumb
+{
+ display: none;
+ font-size: 9px;
+}
+
+.sheet-equipment .sheet-encumberance[value="IMMOBILE"] ~ .sheet-immobile,
+.sheet-equipment .sheet-encumberance[value="HEAVILY ENCUMBERED"] ~ .sheet-heavily,
+.sheet-equipment .sheet-encumberance[value="ENCUMBERED"] ~ .sheet-encumbered,
+.sheet-equipment .sheet-encumberance[value="OVER CARRYING CAPACITY"] ~ .sheet-over,
+{
+ display: block;
+}
+
.sheet-equipment .sheet-warning input[type="checkbox"] {
-webkit-appearance: checkbox;
-moz-appearance: checkbox;
width: auto;
}
+.sheet-equipment .sheet-item .sheet-subitem .sheet-equipped {
+ -webkit-appearance: checkbox;
+ -moz-appearance: checkbox;
+ width: initial;
+ margin-left: 15px;
+}
+
+.sheet-equipment .sheet-item .sheet-subitem .sheet-equippedlabel {
+ width: calc(100% - 50px);
+ text-align: left;
+ padding-left: 5px;
+}
+
+.sheet-equipment .sheet-equippedflag[value="unequipped"] ~ .sheet-item > .sheet-name {
+ color: #999;
+}
+
.sheet-version {
position: absolute;
top: 0px;
@@ -2179,6 +2329,102 @@ button[type=roll] * {
display: none;
}
-.charsheet .sheet-spells .sheet-spellattackinfoflag[value="show"] ~ .sheet-spellattackinfo {
+.charsheet .sheet-spells .sheet-spellattackinfoflag[value="show"] ~ .sheet-spellattackinfo,
+.charsheet .sheet-npc .sheet-spellattackinfoflag[value="show"] ~ .sheet-spellattackinfo,
+{
display: block;
}
+
+.sheet-attack input[type=text].sheet-flat {
+ display: none;
+}
+
+.sheet-attack .sheet-flatflag[value="show"] ~ input[type=text].sheet-flat {
+ display: inline-block;
+}
+
+
+.sheet-rolltemplate-simple .sheet-charname,
+.sheet-rolltemplate-atk .sheet-charname,
+.sheet-rolltemplate-dmg .sheet-charname,
+.sheet-rolltemplate-atkdmg .sheet-charname
+{
+ text-align: center;
+ margin-top: -10px;
+}
+
+.sheet-rolltemplate-simple .sheet-charname span,
+.sheet-rolltemplate-atk .sheet-charname span,
+.sheet-rolltemplate-dmg .sheet-charname span,
+.sheet-rolltemplate-atkdmg .sheet-charname span
+{
+ font-size: 11px;
+ font-weight: normal;
+ color: #A0A0A0;
+}
+
+.sheet-advantagetoggle {
+ display: none;
+}
+
+.sheet-toggleflag[value="show"] ~ .sheet-advantagetoggle {
+ display: block;
+}
+
+.sheet-npc .sheet-advantagetoggle input[type=radio] + span {
+ text-transform: capitalize;
+ font-variant: small-caps;
+ font-weight: normal;
+ background: transparent;
+ border: none;
+}
+
+.sheet-npc .sheet-advantagetoggle input[type=radio]:checked + span {
+ font-weight: bold;
+ color: rgb(126, 45, 64);
+}
+
+.sheet-npc .sheet-display .sheet-info {
+ font-weight: normal;
+}
+
+
+/* TRANSITION SCRIPT */
+.sheet-class_options,
+.sheet-skill_options,
+.sheet-general_options,
+.sheet-transition_options
+{
+ border: 1px solid #666;
+ border-radius: 5px;
+ padding: 5px;
+ margin-bottom: 5px;
+}
+
+.sheet-transition_options {
+ display: none;
+}
+
+.sheet-already_transitioned[value="0"] ~ .sheet-transition_options {
+ display: block;
+}
+
+.sheet-sheet_select img {
+ padding: 5px;
+ border: 1px solid #BBB;
+ border-radius: 5px;
+}
+
+.sheet-sheet_select img:hover {
+ background-color: #DDD;
+ cursor: pointer!important;
+}
+
+.charsheet .sheet-options .sheet-row span.sheet-transition_text {
+ color: #A0A0A0;
+}
+
+.charsheet .sheet-options .sheet-row span.sheet-transition_text_highlight {
+ color: #F00;
+}
+/* /TRANSITION SCRIPT */
diff --git a/5th Edition OGL by Roll20/5th Edition OGL by Roll20.html b/5th Edition OGL by Roll20/5th Edition OGL by Roll20.html
index 779a6081cd..9d9a05193f 100644
--- a/5th Edition OGL by Roll20/5th Edition OGL by Roll20.html
+++ b/5th Edition OGL by Roll20/5th Edition OGL by Roll20.html
@@ -1,8 +1,8 @@
-
+
y
-
+
+
+
+
+ HAS REACTIONS
+
LEGENDARY ACTIONS:
@@ -205,6 +231,7 @@
ROLL QUERIES:
Always Roll Advantage
+ Advantage Toggle
Query Advantage
Never Roll Advantage
@@ -451,30 +478,30 @@
Damage Vulnerabilities
-
+
Damage Resistances
-
+
Damage Immunities
-
+
Condition Immunities
-
+
-
+
Senses
-
+
-
+
Languages
-
+
Challenge
@@ -485,65 +512,71 @@
-
+
-
+
+
+
+ Reactions
+
+
+
+
+
+
+
+
+
+
-
Legendary Actions
@@ -594,45 +786,45 @@
NAME:
-
-
-
+
+
+
+
+
+
+
@@ -671,6 +851,13 @@
@@ -1330,22 +1513,24 @@
Total
-
+
+
-
+
FEATURES & TRAITS
@@ -1586,6 +1771,8 @@
d12
d20
+ +
+
@@ -1603,8 +1790,6 @@
-
-
@@ -1750,6 +1935,8 @@
d12
d20
+ +
+
@@ -1767,8 +1954,6 @@
-
-
@@ -1915,6 +2100,8 @@
d12
d20
+ +
+
@@ -1932,8 +2119,6 @@
-
-
@@ -2083,6 +2268,8 @@
d12
d20
+ +
+
@@ -2100,8 +2287,6 @@
-
-
@@ -2248,6 +2433,8 @@
d12
d20
+ +
+
@@ -2265,8 +2452,6 @@
-
-
@@ -2413,6 +2598,8 @@
d12
d20
+ +
+
@@ -2430,8 +2617,6 @@
-
-
@@ -2581,6 +2766,8 @@
d12
d20
+ +
+
@@ -2598,8 +2785,6 @@
-
-
@@ -2746,6 +2931,8 @@
d12
d20
+ +
+
@@ -2763,8 +2950,6 @@
-
-
@@ -2911,6 +3096,8 @@
d12
d20
+ +
+
@@ -2928,8 +3115,6 @@
-
-
@@ -3076,6 +3261,8 @@
d12
d20
+ +
+
@@ -3093,8 +3280,6 @@
-
-
@@ -3204,6 +3389,10 @@
GLOBAL SAVING THROW MODIFIER:
+
+ GLOBAL ARMOR CLASS MODIFIER:
+
+
@@ -3611,6 +3860,11 @@
{{rname}}{{#mod}} ({{mod}}) {{/mod}}
+ {{#charname}}
+
+ {{charname}}
+
+ {{/charname}}
@@ -3719,7 +3973,12 @@
{{#rollGreater() r1 r2}}{{rname}} ({{mod}}) {{/rollGreater() r1 r2}}
{{/disadvantage}}
-
+ {{#charname}}
+
+ {{charname}}
+
+ {{/charname}}
+
{{#desc}}
{{desc}}
@@ -3768,47 +4027,52 @@
{{/hldmg}}
- {{#dmg1flag}}
- {{^dmg2flag}}
-
- {{dmg1}}{{#crit}} + {{crit1}}{{/crit}}
- {{dmg1type}}
-
- {{/dmg2flag}}
- {{/dmg1flag}}
- {{#dmg2flag}}
- {{^dmg1flag}}
-
- {{dmg2}}{{#crit}} + {{crit2}}{{/crit}}
- {{dmg2type}}
-
- {{/dmg1flag}}
- {{/dmg2flag}}
- {{#dmg1flag}}
- {{#dmg2flag}}
-
- {{dmg1}}{{#crit}} + {{crit1}}{{/crit}}
- {{dmg1type}}
-
-
-
- {{dmg2}}{{#crit}} + {{crit2}}{{/crit}}
- {{dmg2type}}
-
- {{/dmg2flag}}
- {{/dmg1flag}}
-
- {{^attack}}
- {{#range}}
-
- {{range}}
-
- {{/range}}
+ {{#dmg1flag}}
+ {{^dmg2flag}}
+
+ {{dmg1}}{{#crit}} + {{crit1}}{{/crit}}
+ {{dmg1type}}
+
+ {{/dmg2flag}}
+ {{/dmg1flag}}
+ {{#dmg2flag}}
+ {{^dmg1flag}}
+
+ {{dmg2}}{{#crit}} + {{crit2}}{{/crit}}
+ {{dmg2type}}
+
+ {{/dmg1flag}}
+ {{/dmg2flag}}
+ {{#dmg1flag}}
+ {{#dmg2flag}}
+
+ {{dmg1}}{{#crit}} + {{crit1}}{{/crit}}
+ {{dmg1type}}
+
+
+
+ {{dmg2}}{{#crit}} + {{crit2}}{{/crit}}
+ {{dmg2type}}
+
+ {{/dmg2flag}}
+ {{/dmg1flag}}
+
+ {{^attack}}
+ {{#range}}
+
+ {{range}}
+
+ {{/range}}
- {{rname}}
-
- {{/attack}}
-
+ {{rname}}
+
+ {{#charname}}
+
+ {{charname}}
+
+ {{/charname}}
+ {{/attack}}
+
@@ -3888,15 +4152,20 @@
{{/rollGreater() r1 r2}}
{{/disadvantage}}
- {{#range}}
-
- {{range}}
-
- {{/range}}
-
- {{rname}}{{#attack}} ({{mod}}) {{/attack}}
-
-
+ {{#range}}
+
+ {{range}}
+
+ {{/range}}
+
+ {{rname}}{{#attack}} ({{mod}}) {{/attack}}
+
+ {{#charname}}
+
+ {{charname}}
+
+ {{/charname}}
+
{{/attack}}
{{#save}}
{{#attack}}
@@ -3938,125 +4207,130 @@
{{#dmg1flag}}
- {{^dmg2flag}}
-
-
- {{dmg1}}
- {{#attack}}
- {{#normal}}
- {{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}
- {{/normal}}
+ {{^dmg2flag}}
+
+
+ {{dmg1}}
+ {{#attack}}
+ {{#normal}}
+ {{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}
+ {{/normal}}
{{#always}}
- {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
- {{/always}}
- {{#advantage}}
- {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
- {{/advantage}}
- {{#disadvantage}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{/disadvantage}}
- {{/attack}}
-
+ {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
+ {{/always}}
+ {{#advantage}}
+ {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
+ {{/advantage}}
+ {{#disadvantage}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{/disadvantage}}
+ {{/attack}}
+
{{dmg1type}}
-
+
{{/dmg2flag}}
{{/dmg1flag}}
{{#dmg2flag}}
- {{^dmg1flag}}
-
-
- {{dmg2}}
- {{#attack}}
- {{#normal}}
- {{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}
- {{/normal}}
+ {{^dmg1flag}}
+
+
+ {{dmg2}}
+ {{#attack}}
+ {{#normal}}
+ {{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}
+ {{/normal}}
{{#always}}
- {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit2}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
- {{/always}}
- {{#advantage}}
- {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit2}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
- {{/advantage}}
- {{#disadvantage}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{/disadvantage}}
- {{/attack}}
-
+ {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit2}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
+ {{/always}}
+ {{#advantage}}
+ {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit2}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
+ {{/advantage}}
+ {{#disadvantage}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{/disadvantage}}
+ {{/attack}}
+
{{dmg2type}}
-
+
{{/dmg1flag}}
{{/dmg2flag}}
{{#dmg1flag}}
{{#dmg2flag}}
-
- {{dmg1}}
- {{#attack}}
- {{#normal}}
- {{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}
- {{/normal}}
+
+ {{dmg1}}
+ {{#attack}}
+ {{#normal}}
+ {{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}
+ {{/normal}}
{{#always}}
- {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
- {{/always}}
- {{#advantage}}
- {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
- {{/advantage}}
- {{#disadvantage}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{/disadvantage}}
- {{/attack}}
-
+ {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
+ {{/always}}
+ {{#advantage}}
+ {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
+ {{/advantage}}
+ {{#disadvantage}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{/disadvantage}}
+ {{/attack}}
+
{{dmg1type}}
-
-
-
-
- {{dmg2}}
- {{#attack}}
- {{#normal}}
- {{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}
- {{/normal}}
+
+
+
+
+ {{dmg2}}
+ {{#attack}}
+ {{#normal}}
+ {{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}
+ {{/normal}}
{{#always}}
- {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit2}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
- {{/always}}
- {{#advantage}}
- {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit2}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
- {{/advantage}}
- {{#disadvantage}}
- {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
- {{/disadvantage}}
- {{/attack}}
-
+ {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit2}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
+ {{/always}}
+ {{#advantage}}
+ {{#rollLess() r1 r2}}{{#rollWasCrit() r2}}+ {{crit2}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollGreater() r1 r2}}
+ {{/advantage}}
+ {{#disadvantage}}
+ {{#rollTotal() r1 r2}}{{#rollWasCrit() r1}}+ {{crit2}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
+ {{/disadvantage}}
+ {{/attack}}
+
{{dmg2type}}
-
+
{{/dmg2flag}}
{{/dmg1flag}}
{{^attack}}
- {{#range}}
-
- {{range}}
-
- {{/range}}
+ {{#range}}
+
+ {{range}}
+
+ {{/range}}
{{rname}}
-
- {{/attack}}
+
+ {{#charname}}
+
+ {{charname}}
+
+ {{/charname}}
+ {{/attack}}
{{/damage}}
@@ -4113,47 +4387,47 @@
-
-
-
-
- {{#normal}}
- {{rname}}: {{r1}}
- {{/normal}}
- {{#always}}
- {{rname}}: {{r1}} | {{r2}}
- {{/always}}
- {{#advantage}}
- {{#rollLess() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollGreater() r1 r2}}
- {{/advantage}}
- {{#disadvantage}}
- {{#rollLess() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollGreater() r1 r2}}
- {{/disadvantage}}
-
-
+
+
+
+
+ {{#normal}}
+ {{rname}}: {{r1}}
+ {{/normal}}
+ {{#always}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/always}}
+ {{#advantage}}
+ {{#rollLess() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollGreater() r1 r2}}
+ {{/advantage}}
+ {{#disadvantage}}
+ {{#rollLess() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollGreater() r1 r2}}
+ {{/disadvantage}}
+
+
-
{{#description}}
{{description}}
- {{/description}}
-
+ {{/description}}
+
@@ -4257,58 +4531,58 @@
-
-
-
- {{#attack}}
-
- {{#normal}}
- Attack: {{r1}}
- {{/normal}}
- {{#always}}
- {{rname}}: {{r1}} | {{r2}}
- {{/always}}
- {{#advantage}}
- {{#rollLess() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollGreater() r1 r2}}
- {{/advantage}}
- {{#disadvantage}}
- {{#rollLess() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollLess() r1 r2}}
- {{#rollTotal() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollTotal() r1 r2}}
- {{#rollGreater() r1 r2}}
- {{rname}}: {{r1}} | {{r2}}
- {{/rollGreater() r1 r2}}
- {{/disadvantage}}
-
- {{/attack}}
- {{#description}}
-
{{description}}
- {{/description}}
-
- {{#damage}}
-
-
Damage:
+
+
+
+ {{#attack}}
+
+ {{#normal}}
+ Attack: {{r1}}
+ {{/normal}}
+ {{#always}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/always}}
+ {{#advantage}}
+ {{#rollLess() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollGreater() r1 r2}}
+ {{/advantage}}
+ {{#disadvantage}}
+ {{#rollLess() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollLess() r1 r2}}
+ {{#rollTotal() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollTotal() r1 r2}}
+ {{#rollGreater() r1 r2}}
+ {{rname}}: {{r1}} | {{r2}}
+ {{/rollGreater() r1 r2}}
+ {{/disadvantage}}
+
+ {{/attack}}
+ {{#description}}
+
{{description}}
+ {{/description}}
+
+ {{#damage}}
+
+ Damage:
{{#dmg1flag}}
{{dmg1}}
{{#normal}}
- {{#rollWasCrit() r1}} + {{crit1}}{{/rollWasCrit() r1}}
- {{/normal}}
+ {{#rollWasCrit() r1}} + {{crit1}}{{/rollWasCrit() r1}}
+ {{/normal}}
{{#always}}
{{#rollLess() r1 r2}}{{#rollWasCrit() r2}} + {{crit1}}{{/rollWasCrit() r2}}{{/rollLess() r1 r2}}
{{#rollTotal() r1 r2}}{{#rollWasCrit() r1}} + {{crit1}}{{/rollWasCrit() r1}}{{/rollTotal() r1 r2}}
@@ -4346,9 +4620,9 @@
{{dmg2type}}
{{/dmg2flag}}
-
- {{/damage}}
-
+
+ {{/damage}}
+
@@ -4357,6 +4631,22 @@
on("sheet:opened", function() {
versioning();
+
+ getAttrs(['meleedmg1','rangeddmg1','pro_weapons','pro_armor','inventoryname1','barbarian_level','bard_level','cleric_level','druid_level','figher_level','monk_level','paladin_level','ranger_level','rogue_level','sorcerer_level','warlock_level','wizard_level','npc_type','npc_size','npc_alignment','npc_hp','npc_HP_hit_dice','npc_AC_note','npc_strength','npc_dexterity','npc_constitution','npc_intelligence','npc_wisdom','npc_charisma','speed','speed_fly','speed_burrow','speed_swim','speed_climb','prolanguages','blindsight','darkvision','tremorsense','truesight','challenge','xp','multiattack','npc_traits','lair_actions','legendary_action_notes','damage_vulnerability','damage_resistance','damage_immunity','condition_immunity'], function(attrs) {
+ var hasOldData = false;
+ var updates = {};
+ _.each(attrs, function(value, key) {
+ if(value) {
+ hasOldData = true;
+ updates.tab = 'options';
+ }
+ });
+ if(!hasOldData) {
+ updates.already_transitioned = '1';
+ }
+
+ setAttrs(updates);
+ });
});
on("change:npc", function() {
@@ -4450,50 +4740,52 @@
updateTool();
});
- on("change:repeating_attack:atkflag change:repeating_attack:atkname_base change:repeating_attack:atkattr_base change:repeating_attack:atkmod change:repeating_attack:atkmagic change:repeating_attack:atkprofflag change:repeating_attack:dmgflag change:repeating_attack:dmgbase change:repeating_attack:dmgattr change:repeating_attack:dmgmod change:repeating_attack:dmgtype change:repeating_attack:dmg2flag change:repeating_attack:dmg2base change:repeating_attack:dmg2attr change:repeating_attack:dmg2mod change:repeating_attack:dmg2type change:repeating_attack:saveflag change:repeating_attack:savedc change:repeating_attack:updateflag change:repeating_attack:dmgcustcrit change:repeating_attack:dmg2custcrit", function() {
- updateAttack();
+ on("change:repeating_attack:atkflag change:repeating_attack:atkname_base change:repeating_attack:atkattr_base change:repeating_attack:atkmod change:repeating_attack:atkmagic change:repeating_attack:atkprofflag change:repeating_attack:dmgflag change:repeating_attack:dmgbase change:repeating_attack:dmgattr change:repeating_attack:dmgmod change:repeating_attack:dmgtype change:repeating_attack:dmg2flag change:repeating_attack:dmg2base change:repeating_attack:dmg2attr change:repeating_attack:dmg2mod change:repeating_attack:dmg2type change:repeating_attack:saveflag change:repeating_attack:savedc change:repeating_attack:saveflat change:repeating_attack:updateflag change:repeating_attack:dmgcustcrit change:repeating_attack:dmg2custcrit", function(eventinfo) {
+ updateAttack(eventinfo);
});
on("change:dtype", function() {
- getAttrs(["dtype"], function(v) {
- setAttrs({
- dflag: v.dtype
- });
- var updatepickbase = v.dtype;
- getSectionIDs("repeating_attack", function(idarray) {
- _.each(idarray, function(currentID) {
- getAttrs(["repeating_attack_" + currentID + "_atkflag", "repeating_attack_" + currentID + "_dmgflag"], function(v) {
- update = {};
- if(updatepickbase === "full") {
- update["repeating_attack_" + currentID + "_hidden_pickbase"] = "full";
- }
- else {
- if(!v["repeating_attack_" + currentID + "_atkflag"] || v["repeating_attack_" + currentID + "_atkflag"] != 0) {
- update["repeating_attack_" + currentID + "_hidden_pickbase"] = "pick";
- }
- else if(!v["repeating_attack_" + currentID + "_dmgflag"] || v["repeating_attack_" + currentID + "_dmgflag"] != 0) {
- update["repeating_attack_" + currentID + "_hidden_pickbase"] = "dmg";
- }
- else {
- update["repeating_attack_" + currentID + "_hidden_pickbase"] = "empty";
- }
- }
- setAttrs(update);
- });
- });
- });
- });
+ force_refresh_attacks();
+ force_refresh_npcactions();
+ // getAttrs(["dtype"], function(v) {
+ // setAttrs({
+ // dflag: v.dtype
+ // });
+ // var updatepickbase = v.dtype;
+ // getSectionIDs("repeating_attack", function(idarray) {
+ // _.each(idarray, function(currentID) {
+ // getAttrs(["repeating_attack_" + currentID + "_atkflag", "repeating_attack_" + currentID + "_dmgflag"], function(v) {
+ // update = {};
+ // if(updatepickbase === "full") {
+ // update["repeating_attack_" + currentID + "_hidden_pickbase"] = "full";
+ // }
+ // else {
+ // if(!v["repeating_attack_" + currentID + "_atkflag"] || v["repeating_attack_" + currentID + "_atkflag"] != 0) {
+ // update["repeating_attack_" + currentID + "_hidden_pickbase"] = "pick";
+ // }
+ // else if(!v["repeating_attack_" + currentID + "_dmgflag"] || v["repeating_attack_" + currentID + "_dmgflag"] != 0) {
+ // update["repeating_attack_" + currentID + "_hidden_pickbase"] = "dmg";
+ // }
+ // else {
+ // update["repeating_attack_" + currentID + "_hidden_pickbase"] = "empty";
+ // }
+ // }
+ // setAttrs(update);
+ // });
+ // });
+ // });
+ // });
});
- on("change:repeating_spell-cantrip:spellname_base change:repeating_spell-1:spellname_base change:repeating_spell-1:spellprepared change:repeating_spell-2:spellname_base change:repeating_spell-2:spellprepared change:repeating_spell-3:spellname_base change:repeating_spell-3:spellprepared change:repeating_spell-4:spellname_base change:repeating_spell-4:spellprepared change:repeating_spell-5:spellname_base change:repeating_spell-5:spellprepared change:repeating_spell-6:spellname_base change:repeating_spell-6:spellprepared change:repeating_spell-7:spellname_base change:repeating_spell-7:spellprepared change:repeating_spell-8:spellname_base change:repeating_spell-8:spellprepared change:repeating_spell-9:spellname_base change:repeating_spell-9:spellprepared change:repeating_spell-cantrip:spellrange change:repeating_spell-1:spellrange change:repeating_spell-2:spellrange change:repeating_spell-3:spellrange change:repeating_spell-4:spellrange change:repeating_spell-5:spellrange change:repeating_spell-6:spellrange change:repeating_spell-7:spellrange change:repeating_spell-8:spellrange change:repeating_spell-9:spellrange change:repeating_spell-cantrip:spelltarget change:repeating_spell-1:spelltarget change:repeating_spell-2:spelltarget change:repeating_spell-3:spelltarget change:repeating_spell-4:spelltarget change:repeating_spell-5:spelltarget change:repeating_spell-6:spelltarget change:repeating_spell-7:spelltarget change:repeating_spell-8:spelltarget change:repeating_spell-9:spelltarget change:repeating_spell-cantrip:spelldamage change:repeating_spell-1:spelldamage change:repeating_spell-2:spelldamage change:repeating_spell-3:spelldamage change:repeating_spell-4:spelldamage change:repeating_spell-5:spelldamage change:repeating_spell-6:spelldamage change:repeating_spell-7:spelldamage change:repeating_spell-8:spelldamage change:repeating_spell-9:spelldamage change:repeating_spell-cantrip:spelldamagetype change:repeating_spell-1:spelldamagetype change:repeating_spell-2:spelldamagetype change:repeating_spell-3:spelldamagetype change:repeating_spell-4:spelldamagetype change:repeating_spell-5:spelldamagetype change:repeating_spell-6:spelldamagetype change:repeating_spell-7:spelldamagetype change:repeating_spell-8:spelldamagetype change:repeating_spell-9:spelldamagetype change:repeating_spell-cantrip:spelldamage2 change:repeating_spell-1:spelldamage2 change:repeating_spell-2:spelldamage2 change:repeating_spell-3:spelldamage2 change:repeating_spell-4:spelldamage2 change:repeating_spell-5:spelldamage2 change:repeating_spell-6:spelldamage2 change:repeating_spell-7:spelldamage2 change:repeating_spell-8:spelldamage2 change:repeating_spell-9:spelldamage2 change:repeating_spell-cantrip:spelldamagetype2 change:repeating_spell-1:spelldamagetype2 change:repeating_spell-2:spelldamagetype2 change:repeating_spell-3:spelldamagetype2 change:repeating_spell-4:spelldamagetype2 change:repeating_spell-5:spelldamagetype2 change:repeating_spell-6:spelldamagetype2 change:repeating_spell-7:spelldamagetype2 change:repeating_spell-8:spelldamagetype2 change:repeating_spell-9:spelldamagetype2 change:repeating_spell-cantrip:spellhealing change:repeating_spell-1:spellhealing change:repeating_spell-2:spellhealing change:repeating_spell-3:spellhealing change:repeating_spell-4:spellhealing change:repeating_spell-5:spellhealing change:repeating_spell-6:spellhealing change:repeating_spell-7:spellhealing change:repeating_spell-8:spellhealing change:repeating_spell-9:spellhealing change:repeating_spell-cantrip:spelldmgmod change:repeating_spell-1:spelldmgmod change:repeating_spell-2:spelldmgmod change:repeating_spell-3:spelldmgmod change:repeating_spell-4:spelldmgmod change:repeating_spell-5:spelldmgmod change:repeating_spell-6:spelldmgmod change:repeating_spell-7:spelldmgmod change:repeating_spell-8:spelldmgmod change:repeating_spell-9:spelldmgmod change:repeating_spell-cantrip:spellsave change:repeating_spell-1:spellsave change:repeating_spell-2:spellsave change:repeating_spell-3:spellsave change:repeating_spell-4:spellsave change:repeating_spell-5:spellsave change:repeating_spell-6:spellsave change:repeating_spell-7:spellsave change:repeating_spell-8:spellsave change:repeating_spell-9:spellsave change:repeating_spell-cantrip:spellsavesuccess change:repeating_spell-1:spellsavesuccess change:repeating_spell-2:spellsavesuccess change:repeating_spell-3:spellsavesuccess change:repeating_spell-4:spellsavesuccess change:repeating_spell-5:spellsavesuccess change:repeating_spell-6:spellsavesuccess change:repeating_spell-7:spellsavesuccess change:repeating_spell-8:spellsavesuccess change:repeating_spell-9:spellsavesuccess change:repeating_spell-cantrip:spellhldie change:repeating_spell-1:spellhldie change:repeating_spell-2:spellhldie change:repeating_spell-3:spellhldie change:repeating_spell-4:spellhldie change:repeating_spell-5:spellhldie change:repeating_spell-6:spellhldie change:repeating_spell-7:spellhldie change:repeating_spell-8:spellhldie change:repeating_spell-9:spellhldie change:repeating_spell-cantrip:spellhldietype change:repeating_spell-1:spellhldietype change:repeating_spell-2:spellhldietype change:repeating_spell-3:spellhldietype change:repeating_spell-4:spellhldietype change:repeating_spell-5:spellhldietype change:repeating_spell-6:spellhldietype change:repeating_spell-7:spellhldietype change:repeating_spell-8:spellhldietype change:repeating_spell-9:spellhldietype change:repeating_spell-cantrip:spell_updateflag change:repeating_spell-1:spell_updateflag change:repeating_spell-2:spell_updateflag change:repeating_spell-3:spell_updateflag change:repeating_spell-4:spell_updateflag change:repeating_spell-5:spell_updateflag change:repeating_spell-6:spell_updateflag change:repeating_spell-7:spell_updateflag change:repeating_spell-8:spell_updateflag change:repeating_spell-9:spell_updateflag change:repeating_spell-cantrip:spellattack change:repeating_spell-1:spellattack change:repeating_spell-2:spellattack change:repeating_spell-3:spellattack change:repeating_spell-4:spellattack change:repeating_spell-5:spellattack change:repeating_spell-6:spellattack change:repeating_spell-7:spellattack change:repeating_spell-8:spellattack change:repeating_spell-9:spellattack", function() {
- updateSpell();
+ on("change:repeating_spell-cantrip:spellname_base change:repeating_spell-1:spellname_base change:repeating_spell-1:spellprepared change:repeating_spell-2:spellname_base change:repeating_spell-2:spellprepared change:repeating_spell-3:spellname_base change:repeating_spell-3:spellprepared change:repeating_spell-4:spellname_base change:repeating_spell-4:spellprepared change:repeating_spell-5:spellname_base change:repeating_spell-5:spellprepared change:repeating_spell-6:spellname_base change:repeating_spell-6:spellprepared change:repeating_spell-7:spellname_base change:repeating_spell-7:spellprepared change:repeating_spell-8:spellname_base change:repeating_spell-8:spellprepared change:repeating_spell-9:spellname_base change:repeating_spell-9:spellprepared change:repeating_spell-cantrip:spellrange change:repeating_spell-1:spellrange change:repeating_spell-2:spellrange change:repeating_spell-3:spellrange change:repeating_spell-4:spellrange change:repeating_spell-5:spellrange change:repeating_spell-6:spellrange change:repeating_spell-7:spellrange change:repeating_spell-8:spellrange change:repeating_spell-9:spellrange change:repeating_spell-cantrip:spelltarget change:repeating_spell-1:spelltarget change:repeating_spell-2:spelltarget change:repeating_spell-3:spelltarget change:repeating_spell-4:spelltarget change:repeating_spell-5:spelltarget change:repeating_spell-6:spelltarget change:repeating_spell-7:spelltarget change:repeating_spell-8:spelltarget change:repeating_spell-9:spelltarget change:repeating_spell-cantrip:spelldamage change:repeating_spell-1:spelldamage change:repeating_spell-2:spelldamage change:repeating_spell-3:spelldamage change:repeating_spell-4:spelldamage change:repeating_spell-5:spelldamage change:repeating_spell-6:spelldamage change:repeating_spell-7:spelldamage change:repeating_spell-8:spelldamage change:repeating_spell-9:spelldamage change:repeating_spell-cantrip:spelldamagetype change:repeating_spell-1:spelldamagetype change:repeating_spell-2:spelldamagetype change:repeating_spell-3:spelldamagetype change:repeating_spell-4:spelldamagetype change:repeating_spell-5:spelldamagetype change:repeating_spell-6:spelldamagetype change:repeating_spell-7:spelldamagetype change:repeating_spell-8:spelldamagetype change:repeating_spell-9:spelldamagetype change:repeating_spell-cantrip:spelldamage2 change:repeating_spell-1:spelldamage2 change:repeating_spell-2:spelldamage2 change:repeating_spell-3:spelldamage2 change:repeating_spell-4:spelldamage2 change:repeating_spell-5:spelldamage2 change:repeating_spell-6:spelldamage2 change:repeating_spell-7:spelldamage2 change:repeating_spell-8:spelldamage2 change:repeating_spell-9:spelldamage2 change:repeating_spell-cantrip:spelldamagetype2 change:repeating_spell-1:spelldamagetype2 change:repeating_spell-2:spelldamagetype2 change:repeating_spell-3:spelldamagetype2 change:repeating_spell-4:spelldamagetype2 change:repeating_spell-5:spelldamagetype2 change:repeating_spell-6:spelldamagetype2 change:repeating_spell-7:spelldamagetype2 change:repeating_spell-8:spelldamagetype2 change:repeating_spell-9:spelldamagetype2 change:repeating_spell-cantrip:spellhealing change:repeating_spell-1:spellhealing change:repeating_spell-2:spellhealing change:repeating_spell-3:spellhealing change:repeating_spell-4:spellhealing change:repeating_spell-5:spellhealing change:repeating_spell-6:spellhealing change:repeating_spell-7:spellhealing change:repeating_spell-8:spellhealing change:repeating_spell-9:spellhealing change:repeating_spell-cantrip:spelldmgmod change:repeating_spell-1:spelldmgmod change:repeating_spell-2:spelldmgmod change:repeating_spell-3:spelldmgmod change:repeating_spell-4:spelldmgmod change:repeating_spell-5:spelldmgmod change:repeating_spell-6:spelldmgmod change:repeating_spell-7:spelldmgmod change:repeating_spell-8:spelldmgmod change:repeating_spell-9:spelldmgmod change:repeating_spell-cantrip:spellsave change:repeating_spell-1:spellsave change:repeating_spell-2:spellsave change:repeating_spell-3:spellsave change:repeating_spell-4:spellsave change:repeating_spell-5:spellsave change:repeating_spell-6:spellsave change:repeating_spell-7:spellsave change:repeating_spell-8:spellsave change:repeating_spell-9:spellsave change:repeating_spell-cantrip:spellsavesuccess change:repeating_spell-1:spellsavesuccess change:repeating_spell-2:spellsavesuccess change:repeating_spell-3:spellsavesuccess change:repeating_spell-4:spellsavesuccess change:repeating_spell-5:spellsavesuccess change:repeating_spell-6:spellsavesuccess change:repeating_spell-7:spellsavesuccess change:repeating_spell-8:spellsavesuccess change:repeating_spell-9:spellsavesuccess change:repeating_spell-cantrip:spellhldie change:repeating_spell-1:spellhldie change:repeating_spell-2:spellhldie change:repeating_spell-3:spellhldie change:repeating_spell-4:spellhldie change:repeating_spell-5:spellhldie change:repeating_spell-6:spellhldie change:repeating_spell-7:spellhldie change:repeating_spell-8:spellhldie change:repeating_spell-9:spellhldie change:repeating_spell-cantrip:spellhldietype change:repeating_spell-1:spellhldietype change:repeating_spell-2:spellhldietype change:repeating_spell-3:spellhldietype change:repeating_spell-4:spellhldietype change:repeating_spell-5:spellhldietype change:repeating_spell-6:spellhldietype change:repeating_spell-7:spellhldietype change:repeating_spell-8:spellhldietype change:repeating_spell-9:spellhldietype change:repeating_spell-cantrip:spell_updateflag change:repeating_spell-1:spell_updateflag change:repeating_spell-2:spell_updateflag change:repeating_spell-3:spell_updateflag change:repeating_spell-4:spell_updateflag change:repeating_spell-5:spell_updateflag change:repeating_spell-6:spell_updateflag change:repeating_spell-7:spell_updateflag change:repeating_spell-8:spell_updateflag change:repeating_spell-9:spell_updateflag change:repeating_spell-cantrip:spellattack change:repeating_spell-1:spellattack change:repeating_spell-2:spellattack change:repeating_spell-3:spellattack change:repeating_spell-4:spellattack change:repeating_spell-5:spellattack change:repeating_spell-6:spellattack change:repeating_spell-7:spellattack change:repeating_spell-8:spellattack change:repeating_spell-9:spellattack change:repeating_spell-cantrip:spellhlbonus change:repeating_spell-1:spellhlbonus change:repeating_spell-2:spellhlbonus change:repeating_spell-3:spellhlbonus change:repeating_spell-4:spellhlbonus change:repeating_spell-5:spellhlbonus change:repeating_spell-6:spellhlbonus change:repeating_spell-7:spellhlbonus change:repeating_spell-8:spellhlbonus change:repeating_spell-9:spellhlbonus change:repeating_spell-npc:spellname_base change:repeating_spell-npc:spellrange change:repeating_spell-npc:spelltarget change:repeating_spell-npc:spelldamage change:repeating_spell-npc:spelldamagetype change:repeating_spell-npc:spelldamage2 change:repeating_spell-npc:spelldamagetype2 change:repeating_spell-npc:spellhealing change:repeating_spell-npc:spelldmgmod change:repeating_spell-npc:spellsave change:repeating_spell-npc:spellsavesuccess change:repeating_spell-npc:spellhldie change:repeating_spell-npc:spellhldietype change:repeating_spell-npc:spell_updateflag change:repeating_spell-npc:spellattack change:repeating_spell-npc:spellhlbonus", function(eventinfo) {
+ updateSpell("","",eventinfo);
});
- on("change:npc_name change:npc_type change:npc_ac change:npc_actype change:hp_max change:npc_hpformula change:npc_speed change:strength change:dexterity change:constitution change:intelligence change:wisdom change:charisma change:npc_str_save change:npc_dex_save change:npc_con_save change:npc_int_save change:npc_wis_save change:npc_cha_save change:npc_acrobatics change:npc_animal_handling change:npc_arcana change:npc_athletics change:npc_deception change:npc_history change:npc_insight change:npc_intimidation change:npc_investigation change:npc_medicine change:npc_nature change:npc_perception change:npc_performance change:npc_persuasion change:npc_religion change:npc_sleight_of_hand change:npc_stealth change:npc_survival change:npc_vulnerabilities change:npc_resistances change:npc_immunities change:npc_condition_immunities change:npc_senses change:npc_languages change:npc_challenge change:npc_xp change:npc_legendary_actions", function() {
+ on("change:npc_name change:npc_type change:npc_ac change:npc_actype change:hp_max change:npc_hpformula change:npc_speed change:strength change:dexterity change:constitution change:intelligence change:wisdom change:charisma change:npc_str_save change:npc_dex_save change:npc_con_save change:npc_int_save change:npc_wis_save change:npc_cha_save change:npc_acrobatics change:npc_animal_handling change:npc_arcana change:npc_athletics change:npc_deception change:npc_history change:npc_insight change:npc_intimidation change:npc_investigation change:npc_medicine change:npc_nature change:npc_perception change:npc_performance change:npc_persuasion change:npc_religion change:npc_sleight_of_hand change:npc_stealth change:npc_survival change:npc_vulnerabilities change:npc_resistances change:npc_immunities change:npc_condition_immunities change:npc_senses change:npc_languages change:npc_challenge change:npc_xp change:npc_legendary_actions change:npcreactionsflag change:npcspellcastingflag", function() {
updateNPC();
});
- on("change:repeating_spell-cantrip:spellritualflag change:repeating_spell-1:spellritualflag change:repeating_spell-2:spellritualflag change:repeating_spell-3:spellritualflag change:repeating_spell-4:spellritualflag change:repeating_spell-5:spellritualflag change:repeating_spell-6:spellritualflag change:repeating_spell-7:spellritualflag change:repeating_spell-8:spellritualflag change:repeating_spell-9:spellritualflag", function() {
+ on("change:repeating_spell-cantrip:spellritualflag change:repeating_spell-1:spellritualflag change:repeating_spell-2:spellritualflag change:repeating_spell-3:spellritualflag change:repeating_spell-4:spellritualflag change:repeating_spell-5:spellritualflag change:repeating_spell-6:spellritualflag change:repeating_spell-7:spellritualflag change:repeating_spell-8:spellritualflag change:repeating_spell-9:spellritualflag change:repeating_spell-npc:spellritualflag", function() {
getAttrs(["repeating_spell_spellritualflag"], function(v) {
flag = v.repeating_spell_spellritualflag === "Yes" ? "{{ritual=1}}" : "0";
setAttrs({
@@ -4502,7 +4794,7 @@
});
});
- on("change:repeating_spell-cantrip:spellconcentrationflag change:repeating_spell-1:spellconcentrationflag change:repeating_spell-2:spellconcentrationflag change:repeating_spell-3:spellconcentrationflag change:repeating_spell-4:spellconcentrationflag change:repeating_spell-5:spellconcentrationflag change:repeating_spell-6:spellconcentrationflag change:repeating_spell-7:spellconcentrationflag change:repeating_spell-8:spellconcentrationflag change:repeating_spell-9:spellconcentrationflag", function() {
+ on("change:repeating_spell-cantrip:spellconcentrationflag change:repeating_spell-1:spellconcentrationflag change:repeating_spell-2:spellconcentrationflag change:repeating_spell-3:spellconcentrationflag change:repeating_spell-4:spellconcentrationflag change:repeating_spell-5:spellconcentrationflag change:repeating_spell-6:spellconcentrationflag change:repeating_spell-7:spellconcentrationflag change:repeating_spell-8:spellconcentrationflag change:repeating_spell-9:spellconcentrationflag change:repeating_spell-npc:spellconcentrationflag", function() {
getAttrs(["repeating_spell_spellconcentrationflag"], function(v) {
flag = v.repeating_spell_spellconcentrationflag === "Yes" ? "{{concentration=1}}" : "0";
setAttrs({
@@ -4511,7 +4803,7 @@
});
});
- on("change:repeating_spell-cantrip:spellcomp change:repeating_spell-1:spellcomp change:repeating_spell-2:spellcomp change:repeating_spell-3:spellcomp change:repeating_spell-4:spellcomp change:repeating_spell-5:spellcomp change:repeating_spell-6:spellcomp change:repeating_spell-7:spellcomp change:repeating_spell-8:spellcomp change:repeating_spell-9:spellcomp", function() {
+ on("change:repeating_spell-cantrip:spellcomp change:repeating_spell-1:spellcomp change:repeating_spell-2:spellcomp change:repeating_spell-3:spellcomp change:repeating_spell-4:spellcomp change:repeating_spell-5:spellcomp change:repeating_spell-6:spellcomp change:repeating_spell-7:spellcomp change:repeating_spell-8:spellcomp change:repeating_spell-9:spellcomp change:repeating_spell-npc:spellcomp", function() {
getAttrs(["repeating_spell_spellcomp"], function(v) {
spellv = v.repeating_spell_spellcomp.indexOf("V") > -1 ? "{{v=1}}" : "0"
spells = v.repeating_spell_spellcomp.indexOf("S") > -1 ? "{{s=1}}" : "0"
@@ -4524,7 +4816,7 @@
});
});
- on("change:repeating_spell-cantrip:spellcontent change:repeating_spell-1:spellcontent change:repeating_spell-2:spellcontent change:repeating_spell-3:spellcontent change:repeating_spell-4:spellcontent change:repeating_spell-5:spellcontent change:repeating_spell-6:spellcontent change:repeating_spell-7:spellcontent change:repeating_spell-8:spellcontent change:repeating_spell-9:spellcontent", function() {
+ on("change:repeating_spell-cantrip:spellcontent change:repeating_spell-1:spellcontent change:repeating_spell-2:spellcontent change:repeating_spell-3:spellcontent change:repeating_spell-4:spellcontent change:repeating_spell-5:spellcontent change:repeating_spell-6:spellcontent change:repeating_spell-7:spellcontent change:repeating_spell-8:spellcontent change:repeating_spell-9:spellcontent change:repeating_spell-npc:spellcontent", function() {
getAttrs(["repeating_spell_spellcontent"], function(v) {
content = v.repeating_spell_spellcontent.split("At Higher Levels:");
if(content.length > 1) {
@@ -4559,12 +4851,16 @@
// });
// });
- on("change:repeating_spell-cantrip:spelloutput change:repeating_spell-1:spelloutput change:repeating_spell-2:spelloutput change:repeating_spell-3:spelloutput change:repeating_spell-4:spelloutput change:repeating_spell-5:spelloutput change:repeating_spell-6:spelloutput change:repeating_spell-7:spelloutput change:repeating_spell-8:spelloutput change:repeating_spell-9:spelloutput", function() {
- getAttrs(["repeating_spell_spellattackid","repeating_spell_spelloutput","character_name","repeating_spell_pickbase"], function(v) {
+ on("change:repeating_spell-cantrip:spelloutput change:repeating_spell-1:spelloutput change:repeating_spell-2:spelloutput change:repeating_spell-3:spelloutput change:repeating_spell-4:spelloutput change:repeating_spell-5:spelloutput change:repeating_spell-6:spelloutput change:repeating_spell-7:spelloutput change:repeating_spell-8:spelloutput change:repeating_spell-9:spelloutput change:repeating_spell-npc:spelloutput", function(eventinfo) {
+ var idlvl = "-" + eventinfo.sourceAttribute.match(/repeating_spell-(.*?)-/)[1];
+ var spid = eventinfo.sourceAttribute.split("_")[2];
+ var ourid = idlvl + spid;
+ getAttrs(["repeating_spell_spellattackid","repeating_spell_spelloutput","character_id","repeating_spell_pickbase"], function(v) {
if(v.repeating_spell_spelloutput === "ATTACK") {
+ // if(idlvl != "-npc_") {
setAttrs({repeating_spell_spellattackinfoflag:"show"});
if(!v.repeating_spell_spellattackid) {
- addspellattack();
+ addspellattack(ourid);
}
else {
getSectionIDs("repeating_attack", function(idarray) {
@@ -4572,19 +4868,25 @@
return (thisid.toLowerCase() === v.repeating_spell_spellattackid.toLowerCase() )
});
if(!existingid) {
- addspellattack();
+ addspellattack(ourid);
}
else {
getAttrs(["repeating_attack_" + v.repeating_spell_spellattackid + "_hidden_pickbase"], function(x) {
- pbase = x["repeating_attack_" + v.repeating_spell_spellattackid + "_hidden_pickbase"];
+ // pbase = x["repeating_attack_" + v.repeating_spell_spellattackid + "_hidden_pickbase"];
setAttrs({
- repeating_spell_rollcontent: "%{" + v.character_name + "|repeating_attack_" + v.repeating_spell_spellattackid + "_attack_" + pbase + "}"
+ repeating_spell_rollcontent: "%{" + v.character_id + "|repeating_attack_" + v.repeating_spell_spellattackid + "_attack}"
});
});
}
});
};
-
+ // }
+ // else {
+ // setAttrs({
+ // repeating_spell_rollcontent: "@{rollbase}"
+ // });
+ // updateNPCspell(eventinfo);
+ // }
}
else {
setAttrs({
@@ -4595,7 +4897,7 @@
});
});
- on("change:repeating_spell-cantrip:spelldamage change:repeating_spell-1:spelldamage change:repeating_spell-2:spelldamage change:repeating_spell-3:spelldamage change:repeating_spell-4:spelldamage change:repeating_spell-5:spelldamage change:repeating_spell-6:spelldamage change:repeating_spell-7:spelldamage change:repeating_spell-8:spelldamage change:repeating_spell-9:spelldamage change:repeating_spell-cantrip:spellhealing change:repeating_spell-1:spellhealing change:repeating_spell-2:spellhealing change:repeating_spell-3:spellhealing change:repeating_spell-4:spellhealing change:repeating_spell-5:spellhealing change:repeating_spell-6:spellhealing change:repeating_spell-7:spellhealing change:repeating_spell-8:spellhealing change:repeating_spell-9:spellhealing", function() {
+ on("change:repeating_spell-cantrip:spelldamage change:repeating_spell-1:spelldamage change:repeating_spell-2:spelldamage change:repeating_spell-3:spelldamage change:repeating_spell-4:spelldamage change:repeating_spell-5:spelldamage change:repeating_spell-6:spelldamage change:repeating_spell-7:spelldamage change:repeating_spell-8:spelldamage change:repeating_spell-9:spelldamage change:repeating_spell-npc:spelldamage change:repeating_spell-cantrip:spellhealing change:repeating_spell-1:spellhealing change:repeating_spell-2:spellhealing change:repeating_spell-3:spellhealing change:repeating_spell-4:spellhealing change:repeating_spell-5:spellhealing change:repeating_spell-6:spellhealing change:repeating_spell-7:spellhealing change:repeating_spell-8:spellhealing change:repeating_spell-9:spellhealing change:repeating_spell-npc:spellhealing", function() {
getAttrs(["repeating_spell_spelldamage","repeating_spell_spellhealing"], function(v) {
if((v.repeating_spell_spelldamage && v.repeating_spell_spelldamage != "") || (v.repeating_spell_spellhealing && v.repeating_spell_spellhealing != "")) {
setAttrs({
@@ -4621,27 +4923,27 @@
// });
// });
- on("change:repeating_attack:hidden_pickbase", function(eventinfo) {
- getAttrs(["repeating_attack_hidden_pickbase"], function(x) {
- getSectionIDs("repeating_spell", function(idarray) {
- attackid = eventinfo.sourceAttribute.substring(17, 37);
- _.each(idarray, function(currentID) {
- getAttrs(["repeating_spell-cantrip_" + currentID + "_spelloutput","repeating_spell-cantrip_" + currentID + "_spellattackid","repeating_spell-1_" + currentID + "_spelloutput","repeating_spell-1_" + currentID + "_spellattackid","repeating_spell-2_" + currentID + "_spelloutput","repeating_spell-2_" + currentID + "_spellattackid","repeating_spell-3_" + currentID + "_spelloutput","repeating_spell-3_" + currentID + "_spellattackid","repeating_spell-4_" + currentID + "_spelloutput","repeating_spell-4_" + currentID + "_spellattackid","repeating_spell-5_" + currentID + "_spelloutput","repeating_spell-5_" + currentID + "_spellattackid","repeating_spell-6_" + currentID + "_spelloutput","repeating_spell-6_" + currentID + "_spellattackid","repeating_spell-7_" + currentID + "_spelloutput","repeating_spell-7_" + currentID + "_spellattackid","repeating_spell-8_" + currentID + "_spelloutput","repeating_spell-8_" + currentID + "_spellattackid","repeating_spell-9_" + currentID + "_spelloutput","repeating_spell-9_" + currentID + "_spellattackid","character_name"], function(v) {
- lvl = Object.keys(v)[0].match(/repeating_spell-(.*?)-/);
- if(lvl && v["repeating_spell-" + lvl[1] + currentID + "_spellattackid"] && v["repeating_spell-" + lvl[1] + currentID + "_spellattackid"].toLowerCase() === attackid && v["repeating_spell-" + lvl[1] + currentID + "_spelloutput"] === "ATTACK") {
- update = {};
- update["repeating_spell-" + lvl[1] + currentID + "_rollcontent"] = "%{" + v.character_name + "|repeating_attack_" + attackid + "_attack_" + x.repeating_attack_hidden_pickbase + "}";
- setAttrs(update);
- }
- });
- });
- });
- })
+ // on("change:repeating_attack:hidden_pickbase", function(eventinfo) {
+ // getAttrs(["repeating_attack_hidden_pickbase"], function(x) {
+ // getSectionIDs("repeating_spell", function(idarray) {
+ // attackid = eventinfo.sourceAttribute.substring(17, 37);
+ // _.each(idarray, function(currentID) {
+ // getAttrs(["repeating_spell-cantrip_" + currentID + "_spelloutput","repeating_spell-cantrip_" + currentID + "_spellattackid","repeating_spell-1_" + currentID + "_spelloutput","repeating_spell-1_" + currentID + "_spellattackid","repeating_spell-2_" + currentID + "_spelloutput","repeating_spell-2_" + currentID + "_spellattackid","repeating_spell-3_" + currentID + "_spelloutput","repeating_spell-3_" + currentID + "_spellattackid","repeating_spell-4_" + currentID + "_spelloutput","repeating_spell-4_" + currentID + "_spellattackid","repeating_spell-5_" + currentID + "_spelloutput","repeating_spell-5_" + currentID + "_spellattackid","repeating_spell-6_" + currentID + "_spelloutput","repeating_spell-6_" + currentID + "_spellattackid","repeating_spell-7_" + currentID + "_spelloutput","repeating_spell-7_" + currentID + "_spellattackid","repeating_spell-8_" + currentID + "_spelloutput","repeating_spell-8_" + currentID + "_spellattackid","repeating_spell-9_" + currentID + "_spelloutput","repeating_spell-9_" + currentID + "_spellattackid","character_name"], function(v) {
+ // lvl = Object.keys(v)[0].match(/repeating_spell-(.*?)-/);
+ // if(lvl && v["repeating_spell-" + lvl[1] + currentID + "_spellattackid"] && v["repeating_spell-" + lvl[1] + currentID + "_spellattackid"].toLowerCase() === attackid && v["repeating_spell-" + lvl[1] + currentID + "_spelloutput"] === "ATTACK") {
+ // update = {};
+ // update["repeating_spell-" + lvl[1] + currentID + "_rollcontent"] = "%{" + v.character_name + "|repeating_attack_" + attackid + "_attack_" + x.repeating_attack_hidden_pickbase + "}";
+ // setAttrs(update);
+ // }
+ // });
+ // });
+ // });
+ // })
- });
+ // });
- on("change:repeating_npcaction:name change:repeating_npcaction:attack_flag change:repeating_npcaction:attack_type change:repeating_npcaction:attack_range change:repeating_npcaction:attack_target change:repeating_npcaction:attack_tohit change:repeating_npcaction:attack_damage change:repeating_npcaction:attack_damagetype change:repeating_npcaction:attack_damage2 change:repeating_npcaction:attack_damagetype2 change:repeating_npcaction:description change:repeating_npcaction-l:name change:repeating_npcaction-l:attack_flag change:repeating_npcaction-l:attack_type change:repeating_npcaction-l:attack_range change:repeating_npcaction-l:attack_target change:repeating_npcaction-l:attack_tohit change:repeating_npcaction-l:attack_damage change:repeating_npcaction-l:attack_damagetype change:repeating_npcaction-l:attack_damage2 change:repeating_npcaction-l:attack_damagetype2 change:repeating_npcaction-l:description", function() {
- updateNPCaction();
+ on("change:repeating_npcaction:name change:repeating_npcaction:attack_flag change:repeating_npcaction:attack_type change:repeating_npcaction:attack_range change:repeating_npcaction:attack_target change:repeating_npcaction:attack_tohit change:repeating_npcaction:attack_damage change:repeating_npcaction:attack_damagetype change:repeating_npcaction:attack_damage2 change:repeating_npcaction:attack_damagetype2 change:repeating_npcaction:description change:repeating_npcaction-l:name change:repeating_npcaction-l:attack_flag change:repeating_npcaction-l:attack_type change:repeating_npcaction-l:attack_range change:repeating_npcaction-l:attack_target change:repeating_npcaction-l:attack_tohit change:repeating_npcaction-l:attack_damage change:repeating_npcaction-l:attack_damagetype change:repeating_npcaction-l:attack_damage2 change:repeating_npcaction-l:attack_damagetype2 change:repeating_npcaction-l:description change:repeating_npcaction:updateflag change:repeating_npcaction-l:updateflag", function(eventinfo) {
+ updateNPCaction(eventinfo);
});
on("change:npc_challenge", function() {
@@ -4736,7 +5038,7 @@
xp = "155,000";
break;
}
- setAttrs({npc_xp: xp + " XP"});
+ setAttrs({npc_xp: xp});
});
});
@@ -4748,7 +5050,7 @@
});
});
- on("change:repeating_inventory:itemweight change:repeating_inventory:itemcount change:cp change:sp change:ep change:gp change:pp", function() {
+ on("change:repeating_inventory:itemweight change:repeating_inventory:equipped change:repeating_inventory:itemcount change:cp change:sp change:ep change:gp change:pp", function() {
updateitemweight();
});
@@ -4791,46 +5093,67 @@
});
});
- on("remove:repeating_spell-cantrip remove:repeating_spell-1 remove:repeating_spell-2 remove:repeating_spell-3 remove:repeating_spell-4 remove:repeating_spell-5 remove:repeating_spell-6 remove:repeating_spell-7 remove:repeating_spell-8 remove:repeating_spell-9", function(eventinfo) {
- // console.log(eventinfo);
- // id = eventinfo.sourceAttribute.substring(18, 38);
- // console.log(id);
- // getSectionIDs("repeating_attack", function(idarray) {
- // _.each(idarray, function(currentID, i) {
- // getAttrs(["repeating_attack_" + currentID + "_itemid"], function(v) {
- // console.log(currentID);
- // console.log(v["repeating_attack_" + currentID + "_itemid"]);
- // console.log(id.toLowerCase());
- // console.log(v["repeating_attack_" + currentID + "_itemid"] === id.toLowerCase());
- // if(v["repeating_attack_" + currentID + "_itemid"] === id.toLowerCase()) {
- // removeRepeatingRow("repeating_attack_" + currentID);
- // }
- // });
- // });
- // });
+ on("remove:repeating_spell-cantrip remove:repeating_spell-1 remove:repeating_spell-2 remove:repeating_spell-3 remove:repeating_spell-4 remove:repeating_spell-5 remove:repeating_spell-6 remove:repeating_spell-7 remove:repeating_spell-8 remove:repeating_spell-9 remove:repeating_spell-npc", function(eventinfo) {
+ id = eventinfo.sourceAttribute.split("_")[2];
+ getSectionIDs("repeating_attack", function(idarray) {
+ _.each(idarray, function(currentID, i) {
+ getAttrs(["repeating_attack_" + currentID + "_spellid"], function(v) {
+ var spellid = v["repeating_attack_" + currentID + "_spellid"] && v["repeating_attack_" + currentID + "_spellid"].indexOf("_") > -1 ? v["repeating_attack_" + currentID + "_spellid"].split("_")[1] : v["repeating_attack_" + currentID + "_spellid"];
+ if(spellid === id.toLowerCase()) {
+ removeRepeatingRow("repeating_attack_" + currentID);
+ }
+ });
+ });
+ });
});
on("remove:repeating_inventory", function(eventinfo) {
- // id = eventinfo.sourceAttribute.substring(20, 40);
- // getSectionIDs("repeating_attack", function(idarray) {
- // _.each(idarray, function(currentID, i) {
- // getAttrs(["repeating_attack_" + currentID + "_itemid"], function(v) {
- // console.log(currentID);
- // console.log(v["repeating_attack_" + currentID + "_itemid"]);
- // console.log(id.toLowerCase());
- // console.log(v["repeating_attack_" + currentID + "_itemid"] === id.toLowerCase());
- // if(v["repeating_attack_" + currentID + "_itemid"] === id.toLowerCase()) {
- // removeRepeatingRow("repeating_attack_" + currentID);
- // }
- // });
- // });
- // });
+ id = eventinfo.sourceAttribute.substring(20, 40);
+ getSectionIDs("repeating_attack", function(idarray) {
+ _.each(idarray, function(currentID, i) {
+ getAttrs(["repeating_attack_" + currentID + "_itemid"], function(v) {
+ if(v["repeating_attack_" + currentID + "_itemid"] === id.toLowerCase()) {
+ removeRepeatingRow("repeating_attack_" + currentID);
+ }
+ });
+ });
+ });
+ getAttrs(["other_resource_itemid"], function(v) {
+ if(v["other_resource_itemid"] === id.toLowerCase()) {
+ update["other_resource_itemid"] = "";
+ update["other_resource"] = "";
+ update["other_resource_name"] = "";
+ update["other_resource_max"] = "";
+ setAttrs(update);
+ }
+ });
+ getSectionIDs("repeating_resource", function(idarray) {
+ var update = {};
+ _.each(idarray, function(currentID, i) {
+ getAttrs(["repeating_resource_" + currentID + "_resource_left_itemid","repeating_resource_" + currentID + "_resource_right_itemid"], function(v) {
+ if(v["repeating_resource_" + currentID + "_resource_left_itemid"] === id.toLowerCase()) {
+ update["repeating_resource_" + currentID + "_resource_left_itemid"] = "";
+ update["repeating_resource_" + currentID + "_resource_left"] = "";
+ update["repeating_resource_" + currentID + "_resource_left_name"] = "";
+ update["repeating_resource_" + currentID + "_resource_left_max"] = "";
+ setAttrs(update);
+ }
+ if(v["repeating_resource_" + currentID + "_resource_right_itemid"] === id.toLowerCase()) {
+ update["repeating_resource_" + currentID + "_resource_right_itemid"] = "";
+ update["repeating_resource_" + currentID + "_resource_right"] = "";
+ update["repeating_resource_" + currentID + "_resource_right_name"] = "";
+ update["repeating_resource_" + currentID + "_resource_right_max"] = "";
+ setAttrs(update);
+ }
+ });
+ });
+ });
updateac();
updateitemweight();
updateglobalsave();
});
- on("change:dexterity", function() {
+ on("change:dexterity change:repeating_inventory:equipped change:globalacmod change:repeating_inventory:itemmodifiers", function() {
updateac();
});
@@ -4887,6 +5210,11 @@
var legendaryactionsarray = temp[1];
contentarray = temp[0];
}
+ if(contentarray && contentarray.indexOf("Reactions") > -1) {
+ temp = contentarray.split(/Reactions\n/)
+ var reactionsarray = temp[1];
+ contentarray = temp[0];
+ }
if(contentarray && contentarray.indexOf("Actions") > -1) {
temp = contentarray.split(/Actions\n/)
var actionsarray = temp[1];
@@ -4946,7 +5274,7 @@
if(desc.toLowerCase().indexOf("damage") > -1 && npc_exception_actions.indexOf(name) === -1) {
update["repeating_npcaction_" + newrowid + "_attack_damage"] = (desc.match(/\(([^)]+)\)/) || ["",""])[1];
update["repeating_npcaction_" + newrowid + "_attack_damagetype"] = (desc.match(/\) (.*?) damage/) || ["",""])[1];
- if((desc.match(/\(/g) || []).length > 1) {
+ if((desc.match(/\(/g) || []).length > 1 && desc.match(/\((?!.*\()([^)]+)\)/).indexOf(" DC")[1] === -1) {
update["repeating_npcaction_" + newrowid + "_attack_damage2"] = (desc.match(/\((?!.*\()([^)]+)\)/) || ["",""])[1];
update["repeating_npcaction_" + newrowid + "_attack_damagetype2"] = (desc.match(/\)(?!.*\)) (.*?) damage/) || ["",""])[1];
}
@@ -4969,6 +5297,24 @@
});
}
+ if(reactionsarray) {
+ update["npcreactionsflag"] = 1;
+ reactionsarray = reactionsarray.split("**");
+ reactionsarray.shift();
+ var reactionsobj = {};
+ reactionsarray.forEach(function(val, i) {
+ if (i % 2 === 1) return;
+ reactionsobj[val] = reactionsarray[i + 1];
+ });
+ _.each(reactionsobj, function(desc, name) {
+ newrowid = generateRowID();
+ update["repeating_npcreaction_" + newrowid + "_name"] = name + ".";
+ if(desc.substring(0,2) === ": ") {
+ desc = desc.substring(2);
+ }
+ update["repeating_npcreaction_" + newrowid + "_desc"] = desc.trim();
+ });
+ }
if(legendaryactionsarray) {
update["npc_legendary_actions"] = (legendaryactionsarray.match(/\d+/) || [""])[0];
legendaryactionsarray = legendaryactionsarray.split("**");
@@ -5045,6 +5391,194 @@
});
});
+ on("change:weighttotal change:encumberance_setting change:strength", function() {
+ getAttrs(["weighttotal","encumberance_setting","strength"], function(v) {
+ var update = {};
+ var str = parseInt(v.strength, 10);
+ var weight = parseInt(v.weighttotal, 10);
+ if(!v.encumberance_setting || v.encumberance_setting === "on") {
+ if(weight > str*15) {
+ update["encumberance"] = "IMMOBILE";
+ }
+ else if(weight > str*10) {
+ update["encumberance"] = "HEAVILY ENCUMBERED";
+ }
+ else if(weight > str*5) {
+ update["encumberance"] = "ENCUMBERED";
+ }
+ else {
+ update["encumberance"] = " ";
+ }
+ }
+ else {
+ if(weight > str*15) {
+ update["encumberance"] = "OVER CARRYING CAPACITY";
+ }
+ else {
+ update["encumberance"] = " ";
+ }
+ }
+ setAttrs(update);
+ });
+ });
+
+ on("change:repeating_inventory:useasresource change:repeating_inventory:itemcount change:repeating_inventory:itemname", function(eventinfo) {
+ itemid = eventinfo.sourceAttribute.substring(20, 40);
+ sourcetype = eventinfo.sourceType;
+ var update = {};
+ var newrowid = generateRowID();
+ getAttrs(["repeating_inventory_itemresourceid","repeating_inventory_useasresource","repeating_inventory_itemcount","repeating_inventory_itemname","repeating_inventory_itemattackid"], function(v) {
+ var count = v["repeating_inventory_itemcount"] && v["repeating_inventory_itemcount"] != "" ? v["repeating_inventory_itemcount"] : 0;
+ var name = v["repeating_inventory_itemname"] && v["repeating_inventory_itemname"] != "" ? v["repeating_inventory_itemname"] : "";
+ if(v.repeating_inventory_useasresource && v.repeating_inventory_useasresource === "1") {
+ if(v.repeating_inventory_itemresourceid && v.repeating_inventory_itemresourceid != "") {
+ if(sourcetype && sourcetype === "player") {
+ if(v.repeating_inventory_itemresourceid === "other_resource") {
+ update["other_resource"] = count;
+ update["other_resource_name"] = name;
+ }
+ else {
+ update["repeating_resource_" + v.repeating_inventory_itemresourceid] = count;
+ update["repeating_resource_" + v.repeating_inventory_itemresourceid + "_name"] = name;
+ }
+ setAttrs(update, {silent: true});
+ }
+ }
+ else {
+ getAttrs(["other_resource_name"], function(x) {
+ if(x.other_resource_name && x.other_resource_name != "") {
+ getSectionIDs("repeating_resource", function(idarray) {
+ if(idarray.length > 0) {
+ var match = false;
+ _.each(idarray, function(currentID, i) {
+ getAttrs(["repeating_resource_" + currentID + "_resource_left_name","repeating_resource_" + currentID + "_resource_right_name"], function(y) {
+ if((!y["repeating_resource_" + currentID + "_resource_left_name"] || y["repeating_resource_" + currentID + "_resource_left_name"] === "") && match === false) {
+ match = true;
+ update["repeating_inventory_itemresourceid"] = currentID + "_resource_left";
+ update["repeating_resource_" + currentID + "_resource_left_itemid"] = itemid;
+ update["repeating_resource_" + currentID + "_resource_left"] = count;
+ update["repeating_resource_" + currentID + "_resource_left_name"] = name;
+ }
+ else if((!y["repeating_resource_" + currentID + "_resource_right_name"] || y["repeating_resource_" + currentID + "_resource_right_name"] === "") && match === false){
+ match = true;
+ update["repeating_inventory_itemresourceid"] = currentID + "_resource_right";
+ update["repeating_resource_" + currentID + "_resource_right_itemid"] = itemid;
+ update["repeating_resource_" + currentID + "_resource_right"] = count;
+ update["repeating_resource_" + currentID + "_resource_right_name"] = name;
+ }
+ if(i === idarray.length - 1 && match === false) {
+ update["repeating_inventory_itemresourceid"] = newrowid + "_resource_left";
+ update["repeating_resource_" + newrowid + "_resource_left_itemid"] = itemid;
+ update["repeating_resource_" + newrowid + "_resource_left"] = count;
+ update["repeating_resource_" + newrowid + "_resource_left_name"] = name;
+ }
+ setAttrs(update, {silent: true});
+ });
+ });
+ }
+ else {
+ update["repeating_inventory_itemresourceid"] = newrowid + "_resource_left";
+ update["repeating_resource_" + newrowid + "_resource_left_itemid"] = itemid;
+ update["repeating_resource_" + newrowid + "_resource_left"] = count;
+ update["repeating_resource_" + newrowid + "_resource_left_name"] = name;
+ setAttrs(update, {silent: true});
+ }
+ });
+ }
+ else {
+ update["repeating_inventory_itemresourceid"] = "other_resource";
+ update["other_resource_itemid"] = itemid;
+ update["other_resource"] = count;
+ update["other_resource_name"] = name;
+ setAttrs(update, {silent: true});
+ }
+ });
+ }
+ }
+ else {
+ if(v.repeating_inventory_itemresourceid && v.repeating_inventory_itemresourceid != "") {
+ update["repeating_inventory_itemresourceid"] = "";
+ if(v.repeating_inventory_itemresourceid === "other_resource") {
+ update["other_resource"] = "";
+ update["other_resource_name"] = "";
+ update["other_resource_max"] = "";
+ }
+ else {
+ update["repeating_resource_" + v.repeating_inventory_itemresourceid] = "";
+ update["repeating_resource_" + v.repeating_inventory_itemresourceid + "_name"] = "";
+ update["repeating_resource_" + v.repeating_inventory_itemresourceid + "_max"] = "";
+ }
+ setAttrs(update, {silent: true});
+ }
+ }
+ if(sourcetype && sourcetype === "player" && v["repeating_inventory_itemattackid"] && v["repeating_inventory_itemattackid"] != "") {
+ update["repeating_attack_" + v["repeating_inventory_itemattackid"] + "_atkname_base"] = name;
+ setAttrs(update);
+ }
+ });
+ });
+
+ on("change:other_resource change:other_resource_name change:repeating_resource:resource_left change:repeating_resource:resource_left_name change:repeating_resource:resource_right change:repeating_resource:resource_right_name", function(eventinfo) {
+ if(eventinfo.sourceType && eventinfo.sourceType === "player") {
+ var update = {};
+ if(eventinfo.sourceAttribute === "other_resource") {
+ getAttrs(["other_resource_itemid","other_resource","other_resource_name"], function(v) {
+ update["repeating_inventory_" + v["other_resource_itemid"] + "_itemcount"] = v["other_resource"];
+ update["repeating_inventory_" + v["other_resource_itemid"] + "_itemname"] = v["other_resource_name"];
+ setAttrs(update, {silent: true});
+ });
+ }
+ else if(eventinfo.sourceAttribute.indexOf("left") > -1) {
+ getAttrs(["repeating_resource_resource_left_itemid","repeating_resource_resource_left","repeating_resource_resource_left_name"], function(v) {
+ update["repeating_inventory_" + v["repeating_resource_resource_left_itemid"] + "_itemcount"] = v["repeating_resource_resource_left"];
+ update["repeating_inventory_" + v["repeating_resource_resource_left_itemid"] + "_itemname"] = v["repeating_resource_resource_left_name"];
+ setAttrs(update, {silent: true});
+ });
+ }
+ else if(eventinfo.sourceAttribute.indexOf("right") > -1) {
+ getAttrs(["repeating_resource_resource_right_itemid","repeating_resource_resource_right","repeating_resource_resource_right_name"], function(v) {
+ update["repeating_inventory_" + v["repeating_resource_resource_right_itemid"] + "_itemcount"] = v["repeating_resource_resource_right"];
+ update["repeating_inventory_" + v["repeating_resource_resource_right_itemid"] + "_itemname"] = v["repeating_resource_resource_right_name"];
+ setAttrs(update, {silent: true});
+ });
+ }
+ }
+ });
+
+ on("change:repeating_attack:savedc", function() {
+ getAttrs(["repeating_attack_savedc"], function(v) {
+ var update = {};
+ if(v.repeating_attack_savedc && v.repeating_attack_savedc === "(@{saveflat})") {
+ update["repeating_attack_flatflag"] = "show";
+ }
+ else {
+ update["repeating_attack_flatflag"] = "hide";
+ }
+ setAttrs(update);
+ });
+ });
+
+ on("change:charname_output", function() {
+ force_refresh_attacks();
+ });
+
+ on("change:rtype", function() {
+ var update = {};
+ getAttrs(["rtype"], function(v) {
+ if(v.rtype && v.rtype === "@{advantagetoggle}") {
+ update["toggleflag"] = "show";
+ }
+ else {
+ update["toggleflag"] = "hide";
+ }
+ setAttrs(update);
+ });
+ });
+
+ on("change:npc_spelldc change:npc_spellattackmod change:spellcasting_ability ", function() {
+ force_refresh_spells();
+ });
+
var updateitemweight = function() {
var wtotal = 0;
getAttrs(["cp","sp","ep","gp","pp"], function(v) {
@@ -5082,8 +5616,16 @@
getSectionIDs("repeating_inventory", function(idarray) {
if(idarray.length > 0) {
_.each(idarray, function(currentID, i) {
- getAttrs(["repeating_inventory_" + currentID + "_itemtype"], function(x) {
- if(x["repeating_inventory_" + currentID + "_itemtype"]) {
+ getAttrs(["repeating_inventory_" + currentID + "_itemtype","repeating_inventory_" + currentID + "_equipped"], function(x) {
+ var update = {};
+ if(x["repeating_inventory_" + currentID + "_equipped"] === "0") {
+ update["repeating_inventory_" + currentID + "_equippedflag"] = "unequipped";
+ }
+ else {
+ update["repeating_inventory_" + currentID + "_equippedflag"] = "equipped";
+ }
+ setAttrs(update);
+ if(x["repeating_inventory_" + currentID + "_itemtype"] && (!x["repeating_inventory_" + currentID + "_equipped"] || x["repeating_inventory_" + currentID + "_equipped"] === "1")) {
itemtypes.push(x["repeating_inventory_" + currentID + "_itemtype"].toLowerCase());
}
if(i === idarray.length - 1) {
@@ -5096,6 +5638,10 @@
});
}
else {
+ setAttrs({
+ armorwarningflag: "hide",
+ armorwarning: "0"
+ });
setac(itemtypes);
}
}
@@ -5104,7 +5650,7 @@
}
else {
getAttrs(["dexterity"], function(v) {
- setAttrs({ac: 10 + ((parseInt(v.dexterity, 10) - 10) / 2)})
+ setAttrs({ac: 10 + Math.floor((parseInt(v.dexterity, 10) - 10) / 2)})
});
}
@@ -5115,12 +5661,13 @@
var actotal = 0;
getSectionIDs("repeating_inventory", function(idarray) {
_.each(idarray, function(currentID, i) {
- getAttrs(["repeating_inventory_" + currentID + "_itemac","repeating_inventory_" + currentID + "_itemmodifiers","dexterity"], function(v) {
- var dexmod = (parseInt(v.dexterity, 10) - 10) / 2;
- if(v["repeating_inventory_" + currentID + "_itemac"] && isNaN(parseInt(v["repeating_inventory_" + currentID + "_itemac"], 10)) === false) {
+ getAttrs(["repeating_inventory_" + currentID + "_itemac","repeating_inventory_" + currentID + "_equipped","repeating_inventory_" + currentID + "_itemmodifiers","dexterity","globalacmod"], function(v) {
+ var dexmod = Math.floor((parseInt(v.dexterity, 10) - 10) / 2);
+ var globalacmod = isNaN(parseInt(v.globalacmod, 10)) === false ? parseInt(v.globalacmod, 10) : 0;
+ if(v["repeating_inventory_" + currentID + "_itemac"] && isNaN(parseInt(v["repeating_inventory_" + currentID + "_itemac"], 10)) === false && (!v["repeating_inventory_" + currentID + "_equipped"] || v["repeating_inventory_" + currentID + "_equipped"] === "1")) {
actotal = actotal + parseInt(v["repeating_inventory_" + currentID + "_itemac"], 10);
}
- if(v["repeating_inventory_" + currentID + "_itemmodifiers"] && v["repeating_inventory_" + currentID + "_itemmodifiers"].toLowerCase().indexOf("ac +") > -1) {
+ if(v["repeating_inventory_" + currentID + "_itemmodifiers"] && v["repeating_inventory_" + currentID + "_itemmodifiers"].toLowerCase().indexOf("ac +") > -1 && (!v["repeating_inventory_" + currentID + "_equipped"] || v["repeating_inventory_" + currentID + "_equipped"] === "1")) {
newac = v["repeating_inventory_" + currentID + "_itemmodifiers"].toLowerCase().split("ac")[1].match(/\d/);
actotal = actotal + parseInt(newac[0], 10);
}
@@ -5137,6 +5684,7 @@
else {
actotal = actotal + 10 + dexmod;
}
+ actotal = actotal + globalacmod;
setAttrs({ac: actotal});
}
});
@@ -5195,15 +5743,16 @@
});
}
- var addspellattack = function() {
- getAttrs(["repeating_spell_spelloutput","repeating_spell_spellname_base","repeating_spell_spellrange","repeating_spell_spellattack","spellcasting_ability","repeating_spell_spelldamage","repeating_spell_spelldamagetype","repeating_spell_spelldamage2","repeating_spell_spelldamagetype2","repeating_spell_spellsave","repeating_spell_spellsavesuccess","repeating_spell_spellattackid","character_name","repeating_spell_spellhldie","repeating_spell_spellhldietype","repeating_spell_spelldmgmod","repeating_spell_spellhealing","repeating_spell_spelllevel"], function(v) {
+ var addspellattack = function(sid) {
+ getAttrs(["repeating_spell_spelloutput","repeating_spell_spellname_base","repeating_spell_spellrange","repeating_spell_spellattack","spellcasting_ability","repeating_spell_spelldamage","repeating_spell_spelldamagetype","repeating_spell_spelldamage2","repeating_spell_spelldamagetype2","repeating_spell_spellsave","repeating_spell_spellsavesuccess","repeating_spell_spellattackid","character_id","repeating_spell_spellhldie","repeating_spell_spellhldietype","repeating_spell_spellhlbonus","repeating_spell_spelldmgmod","repeating_spell_spellhealing","repeating_spell_spelllevel","npc_spellattackmod","level","npc_spelldc"], function(v) {
var newrowid = generateRowID();
var newrowattrs = {};
- var cname = v.character_name
+ var npcspell = sid.substring(0,4) === "-npc" ? true : false;
newrowattrs["repeating_spell_spellattackid"] = newrowid;
- newrowattrs["repeating_spell_rollcontent"] = "%{" + v.character_name + "|repeating_attack_" + newrowid + "_attack_full}";
+ newrowattrs["repeating_spell_rollcontent"] = "%{" + v.character_id + "|repeating_attack_" + newrowid + "_attack}";
newrowattrs["repeating_attack_" + newrowid + "_options-flag"] = "0";
newrowattrs["repeating_attack_" + newrowid + "_atkname_base"] = v.repeating_spell_spellname_base;
+ newrowattrs["repeating_attack_" + newrowid + "_spellid"] = sid;
if(v.repeating_spell_spellrange && v.repeating_spell_spellrange != "") {
newrowattrs["repeating_attack_" + newrowid + "_atkrange"] = v.repeating_spell_spellrange;
}
@@ -5233,17 +5782,21 @@
newrowattrs["repeating_attack_" + newrowid + "_dmg2type"] = v.repeating_spell_spelldamagetype2;
}
if(v.repeating_spell_spellsave && v.repeating_spell_spellsave != "") {
- newrowattrs["repeating_attack_" + newrowid + "_saveflag"] = "{{save=1}} {{saveattr=@{saveattr}}} {{savedesc=@{saveeffect}}} {{savedc=[[@{savedc}]]}}";
+ newrowattrs["repeating_attack_" + newrowid + "_saveflag"] = "{{save=1}} {{saveattr=@{saveattr}}} {{savedesc=@{saveeffect}}} {{savedc=[[[[@{savedc}]][SAVE]]]}}";
newrowattrs["repeating_attack_" + newrowid + "_saveattr"] = v.repeating_spell_spellsave;
newrowattrs["repeating_attack_" + newrowid + "_saveeffect"] = v.repeating_spell_spellsavesuccess;
}
if(v.repeating_spell_spellhldie && v.repeating_spell_spellhldie != "" && v.repeating_spell_spellhldietype && v.repeating_spell_spellhldietype != "") {
- query = "?{Cast at what level?";
+ var bonus = "";
+ var query = "?{Cast at what level?";
for(i = 0; i < 10-v.repeating_spell_spelllevel; i++) {
query = query + "|Level " + (parseInt(i, 10) + parseInt(v.repeating_spell_spelllevel, 10)) + "," + i;
}
query = query + "}";
- newrowattrs["repeating_attack_" + newrowid + "_hldmg"] = "{{hldmg=[[(" + v.repeating_spell_spellhldie + "*" + query + ")" + v.repeating_spell_spellhldietype + "]]}}";
+ if(v.repeating_spell_spellhlbonus && v.repeating_spell_spellhlbonus != "") {
+ bonus = "+(" + v.repeating_spell_spellhlbonus + "*" + query + ")";
+ }
+ newrowattrs["repeating_attack_" + newrowid + "_hldmg"] = "{{hldmg=[[(" + v.repeating_spell_spellhldie + "*" + query + ")" + v.repeating_spell_spellhldietype + bonus + "]]}}";
}
if(v.repeating_spell_spellhealing && v.repeating_spell_spellhealing != "") {
if(!v.repeating_spell_spelldamage || v.repeating_spell_spelldamage === "") {
@@ -5269,6 +5822,14 @@
}
}
}
+ if(npcspell === true) {
+ var pb = Math.ceil((v.level)/1e10) + Math.ceil((v.level)/4);
+ pb = isNaN(pb) === false ? pb : 0;
+ newrowattrs["repeating_attack_" + newrowid + "_atkattr_base"] = "0";
+ newrowattrs["repeating_attack_" + newrowid + "_atkmod"] = v.npc_spellattackmod && isNaN(parseInt(v.npc_spellattackmod, 10)) === false ? parseInt(v.npc_spellattackmod, 10) - pb : 0 - pb;
+ newrowattrs["repeating_attack_" + newrowid + "_savedc"] = "(@{saveflat})";
+ newrowattrs["repeating_attack_" + newrowid + "_saveflat"] = v.npc_spelldc && isNaN(parseInt(v.npc_spelldc, 10)) === false ? parseInt(v.npc_spelldc, 10) : 0;
+ }
setAttrs(newrowattrs);
});
}
@@ -5409,6 +5970,7 @@
update["intelligence_save_prof"] = 0;
update["wisdom_save_prof"] = 0;
update["charisma_save_prof"] = 0;
+ update["class_resource_name"] = "Rage";
}
break;
case "Bard":
@@ -5421,6 +5983,7 @@
update["intelligence_save_prof"] = 0;
update["wisdom_save_prof"] = 0;
update["charisma_save_prof"] = "(@{pb})";
+ update["class_resource_name"] = "Bardic Inspiration";
}
break;
case "Cleric":
@@ -5433,6 +5996,7 @@
update["intelligence_save_prof"] = 0;
update["wisdom_save_prof"] = "(@{pb})";
update["charisma_save_prof"] = "(@{pb})";
+ update["class_resource_name"] = "Channel Divinity";
}
break;
case "Druid":
@@ -5445,6 +6009,7 @@
update["intelligence_save_prof"] = "(@{pb})";
update["wisdom_save_prof"] = "(@{pb})";
update["charisma_save_prof"] = 0;
+ update["class_resource_name"] = "Wild Shape";
}
break;
case "Fighter":
@@ -5457,6 +6022,7 @@
update["intelligence_save_prof"] = 0;
update["wisdom_save_prof"] = 0;
update["charisma_save_prof"] = 0;
+ update["class_resource_name"] = "Second Wind";
}
break;
case "Monk":
@@ -5469,6 +6035,7 @@
update["intelligence_save_prof"] = 0;
update["wisdom_save_prof"] = 0;
update["charisma_save_prof"] = 0;
+ update["class_resource_name"] = "Ki";
}
break;
case "Paladin":
@@ -5481,6 +6048,7 @@
update["intelligence_save_prof"] = 0;
update["wisdom_save_prof"] = "(@{pb})";
update["charisma_save_prof"] = "(@{pb})";
+ update["class_resource_name"] = "Channel Divinity";
}
break;
case "Ranger":
@@ -5517,6 +6085,7 @@
update["intelligence_save_prof"] = 0;
update["wisdom_save_prof"] = 0;
update["charisma_save_prof"] = "(@{pb})";
+ update["class_resource_name"] = "Sorcery Points";
}
break;
case "Warlock":
@@ -5566,13 +6135,18 @@
});
};
- var updateAttack = function() {
- getAttrs(["level","repeating_attack_atkflag","repeating_attack_atkname_base","repeating_attack_atkattr_base","repeating_attack_atkmod","repeating_attack_atkprofflag","repeating_attack_atkmagic","repeating_attack_dmgflag","repeating_attack_dmgbase","repeating_attack_dmgattr","repeating_attack_dmgmod","repeating_attack_dmgtype","repeating_attack_dmg2flag","repeating_attack_dmg2base","repeating_attack_dmg2attr","repeating_attack_dmg2mod","repeating_attack_dmg2type","strength","dexterity","constitution","intelligence","wisdom","charisma","spellcasting_ability","repeating_attack_dmgcustcrit","repeating_attack_dmg2custcrit","repeating_attack_saveflag","repeating_attack_savedc","dflag","repeating_attack_hldmg"], function(v) {
+ var updateAttack = function(eventinfo) {
+ var sourcetype = eventinfo.sourceType;
+ var attackid = eventinfo.sourceAttribute.substring(17, 37);
+ getAttrs(["level","repeating_attack_atkflag","repeating_attack_atkname_base","repeating_attack_atkattr_base","repeating_attack_atkmod","repeating_attack_atkprofflag","repeating_attack_atkmagic","repeating_attack_dmgflag","repeating_attack_dmgbase","repeating_attack_dmgattr","repeating_attack_dmgmod","repeating_attack_dmgtype","repeating_attack_dmg2flag","repeating_attack_dmg2base","repeating_attack_dmg2attr","repeating_attack_dmg2mod","repeating_attack_dmg2type","strength","dexterity","constitution","intelligence","wisdom","charisma","spellcasting_ability","repeating_attack_dmgcustcrit","repeating_attack_dmg2custcrit","repeating_attack_saveflag","repeating_attack_savedc","repeating_attack_saveeffect","repeating_attack_saveflat","dtype","repeating_attack_hldmg","repeating_attack_spellid","repeating_attack_atkrange","repeating_attack_itemid"], function(v) {
+ var update = {};
+ var quietupdate = {};
var hbonus = "";
var hdmg1 = "";
var hdmg2 = "";
var dmg = "";
var dmg2 = "";
+ var rollbase = "";
if(v.repeating_attack_atkattr_base === "0") {atkattr_base = 0} else {atkattr_base = Math.floor((v[v.repeating_attack_atkattr_base.substring(0, v.repeating_attack_atkattr_base.length - 5).substr(2)] - 10) / 2 );};
if(v.repeating_attack_dmgattr === "0") {dmgattr = 0} else {dmgattr = Math.floor((v[v.repeating_attack_dmgattr.substring(0, v.repeating_attack_dmgattr.length - 5).substr(2)] - 10) / 2 );};
if(v.repeating_attack_dmg2attr === "0") {dmg2attr = 0} else {dmg2attr = Math.floor((v[v.repeating_attack_dmg2attr.substring(0, v.repeating_attack_dmg2attr.length - 5).substr(2)] - 10) / 2 );};
@@ -5595,7 +6169,12 @@
else if(v.repeating_attack_saveflag && v.repeating_attack_saveflag != 0) {
savedcattr = v.repeating_attack_savedc.indexOf("spell") > -1 ? v.spellcasting_ability : v.repeating_attack_savedc;
savedcattr = savedcattr.replace(/^[^{]*{/,"").replace(/\_.*$/,"");
- tempdc = isNaN(Math.floor((parseInt(v[savedcattr], 10) - 10) / 2) + 8 + pb) === false ? (Math.floor((parseInt(v[savedcattr], 10) - 10) / 2) + 8 + pb) : "0";
+ if(v.repeating_attack_savedc && v.repeating_attack_savedc === "(@{saveflat})") {
+ var tempdc = isNaN(parseInt(v.repeating_attack_saveflat)) === false ? parseInt(v.repeating_attack_saveflat) : "0";
+ }
+ else {
+ var tempdc = isNaN(Math.floor((parseInt(v[savedcattr], 10) - 10) / 2) + 8 + pb) === false ? (Math.floor((parseInt(v[savedcattr], 10) - 10) / 2) + 8 + pb) : "0";
+ }
bonus = "DC" + tempdc;
}
else {
@@ -5668,116 +6247,167 @@
else {
hdmg2 = "0";
}
- if(v.dflag === "full") {
+ if(v.dtype === "full") {
pickbase = "full";
+ rollbase = "@{wtype}&{template:atkdmg} {{mod=@{atkbonus}}} {{rname=@{atkname}}} {{r1=[[@{hidden_r1base}@{halflingluck}cs>@{atkcritrange}@{hidden_atkbonus}]]}} @{hidden_r2base}@{halflingluck}cs>@{atkcritrange}@{hidden_atkbonus}]]}} @{atkflag} {{range=@{atkrange}}} @{dmgflag} {{dmg1=[[@{hidden_dmg1}]]}} {{dmg1type=@{hidden_dmg1type}}} @{dmg2flag} {{dmg2=[[@{hidden_dmg2}]]}}} {{dmg2type=@{hidden_dmg2type}}} {{crit1=[[@{hidden_crit1}]]}} {{crit2=[[@{hidden_crit2}]]}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} @{charname_output}";
}
else if(v.repeating_attack_atkflag && v.repeating_attack_atkflag != 0) {
pickbase = "pick";
+ rollbase = "@{wtype}&{template:atk} {{mod=@{atkbonus}}} {{rname=[@{atkname}](~repeating_attack_attack_dmg)}} {{rnamec=[@{atkname}](~repeating_attack_attack_crit)}} {{r1=[[@{hidden_r1base}@{halflingluck}cs>@{atkcritrange}@{hidden_atkbonus}]]}} @{hidden_r2base}@{halflingluck}cs>@{atkcritrange}@{hidden_atkbonus}]]}} {{range=@{atkrange}}} {{desc=@{atk_desc}}} @{charname_output}";
}
else if(v.repeating_attack_dmgflag && v.repeating_attack_dmgflag != 0) {
pickbase = "dmg";
+ rollbase = "@{wtype}&{template:dmg} {{rname=@{atkname}}} @{atkflag} {{range=@{atkrange}}} @{dmgflag} {{dmg1=[[@{hidden_dmg1}]]}} {{dmg1type=@{hidden_dmg1type}}} @{dmg2flag} {{dmg2=[[@{hidden_dmg2}]]}}} {{dmg2type=@{hidden_dmg2type}}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} @{charname_output}"
}
else {
pickbase = "empty";
+ rollbase = "@{wtype}&{template:dmg} {{rname=@{atkname}}} @{atkflag} {{range=@{atkrange}}} @{saveflag} {{desc=@{atk_desc}}} @{charname_output}"
}
-
- setAttrs({
- repeating_attack_atkname: name,
- repeating_attack_atkbonus: bonus,
- repeating_attack_atkdmgtype: dmg + dmgspacer + dmg2 + dmgmag + " ",
- repeating_attack_hidden_r1base: r1,
- repeating_attack_hidden_r2base: r2,
- repeating_attack_hidden_atkbonus: hbonus,
- repeating_attack_hidden_dmg1: hdmg1,
- repeating_attack_hidden_dmg2: hdmg2,
- repeating_attack_hidden_dmg1type: dmgtype,
- repeating_attack_hidden_dmg2type: dmg2type,
- repeating_attack_hidden_crit1: crit1 + "[CRIT]",
- repeating_attack_hidden_crit2: crit2 + "[CRIT]",
- repeating_attack_hidden_pickbase: pickbase
- });
+ update["repeating_attack_atkname"] = name;
+ update["repeating_attack_atkbonus"] = bonus;
+ update["repeating_attack_atkdmgtype"] = dmg + dmgspacer + dmg2 + dmgmag + " ";
+ update["repeating_attack_hidden_r1base"] = r1;
+ update["repeating_attack_hidden_r2base"] = r2;
+ update["repeating_attack_hidden_atkbonus"] = hbonus;
+ update["repeating_attack_hidden_dmg1"] = hdmg1;
+ update["repeating_attack_hidden_dmg2"] = hdmg2;
+ update["repeating_attack_hidden_dmg1type"] = dmgtype;
+ update["repeating_attack_hidden_dmg2type"] = dmg2type;
+ update["repeating_attack_hidden_crit1"] = crit1 + "[CRIT]";
+ update["repeating_attack_hidden_crit2"] = crit2 + "[CRIT]";
+ update["repeating_attack_hidden_pickbase"] = pickbase;
+ update["repeating_attack_rollbase"] = rollbase;
+ if(sourcetype && sourcetype === "player" && v.repeating_attack_spellid && v.repeating_attack_spellid != "") {
+ var spellid = v.repeating_attack_spellid;
+ quietupdate["repeating_spell" + spellid + "_spellname_base"] = name;
+ if(v.repeating_attack_atkrange && v.repeating_attack_atkrange != "") {
+ quietupdate["repeating_spell" + spellid + "_spellrange"] = v.repeating_attack_atkrange;
+ }
+ if(dmgbase && dmgbase != 0) {
+ quietupdate["repeating_spell" + spellid + "_spelldamage"] = dmgbase;
+ quietupdate["repeating_spell" + spellid + "_spelldamagetype"] = dmgtype;
+ }
+ if(dmg2base && dmg2base != 0) {
+ quietupdate["repeating_spell" + spellid + "_spelldamage2"] = dmg2base;
+ quietupdate["repeating_spell" + spellid + "_spelldamagetype2"] = dmg2type;
+ }
+ if(v.repeating_attack_saveflag && v.repeating_attack_saveflag != "0") {
+ quietupdate["repeating_spell" + spellid + "_spellsave"] = savedcattr;
+ quietupdate["repeating_spell" + spellid + "_spellsavesuccess"] = v.repeating_attack_saveeffect;
+ }
+ }
+ if(sourcetype && sourcetype === "player" && v.repeating_attack_itemid && v.repeating_attack_itemid != "") {
+ var itemid = v.repeating_attack_itemid;
+ quietupdate["repeating_inventory_" + itemid + "_itemname"] = name;
+ }
+ setAttrs(quietupdate, {silent: true});
+ setAttrs(update);
});
};
- var updateSpell = function(spellid, category) {
+ var updateSpell = function(spellid, category, eventinfo, forceupdate) {
+ var sourcetype = eventinfo ? eventinfo.sourceType : "";
var cat = category ? "-" + category : "";
var repid = spellid ? spellid + "_" : "";
- getAttrs(["repeating_spell" + cat + "_" + repid + "spellname_base","repeating_spell" + cat + "_" + repid + "spellprepared","repeating_spell" + cat + "_" + repid + "spellrange","repeating_spell" + cat + "_" + repid + "spelltarget","repeating_spell" + cat + "_" + repid + "spellattack","repeating_spell" + cat + "_" + repid + "spelldamage","repeating_spell" + cat + "_" + repid + "spelldamagetype","repeating_spell" + cat + "_" + repid + "spelldamage2","repeating_spell" + cat + "_" + repid + "spelldamagetype2","repeating_spell" + cat + "_" + repid + "spellhealing","repeating_spell" + cat + "_" + repid + "spelldmgmod","repeating_spell" + cat + "_" + repid + "spellsave","repeating_spell" + cat + "_" + repid + "spellsavesuccess","repeating_spell" + cat + "_" + repid + "spellhldie","repeating_spell" + cat + "_" + repid + "spellhldietype","repeating_spell" + cat + "_" + repid + "spellattackid","character_name","repeating_spell" + cat + "_" + repid + "spelloutput","repeating_spell" + cat + "_" + repid + "spelllevel","spellcasting_ability"], function(v) {
- var update = {};
+ var update = {};
+ var quietupdate = {};
+ var npcspell = false;
+ if((eventinfo && eventinfo.sourceAttribute && eventinfo.sourceAttribute.split("_")[1] === "spell-npc") || (category && category === "npc")) {
+ npcspell = true;
+ }
+ getAttrs(["npc_spellattackmod","level","npc_spelldc","repeating_spell" + cat + "_" + repid + "spellname_base","repeating_spell" + cat + "_" + repid + "spellprepared","repeating_spell" + cat + "_" + repid + "spellrange","repeating_spell" + cat + "_" + repid + "spelltarget","repeating_spell" + cat + "_" + repid + "spellattack","repeating_spell" + cat + "_" + repid + "spelldamage","repeating_spell" + cat + "_" + repid + "spelldamagetype","repeating_spell" + cat + "_" + repid + "spelldamage2","repeating_spell" + cat + "_" + repid + "spelldamagetype2","repeating_spell" + cat + "_" + repid + "spellhealing","repeating_spell" + cat + "_" + repid + "spelldmgmod","repeating_spell" + cat + "_" + repid + "spellsave","repeating_spell" + cat + "_" + repid + "spellsavesuccess","repeating_spell" + cat + "_" + repid + "spellhldie","repeating_spell" + cat + "_" + repid + "spellhldietype","repeating_spell" + cat + "_" + repid + "spellhlbonus","repeating_spell" + cat + "_" + repid + "spellattackid","character_id","repeating_spell" + cat + "_" + repid + "spelloutput","repeating_spell" + cat + "_" + repid + "spelllevel","spellcasting_ability"], function(v) {
update["repeating_spell" + cat + "_" + repid + "spellname"] = v["repeating_spell" + cat + "_" + repid + "spellname_base"] ? v["repeating_spell" + cat + "_" + repid + "spellname_base"] : "";
update["repeating_spell" + cat + "_" + repid + "prep"] = v["repeating_spell" + cat + "_" + repid + "spellprepared"] ? v["repeating_spell" + cat + "_" + repid + "spellprepared"] : 1;
update["repeating_spell" + cat + "_" + repid + "spellattackinfoflag"] = v["repeating_spell" + cat + "_" + repid + "spelloutput"] && v["repeating_spell" + cat + "_" + repid + "spelloutput"] === "ATTACK" ? "show" : "hide";
if(v["repeating_spell" + cat + "_" + repid + "spellattackid"] && v["repeating_spell" + cat + "_" + repid + "spellattackid"] != "") {
atkid = v["repeating_spell" + cat + "_" + repid + "spellattackid"];
- update["repeating_spell" + cat + "_" + repid + "rollcontent"] = "%{" + v.character_name + "|repeating_attack_" + atkid + "_attack_full}";
- update["repeating_attack_" + atkid + "_options-flag"] = "0";
- update["repeating_attack_" + atkid + "_atkname_base"] = v["repeating_spell" + cat + "_" + repid + "spellname_base"];
- if(v["repeating_spell" + cat + "_" + repid + "spellrange"] && v["repeating_spell" + cat + "_" + repid + "spellrange"] != "") {
- update["repeating_attack_" + atkid + "_atkrange"] = v["repeating_spell" + cat + "_" + repid + "spellrange"];
- }
- if(!v["repeating_spell" + cat + "_" + repid + "spellattack"] || v["repeating_spell" + cat + "_" + repid + "spellattack"] === "None") {
- update["repeating_attack_" + atkid + "_atkflag"] = "0";
- }
- else {
- update["repeating_attack_" + atkid + "_atkattr_base"] = v.spellcasting_ability.slice(0, -1);
- }
- if(v["repeating_spell" + cat + "_" + repid + "spelldamage"] && v["repeating_spell" + cat + "_" + repid + "spelldamage"] != "") {
- update["repeating_attack_" + atkid + "_dmgbase"] = v["repeating_spell" + cat + "_" + repid + "spelldamage"];
- update["repeating_attack_" + atkid + "_dmgtype"] = v["repeating_spell" + cat + "_" + repid + "spelldamagetype"];
- if(v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] && v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] === "Yes") {
- update["repeating_attack_" + atkid + "_dmgattr"] = v.spellcasting_ability.slice(0, -1);
+ quietupdate["repeating_spell" + cat + "_" + repid + "rollcontent"] = "%{" + v.character_id + "|repeating_attack_" + atkid + "_attack}";
+ if((sourcetype && sourcetype === "player") || (forceupdate && forceupdate === true)) {
+ quietupdate["repeating_attack_" + atkid + "_options-flag"] = "0";
+ quietupdate["repeating_attack_" + atkid + "_atkname_base"] = v["repeating_spell" + cat + "_" + repid + "spellname_base"];
+ if(v["repeating_spell" + cat + "_" + repid + "spellrange"] && v["repeating_spell" + cat + "_" + repid + "spellrange"] != "") {
+ quietupdate["repeating_attack_" + atkid + "_atkrange"] = v["repeating_spell" + cat + "_" + repid + "spellrange"];
+ }
+ if(!v["repeating_spell" + cat + "_" + repid + "spellattack"] || v["repeating_spell" + cat + "_" + repid + "spellattack"] === "None") {
+ quietupdate["repeating_attack_" + atkid + "_atkflag"] = "0";
}
else {
- update["repeating_attack_" + atkid + "_dmgattr"] = "0";
+ quietupdate["repeating_attack_" + atkid + "_atkattr_base"] = v.spellcasting_ability.slice(0, -1);
}
- }
- else {
- update["repeating_attack_" + atkid + "_dmgflag"] = "0";
- }
- if(v["repeating_spell" + cat + "_" + repid + "spelldamage2"] && v["repeating_spell" + cat + "_" + repid + "spelldamage2"] != "") {
- update["repeating_attack_" + atkid + "_dmg2flag"] = "{{damage=1}} {{dmg2flag=1}}";
- update["repeating_attack_" + atkid + "_dmg2base"] = v["repeating_spell" + cat + "_" + repid + "spelldamage2"];
- update["repeating_attack_" + atkid + "_dmg2attr"] = "0";
- update["repeating_attack_" + atkid + "_dmg2type"] = v["repeating_spell" + cat + "_" + repid + "spelldamagetype2"];
- }
- if(v["repeating_spell" + cat + "_" + repid + "spellsave"] && v["repeating_spell" + cat + "_" + repid + "spellsave"] != "") {
- update["repeating_attack_" + atkid + "_saveflag"] = "{{save=1}} {{saveattr=@{saveattr}}} {{savedesc=@{saveeffect}}} {{savedc=[[@{savedc}]]}}";
- update["repeating_attack_" + atkid + "_saveattr"] = v["repeating_spell" + cat + "_" + repid + "spellsave"];
- update["repeating_attack_" + atkid + "_saveeffect"] = v["repeating_spell" + cat + "_" + repid + "spellsavesuccess"];
- }
- if(v["repeating_spell" + cat + "_" + repid + "spellhldie"] && v["repeating_spell" + cat + "_" + repid + "spellhldie"] != "" && v["repeating_spell" + cat + "_" + repid + "spellhldietype"] && v["repeating_spell" + cat + "_" + repid + "spellhldietype"] != "") {
- query = "?{Cast at what level?";
- for(i = 0; i < 10-v["repeating_spell" + cat + "_" + repid + "spelllevel"]; i++) {
- query = query + "|Level " + (parseInt(i, 10) + parseInt(v["repeating_spell" + cat + "_" + repid + "spelllevel"], 10)) + "," + i;
- }
- query = query + "}";
- update["repeating_attack_" + atkid + "_hldmg"] = "{{hldmg=[[(" + v["repeating_spell" + cat + "_" + repid + "spellhldie"] + "*" + query + ")" + v["repeating_spell" + cat + "_" + repid + "spellhldietype"] + "]]}}";
- }
- if(v["repeating_spell" + cat + "_" + repid + "spellhealing"] && v["repeating_spell" + cat + "_" + repid + "spellhealing"] != "") {
- if(!v["repeating_spell" + cat + "_" + repid + "spelldamage"] || v["repeating_spell" + cat + "_" + repid + "spelldamage"] === "") {
- update["repeating_attack_" + atkid + "_dmgflag"] = "{{damage=1}} {{dmg1flag=1}}";
- update["repeating_attack_" + atkid + "_dmgbase"] = v["repeating_spell" + cat + "_" + repid + "spellhealing"];
- update["repeating_attack_" + atkid + "_dmgtype"] = "Healing";
+ if(v["repeating_spell" + cat + "_" + repid + "spelldamage"] && v["repeating_spell" + cat + "_" + repid + "spelldamage"] != "") {
+ quietupdate["repeating_attack_" + atkid + "_dmgbase"] = v["repeating_spell" + cat + "_" + repid + "spelldamage"];
+ quietupdate["repeating_attack_" + atkid + "_dmgtype"] = v["repeating_spell" + cat + "_" + repid + "spelldamagetype"];
if(v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] && v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] === "Yes") {
- update["repeating_attack_" + atkid + "_dmgattr"] = v.spellcasting_ability.slice(0, -1);
+ quietupdate["repeating_attack_" + atkid + "_dmgattr"] = v.spellcasting_ability.slice(0, -1);
}
else {
- update["repeating_attack_" + atkid + "_dmgattr"] = "0";
+ quietupdate["repeating_attack_" + atkid + "_dmgattr"] = "0";
}
- }
- else if(!v["repeating_spell" + cat + "_" + repid + "spelldamage2"] || v["repeating_spell" + cat + "_" + repid + "spelldamage2"] === "") {
- update["repeating_attack_" + atkid + "_dmg2flag"] = "{{damage=1}} {{dmg2flag=1}}";
- update["repeating_attack_" + atkid + "_dmg2base"] = v["repeating_spell" + cat + "_" + repid + "spellhealing"];
- update["repeating_attack_" + atkid + "_dmg2type"] = "Healing";
- if(v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] && v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] === "Yes") {
- update["repeating_attack_" + atkid + "_dmg2attr"] = v.spellcasting_ability.slice(0, -1);
+ }
+ else {
+ quietupdate["repeating_attack_" + atkid + "_dmgflag"] = "0";
+ }
+ if(v["repeating_spell" + cat + "_" + repid + "spelldamage2"] && v["repeating_spell" + cat + "_" + repid + "spelldamage2"] != "") {
+ quietupdate["repeating_attack_" + atkid + "_dmg2flag"] = "{{damage=1}} {{dmg2flag=1}}";
+ quietupdate["repeating_attack_" + atkid + "_dmg2base"] = v["repeating_spell" + cat + "_" + repid + "spelldamage2"];
+ quietupdate["repeating_attack_" + atkid + "_dmg2attr"] = "0";
+ quietupdate["repeating_attack_" + atkid + "_dmg2type"] = v["repeating_spell" + cat + "_" + repid + "spelldamagetype2"];
+ }
+ if(v["repeating_spell" + cat + "_" + repid + "spellsave"] && v["repeating_spell" + cat + "_" + repid + "spellsave"] != "") {
+ quietupdate["repeating_attack_" + atkid + "_saveflag"] = "{{save=1}} {{saveattr=@{saveattr}}} {{savedesc=@{saveeffect}}} {{savedc=[[[[@{savedc}]][SAVE]]]}}";
+ quietupdate["repeating_attack_" + atkid + "_saveattr"] = v["repeating_spell" + cat + "_" + repid + "spellsave"];
+ quietupdate["repeating_attack_" + atkid + "_saveeffect"] = v["repeating_spell" + cat + "_" + repid + "spellsavesuccess"];
+ }
+ if(v["repeating_spell" + cat + "_" + repid + "spellhldie"] && v["repeating_spell" + cat + "_" + repid + "spellhldie"] != "" && v["repeating_spell" + cat + "_" + repid + "spellhldietype"] && v["repeating_spell" + cat + "_" + repid + "spellhldietype"] != "") {
+ var bonus = "";
+ var query = "?{Cast at what level?";
+ for(i = 0; i < 10-v["repeating_spell" + cat + "_" + repid + "spelllevel"]; i++) {
+ query = query + "|Level " + (parseInt(i, 10) + parseInt(v["repeating_spell" + cat + "_" + repid + "spelllevel"], 10)) + "," + i;
}
- else {
- update["repeating_attack_" + atkid + "_dmg2attr"] = "0";
+ query = query + "}";
+ if(v["repeating_spell" + cat + "_" + repid + "spellhlbonus"] && v["repeating_spell" + cat + "_" + repid + "spellhlbonus"] != "") {
+ bonus = "+(" + v["repeating_spell" + cat + "_" + repid + "spellhlbonus"] + "*" + query + ")";
}
+ quietupdate["repeating_attack_" + atkid + "_hldmg"] = "{{hldmg=[[(" + v["repeating_spell" + cat + "_" + repid + "spellhldie"] + "*" + query + ")" + v["repeating_spell" + cat + "_" + repid + "spellhldietype"] + bonus + "]]}}";
+ }
+ else {
+ quietupdate["repeating_attack_" + atkid + "_hldmg"] = "";
+ }
+ if(v["repeating_spell" + cat + "_" + repid + "spellhealing"] && v["repeating_spell" + cat + "_" + repid + "spellhealing"] != "") {
+ if(!v["repeating_spell" + cat + "_" + repid + "spelldamage"] || v["repeating_spell" + cat + "_" + repid + "spelldamage"] === "") {
+ quietupdate["repeating_attack_" + atkid + "_dmgflag"] = "{{damage=1}} {{dmg1flag=1}}";
+ quietupdate["repeating_attack_" + atkid + "_dmgbase"] = v["repeating_spell" + cat + "_" + repid + "spellhealing"];
+ quietupdate["repeating_attack_" + atkid + "_dmgtype"] = "Healing";
+ if(v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] && v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] === "Yes") {
+ quietupdate["repeating_attack_" + atkid + "_dmgattr"] = v.spellcasting_ability.slice(0, -1);
+ }
+ else {
+ quietupdate["repeating_attack_" + atkid + "_dmgattr"] = "0";
+ }
+ }
+ else if(!v["repeating_spell" + cat + "_" + repid + "spelldamage2"] || v["repeating_spell" + cat + "_" + repid + "spelldamage2"] === "") {
+ quietupdate["repeating_attack_" + atkid + "_dmg2flag"] = "{{damage=1}} {{dmg2flag=1}}";
+ quietupdate["repeating_attack_" + atkid + "_dmg2base"] = v["repeating_spell" + cat + "_" + repid + "spellhealing"];
+ quietupdate["repeating_attack_" + atkid + "_dmg2type"] = "Healing";
+ if(v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] && v["repeating_spell" + cat + "_" + repid + "spelldmgmod"] === "Yes") {
+ quietupdate["repeating_attack_" + atkid + "_dmg2attr"] = v.spellcasting_ability.slice(0, -1);
+ }
+ else {
+ quietupdate["repeating_attack_" + atkid + "_dmg2attr"] = "0";
+ }
+ }
+ }
+ if(npcspell === true) {
+ var pb = Math.ceil((v.level)/1e10) + Math.ceil((v.level)/4);
+ pb = isNaN(pb) === false ? pb : 0;
+ quietupdate["repeating_attack_" + atkid + "_atkattr_base"] = "0";
+ quietupdate["repeating_attack_" + atkid + "_atkmod"] = v.npc_spellattackmod && isNaN(parseInt(v.npc_spellattackmod, 10)) === false ? parseInt(v.npc_spellattackmod, 10) - pb : 0 - pb;
+ quietupdate["repeating_attack_" + atkid + "_savedc"] = "(@{saveflat})";
+ quietupdate["repeating_attack_" + atkid + "_saveflat"] = v.npc_spelldc && isNaN(parseInt(v.npc_spelldc, 10)) === false ? parseInt(v.npc_spelldc, 10) : 0;
}
}
}
+ setAttrs(quietupdate, {silent: true});
setAttrs(update);
});
};
@@ -5812,32 +6442,33 @@
};
var updateNPC = function() {
- getAttrs(["npc_name","npc_type","npc_ac","npc_actype","hp_max","npc_hpformula","npc_speed","strength","dexterity","constitution","intelligence","wisdom","charisma","npc_str_save","npc_dex_save","npc_con_save","npc_int_save","npc_wis_save","npc_cha_save","npc_acrobatics","npc_animal_handling","npc_arcana","npc_athletics","npc_deception","npc_history","npc_insight","npc_intimidation","npc_investigation","npc_medicine","npc_nature","npc_perception","npc_performance","npc_persuasion","npc_religion","npc_sleight_of_hand","npc_stealth","npc_survival","npc_vulnerabilities","npc_resistances","npc_immunities","npc_condition_immunities","npc_senses","npc_languages","npc_challenge","npc_xp","npc_legendary_actions"], function(v) {
- first_save = 0;
- first_skill = 0;
- hp_max = isNaN(parseInt(v.hp_max, 10)) === false ? parseInt(v.hp_max, 10) : 0;
- actype = v.npc_actype && v.npc_actype != "" ? "(" + v.npc_actype + ")" : "";
- hpformula = v.npc_hpformula && v.npc_hpformula != "" ? "(" + v.npc_hpformula + ")" : "";
- str_mod_base = v.strength && isNaN(v.strength) === false ? Math.floor((parseInt(v.strength, 10) - 10) / 2) : 0;
- str_mod = str_mod_base > -1 ? "(+" + str_mod_base + ")" : "(" + str_mod_base + ")"
- dex_mod_base = v.dexterity && isNaN(v.dexterity) === false ? Math.floor((parseInt(v.dexterity, 10) - 10) / 2) : 0;
- dex_mod = dex_mod_base > -1 ? "(+" + dex_mod_base + ")" : "(" + dex_mod_base + ")"
- con_mod_base = v.constitution && isNaN(v.constitution) === false ? Math.floor((parseInt(v.constitution, 10) - 10) / 2) : 0;
- con_mod = con_mod_base > -1 ? "(+" + con_mod_base + ")" : "(" + con_mod_base + ")"
- int_mod_base = v.intelligence && isNaN(v.intelligence) === false ? Math.floor((parseInt(v.intelligence, 10) - 10) / 2) : 0;
- int_mod = int_mod_base > -1 ? "(+" + int_mod_base + ")" : "(" + int_mod_base + ")"
- wis_mod_base = v.wisdom && isNaN(v.wisdom) === false ? Math.floor((parseInt(v.wisdom, 10) - 10) / 2) : 0;
- wis_mod = wis_mod_base > -1 ? "(+" + wis_mod_base + ")" : "(" + wis_mod_base + ")"
- cha_mod_base = v.charisma && isNaN(v.charisma) === false ? Math.floor((parseInt(v.charisma, 10) - 10) / 2) : 0;
- cha_mod = cha_mod_base > -1 ? "(+" + cha_mod_base + ")" : "(" + cha_mod_base + ")"
+ getAttrs(["npc_name","npc_type","npc_ac","npc_actype","hp_max","npc_hpformula","npc_speed","strength","dexterity","constitution","intelligence","wisdom","charisma","npc_str_save","npc_dex_save","npc_con_save","npc_int_save","npc_wis_save","npc_cha_save","npc_acrobatics","npc_animal_handling","npc_arcana","npc_athletics","npc_deception","npc_history","npc_insight","npc_intimidation","npc_investigation","npc_medicine","npc_nature","npc_perception","npc_performance","npc_persuasion","npc_religion","npc_sleight_of_hand","npc_stealth","npc_survival","npc_vulnerabilities","npc_resistances","npc_immunities","npc_condition_immunities","npc_senses","npc_languages","npc_challenge","npc_xp","npc_legendary_actions","npcreactionsflag","npcspellcastingflag"], function(v) {
+ var rollbase = "";
+ var first_save = 0;
+ var first_skill = 0;
+ var hp_max = isNaN(parseInt(v.hp_max, 10)) === false ? parseInt(v.hp_max, 10) : 0;
+ var actype = v.npc_actype && v.npc_actype != "" ? "(" + v.npc_actype + ")" : "";
+ var hpformula = v.npc_hpformula && v.npc_hpformula != "" ? "(" + v.npc_hpformula + ")" : "";
+ var str_mod_base = v.strength && isNaN(v.strength) === false ? Math.floor((parseInt(v.strength, 10) - 10) / 2) : 0;
+ var str_mod = str_mod_base > -1 ? "(+" + str_mod_base + ")" : "(" + str_mod_base + ")"
+ var dex_mod_base = v.dexterity && isNaN(v.dexterity) === false ? Math.floor((parseInt(v.dexterity, 10) - 10) / 2) : 0;
+ var dex_mod = dex_mod_base > -1 ? "(+" + dex_mod_base + ")" : "(" + dex_mod_base + ")"
+ var con_mod_base = v.constitution && isNaN(v.constitution) === false ? Math.floor((parseInt(v.constitution, 10) - 10) / 2) : 0;
+ var con_mod = con_mod_base > -1 ? "(+" + con_mod_base + ")" : "(" + con_mod_base + ")"
+ var int_mod_base = v.intelligence && isNaN(v.intelligence) === false ? Math.floor((parseInt(v.intelligence, 10) - 10) / 2) : 0;
+ var int_mod = int_mod_base > -1 ? "(+" + int_mod_base + ")" : "(" + int_mod_base + ")"
+ var wis_mod_base = v.wisdom && isNaN(v.wisdom) === false ? Math.floor((parseInt(v.wisdom, 10) - 10) / 2) : 0;
+ var wis_mod = wis_mod_base > -1 ? "(+" + wis_mod_base + ")" : "(" + wis_mod_base + ")"
+ var cha_mod_base = v.charisma && isNaN(v.charisma) === false ? Math.floor((parseInt(v.charisma, 10) - 10) / 2) : 0;
+ var cha_mod = cha_mod_base > -1 ? "(+" + cha_mod_base + ")" : "(" + cha_mod_base + ")"
if(v.npc_vulnerabilities && v.npc_vulnerabilities) {vulnerabilities_flag = 1; vulnerabilities = v.npc_vulnerabilities} else {vulnerabilities_flag = 0; vulnerabilities = 0;};
if(v.npc_resistances && v.npc_resistances) {resistances_flag = 1; resistances = v.npc_resistances} else {resistances_flag = 0; resistances = 0;};
if(v.npc_immunities && v.npc_immunities) {immunities_flag = 1; immunities = v.npc_immunities} else {immunities_flag = 0; immunities = 0;};
if(v.npc_condition_immunities && v.npc_condition_immunities) {condition_immunities_flag = 1; condition_immunities = v.npc_condition_immunities} else {condition_immunities_flag = 0; condition_immunities = 0;};
- senses = v.npc_senses && v.npc_senses != "" ? v.npc_senses : "-";
- languages = v.npc_languages && v.npc_languages != "" ? v.npc_languages : "-";
- challenge = v.npc_challenge && v.npc_challenge != "" ? v.npc_challenge : "-";
- xp = v.npc_xp && v.npc_xp != "" ? "(" + v.npc_xp + ")" : "(-)";
+ var senses = v.npc_senses && v.npc_senses != "" ? v.npc_senses : "-";
+ var languages = v.npc_languages && v.npc_languages != "" ? v.npc_languages : "-";
+ var challenge = v.npc_challenge && v.npc_challenge != "" ? v.npc_challenge : "-";
+ var xp = v.npc_xp && v.npc_xp != "" ? "(" + v.npc_xp + " XP)" : "(-)";
// 1 = First Entry Single Digit, 2 = First Entry Double Digit, 3 = Later Entry Single Digit, 4 = Later Entry Double Digit
if(v.npc_str_save && v.npc_str_save != "") {str_save = parseInt(v.npc_str_save, 10); if(first_save === 0 && str_save < 10) {str_save_flag = 1} else if(first_save === 0 && str_save > 9) {str_save_flag = 2} else if(first_save === 1 && str_save < 10) {str_save_flag = 3} else if(first_save === 1 && str_save > 9) {str_save_flag = 4}; first_save = 1;} else {str_save_flag = 0; str_save = "";}
if(v.npc_dex_save && v.npc_dex_save != "") {dex_save = parseInt(v.npc_dex_save, 10); if(first_save === 0 && dex_save < 10) {dex_save_flag = 1} else if(first_save === 0 && dex_save > 9) {dex_save_flag = 2} else if(first_save === 1 && dex_save < 10) {dex_save_flag = 3} else if(first_save === 1 && dex_save > 9) {dex_save_flag = 4}; first_save = 1;} else {dex_save_flag = 0; dex_save = "";}
@@ -5864,6 +6495,8 @@
if(v.npc_stealth && v.npc_stealth != "") {stealth = parseInt(v.npc_stealth, 10); if(first_skill === 0 && stealth < 10) {stealth_flag = 1} else if(first_skill === 0 && stealth > 9) {stealth_flag = 2} else if(first_skill === 1 && stealth < 10) {stealth_flag = 3} else if(first_skill === 1 && stealth > 9) {stealth_flag = 4}; first_skill = 1;} else {stealth_flag = 0; stealth = "";}
if(v.npc_survival && v.npc_survival != "") {survival = parseInt(v.npc_survival, 10); if(first_skill === 0 && survival < 10) {survival_flag = 1} else if(first_skill === 0 && survival > 9) {survival_flag = 2} else if(first_skill === 1 && survival < 10) {survival_flag = 3} else if(first_skill === 1 && survival > 9) {survival_flag = 4}; first_skill = 1;} else {survival_flag = 0; survival = "";}
leg_act = v.npc_legendary_actions && v.npc_legendary_actions != "" ? v.npc_legendary_actions : 0;
+ react = v.npcreactionsflag && v.npcreactionsflag != "0" ? v.npcreactionsflag : 0;
+ npcspells = v.npcspellcastingflag && v.npcspellcastingflag != "0" ? v.npcspellcastingflag : 0;
legendary_actions_display = "The " + v.npc_name + " can take " + leg_act + " legendary actions, choosing from the options below. Only one legendary option can be used at a time and only at the end of another creature's turn. The " + v.npc_name + " regains spent legendary actions at the start of its turn."
setAttrs({
@@ -5949,13 +6582,15 @@
npcd_challenge: challenge,
npcd_xp: xp,
legendary_flag: leg_act,
- legendary_actions_display: legendary_actions_display
+ legendary_actions_display: legendary_actions_display,
+ reaction_flag: react,
+ npcspell_flag: npcspells
});
});
};
- var updateNPCaction = function() {
- getAttrs(["repeating_npcaction_name","repeating_npcaction_attack_flag","repeating_npcaction_attack_type","repeating_npcaction_attack_range","repeating_npcaction_attack_target","repeating_npcaction_attack_tohit","repeating_npcaction_attack_damage","repeating_npcaction_attack_damagetype","repeating_npcaction_attack_damage2","repeating_npcaction_attack_damagetype2","repeating_npcaction_description"], function(v) {
+ var updateNPCaction = function(eventinfo) {
+ getAttrs(["repeating_npcaction_name","repeating_npcaction_attack_flag","repeating_npcaction_attack_type","repeating_npcaction_attack_range","repeating_npcaction_attack_target","repeating_npcaction_attack_tohit","repeating_npcaction_attack_damage","repeating_npcaction_attack_damagetype","repeating_npcaction_attack_damage2","repeating_npcaction_attack_damagetype2","repeating_npcaction_description","dtype"], function(v) {
var onhit = "";
var damage_flag = "";
description_flag = v.repeating_npcaction_description && v.repeating_npcaction_description != "" ? Math.max(Math.ceil(v.repeating_npcaction_description.length/57),1) : 0;
@@ -6008,6 +6643,24 @@
if(dmg2 != "") {damage_flag = damage_flag + "{{dmg2flag=1}} "};
crit1 = dmg1 != "" && dmg1t.length > 1 ? dmg1t[0] + "d" + dmg1t[1] : "";
crit2 = dmg2 != "" && dmg2t.length > 1 ? dmg2t[0] + "d" + dmg2t[1] : "";
+ if(v.dtype === "full") {
+ rollbase = "@{wtype}&{template:npcaction} @{attack_display_flag} @{damage_flag} {{name=@{npc_name}}} {{rname=@{name}}} {{r1=[[1d20+(@{attack_tohit}+0)]]}} @{rtype}+(@{attack_tohit}+0)]]}} {{dmg1=[[@{attack_damage}+0]]}} {{dmg1type=@{attack_damagetype}}} {{dmg2=[[@{attack_damage2}+0]]}} {{dmg2type=@{attack_damagetype2}}} {{crit1=[[@{attack_crit}+0]]}} {{crit2=[[@{attack_crit2}+0]]}} {{description=@{description}}} @{charname_output}";
+ }
+ else if(v.repeating_npcaction_attack_flag && v.repeating_npcaction_attack_flag != "0") {
+ if(eventinfo.sourceAttribute.indexOf("npcaction-l") === -1) {
+ rollbase = "@{wtype}&{template:npcatk} @{attack_display_flag} @{damage_flag} {{name=@{npc_name}}} {{rname=[@{name}](~repeating_npcaction_npc_dmg)}} {{rnamec=[@{name}](~repeating_npcaction_npc_crit)}} {{r1=[[1d20+(@{attack_tohit}+0)]]}} @{rtype}+(@{attack_tohit}+0)]]}} {{description=@{description}}} @{charname_output}";
+ }
+ else {
+ rollbase = "@{wtype}&{template:npcatk} @{attack_display_flag} @{damage_flag} {{name=@{npc_name}}} {{rname=[@{name}](~repeating_npcaction-l_npc_dmg)}} {{rnamec=[@{name}](~repeating_npcaction-l_npc_crit)}} {{r1=[[1d20+(@{attack_tohit}+0)]]}} @{rtype}+(@{attack_tohit}+0)]]}} {{description=@{description}}} @{charname_output}"
+ }
+ }
+ else if(v.repeating_npcaction_attack_damage && v.repeating_npcaction_attack_damage != "") {
+ rollbase = "@{wtype}&{template:npcdmg} @{damage_flag} {{dmg1=[[@{attack_damage}+0]]}} {{dmg1type=@{attack_damagetype}}} {{dmg2=[[@{attack_damage2}+0]]}} {{dmg2type=@{attack_damagetype2}}} {{crit1=[[@{attack_crit}+0]]}} {{crit2=[[@{attack_crit2}+0]]}} @{charname_output}"
+ }
+ else {
+ rollbase = "@{wtype}&{template:npcaction} {{name=@{npc_name}}} {{rname=@{name}}} {{description=@{description}}} @{charname_output}"
+ }
+
setAttrs({
repeating_npcaction_name_display: v.repeating_npcaction_name + ".",
repeating_npcaction_attack_display_flag: attack_flag,
@@ -6018,23 +6671,50 @@
repeating_npcaction_description_flag: description_flag,
repeating_npcaction_damage_flag: damage_flag,
repeating_npcaction_attack_crit: crit1,
- repeating_npcaction_attack_crit2: crit2
+ repeating_npcaction_attack_crit2: crit2,
+ repeating_npcaction_rollbase: rollbase
});
});
};
+ // var updateNPCspell = function(eventinfo) {
+ // var id = eventinfo.sourceAttribute.split("_")[2];
+ // console.log(id);
+ // var update = {};
+ // var rollbase = "";
+ // getAttrs(["dtype","spellcasting_ability","npc_spelldc","character_id","npc_spellattackmod","repeating_spell-npc_"+id+"_spelloutput","repeating_spell-npc_"+id+"_spellattack","repeating_spell-npc_"+id+"_spellattack","repeating_spell-npc_"+id+"_spellname_base"], function(v) {
+ // var atk_flag = v["repeating_spell-npc_"+id+"_spellattack"] != "None" ? "{{attack=1}} " : "";
+ // var dmg_flag = v["repeating_spell-npc_"+id+"_spelldamage"] != "" ? "{{damage=1}} " : "";
+ // if(v["repeating_spell-npc_"+id+"_spelloutput"] === "ATTACK") {
+ // if(v.dtype === "full") {
+ // rollbase = "@{wtype}&{template:npcaction} " + atk_flag + dmg_flag + "{{name=@{npc_name}}} {{rname=" + v["repeating_spell-npc_"+id+"_spellname_base"] + "}} {{r1=[[1d20+(@{npc_spellattackmod}+0)]]}} @{rtype}+(@{npc_spellattackmod}+0)]]}} {{dmg1=[[@{spelldamage}+0]]}} {{dmg1type=@{spelldamagetype}}} {{dmg2=[[@{spelldamage2}+0]]}} {{dmg2type=@{spelldamagetype2}}} {{crit1=[[@{attack_crit}+0]]}} {{crit2=[[@{attack_crit2}+0]]}} {{description=@{spelldescription}}}";
+ // }
+ // // else if(v.repeating_npcaction_attack_flag && v.repeating_npcaction_attack_flag != "0") {
+ // // if(eventinfo.sourceAttribute.indexOf("npcaction-l") === -1) {
+ // // rollbase = "@{wtype}&{template:npcatk} @{attack_display_flag} @{damage_flag} {{name=@{npc_name}}} {{rname=[@{name}](~repeating_npcaction_npc_dmg)}} {{rnamec=[@{name}](~repeating_npcaction_npc_crit)}} {{r1=[[1d20+(@{attack_tohit}+0)]]}} @{rtype}+(@{attack_tohit}+0)]]}} {{description=@{description}}} @{charname_output}";
+ // // }
+ // // else {
+ // // rollbase = "@{wtype}&{template:npcatk} @{attack_display_flag} @{damage_flag} {{name=@{npc_name}}} {{rname=[@{name}](~repeating_npcaction-l_npc_dmg)}} {{rnamec=[@{name}](~repeating_npcaction-l_npc_crit)}} {{r1=[[1d20+(@{attack_tohit}+0)]]}} @{rtype}+(@{attack_tohit}+0)]]}} {{description=@{description}}} @{charname_output}"
+ // // }
+ // // }
+ // // else if(v.repeating_npcaction_attack_damage && v.repeating_npcaction_attack_damage != "") {
+ // // rollbase = "@{wtype}&{template:npcdmg} @{damage_flag} {{dmg1=[[@{attack_damage}+0]]}} {{dmg1type=@{attack_damagetype}}} {{dmg2=[[@{attack_damage2}+0]]}} {{dmg2type=@{attack_damagetype2}}} {{crit1=[[@{attack_crit}+0]]}} {{crit2=[[@{attack_crit2}+0]]}} @{charname_output}"
+ // // }
+ // // else {
+ // // rollbase = "@{wtype}&{template:npcaction} {{name=@{npc_name}}} {{rname=@{name}}} {{description=@{description}}} @{charname_output}"
+ // }
+ // update["repeating_spell-npc_"+id+"_rollbase"] = rollbase;
+ // setAttrs(update);
+ // }
+ // });
+ // }
+
var force_refresh_spells = function() {
- spellcats = ["cantrip","1","2","3","4","5","6","7","8","9"];
+ spellcats = ["cantrip","1","2","3","4","5","6","7","8","9","npc"];
_.each(spellcats, function(cat) {
getSectionIDs("repeating_spell-" + cat, function(idarray) {
_.each(idarray, function(currentID, i) {
- updateSpell(currentID,cat);
- // getAttrs(["repeating_spell-" + cat + "_" + currentID + "_spell_updateflag"], function(v) {
- // update = {};
- // toggle = v["repeating_spell-" + cat + "_" + currentID + "_spell_updateflag"] === true ? false : true;
- // update["repeating_spell-" + cat + "_" + currentID + "_spell_updateflag"] = toggle;
- // setAttrs(update);
- // });
+ updateSpell(currentID,cat,"",true);
});
});
})
@@ -6044,8 +6724,8 @@
getSectionIDs("repeating_attack", function(idarray) {
_.each(idarray, function(currentID, i) {
getAttrs(["repeating_attack_" + currentID + "_updateflag"], function(v) {
- update = {};
- toggle = v["repeating_attack_" + currentID + "_updateflag"] === true ? false : true;
+ var update = {};
+ var toggle = v["repeating_attack_" + currentID + "_updateflag"] === true ? false : true;
update["repeating_attack_" + currentID + "_updateflag"] = toggle;
setAttrs(update);
});
@@ -6053,9 +6733,673 @@
});
}
- var upgrade_1_1_to_1_2 = function() {
+ var force_refresh_npcactions = function() {
+ getSectionIDs("repeating_npcaction-l", function(idarray) {
+ legendaryarray = idarray;
+ if(legendaryarray.length > 0) {
+ _.each(legendaryarray, function(currentID, i) {
+ getAttrs(["repeating_npcaction-l_" + currentID + "_updateflag"], function(v) {
+ var update_l = {};
+ var toggle_l = v["repeating_npcaction-l_" + currentID + "_updateflag"] === true ? false : true;
+ update_l["repeating_npcaction-l_" + currentID + "_updateflag"] = toggle_l;
+ setAttrs(update_l);
+ });
+ });
+ }
+ });
+
+ getSectionIDs("repeating_npcaction", function(idarray) {
+ cleanarray = idarray.filter(function(el) {
+ return legendaryarray.indexOf(el) < 0;
+ });
+ if(cleanarray.length > 0) {
+ _.each(cleanarray, function(currentID, i) {
+ getAttrs(["repeating_npcaction_" + currentID + "_updateflag"], function(v) {
+ var update = {};
+ var toggle = v["repeating_npcaction_" + currentID + "_updateflag"] === true ? false : true;
+ update["repeating_npcaction_" + currentID + "_updateflag"] = toggle;
+ setAttrs(update);
+ });
+ });
+ }
+ });
+ }
+
+ // TRANSITION SCRIPT
+ on("change:is_shaped change:is_simple", function() {
+ transitionCharacterSheet();
+ });
+
+ var transitionCharacterSheet = function() {
+ getAttrs(['already_transitioned','is_npc','is_shaped'], function(attrs) {
+ if (attrs.already_transitioned === "1") {
+ console.log('do nothing, already transitioned');
+ return;
+ }
+ setAttrs({ already_transitioned: '1' });
+
+ if((!attrs.is_npc && !attrs.pcornpc) || (attrs.is_npc && attrs.is_npc !== '1')) {
+ transferPC(attrs.is_shaped === '1');
+ }
+ else if(attrs.is_npc) {
+ if(attrs.is_shaped === '1') {
+ transferNPCShaped();
+ }
+ else {
+ transferNPCSimple();
+ }
+ }
+ });
+ };
+
+ var transferNPCShaped = function() {
+ getAttrs(['character_name','speed','speed_fly','speed_burrow','speed_swim','speed_climb','prolanguages','wisdom','blindsight','darkvision','tremorsense','truesight','challenge','xp','multiattack','npc_traits','lair_actions','legendary_action_notes','reactions','damage_vulnerability','damage_resistance','damage_immunity','condition_immunity'],function(attrs) {
+ var updates = {},
+ senses = [],
+ newRowId = '';
+
+ updates.npc = '1';
+ //updates['npc_options-flag'] = 0;
+ updates.npc_name = attrs.character_name;
+ updates.npc_speed = attrs.speed+
+ (attrs.speed_fly && attrs.speed_fly !== '' ? ' | '+attrs.speed_fly+' fly' : '')+
+ (attrs.speed_climb && attrs.speed_climb !== '' ? ' | '+attrs.speed_climb+' climb' : '')+
+ (attrs.speed_swim && attrs.speed_swim !== '' ? ' | '+attrs.speed_swim+' swim' : '')+
+ (attrs.speed_burrow && attrs.speed_burrow !== '' ? ' | '+attrs.speed_burrow+' burrow' : '');
+
+ updates.npc_vulnerabilities = attrs.damage_vulnerability;
+ updates.npc_resistances = attrs.damage_resistance;
+ updates.npc_immunities = attrs.damage_immunity;
+ updates.npc_condition_immunities = attrs.condition_immunity;
+
+ updates.npc_languages = attrs.prolanguages;
+
+ updates.npc_senses = 'pass Perc: '+attrMod(attrs.wisdom)+
+ (attrs.blindsight && attrs.blindsight !== '' ? ' | blindsight: '+attrs.blindsight : '')+
+ (attrs.darkvision && attrs.darkvision !== '' ? ' | darkvision: '+attrs.darkvision : '')+
+ (attrs.tremorsense && attrs.tremorsense !== '' ? ' | tremorsense: '+attrs.tremorsense : '')+
+ (attrs.truesight && attrs.truesight !== '' ? ' | truesight: '+attrs.truesight : '');
+
+ updates.npc_challenge = attrs.challenge;
+ updates.npc_xp = attrs.xp;
+
+
+ if(attrs.multiattack && attrs.multiattack !== '') {
+ newRowId = generateRowID();
+ updates['repeating_npctrait_'+newRowId+'_name'] = 'Multiattack';
+ updates['repeating_npctrait_'+newRowId+'_desc'] = attrs.multiattack;
+ }
+ if(attrs.npc_traits && attrs.npc_traits !== '') {
+ newRowId = generateRowID();
+ updates['repeating_npctrait_'+newRowId+'_name'] = 'NPC Traits';
+ updates['repeating_npctrait_'+newRowId+'_desc'] = attrs.npc_traits;
+ }
+ if(attrs.lair_actions && attrs.lair_actions !== '') {
+ newRowId = generateRowID();
+ updates['repeating_npctrait_'+newRowId+'_name'] = 'Lair Actions';
+ updates['repeating_npctrait_'+newRowId+'_desc'] = attrs.lair_actions;
+ }
+ if(attrs.legendary_action_notes && attrs.legendary_action_notes !== '') {
+ newRowId = generateRowID();
+ updates['repeating_npctrait_'+newRowId+'_name'] = 'Legendary Actions Notes';
+ updates['repeating_npctrait_'+newRowId+'_desc'] = attrs.legendary_action_notes;
+ updates.npc_legendary_actions = 3;
+ }
+ if(attrs.reactions && attrs.reactions !== '') {
+ newRowId = generateRowID();
+ updates['repeating_npctrait_'+newRowId+'_name'] = 'Reactions';
+ updates['repeating_npctrait_'+newRowId+'_desc'] = attrs.reactions;
+ }
+
+ // var npcActionBase = ['name','emote','reach','range','target','tohit','dmg','dmg_type','crit_dmg','crit_range','second_dmg','second_dmg_type','second_crit_dmg','save_dc','save_stat','save_dmg','save_dmg_type','save_success','effect','recharge'],
+ // npcActionAttrs = [];
+
+ // // Lair Actions
+ // for(var i = 0; i < 4; i++) {
+ // npcActionAttrs = npcActionAttrs.concat(npcActionBase.map(function(attr) { return 'repeating_lair_actions_'+i+'_'+attr; }));
+ // }
+ // getAttrs(npcActionAttrs,function(attrs) {
+ // console.log('Lair Actions');
+ // console.log(attrs);
+ // });
+
+ // // Legendary Actions
+ // npcActionAttrs = [];
+ // for(var i = 0; i < 4; i++) {
+ // npcActionAttrs = npcActionAttrs.concat(npcActionBase.map(function(attr) { return 'repeating_legendary_actions_'+i+'_'+attr; }));
+ // }
+ // getAttrs(npcActionAttrs,function(attrs) {
+ // console.log('Legendary Actions');
+ // console.log(attrs);
+ // });
+
+ // // Actions
+ // npcActionAttrs = [];
+ // for(var i = 0; i < 4; i++) {
+ // npcActionAttrs = npcActionAttrs.concat(npcActionBase.map(function(attr) { return 'repeating_actions_'+i+'_'+attr; }));
+ // }
+ // getAttrs(npcActionAttrs,function(attrs) {
+ // console.log('Actions');
+ // console.log(attrs);
+ // });
+
+ setAttrs(JSON.parse(JSON.stringify(updates)));
+ });
+
+ function attrMod(value) {
+ return Math.floor((parseInt(value)-10)/2);
+ }
+ }
+
+ var transferNPCSimple = function() {
+ getAttrs(['npc_type','npc_size','npc_alignment','character_name','npc_hp','npc_HP_hit_dice','npc_AC_note','npc_strength','npc_dexterity','npc_constitution','npc_intelligence','npc_wisdom','npc_charisma','npc_strength_save_bonus','npc_dexterity_save_bonus','npc_constitution_save_bonus','npc_intelligence_save_bonus','npc_wisdom_save_bonus','npc_charisma_save_bonus','npc_speed','npc_speed_fly','npc_speed_climb','npc_speed_swim','npc_damage_immunity','npc_damage_resistance','npc_condition_immunity','npc_damage_vulnerability','npc_acrobatics_bonus','npc_animalhandling_bonus','npc_arcana_bonus','npc_athletics_bonus','npc_deception_bonus','npc_history_bonus','npc_insight_bonus','npc_intimidation_bonus','npc_investigation_bonus','npc_medicine_bonus','npc_nature_bonus','npc_perception_bonus','npc_performance_bonus','npc_persuasion_bonus','npc_religion_bonus','npc_sleightofhand_bonus','npc_stealth_bonus','npc_survival_bonus','npc_multiattack','npc_traits'],function(attrs) {
+ var updates = {},
+ newRowId = '';
+
+ updates.npc = '1';
+ //updates['npc_options-flag'] = 0;
+ updates.npc_name = attrs.character_name;
+ updates.hp_max = attrs.npc_hp;
+ updates.npc_hpformula = attrs.npc_HP_hit_dice;
+ updates.npc_actype = attrs.npc_AC_note;
+ updates.npc_type = (attrs.npc_size || '')+' '+(attrs.npc_type || '')+(attrs.npc_alignment && attrs.npc_alignment !== '' ? (attrs.npc_size || attrs.npc_type ? ', ' : '')+attrs.npc_alignment : '');
+
+ updates.strength = attrs.npc_strength;
+ updates.dexterity = attrs.npc_dexterity;
+ updates.constitution = attrs.npc_constitution;
+ updates.intelligence = attrs.npc_intelligence;
+ updates.wisdom = attrs.npc_wisdom;
+ updates.charisma = attrs.npc_charisma;
+
+ updates.npc_str_save = attrs.npc_strength_save_bonus === '0' ? '' : attrs.npc_strength_save_bonus;
+ updates.npc_dex_save = attrs.npc_dexterity_save_bonus === '0' ? '' : attrs.npc_dexterity_save_bonus;
+ updates.npc_con_save = attrs.npc_constitution_save_bonus === '0' ? '' : attrs.npc_constitution_save_bonus;
+ updates.npc_int_save = attrs.npc_intelligence_save_bonus === '0' ? '' : attrs.npc_intelligence_save_bonus;
+ updates.npc_wis_save = attrs.npc_wisdom_save_bonus === '0' ? '' : attrs.npc_wisdom_save_bonus;
+ updates.npc_cha_save = attrs.npc_charisma_save_bonus === '0' ? '' : attrs.npc_charisma_save_bonus;
+
+ updates.npc_speed = attrs.npc_speed+
+ (attrs.npc_speed_fly && attrs.npc_speed_fly !== '' ? ' | '+attrs.npc_speed_fly+' fly' : '')+
+ (attrs.npc_speed_climb && attrs.npc_speed_climb !== '' ? ' | '+attrs.npc_speed_climb+' climb' : '')+
+ (attrs.npc_speed_swim && attrs.npc_speed_swim !== '' ? ' | '+attrs.npc_speed_swim+' swim' : '');
+
+ updates.npc_vulnerabilities = attrs.npc_damage_vulnerability === 'None' ? '' : attrs.npc_damage_vulnerability;
+ updates.npc_resistances = attrs.npc_damage_resistance === 'None' ? '' : attrs.npc_damage_resistance;
+ updates.npc_immunities = attrs.npc_damage_immunity === 'None' ? '' : attrs.npc_damage_immunity;
+ updates.npc_condition_immunities = attrs.npc_condition_immunity === 'None' ? '' : attrs.npc_condition_immunity;
+
+ updates.npc_acrobatics = attrs.npc_acrobatics_bonus;
+ updates.npc_animal_handling = attrs.npc_animalhandling_bonus;
+ updates.npc_arcana = attrs.npc_arcana_bonus;
+ updates.npc_athletics = attrs.npc_athletics_bonus;
+ updates.npc_deception = attrs.npc_deception_bonus;
+ updates.npc_history = attrs.npc_history_bonus;
+ updates.npc_insight = attrs.npc_insight_bonus;
+ updates.npc_intimidation = attrs.npc_intimidation_bonus;
+ updates.npc_investigation = attrs.npc_investigation_bonus;
+ updates.npc_medicine = attrs.npc_medicine_bonus;
+ updates.npc_nature = attrs.npc_nature_bonus;
+ updates.npc_perception = attrs.npc_perception_bonus;
+ updates.npc_performance = attrs.npc_performance_bonus;
+ updates.npc_persuasion = attrs.npc_persuasion_bonus;
+ updates.npc_religion = attrs.npc_religion_bonus;
+ updates.npc_sleight_of_hand = attrs.npc_sleightofhand_bonus;
+ updates.npc_stealth = attrs.npc_stealth_bonus;
+ updates.npc_survival = attrs.npc_survival_bonus;
+
+ updates.wtype = (attrs.npc_output_option && attrs.npc_output_option !== '/w GM ' ? '' : '/w gm ');
+
+ if(attrs.npc_multiattack && attrs.npc_multiattack !== '') {
+ newRowId = generateRowID();
+ updates['repeating_npctrait_'+newRowId+'_name'] = 'Multiattack';
+ updates['repeating_npctrait_'+newRowId+'_desc'] = attrs.npc_multiattack;
+ }
+ if(attrs.npc_traits && attrs.npc_traits !== '' && attrs.npc_traits !== 'None') {
+ newRowId = generateRowID();
+ updates['repeating_npctrait_'+newRowId+'_name'] = 'NPC Traits';
+ updates['repeating_npctrait_'+newRowId+'_desc'] = attrs.npc_traits;
+ }
+
+ setAttrs(JSON.parse(JSON.stringify(updates)));
+ });
+
+ // set NPC Actions
+ var npcActions = [];
+ for(var i = 1; i <= 20; i++) {
+ npcActions.push('npc_action_name'+i);
+ npcActions.push('npc_action_type'+i);
+ npcActions.push('npc_action_description'+i);
+ npcActions.push('npc_action_effect'+i);
+ }
+ getAttrs(npcActions,function(attrs) {
+ var updates = {};
+ for(var i = 1; i <= 20; i++) {
+ var actionName = attrs['npc_action_name'+i],
+ actionType = (attrs['npc_action_type'+i] || '(Normal Action)').trim(),
+ actionDescription = attrs['npc_action_description'+i],
+ actionEffect = attrs['npc_action_effect'+i],
+ newRowId = generateRowID();
+
+ if(actionName && actionName !== '' && ((actionDescription && actionDescription !== '') || (actionEffect && actionEffect !== ''))) {
+ if(actionType && (actionType === '(Legendary Action)' || actionType === '(Lair Action)')) {
+ updates.npc_legendary_actions = '3';
+
+ updates['repeating_npcaction-l_'+newRowId+'_npc_options-flag'] = 0;
+ updates['repeating_npcaction-l_'+newRowId+'_name'] = actionName;
+ updates['repeating_npcaction-l_'+newRowId+'_description'] = actionType+(actionDescription && actionDescription !== '' ? '\n'+actionDescription : '')+(actionEffect && actionEffect !== '' ? '\n'+actionEffect : '');
+ }
+ else {
+ updates['repeating_npcaction_'+newRowId+'_npc_options-flag'] = 0;
+ updates['repeating_npcaction_'+newRowId+'_name'] = actionName;
+ updates['repeating_npcaction_'+newRowId+'_description'] = actionType+(actionDescription && actionDescription !== '' ? '\nDescription:\n'+actionDescription : '')+(actionEffect && actionEffect !== '' ? '\nEffect:\n'+actionEffect : '');
+ }
+ }
+ }
+
+ setAttrs(updates);
+ });
+ };
+
+ var transferPC = function(isShaped) {
+ var classHitDice = {
+ 'barbarian':'d12',
+ 'bard':'d8',
+ 'cleric':'d8',
+ 'druid':'d8',
+ 'fighter':'d10',
+ 'monk':'d8',
+ 'paladin':'d10',
+ 'ranger':'d10',
+ 'rogue':'d8',
+ 'sorcerer': 'd6',
+ 'warlock': 'd8',
+ 'wizard': 'd6'
+ };
+ // set 1to1 values
+ getAttrs(['temp_hp','xp','death_save_success_1','death_save_success_2','death_save_success_3','death_save_fail_1','death_save_fail_2','death_save_fail_3','inspiration','background','prolanguages','pro_weapons',(isShaped ? 'pro_armor' : 'pro_armour'),'class_features','class_abilities_and_feats','notes'], function(attrs) {
+ // one-to-one mappings
+ var updates = {};
+ updates.hp_temp = (attrs.temp_hp && attrs.temp_hp !== '0' ? attrs.temp_hp : '');
+ updates.experience = (attrs.xp && attrs.xp !== '0' ? attrs.xp : 0);
+ updates.deathsave_succ1 = (attrs.death_save_success_1 && attrs.death_save_success_1 !== '0' ? 'on' : 0);
+ updates.deathsave_succ2 = (attrs.death_save_success_2 && attrs.death_save_success_2 !== '0' ? 'on' : 0);
+ updates.deathsave_succ3 = (attrs.death_save_success_3 && attrs.death_save_success_3 !== '0' ? 'on' : 0);
+ updates.deathsave_fail1 = (attrs.death_save_fail_1 && attrs.death_save_fail_1 !== '0' ? 'on' : 0);
+ updates.deathsave_fail2 = (attrs.death_save_fail_2 && attrs.death_save_fail_2 !== '0' ? 'on' : 0);
+ updates.deathsave_fail3 = (attrs.deathsave_fail3 && attrs.deathsave_fail3 !== '0' ? 'on' : 0);
+ updates.inspiration = (attrs.inspiration && attrs.inspiration !== '0' ? 'on' : 0);
+ updates.character_backstory = (attrs['background'] && attrs['background'] !== '' ? attrs['background'] : '');
+ updates.features_and_traits = (attrs.class_features ? attrs.class_features : '');
+ updates.additional_feature_and_traits = (attrs.class_abilities_and_feats ? attrs.class_abilities_and_feats : '');
+ updates.treasure = (attrs.notes ? attrs.notes : '');
+ updates['background'] = ' ';
+ if (isShaped) {
+ updates.other_proficiencies_and_languages = (attrs.prolanguages ? attrs.prolanguages : '')+(attrs.pro_weapons && attrs.pro_weapons !== '' ? (attrs.prolanguages ? '\n' : '')+attrs.pro_weapons : '')+(attrs.pro_armor && attrs.pro_armor !== '' ? (attrs.prolanguages || attrs.pro_weapons ? '\n' : '')+attrs.pro_armor : '');
+ }
+ else {
+ updates.other_proficiencies_and_languages = (attrs.prolanguages ? attrs.prolanguages : '')+(attrs.pro_weapons && attrs.pro_weapons !== '' ? (attrs.prolanguages ? '\n' : '')+attrs.pro_weapons : '')+(attrs.pro_armour && attrs.pro_armour !== '' ? (attrs.prolanguages || attrs.pro_weapons ? '\n' : '')+attrs.pro_armour : '');
+ }
+
+ updateAll(updates,'core stats/direct mapping');
+ });
+ // set ability proficiency checkboxes
+ getAttrs(['strength_save_prof','dexterity_save_prof','constitution_save_prof','intelligence_save_prof','wisdom_save_prof','charisma_save_prof'], function (attrs) {
+ var updates = {};
+ _.each(attrs, function(value, key) {
+ if(value !== "0") {
+ updates[key] = '(@{pb})';
+ }
+ });
+ updateAll(updates,'ability proficiencies');
+ });
+ // set skill proficiency checkboxes/expertise
+ getAttrs(['acrobatics_prof_exp','animal_handling_prof_exp','arcana_prof_exp','athletics_prof_exp','arcana_prof_exp','deception_prof_exp','history_prof_exp','insight_prof_exp','intimidation_prof_exp','investigation_prof_exp','medicine_prof_exp','nature_prof_exp','perception_prof_exp','performance_prof_exp','religion_prof_exp','sleight_of_hand_prof_exp','stealth_prof_exp','survival_prof_exp'], function(attrs) {
+ var updates = {};
+
+ _.each(attrs, function(value, key) {
+ var skillName = key.slice(0, -9);
+ switch(value) {
+ case '(2*@{PB})': //expertise
+ updates[skillName+'_type'] = '2';
+ case '@{PB}': // proficiency or expertise
+ updates[key.slice(0, -4)] = '(@{pb}*@{'+skillName+'_type'+'})';
+ break;
+ }
+ });
+ updateAll(updates,'skill proficiencies/expertise');
+ });
+ // get AC value, add armor to inventory
+ var baseArmorValues = ['armouractive','armouracbase','armourmagicbonus','armouractiveunarmoured','armourstealthpen','amourname','armourtype','armourspeedpen'],
+ armorFields = [];
+ for(var i = 1; i <= 10; i++) {
+ armorFields = armorFields.concat(baseArmorValues.map(function(armorValue) { return armorValue+i; }));
+ }
+ armorFields.push('dexterity','constitution','wisdom','unarmoured_class_bonus');
+ if (isShaped) {
+ armorFields = armorFields.map(function (name) { return name.replace(/armour|amour/g,'armor'); });
+ }
+ getAttrs(armorFields, function(attrs) {
+ var updates = {},
+ armorTotal = 0,
+ unarmoredTotal = 10 + attrMod(attrs.dexterity);
+
+ // Change the spelling of armour to armor, so that this function will fork for both shaped and
+ if (!isShaped) {
+ _.each(attrs, function(value, key) {
+ Object.defineProperty(attrs, key.replace(/armour|amour/g,'armor'), Object.getOwnPropertyDescriptor(attrs, key));
+ delete(key);
+ });
+ }
+
+ for(var i = 1; i <= 10; i++) {
+ var active = (!attrs['armoractive'+i] || attrs['armoractive'+i] !== '0'),
+ unarmored = (attrs['armoractiveunarmored'+i] && attrs['armoractiveunarmored'+i] !== '0'),
+ baseAC = (parseInt(attrs['armoracbase'+i])||0),
+ magicBonusAC = (parseInt(attrs['armormagicbonus'+i])||0),
+ totalBaseAC = baseAC+magicBonusAC,
+ newRowId = generateRowID(),
+ armorTypeBonus = 0,
+ armorType = '',
+ armorTypeMod = '';
+
+ switch (attrs['armortype'+i]) {
+ case '@{dexterity_mod} + 0.002': // light armor
+ armorTypeBonus = attrMod(attrs.dexterity);
+ armorType = 'Light Armor: ';
+ armorTypeMod = ' (DEX mod)';
+ break;
+ case '(ceil((@{dexterity_mod}-1)/1e10)*2 - floor((@{dexterity_mod}-2)/1e10)*@{dexterity_mod}) + 0.003': // medium armor
+ armorTypeBonus = attrMod(attrs.dexterity) > 1 ? 2 : attrMod(attrs.dexterity);
+ armorType = 'Medium Armor: ';
+ armorTypeMod = ' (DEX mod, max 2)';
+ break;
+ case '0.004': // heavy armor
+ armorType = 'Heavy Armor: ';
+ break;
+ }
+
+ if(active && !unarmored) {
+ armorTotal += totalBaseAC+armorTypeBonus;
+ }
+ else if(active && unarmored) {
+ unarmoredTotal += totalBaseAC;
+ }
+
+ if(attrs['armorname'+i] && attrs['armorname'+i] !== '') {
+ var stealthPen = (attrs['armorstealthpen'+i] && attrs['armorstealthpen'+i] !== 'No Penalty' ? 'Disadvantage Stealth' : ''),
+ speedPen = (attrs['armorspeedpen'+i] && attrs['armorspeedpen'+i] !== 'No' ? ('STR '+attrs['armorspeedpen'+i].slice(-2)) : '');
+
+ updates['repeating_inventory_'+newRowId+'_itemcount'] = 1;
+ updates['repeating_inventory_'+newRowId+'_itemname'] = attrs['armorname'+i];
+ updates['repeating_inventory_'+newRowId+'_itemproperties'] = armorType+(totalBaseAC+armorTypeBonus)+' AC';
+ updates['repeating_inventory_'+newRowId+'_itemmodifiers'] = (magicBonusAC !== 0 ? 'AC +'+magicBonusAC : '');
+ updates['repeating_inventory_'+newRowId+'_itemcontent'] = '['+baseAC+(magicBonusAC !== 0 ? ' + '+magicBonusAC : '')+(armorTypeMod !== ''? ' + '+armorTypeBonus+armorTypeMod : '')+']'+(stealthPen !== '' || speedPen !== '' ? '\n' : '')+(stealthPen !== '' ? stealthPen : '')+(stealthPen !== '' && speedPen !== '' ? '; ' : '')+(speedPen !== '' ? speedPen : '');
+ }
+ }
+
+ if(attrs.unarmored_class_bonus === '(@{constitution_mod} + 0.002)') {
+ unarmoredTotal += attrMod(attrs.constitution);
+ }
+ else if(attrs.unarmored_class_bonus === '(@{wisdom_mod} + 0.003)') {
+ unarmoredTotal += attrMod(attrs.wisdom);
+ }
+ else if(attrs.unarmored_class_bonus === '(3 + 0.004)') {
+ unarmoredTotal += 3;
+ }
+
+ updates['ac'] = (armorTotal > unarmoredTotal ? armorTotal : unarmoredTotal);
+ updateAll(updates,'armor inventory + ac calc');
+ });
+ // set character levels/multiclass/hit dice
+ getAttrs(['barbarian_level','bard_level','cleric_level','druid_level','figher_level','monk_level','paladin_level','ranger_level','rogue_level','sorcerer_level','warlock_level','wizard_level','hd_d6','hd_d8','hd_d10','hd_d12'], function(attrs) {
+ var classLevels = [],
+ updates = {},
+ currentHitDice = [];
+
+ _.each(attrs, function(value, key) {
+ if(value && key.indexOf('level') !== -1 && value !== '0') {
+ classLevels.push({ 'class': key.slice(0,-6), 'level': parseInt(value)});
+ }
+ else if(value && value !== "0") {
+ currentHitDice.push({ 'dice': key.substr(3), 'count': parseInt(value) });
+ }
+ });
+
+ if(classLevels.length > 1) {
+ classLevels.sort(function(a,b) { return b['level']-a['level']; });
+ updates['base_level'] = classLevels[0]['level'];
+ updates['class'] = classLevels[0]['class'].substr(0,1).toUpperCase()+classLevels[0]['class'].substr(1);
+
+ var hitDiceMax = {},
+ hitDiceMaxArray = [];
+
+ _.each(classLevels, function(classLevel) {
+ var numHitDice = hitDiceMax[classHitDice[classLevel['class']]];
+ hitDiceMax[classHitDice[classLevel['class']]] = (!numHitDice ? classLevel['level'] : numHitDice + classLevel['level']);
+ });
+ _.each(hitDiceMax, function(value, key) {
+ hitDiceMaxArray.push({ 'dice': key, 'count': value });
+ });
+
+ updates['hit_dice_max'] = hitDiceMaxArray.sort(function(a,b) { return a['dice'].localeCompare(b['dice']); }).map(function(x) { return x['dice']+' '+x['count']; }).join('|');
+
+ _.each(classLevels, function(classLevel, i) {
+ if (i > 0) {
+ updates['multiclass'+i+'_flag'] = "1";
+ updates['multiclass'+i] = classLevel['class'].substr(0,1).toUpperCase()+classLevel['class'].substr(1);
+ updates['multiclass'+i+'_lvl'] = classLevel['level'];
+ }
+ });
+ }
+ else if(classLevels.length > 0) {
+ updates['base_level'] = classLevels[0]['level'];
+ updates['class'] = classLevels[0]['class'].substr(0,1).toUpperCase()+classLevels[0]['class'].substr(1);
+ updates['hit_dice_max'] = classLevels[0]['level'];
+ }
+
+ if(currentHitDice.length > 1) {
+ updates['hit_dice'] = currentHitDice.sort(function(a,b) { return a['dice'].localeCompare(b['dice']); }).map(function(x) { return x['dice']+' '+x['count']; }).join('|');
+ }
+ else if(currentHitDice.length === 1) {
+ updates['hit_dice'] = currentHitDice[0]['count'];
+ }
+
+ updateAll(updates,'character levels/multclassing');
+ });
+ // set proficiencies
+ getAttrs(['pro_tools'],function(toolAttrs) {
+ var updates = {},
+ tools = (toolAttrs.pro_tools || '').split(/, and|,and|and|;|:|\||,/);
+ if(toolAttrs.pro_tools && toolAttrs.pro_tools.trim() !== '') {
+ _.each(tools, function(tool) {
+ var newRowId = generateRowID();
+
+ updates['repeating_tool_'+newRowId+'_toolname_base'] = tool.trim();
+ updates['repeating_tool_'+newRowId+'_options-flag'] = '0';
+ });
+ }
+ updateAll(updates,'tool proficiencies');
+ });
+ // set class/other resources
+ getSectionIDs('repeating_classresources',function(classResourceIds) {
+ var newRowId = '';
+ if(classResourceIds.length === 0) {
+ updateAll({},'class/other resources');
+ }
+ else expectedUpdates += (classResourceIds.length - 1);
+ _.each(classResourceIds,function(repeatingId, i) {
+ var classResources = ['repeating_classresources_'+repeatingId+'_classresourcename','repeating_classresources_'+repeatingId+'_classresourcerecharge','repeating_classresources_'+repeatingId+'_classresourcetotal','repeating_classresources_'+repeatingId+'_classresourcetotal_max'];
+ getAttrs(classResources, function(attrs) {
+ var updates = {},
+ resourceCurrent = attrs['repeating_classresources_'+repeatingId+'_classresourcetotal'],
+ resourceMax = attrs['repeating_classresources_'+repeatingId+'_classresourcetotal_max'],
+ resourceName = attrs['repeating_classresources_'+repeatingId+'_classresourcename'];
+
+ if(i === 0) {
+ updates.class_resource = resourceCurrent || '';
+ updates.class_resource_max = resourceMax || '';
+ updates.class_resource_name = resourceName || '';
+ }
+ else if(i === 1) {
+ updates.other_resource = resourceCurrent || '';
+ updates.other_resource_max = resourceMax || '';
+ updates.other_resource_name = resourceName || '';
+ }
+ else if(i%2 === 0) {
+ newRowId = generateRowID();
+ updates['repeating_resource_'+newRowId+'_resource_left'] = resourceCurrent || '';
+ updates['repeating_resource_'+newRowId+'_resource_left_max'] = resourceMax || '';
+ updates['repeating_resource_'+newRowId+'_resource_left_name'] = resourceName || '';
+ }
+ else {
+ updates['repeating_resource_'+newRowId+'_resource_right'] = resourceCurrent || '';
+ updates['repeating_resource_'+newRowId+'_resource_right_max'] = resourceMax || '';
+ updates['repeating_resource_'+newRowId+'_resource_right_name'] = resourceName || '';
+ }
+
+ updateAll(updates,'class/other resources');
+ });
+ });
+ });
+ // transfer weapons to inventory/attacks
+ var baseWeaponValues = ['pbmelee','meleeweaponname','meleeattackstat','meleemagic','meleedmg','meleedmgtype','meleeattackstatdmg','meleecritdmg','meleeweaponcritrange'],
+ weaponFields = [];
+ for(var i = 1; i <= 6; i++) {
+ weaponFields = weaponFields.concat(baseWeaponValues.map(function(weaponValue) { return weaponValue+i; })); //melee weapons
+ weaponFields = weaponFields.concat(baseWeaponValues.map(function(weaponValue) { return (weaponValue+i).replace(/melee/g,'ranged'); })); // ranged weapons
+ }
+ getAttrs(weaponFields,function(attrs) {
+ var newRowId = '',
+ updates = {},
+ attackAttr = '';
+ for(var i = 1; i <= 6; i++) {
+ if(attrs['meleeweaponname'+i] && attrs['meleeweaponname'+i] !== '') {
+ newRowId = generateRowID();
+ updates['repeating_inventory_'+newRowId+'_itemcount'] = 1;
+ updates['repeating_inventory_'+newRowId+'_itemname'] = attrs['meleeweaponname'+i];
+ updates['repeating_inventory_'+newRowId+'_itemmodifiers'] = attrs['meleemagic'+i] && attrs['meleemagic'+i] !== '' && attrs['meleemagic'+i] !== '0' ? '+'+attrs['meleemagic'+i]+' Attack/Damage' : '';
+ updates['repeating_inventory_'+newRowId+'_itemcontent'] = 'Damage: '+(attrs['meleedmg'+i]||'')+' '+(attrs['meleedmgtype'+i]||'')+(attrs['meleemagic'+i] && attrs['meleemagic'+i] !== '' && attrs['meleemagic'+i] !== '0' ? '+'+attrs['meleemagic'+i]+' magic' : '');
+
+ newRowId = generateRowID();
+ attackAttr = (!attrs['meleeattackstat'+i] || attrs['meleeattackstat'+i] === '@{finesse_mod}' ? '@{strength_mod}' : attrs['meleeattackstat'+i]);
+ updates['repeating_attack_'+newRowId+'_options-flag'] = 0;
+ updates['repeating_attack_'+newRowId+'_atkname_base'] = attrs['meleeweaponname'+i];
+ updates['repeating_attack_'+newRowId+'_atknattr_base'] = attackAttr;
+ updates['repeating_attack_'+newRowId+'_atkprofflag'] = !attrs['pbmelee'+i] || attrs['pbmelee'] === '@{PB}' ? '(@{pb})' : '0';
+ updates['repeating_attack_'+newRowId+'_atkmagic'] = attrs['meleemagic'+i] || '';
+ updates['repeating_attack_'+newRowId+'_dmgcustcrit'] = attrs['meleecritdmg'+i] || '';
+ updates['repeating_attack_'+newRowId+'_atkcritrange'] = attrs['meleeweaponcritrange'+i] || '20';
+ updates['repeating_attack_'+newRowId+'_dmgbase'] = attrs['meleedmg'+i] || '';
+ updates['repeating_attack_'+newRowId+'_dmgattr'] = !attrs['meleeattackstatdmg'+i] || attrs['meleeattackstatdmg'+i] === '1' ? attackAttr : '0';
+ updates['repeating_attack_'+newRowId+'_dmgtype'] = attrs['meleedmgtype'+i] || '';
+ }
+ }
+
+ for(var i = 1; i <= 6; i++) {
+ if(attrs['rangedweaponname'+i] && attrs['rangedweaponname'+i] !== '') {
+ newRowId = generateRowID();
+ updates['repeating_inventory_'+newRowId+'_itemcount'] = 1;
+ updates['repeating_inventory_'+newRowId+'_itemname'] = attrs['rangedweaponname'+i];
+ updates['repeating_inventory_'+newRowId+'_itemmodifiers'] = attrs['rangedmagic'+i] && attrs['rangedmagic'+i] !== '' && attrs['rangedmagic'+i] !== '0' ? '+'+attrs['rangedmagic'+i]+' Attack/Damage' : '';
+ updates['repeating_inventory_'+newRowId+'_itemcontent'] = 'Damage: '+(attrs['rangeddmg'+i]||'')+' '+(attrs['rangeddmgtype'+i]||'')+(attrs['rangedmagic'+i] && attrs['rangedmagic'+i] !== '' && attrs['rangedmagic'+i] !== '0' ? '+'+attrs['rangedmagic'+i]+' magic' : '');
+
+ newRowId = generateRowID();
+ attackAttr = (!attrs['rangedattackstat'+i] || attrs['rangedattackstat'+i] === '@{finesse_mod}' ? '@{strength_mod}' : attrs['rangedattackstat'+i]);
+ updates['repeating_attack_'+newRowId+'_options-flag'] = 0;
+ updates['repeating_attack_'+newRowId+'_atkname_base'] = attrs['rangedweaponname'+i];
+ updates['repeating_attack_'+newRowId+'_atknattr_base'] = attackAttr;
+ updates['repeating_attack_'+newRowId+'_atkprofflag'] = !attrs['pbranged'+i] || attrs['pbranged'] === '@{PB}' ? '(@{pb})' : '0';
+ updates['repeating_attack_'+newRowId+'_atkmagic'] = attrs['rangedmagic'+i] || '';
+ updates['repeating_attack_'+newRowId+'_atkcritrange'] = attrs['rangedcritdmg'+i] || '';
+ updates['repeating_attack_'+newRowId+'_atkcritrange'] = attrs['rangedweaponcritrange'+i] || '20';
+ updates['repeating_attack_'+newRowId+'_dmgbase'] = attrs['rangeddmg'+i] || '';
+ updates['repeating_attack_'+newRowId+'_dmgattr'] = !attrs['rangedattackstatdmg'+i] || attrs['rangedattackstatdmg'+i] === '1' ? attackAttr : '0';
+ updates['repeating_attack_'+newRowId+'_dmgtype'] = attrs['rangeddmgtype'+i] || '';
+ }
+ }
+ updateAll(updates,'weapons + weapon attacks');
+ });
+ // transfer inventory
+ var baseInventoryValues = ['inventorycarried','inventoryqty','inventoryname','inventoryweight','inventorydescription'],
+ inventoryFields = [];
+ for(var i = 1; i <= 60; i++) {
+ inventoryFields = inventoryFields.concat(baseInventoryValues.map(function(inventoryValue) { return inventoryValue+i; }));
+ }
+ getAttrs(inventoryFields,function(attrs) {
+ var newRowId = '',
+ updates = {};
+ for(var i = 1; i <= 60; i++) {
+ if((!attrs['inventorycarried'+i] || attrs['inventorycarried'+i] !== '0') && attrs['inventoryname'+i] && attrs['inventoryname'+i] !== '') {
+ newRowId = generateRowID();
+ updates['repeating_inventory_'+newRowId+'_itemcount'] = attrs['inventorycount'+i] || 1;
+ updates['repeating_inventory_'+newRowId+'_itemname'] = attrs['inventoryname'+i] || '';
+ updates['repeating_inventory_'+newRowId+'_itemweight'] = (attrs['inventoryweight'+i] && attrs['invetoryweight'+i] !== '0' ? attrs['inventoryweight'+i] : '');
+ updates['repeating_inventory_'+newRowId+'_itemcontent'] = attrs['inventorydescription'+i] || '';
+ }
+ }
+
+ updateAll(updates,'inventory');
+ });
+
+ function attrMod(value) {
+ return Math.floor((parseInt(value)-10)/2);
+ }
+
+ var totalUpdates = 0,
+ expectedUpdates = 9,
+ allUpdates = {};
+
+ function updateAll(newUpdates, updateArea) {
+ console.log('update: '+updateArea);
+ console.log(newUpdates);
+ allUpdates = _.extend(allUpdates, newUpdates);
+ totalUpdates++;
+ console.log('expected: '+expectedUpdates+' vs actual: '+totalUpdates);
+ if(expectedUpdates === totalUpdates) {
+ console.log('expected reached, updating');
+ console.log(allUpdates);
+ setAttrs(allUpdates);
+ allUpdates = {};
+ }
+ }
+ };
+ // /TRANSITION SCRIPT
+
+ var upgrade_1_1_to_1_2 = function(doneupdating) {
force_refresh_spells();
force_refresh_attacks();
+ doneupdating();
+ }
+
+ var upgrade_1_2_to_1_3 = function(doneupdating) {
+ // UPGRADING SAVING THROW TOGGLE
+ getSectionIDs("repeating_attack", function(idarray) {
+ var update = {};
+ _.each(idarray, function(currentID, i) {
+ getAttrs(["repeating_attack_" + currentID + "_saveflag"], function(v) {
+ if(v["repeating_attack_" + currentID + "_saveflag"] && ["repeating_attack_" + currentID + "_saveflag"] != "0") {
+ update["repeating_attack_" + currentID + "_saveflag"] = "{{save=1}} {{saveattr=@{saveattr}}} {{savedesc=@{saveeffect}}} {{savedc=[[[[@{savedc}]][SAVE]]]}}";
+ }
+ if(i === idarray.length - 1) {
+ console.log(update);
+ setAttrs(update, {}, function() {
+ console.log("MOVING ON DOWN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ force_refresh_npcactions();
+ updateac();
+ force_refresh_spells();
+ force_refresh_attacks();
+ doneupdating();
+ });
+ }
+ });
+ });
+ });
+ }
+
+ var upgrade_1_3_to_1_4 = function(doneupdating) {
+ force_refresh_spells();
+ force_refresh_attacks();
+ doneupdating();
}
var versioning = function() {
@@ -6072,11 +7416,29 @@
}
else if(v["version"] === "1.1") {
console.log("UPGRADING TO v1.2");
- upgrade_1_1_to_1_2();
- setAttrs({version: "1.2"});
- versioning();
+ upgrade_1_1_to_1_2(function() {
+ setAttrs({version: "1.2"});
+ versioning();
+ });
+
+ }
+ else if(v["version"] === "1.2") {
+ console.log("UPGRADING TO v1.3");
+ upgrade_1_2_to_1_3(function() {
+ setAttrs({version: "1.3"});
+ versioning();
+ });
+
+ }
+ else if(v["version"] === "1.3") {
+ console.log("UPGRADING TO v1.4");
+ upgrade_1_3_to_1_4(function() {
+ setAttrs({version: "1.4"});
+ versioning();
+ });
}
else {
+ setAttrs({version: "1.4"});
console.log("5th Edition OGL by Roll20 version " + v["version"]);
}
});
diff --git a/5th Edition OGL by Roll20/D&D5eCommunityPreview.png b/5th Edition OGL by Roll20/D&D5eCommunityPreview.png
new file mode 100644
index 0000000000..30809b0cc7
Binary files /dev/null and b/5th Edition OGL by Roll20/D&D5eCommunityPreview.png differ
diff --git a/5th Edition OGL by Roll20/D&D5eShapedPreview.png b/5th Edition OGL by Roll20/D&D5eShapedPreview.png
new file mode 100644
index 0000000000..f6b5cc834b
Binary files /dev/null and b/5th Edition OGL by Roll20/D&D5eShapedPreview.png differ
diff --git a/AD&D_1E/1ESheet.html b/AD&D_1E/1ESheet.html
index 5b54365f62..4e8104e376 100644
--- a/AD&D_1E/1ESheet.html
+++ b/AD&D_1E/1ESheet.html
@@ -266,7 +266,7 @@
DMG vs L
Rate of Fire
Range S/M/L
- Qty
+ Qty
Wt
Speed
Cost
@@ -409,8 +409,8 @@
-
-
+
+
/
@@ -434,13 +434,13 @@
@@ -611,7 +611,7 @@