[Stargate RPG]: Official v.1.2 GenCon. skills, saves and more update when attributes are changed
This commit is contained in:
@@ -4,8 +4,12 @@ Offical Roll20 Character sheet for "Stargate RPG" by Wyvern Gaming (Full release
|
||||
|
||||
### Changelog
|
||||
|
||||
**v.1.2 (2020-07-27)**
|
||||
* skills, saves, init, ac, ac_extra & moxie now update when their attribute changes. init is keyed to dex, moxie to cha.
|
||||
* skills & saves that have been marked as proficient will now update when the prof bonus changes.
|
||||
|
||||
**v.1.1 (2020-07-27)**
|
||||
* checking/unchecking proficency checkbox for skills/saves automatically adds/subtracts the proficiency bonus to the affected skill. Changing the value of the proficiency bonus doesn't update skills/saves yet, need to be increased manually still.
|
||||
* checking/unchecking proficency checkbox for skills/saves automatically adds/subtracts the proficiency bonus to the affected skill.
|
||||
|
||||
**v.1.01 (2020-05-13)**
|
||||
* update img links to point to Roll20's repo
|
||||
|
||||
+140
-27
@@ -1,7 +1,7 @@
|
||||
<input type="radio" name="attr_tab" class="tab tab1" value="1" checked="checked"><span title="Main"></span>
|
||||
<input type="radio" name="attr_tab" class="tab tab2" value="2" ><span title="Background"></span>
|
||||
|
||||
<span class="version bold">Sheet Version: 1.1</span>
|
||||
<span class="version bold">Sheet Version: 1.2</span>
|
||||
|
||||
<!--
|
||||
<div>
|
||||
@@ -368,32 +368,32 @@
|
||||
<h3>Saves</h3>
|
||||
<div class="rowflex nowrap">
|
||||
<input name="attr_str_save_c" type="checkbox" value="1">
|
||||
<input name="attr_str_save" type="number" value="" class="w30">
|
||||
<input name="attr_str_save" type="number" value="0" class="w30">
|
||||
<button name="roll_str_save" type="roll" class="txt-btn" value=" &{template:default} {{name=**Strength Save**}} {{[[d20+(@{str_save})]]=[[d20+(@{str_save})]]}}">Strength</button>
|
||||
</div>
|
||||
<div class="rowflex nowrap">
|
||||
<input name="attr_dex_save_c" type="checkbox" value="1">
|
||||
<input name="attr_dex_save" type="number" value="" class="w30">
|
||||
<input name="attr_dex_save" type="number" value="0" class="w30">
|
||||
<button name="roll_dex_save" type="roll" class="txt-btn" value=" &{template:default} {{name=**Dexterity Save**}} {{[[d20+(@{dex_save})]]=[[d20+(@{dex_save})]]}}">Dexterity</button>
|
||||
</div>
|
||||
<div class="rowflex nowrap">
|
||||
<input name="attr_con_save_c" type="checkbox" value="1">
|
||||
<input name="attr_con_save" type="number" value="" class="w30">
|
||||
<input name="attr_con_save" type="number" value="0" class="w30">
|
||||
<button name="roll_con_save" type="roll" class="txt-btn" value=" &{template:default} {{name=**Constitution Save**}} {{[[d20+(@{con_save})]]=[[d20+(@{con_save})]]}}">Constitution</button>
|
||||
</div>
|
||||
<div class="rowflex nowrap">
|
||||
<input name="attr_int_save_c" type="checkbox" value="1">
|
||||
<input name="attr_int_save" type="number" value="" class="w30">
|
||||
<input name="attr_int_save" type="number" value="0" class="w30">
|
||||
<button name="roll_int_save" type="roll" class="txt-btn" value=" &{template:default} {{name=**Intelligence Save**}} {{[[d20+(@{int_save})]]=[[d20+(@{int_save})]]}}">Intelligence</button>
|
||||
</div>
|
||||
<div class="rowflex nowrap">
|
||||
<input name="attr_wis_save_c" type="checkbox" value="1">
|
||||
<input name="attr_wis_save" type="number" value="" class="w30">
|
||||
<input name="attr_wis_save" type="number" value="0" class="w30">
|
||||
<button name="roll_wis_save" type="roll" class="txt-btn" value=" &{template:default} {{name=**Wisdom Save**}} {{[[d20+(@{wis_save})]]=[[d20+(@{wis_save})]]}}">Wisdom</button>
|
||||
</div>
|
||||
<div class="rowflex nowrap mb20">
|
||||
<input name="attr_cha_save_c" type="checkbox" value="1">
|
||||
<input name="attr_cha_save" type="number" value="" class="w30">
|
||||
<input name="attr_cha_save" type="number" value="0" class="w30">
|
||||
<button name="roll_cha_save" type="roll" class="txt-btn" value=" &{template:default} {{name=**Charisma Save**}} {{[[d20+(@{cha_save})]]=[[d20+(@{cha_save})]]}}">Charisma</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -615,33 +615,15 @@
|
||||
<input name="attr_int_mod" type="hidden" value="+0">
|
||||
<input name="attr_cha_mod" type="hidden" value="+0">
|
||||
|
||||
<input name="attr_str_save" type="hidden" value="+0">
|
||||
<input name="attr_dex_save" type="hidden" value="+0">
|
||||
<input name="attr_con_save" type="hidden" value="+0">
|
||||
<input name="attr_int_save" type="hidden" value="+0">
|
||||
<input name="attr_wis_save" type="hidden" value="+0">
|
||||
<input name="attr_cha_save" type="hidden" value="+0">
|
||||
|
||||
<input name="attr_acro" type="hidden" value="+0">
|
||||
<input name="attr_animal" type="hidden" value="+0">
|
||||
|
||||
<script type="text/worker">
|
||||
|
||||
const int = score => parseInt(score, 10) || 0;
|
||||
|
||||
const stats = ["str", "dex", "con", "wis", "int", "cha"];
|
||||
|
||||
|
||||
const skillslist = ["acrobatics", "animalhandling", "athletics", "culture", "deception", "engineering", "history", "insight", "intimidation", "investigation", "medicine", "nature", "perception", "performance", "persuasion", "pilot", "science", "sleight", "stealth", "survival"];
|
||||
const skillsdex = ["acrobatics", "pilot","sleight", "stealth"];
|
||||
const skillsint = ["engineering", "history", "investigation", "nature", "science"];
|
||||
const skillswis = ["animalhandling", "culture", "insight", "medicine", "perception", "survival"];
|
||||
const skillscha = ["deception", "intimidation", "performance", "persuasion"];
|
||||
const init = ["init", "moxie"];
|
||||
|
||||
const statmods = ["str_mod", "dex_mod", "con_mod", "wis_mod", "int_mod", "cha_mod", "prof"];
|
||||
|
||||
const skillslistprof = ["acrobatics_c", "animalhandling_c", "athletics_c", "culture_c", "deception_c", "engineering_c", "history_c", "insight_c", "intimidation_c", "investigation_c", "medicine_c", "nature_c", "perception_c", "performance_c", "persuasion_c", "pilot_c", "science_c", "sleight_c", "stealth_c", "survival_c"];
|
||||
const skillslistprofget = ["acrobatics", "animalhandling", "athletics", "culture", "deception", "engineering", "history", "insight", "intimidation", "investigation", "medicine", "nature", "perception", "performance", "persuasion", "pilot", "science", "sleight", "stealth", "survival", "acrobatics_c", "animalhandling_c", "athletics_c", "culture_c", "deception_c", "engineering_c", "history_c", "insight_c", "intimidation_c", "investigation_c", "medicine_c", "nature_c", "perception_c", "performance_c", "persuasion_c", "pilot_c", "science_c", "sleight_c", "stealth_c", "survival_c", "prof"];
|
||||
|
||||
// Calculate Stat modifier
|
||||
|
||||
@@ -678,7 +660,6 @@ stats.forEach(stat => {
|
||||
});
|
||||
|
||||
|
||||
|
||||
// skill prof check/uncheck
|
||||
|
||||
skillslist.forEach(skillcheckbox => {
|
||||
@@ -756,7 +737,139 @@ stats.forEach(savecheckbox => {
|
||||
});
|
||||
});
|
||||
|
||||
// proficiency changed, updates skills/saves
|
||||
|
||||
on(`change:prof`, eventInfo => {
|
||||
console.log("prof change");
|
||||
let profold = int(eventInfo.previousValue);
|
||||
console.log("eventinfo: " + eventInfo.previousValue);
|
||||
let getlist = ["acrobatics", "animalhandling", "athletics", "culture", "deception", "engineering", "history", "insight", "intimidation", "investigation", "medicine", "nature", "perception", "performance", "persuasion", "pilot", "science", "sleight", "stealth", "survival", "acrobatics_c", "animalhandling_c", "athletics_c", "culture_c", "deception_c", "engineering_c", "history_c", "insight_c", "intimidation_c", "investigation_c", "medicine_c", "nature_c", "perception_c", "performance_c", "persuasion_c", "pilot_c", "science_c", "sleight_c", "stealth_c", "survival_c", "str_save", "dex_save", "con_save", "wis_save", "int_save", "cha_save","str_save_c", "dex_save_c", "con_save_c", "wis_save_c", "int_save_c", "cha_save_c", "prof"];
|
||||
|
||||
getAttrs(getlist, values => {
|
||||
|
||||
var update = {};
|
||||
let profnew = int(values["prof"]);
|
||||
let profdiff = profnew - profold;
|
||||
|
||||
//manual fix for when you change proficiency for first time
|
||||
if (profnew === 3 && profold ===3)( profdiff = 1);
|
||||
|
||||
console.log("profold:" + profold + " profnew:" + profnew + " proffdiff: " + profdiff);
|
||||
|
||||
let xboxlist = ["acrobatics", "animalhandling", "athletics", "culture", "deception", "engineering", "history", "insight", "intimidation", "investigation", "medicine", "nature", "perception", "performance", "persuasion", "pilot", "science", "sleight", "stealth", "survival","str_save", "dex_save", "con_save", "wis_save", "int_save", "cha_save"];
|
||||
|
||||
xboxlist.forEach(number => {
|
||||
|
||||
let checkbox = int(values[`${number}_c`]);
|
||||
|
||||
if (checkbox === 1) {
|
||||
let oldval = int(values[`${number}`]);
|
||||
let newval = oldval + profdiff;
|
||||
|
||||
update[number] = newval;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
console.log(update);
|
||||
|
||||
|
||||
setAttrs(update);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// update skills & saves when attr mod changes
|
||||
|
||||
statmods.forEach(statmod => {
|
||||
on(`change:${statmod}`, eventInfo => {
|
||||
console.log("attr mod change");
|
||||
console.log("old mod: " + eventInfo.previousValue);
|
||||
let temp = eventInfo.previousValue;
|
||||
if (temp === undefined){
|
||||
temp = 0;
|
||||
}else{
|
||||
temp = temp.replace('+', '');
|
||||
}
|
||||
|
||||
let oldstatmod = int(temp);
|
||||
|
||||
console.log("old mod: " + oldstatmod);
|
||||
|
||||
let getlist = ["str_mod", "dex_mod", "con_mod", "wis_mod", "int_mod", "cha_mod", "acrobatics", "animalhandling", "athletics", "culture", "deception", "engineering", "history", "insight", "intimidation", "investigation", "medicine", "nature", "perception", "performance", "persuasion", "pilot", "science", "sleight", "stealth", "survival", "str_save", "dex_save", "con_save", "wis_save", "int_save", "cha_save", "prof", "init", "moxie", "ac", "ac_extra"];
|
||||
|
||||
getAttrs(getlist, values => {
|
||||
|
||||
var update = {};
|
||||
|
||||
let modnew = int(values[`${statmod}`]);
|
||||
let moddiff = modnew - oldstatmod;
|
||||
|
||||
switch (`${statmod}`) {
|
||||
case "str_mod":
|
||||
console.log("oldstatmod: " + oldstatmod + " modnew:" + modnew + " moddiff: " + moddiff);
|
||||
update["athletics"] = int(values["athletics"]) + moddiff;
|
||||
update["str_save"] = int(values["str_save"]) + moddiff;
|
||||
|
||||
setAttrs(update);
|
||||
break;
|
||||
case "con_mod":
|
||||
//let modnew = int(values[`${statmod}`]);
|
||||
//let moddiff = modnew - oldstatmod;
|
||||
update["con_save"] = int(values["con_save"]) + moddiff;
|
||||
|
||||
setAttrs(update);
|
||||
break;
|
||||
case "dex_mod":
|
||||
update["acrobatics"] = int(values["acrobatics"]) + moddiff;
|
||||
update["pilot"] = int(values["pilot"]) + moddiff;
|
||||
update["sleight"] = int(values["sleight"]) + moddiff;
|
||||
update["stealth"] = int(values["stealth"]) + moddiff;
|
||||
update["ac"] = int(values["ac"]) + moddiff;
|
||||
update["ac_extra"] = int(values["ac_extra"]) + moddiff;
|
||||
update["init"] = int(values["init"]) + moddiff;
|
||||
update["dex_save"] = int(values["dex_save"]) + moddiff;
|
||||
|
||||
setAttrs(update);
|
||||
break;
|
||||
case "int_mod":
|
||||
update["engineering"] = int(values["engineering"]) + moddiff;
|
||||
update["history"] = int(values["history"]) + moddiff;
|
||||
update["investigation"] = int(values["investigation"]) + moddiff;
|
||||
update["nature"] = int(values["nature"]) + moddiff;
|
||||
update["science"] = int(values["science"]) + moddiff;
|
||||
update["int_save"] = int(values["int_save"]) + moddiff;
|
||||
|
||||
setAttrs(update);
|
||||
break;
|
||||
case "wis_mod":
|
||||
update["animalhandling"] = int(values["animalhandling"]) + moddiff;
|
||||
update["culture"] = int(values["culture"]) + moddiff;
|
||||
update["insight"] = int(values["insight"]) + moddiff;
|
||||
update["medicine"] = int(values["medicine"]) + moddiff;
|
||||
update["perception"] = int(values["perception"]) + moddiff;
|
||||
update["survival"] = int(values["survival"]) + moddiff;
|
||||
update["wis_save"] = int(values["wis_save"]) + moddiff;
|
||||
|
||||
setAttrs(update);
|
||||
break;
|
||||
case "cha_mod":
|
||||
update["deception"] = int(values["deception"]) + moddiff;
|
||||
update["intimidation"] = int(values["intimidation"]) + moddiff;
|
||||
update["performance"] = int(values["performance"]) + moddiff;
|
||||
update["persuasion"] = int(values["persuasion"]) + moddiff;
|
||||
update["moxie"] = int(values["moxie"]) + moddiff;
|
||||
update["cha_save"] = int(values["cha_save"]) + moddiff;
|
||||
|
||||
setAttrs(update);
|
||||
break;
|
||||
default:
|
||||
false;
|
||||
}
|
||||
console.log(update);
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user