mirror of
https://github.com/Nighthawk42/roll20-character-sheets.git
synced 2026-08-30 03:40:32 +00:00
Court Of Blades: Update to fix bug where attr wasn't daving + add button for indulgence
This commit is contained in:
+1403
-1768
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
||||
<input type="hidden" name="attr_position_query" value="" />
|
||||
<input type="hidden" name="attr_effect_query" value="" />
|
||||
<input type="hidden" name="attr_fortune" value="" />
|
||||
<input type="hidden" name="attr_indulge" value="" />
|
||||
</div>
|
||||
<input type="hidden" id="page-selector" name="attr_setting_currentPage" value="0">
|
||||
<select name="attr_setting_currentPage">
|
||||
@@ -134,53 +135,53 @@
|
||||
<div class="grid gth-5 gtw-11 gw-2 border-left">
|
||||
<div class="gw-11 bg-black b text-center upcase" data-i18n="Status">Status</div>
|
||||
<div class="gw-11 gh-4 tracker tracked-dark grid gtw-11 gth-4 gapw-2 gaph-2 pad-top">
|
||||
<input type="radio" value="0" name="attrpc_status" class="shape-cross track-zero checked-hidden" checked="true">
|
||||
<input type="radio" value="1" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="2" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="3" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="4" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="5" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="6" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="7" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="8" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="9" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="10" name="attrpc_status" class="shape-diamond-med">
|
||||
<input type="radio" value="0" name="attr_pc_status" class="shape-cross track-zero checked-hidden" checked="true">
|
||||
<input type="radio" value="1" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="2" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="3" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="4" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="5" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="6" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="7" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="8" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="9" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="10" name="attr_pc_status" class="shape-diamond-med">
|
||||
|
||||
<input type="radio" disabled class="shape-square-med shape-hidden">
|
||||
<input type="radio" value="11" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="12" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="13" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="14" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="15" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="16" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="17" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="18" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="19" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="20" name="attrpc_status" class="shape-diamond-med">
|
||||
<input type="radio" value="11" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="12" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="13" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="14" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="15" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="16" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="17" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="18" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="19" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="20" name="attr_pc_status" class="shape-diamond-med">
|
||||
|
||||
<input type="radio" disabled class="shape-square-med shape-hidden">
|
||||
<input type="radio" value="21" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="22" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="23" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="24" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="25" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="26" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="27" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="28" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="29" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="30" name="attrpc_status" class="shape-diamond-med">
|
||||
<input type="radio" value="21" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="22" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="23" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="24" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="25" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="26" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="27" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="28" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="29" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="30" name="attr_pc_status" class="shape-diamond-med">
|
||||
|
||||
<input type="radio" disabled class="shape-square-med shape-hidden">
|
||||
<input type="radio" value="31" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="32" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="33" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="34" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="35" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="36" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="37" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="38" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="39" name="attrpc_status" class="shape-square-med">
|
||||
<input type="radio" value="40" name="attrpc_status" class="shape-diamond-med">
|
||||
<input type="radio" value="31" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="32" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="33" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="34" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="35" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="36" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="37" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="38" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="39" name="attr_pc_status" class="shape-square-med">
|
||||
<input type="radio" value="40" name="attr_pc_status" class="shape-diamond-med">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -896,8 +897,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center ">
|
||||
<button type="roll" class="bordered bg-white b upcase pad-left pad-top pad-right pad-bottom" data-i18n="RollFortune" value="&{template:cob-fortune} {{name=@{pcname}}} {{fortune=1}} {{stat=@{fortune}}} @{numberofdice}">
|
||||
<div class="grid gtw-2 gth-1 text-center ">
|
||||
<button type="roll" class="bordered bg-white b upcase marg-left marg-top marg-right marg-bottom" data-i18n="Fortune" value="&{template:cob-fortune} {{name=@{pcname}}} {{fortune=1}} {{stat=@{fortune}}} @{numberofdice}">
|
||||
</button>
|
||||
<button type="roll" class="bordered bg-white b upcase marg-left marg-top marg-right marg-bottom" data-i18n="Indulge" value="&{template:cob-indulge} {{name=@{pcname}}} {{fortune=1}} {{stat=@{indulge}}} @{indulge_formula}">
|
||||
</button>
|
||||
</div>
|
||||
<div class="grid gtw-9 marg-top">
|
||||
@@ -1128,7 +1131,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center marg-top pad-top">
|
||||
<button type="roll" class="bordered bg-white b upcase pad-left pad-top pad-right pad-bottom" data-i18n="RollFortune" value="&{template:cob-fortune} {{name=@{coteriename}}} {{fortune=1}} {{stat=@{fortune}}} @{numberofdice}">
|
||||
<button type="roll" class="bordered bg-white b upcase marg-left marg-top marg-right marg-bottom" data-i18n="Fortune" value="&{template:cob-fortune} {{name=@{coteriename}}} {{fortune=1}} {{stat=@{fortune}}} @{numberofdice}">
|
||||
</button>
|
||||
</div>
|
||||
<div class="grid-favoured-contact ">
|
||||
@@ -2716,7 +2719,7 @@
|
||||
<span class="downcase" data-i18n="IsPublishedBy"></span>
|
||||
<span class="b capitalise" data-i18n="ACoupleOfDrakes"></span> (www.acoupleofdrakes.com).
|
||||
</div>
|
||||
<div class="flex-right b"><span data-i18n="Version"></span> 1.0.3</div>
|
||||
<div class="flex-right b"><span data-i18n="Version"></span> 1.1.0</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2780,7 +2783,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="resist-desc">
|
||||
<span data-i18n="ResistanceRollExplanation"></span>
|
||||
<span class="b" data-i18n="ResistanceRollExplanation1"></span>
|
||||
<span data-i18n="ResistanceRollExplanation2"></span>
|
||||
</div>
|
||||
</div>
|
||||
</rolltemplate>
|
||||
@@ -2806,10 +2810,37 @@
|
||||
</div>
|
||||
</div>
|
||||
</rolltemplate>
|
||||
<rolltemplate class="sheet-rolltemplate-cob-indulge">
|
||||
<div class="template-container">
|
||||
<div class="upper">
|
||||
<div class="name">{{name}} <span data-i18n="RollsToReduceStress"></span></div>
|
||||
<div class="stat">{{stat}}</div>
|
||||
</div>
|
||||
<div class="lower">
|
||||
<div class="dice">
|
||||
{{^zerodice}}
|
||||
<div class="zerodice3">
|
||||
<span data-i18n="Dice"></span>
|
||||
</div>
|
||||
<div>{{dice}}</div>
|
||||
{{/zerodice}}
|
||||
{{#zerodice}}
|
||||
<div class="zerodice3" data-i18n="ZeroDice"></div>
|
||||
<div class="zerodice1">{{zerodice}}</div>
|
||||
<div class="zerodice2" data-i18n="ZeroDiceDescription"></div>
|
||||
{{/zerodice}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="resist-desc">
|
||||
<span class="b" data-i18n="IndulgenceRollExplanation1"></span>
|
||||
<span data-i18n="IndulgenceRollExplanation2"></span>
|
||||
</div>
|
||||
</div>
|
||||
</rolltemplate>
|
||||
<script type="text/worker">
|
||||
const metaData = {
|
||||
sheetVersion: "1.0.3",
|
||||
lastUpdate: "2023-01-17"
|
||||
sheetVersion: "1.1.0",
|
||||
lastUpdate: "2023-04-11"
|
||||
};
|
||||
|
||||
// shorter alias
|
||||
@@ -2991,6 +3022,9 @@
|
||||
position_query: () => `?{${translate("Position")}|${translate("Risky")},position=${translate("Risky")}|${translate("Controlled")},position=${translate("Controlled")}|${translate("Desperate")},position=${translate("Desperate")}|${translate("FortuneRoll")},position=${translate("Fortune")}}`,
|
||||
effect_query: () => `?{${translate("Effect")}|${translate("Standard")}|${translate("Limited")}|${translate("Great")}|${translate("Extreme")}|${translate("Zero")}}`,
|
||||
fortune: () => translate("Fortune"),
|
||||
indulge: () => translate("Indulgence"),
|
||||
indulge_val: () => "0",
|
||||
indulge_formula: () => ``,
|
||||
|
||||
hideGMTurnRolls: () => "/w gm ",
|
||||
pcstresssize: () => "2"
|
||||
@@ -5043,15 +5077,16 @@
|
||||
[key]: dict[key]()
|
||||
});
|
||||
|
||||
if ((key.startsWith("pcskillval") || key.startsWith("pcattrval") || key.startsWith("factstat")) && !key.endsWith("formula")) {
|
||||
if ((key.startsWith("pcskillval") || key.startsWith("pcattrval") || key.startsWith("factstat")) && !key.endsWith("formula") && !key.startsWith("indulexp")) {
|
||||
recalculateFormula(key, dict[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
recalculateIndulgence();
|
||||
};
|
||||
|
||||
const debugPrint = (obj) => {
|
||||
return;
|
||||
//return;
|
||||
Object
|
||||
.keys(obj)
|
||||
.forEach((prop) => {
|
||||
@@ -5060,6 +5095,7 @@
|
||||
};
|
||||
|
||||
const recalculateFormula = (key, newValue) => {
|
||||
log(`Recalculating ${key}: ${newValue}`);
|
||||
var results = [];
|
||||
newValue = parseInt(newValue);
|
||||
for (let i = 0; i <= 5; i++) {
|
||||
@@ -5067,8 +5103,8 @@
|
||||
var dice = "";
|
||||
if (count > 0) {
|
||||
dice = `${i},dice=${Array(count)
|
||||
.fill("[[d6]]")
|
||||
.join("&#44; ")}`;
|
||||
.fill("[[d6]]")
|
||||
.join("&#44; ")}`;
|
||||
} else {
|
||||
dice = `${i},zerodice=[[d6]]&#44; [[d6]]`;
|
||||
}
|
||||
@@ -5094,6 +5130,18 @@
|
||||
});
|
||||
};
|
||||
|
||||
const recalculateIndulgence = () => {
|
||||
getAttrs(["pcattrval1", "pcattrval2", "pcattrval3", "pcattrval4", "pcattrval5", "setting_attrcount"], function(values) {
|
||||
var attrVals = [];
|
||||
for (let i = 1; i <= parseInt(values["setting_attrcount"]); i++) {
|
||||
attrVals.push(parseInt(values[`pcattrval${i}`]));
|
||||
}
|
||||
var newVal = Math.min(...attrVals);
|
||||
setAttrs({indulge_val: newVal});
|
||||
recalculateFormula("indulge", newVal);
|
||||
});
|
||||
}
|
||||
|
||||
const initialSetup = () => {
|
||||
// Default values for sheets
|
||||
setDefaultAttrs(pcDefaults);
|
||||
@@ -5110,15 +5158,43 @@
|
||||
fillFactions();
|
||||
};
|
||||
|
||||
const updateVersion = (oldVersion) =>
|
||||
{
|
||||
var numbers = oldVersion.split(".");
|
||||
var oldMajorVersion = parseInt(numbers[0]);
|
||||
var oldMinorVersion = parseInt(numbers[1]);
|
||||
var oldRevision = parseInt(numbers[2]);
|
||||
|
||||
numbers = metaData.sheetVersion.split(".");
|
||||
var newMajorVersion = parseInt(numbers[0]);
|
||||
var newMinorVersion = parseInt(numbers[1]);
|
||||
var newRevision = parseInt(numbers[2]);
|
||||
|
||||
if (oldMajorVersion == "1" && oldMinorVersion < 1) {// 1.1.0
|
||||
setAttrs({
|
||||
indulge: translate("Indulgence"),
|
||||
indulge_val: 0,
|
||||
indulge_formula: ``,
|
||||
});
|
||||
recalculateIndulgence();
|
||||
}
|
||||
|
||||
setAttrs({ version: metaData.sheetVersion });
|
||||
}
|
||||
|
||||
// Event: When a character sheet is opened
|
||||
on("sheet:opened", () => {
|
||||
getAttrs(["SheetSetup"], function(values) {
|
||||
var isSetup = values["SheetSetup"];
|
||||
if (!isSetup) {
|
||||
initialSetup();
|
||||
setAttrs({ SheetSetup: "true" });
|
||||
getAttrs(["SheetSetup", "version"], function(values) {
|
||||
var isSetup = values["SheetSetup"];
|
||||
var version = values["version"];
|
||||
if (!isSetup) {
|
||||
initialSetup();
|
||||
setAttrs({ SheetSetup: "true" });
|
||||
} else if (version != metaData.sheetVersion) {
|
||||
updateVersion(version);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
});
|
||||
|
||||
// Event: When the playbook title is entered for the first time
|
||||
@@ -5319,6 +5395,7 @@
|
||||
[`${attrName}${attrNum}`]: attrVal
|
||||
});
|
||||
recalculateFormula(`${attrName}${attrNum}`, attrVal);
|
||||
recalculateIndulgence();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -488,7 +488,11 @@
|
||||
"ImpressiveCostumeItemDescription": "An ostentatious outfit that lets everyone know a wizard has just entered the room, for when you want to be noticed.",
|
||||
"IncorruptibleUpgradeDescription": "Your retinues and colleagues all gain the loyal trait. They will never take a bribe; they will never turn on you. They will accept death before dishonor.",
|
||||
"IncorruptibleUpgradeName": "Incorruptible",
|
||||
"Indulge": "Indulge",
|
||||
"Indulgence": "Indulgence",
|
||||
"IndulgenceAndSource": "Indulgence & source",
|
||||
"IndulgenceRollExplanation1": "Clear stress equal to the highest die result.",
|
||||
"IndulgenceRollExplanation2": "If you would clear more stress than you have marked, you Overindulge.",
|
||||
"IndustriousUpgradeDescription": "The coterie gains one extra downtime activity to work on any long-term project or intrigue.",
|
||||
"IndustriousUpgradeName": "Industrious",
|
||||
"Influence": "Influence",
|
||||
@@ -731,7 +735,8 @@
|
||||
"Reputations": "Reputations",
|
||||
"Reset": "Reset",
|
||||
"ResistanceDescription": "Resistance description",
|
||||
"ResistanceRollExplanation": "Suffer 6 stress minus the highest die result. When you roll a critical on resistance, clear 1 stress.",
|
||||
"ResistanceRollExplanation1": "Suffer 6 stress minus the highest die result.",
|
||||
"ResistanceRollExplanation2": "When you roll a critical on resistance, clear 1 stress.",
|
||||
"ResistsAConsequenceWith": "Resists a consequence with",
|
||||
"Retinue": "Retinue",
|
||||
"RetinueLevel1HarmDescription": "Weakened: Reduced effect.",
|
||||
@@ -748,6 +753,7 @@
|
||||
"RollFortune": "Roll fortune",
|
||||
"Rolls": "Rolls",
|
||||
"RollsFortune": "Rolls fortune",
|
||||
"RollsToReduceStress": "Rolls to reduce stress",
|
||||
"SanctumSanctorumUpgradeDescription": "The coterie gains access to the House's Arcane Sanctum. Take +1 clock tick any time the coterie researches or +1d when the coterie performs a ritual.",
|
||||
"SanctumSanctorumUpgradeName": "Sanctum sanctorum",
|
||||
"Scale": "Scale",
|
||||
|
||||
Reference in New Issue
Block a user