From 8e391aba326853fdf84fd4705e07e4e35aba91f9 Mon Sep 17 00:00:00 2001 From: Brett Nash Date: Sun, 7 Apr 2024 22:43:50 -0700 Subject: [PATCH 1/2] [RMU] Talents improvements, and other fixes. --- .../rolemasterunified.css | 45 +++++- .../rolemasterunified.html | 139 +++++++++++------- RolemasterUnified_Official/sheet.json | 2 +- RolemasterUnified_Official/updates.md | 11 ++ 4 files changed, 138 insertions(+), 59 deletions(-) diff --git a/RolemasterUnified_Official/rolemasterunified.css b/RolemasterUnified_Official/rolemasterunified.css index e1e16042531f..715bf19f7e46 100644 --- a/RolemasterUnified_Official/rolemasterunified.css +++ b/RolemasterUnified_Official/rolemasterunified.css @@ -300,6 +300,9 @@ input:not(:checked).toggle + .toggler { display: none; } grid-template-columns: 1fr 4em 5em 8em 2em; display: grid; + border-bottom: 2px; + margin-bottom: 2px; + box-shadow: 0 2px 2px 0 rgba(0,0,0,0.3); } .spellname { @@ -588,10 +591,6 @@ div.attacks { display: inline; } -/* The talents on the main page */ -.talent_name { - font-weight: bold; -} /* Tabs for Our creation */ /** Source: https://codepen.io/markcaron/pen/MvGRYV */ @@ -772,5 +771,41 @@ div.repcontrol { border-radius: 3px !important; } -/* vim: set sts=4 sw=4 : */ + + + + +.cmtalent { + background-color: #ACC3F5; + margin: 1em; + box-shadow: 0 4px 12px 0 rgba(0,0,0,0.4); + padding: 3px; +} + + +.choice-showing.talent_inline { + display: inline !important; +} + + +.talent:nth-of-type(even) .cmtalent { + background-color: #ADF4F5; +} + +@media (prefers-color-scheme: dark) { + +} + + + + +/* The talents on the main page */ +.talent_name { + font-weight: bold; +} + + + + +/* vim: set sts=4 sw=4 syn=css : */ diff --git a/RolemasterUnified_Official/rolemasterunified.html b/RolemasterUnified_Official/rolemasterunified.html index b96fcffa268d..d6b57dede6be 100644 --- a/RolemasterUnified_Official/rolemasterunified.html +++ b/RolemasterUnified_Official/rolemasterunified.html @@ -796,8 +796,9 @@

Language Ranks

Level Up

- 0 + DP Spent: 0 + Dp Available:
@@ -1900,15 +1901,17 @@

Saving Character...

- + - + - + +
+ + Cost:
-
@@ -2048,7 +2051,8 @@

Statistics

Build
Height
Weight
-
Weight allowance
+
yWeight allowance +
Carried
Enc Penalty
Max Pace
@@ -3700,7 +3704,7 @@

Spells

-
+
@@ -3721,7 +3725,7 @@

Spells

-
+
@@ -3742,7 +3746,7 @@

Spells

-
+
@@ -3763,7 +3767,7 @@

Spells

-
+
@@ -3784,7 +3788,7 @@

Spells

-
+
@@ -3805,7 +3809,7 @@

Spells

-
+
@@ -3826,7 +3830,7 @@

Spells

-
+
@@ -3847,7 +3851,7 @@

Spells

-
+
@@ -4748,6 +4752,7 @@

Stuff

return true; } + RMUCosts.update = function(key, cost, ranks) { if (cost == 0) { delete RMUCosts.costs[key]; @@ -5627,7 +5632,6 @@

Stuff

savedlists = []; } var data = getCharmancerData(); - console.log("listtype", listtype); getCompendiumQuery(`Category:SpellList ${listtype}`, (lists) => { // So on error we get 1 element and it has an expansion set to 0. @@ -5661,7 +5665,6 @@

Stuff

continue; } // Filter is currently on ListType - console.log(filter, list) if (filter && filter.length > 0) { if (list.data.ListType == filter) { continue; @@ -5671,7 +5674,6 @@

Stuff

addRepeatingSection(`cmspelllistspell${subtarget}`, 'spelllist', `${subtarget}spelllist`, (sectionname) => { - console.log('sectionname', sectionname, costarray, list.name); cmPopulateListOptions(`${sectionname}_cmranks`, costarray, costarray[0]); setAttrsPending({[`${sectionname}_listname`]: list.name}); @@ -5684,8 +5686,6 @@

Stuff

function initSpellListsCM(savedlists, profession, realm, costs) { // Set the costs cmcategory-spellownbase-cost - console.log("Saved Data", getCharmancerData()); - console.log("realm", realm); setCharmancerText({ "cmcategory-spellownbase-cost": costs.Base, "cmcategory-spellopen-cost": costs.Open, @@ -5908,19 +5908,28 @@

Stuff

/** CLick on the add extra talent button */ function addExtraTalent(ev) { - console.log("Add extra talent", ev); - addRepeatingSection('added_talents', 'talent', (id) => { - console.log("New section is ", id); setCharmancerOptions(`${id}_talent`, "Category:Talent"); }); } +function removeTalent(ev) { + RMUCosts.update(ev.sourceSection, 0, 0); + { + let dpspent = RMUCosts.getTotalCost(); + setCharmancerText({"levelupdp": `${dpspent} DP`}); + } + clearRepeatingSectionById([ev.sourceSection], console.log) +} + + onCheck("mancerchange:repeating_cmskill", changeSkillPurchase); onCheck("mancerchange:repeating_talent_talent", changeTalentPurchase); +onCheck("mancerchange:repeating_talent_tier", changeTalentPurchaseTier); onCheck("clicked:talent_add", addExtraTalent); +onCheck("clicked:repeating_talent", removeTalent); // Generate our set of skill purchase events onCheck("mancerchange:repeating_cmskill_animalhandling_specializations_cmskillranks", changeSkillPurchase); @@ -6149,28 +6158,22 @@

Stuff

let [ranks, costs] = optionDecodeIntPair(ev.newValue); RMUCosts.update(ev.sourceAttribute, costs, ranks); - dpspent = RMUCosts.getTotalCost(); - setCharmancerText({"levelupdp": `${dpspent} DP`}); } /**/ function changeTalentPurchase(ev) { - console.log("talent change", ev); const basename = ev.sourceSection; getCompendiumPage(ev.newValue, (tdata) => { - console.log(tdata); const tiers = parseIntDefault(tdata.data.Tiers, 1); const cost = parseIntDefault(tdata.data.Cost, -1); - console.log(tdata.data.Tiers, tiers) let list = [] if (tiers > 1) { showChoices([`${basename} .talent_tier_show`]) - console.log("Set cmoptions: ", `${basename}_tiers`); for (let i = 1 ; i <= tiers ; i ++) { x = i * cost; - list.push(`Tier ${i}: ${x} dp`); + list.push(`Tier ${i}: ${x} dp~${x}`); } } else { hideChoices([`${basename} .talent_tier_show`]); @@ -6181,17 +6184,35 @@

Stuff

let selectList = RMUTalents.getSelectList(tdata) setCharmancerOptions(`${basename}_choice`, selectList); - console.log({"talent_cost": tdata.data.cost, "talent_description": tdata.data.descriptions});; - setCharmancerText({[`${basename} .talent_cost`]: tdata.data.Cost, - [`${basename} .talent_description`]: tdata.data.Description});; + RMUCosts.update(basename, cost, 1); + let dpspent = RMUCosts.getTotalCost(); + setCharmancerText({"levelupdp": `${dpspent} DP`}); + + setCharmancerText({[`${basename} .talent_cost`]: cost, + [`${basename} .talent_description`]: tdata.data.Description, + "levelupdp": `${dpspent} DP`}); }); } +function changeTalentPurchaseTier(ev) { + let cost = parseIntDefault(ev.newValue.split("~")[1], -111); + if (cost == -111) { + console.log(ev.newValue.split("~")); + rmuerror("Unable to extract cost from ", ev.newValue); + cost = 0; + } + RMUCosts.update(ev.sourceSection, cost, 1); + { + let dpspent = RMUCosts.getTotalCost(); + setCharmancerText({"levelupdp": `${dpspent} DP`}); + } +} + onCheck("page:levelup", (ev) => { console.log("********** Level up start **********"); pendingInfo(); + RMUCosts.reset(); getAttrsPending(["level", "xp", "xplevel", "dp_misc", "dp_used_misc"], (ev) => { - console.log(`Level ${ev.level}, ${ev.xp} ${ev.xplevel}`); // If we are at any level but 0, we get 2 free statgains. const level = parseIntDefault(ev.level, 0); if (level > 0){ @@ -6208,20 +6229,17 @@

Stuff

/**/ const dpavil = Math.min(85, dpreceived - dpspent); - setCharmancerText({"dpinfo": `${dpavil} (${dpreceived} (${newlevel} * 60) + ` + - `${dpmisc}) - ${dpspent} (Max of 85 per level`}) - console.log(`${dpavil} (${dpreceived} (${newlevel} * 60) + ` + - `${dpmisc}) - ${dpspent} (Max of 85 per level`) + setCharmancerText({"dpinfo": `${dpavil} ` + + `(= Total received ${dpreceived} ` + + ` (Level ${newlevel} * 60) + ` + + `Other ${dpmisc}) - Previously spent ${dpspent} (Max of 85 per level)`}) }); // So we need to get the profession & Costs const data = getCharmancerData(); - console.log("skills", data); - console.log(data.knacks.values); const costs = getCostsWithWeapons(data.knacks.values); - console.log("Weapon costs", costs); dpspent = 0; let catupdates = {} @@ -6230,7 +6248,6 @@

Stuff

} catupdates['cmcategory-combattraining-cost'] = '-'; catupdates['cmcategory-spellcasting-cost'] = '-'; - console.log("catupdates", catupdates); setCharmancerText(catupdates); // Update each of the cost fields and the selectors. @@ -6247,8 +6264,9 @@

Stuff

cmPopulateListOptions('cmskill' + skill.aname + 'ranks', costarray); }); - // Global scope as the other is a pending funtion. + // Global scope; as the other is a pending funtion. let savedspelllists = []; + let savedtalents = []; // On load I should check the list of repeating sections and add // them if (data?.levelup?.repeating) { @@ -6262,6 +6280,10 @@

Stuff

savedspelllists.push(prefix); continue; } + if (prefix.endsWith("_talent")) { + savedtalents.push(prefix); + continue; + } const match = prefix.match(/cmskill_(.*)_specializations/) if (!match || match.length < 2) { rmuerror("Coulnd't match regex against ", prefix, index); @@ -6283,9 +6305,17 @@

Stuff

} } + addPendingFunction('Talents add', () => { + for (obj of savedtalents) { + addRepeatingSection('added_talents', 'talent', (id) => { + setCharmancerOptions(`${id}_talent`, "Category:Talent", + { selected: data.levelup.data[obj] }); + }); + } + + }); addPendingFunction('Spell List add', () => { - console.log(data.profession.data); getAttrsPending(["realm"], (realm) => { initSpellListsCM( savedspelllists, @@ -6295,10 +6325,6 @@

Stuff

}); }); - addPendingFunction("Levelup: Add first talent slot", () => { - setCharmancerOptions("talent", "Category:Talent"); //, cmdata?.race?.values?.race); - }); - // Specialisations; get existing ones and ones from cultures page addPendingFunction('Levelup Init Done', () => { console.log("****** Finished levelup function *****");}); @@ -6910,7 +6936,6 @@

Stuff

"rr": { apply: x.applyTalentNotImplemented, }, "melee": { apply: x.applyTalentNotImplemented, }, "ranged": { apply: x.applyTalentNotImplemented, } - }; x.getSelectList = function(talentObj) { @@ -7892,7 +7917,7 @@

Stuff

-// - Maybe call this Movement? +// - Maybe call this Movement // Update all the crud on the frontpage of the charcter sheet. // @@ -7933,9 +7958,17 @@

Stuff

frontpage.updateWeightAllowance = function () { getAttrsPending(["st", "weight"], (ev) => { let st = parseIntDefault(ev.st, -10); + let st2 = st * 2; let weight = parseIntDefault(ev.weight, -100); - let wa = Math.floor(weight * 0.15 + 2 * st); - setAttrsPending({weightallowance: wa}); + let wa15 = Math.floor(weight * 0.15); + let wa = wa15 + 2 * st; + let info = `Weight Allowance\n` + + `${wa15} 15% of Weight\n` + + ` ${weight} Weight\n` + + `${st2} Twice Strength\n` + + `= ${wa} Weight Allowance\n`; + + setAttrsPending({weightallowance: wa, weightallowance_info: info}); }); } onCheck("change:st change:weight", frontpage.updateWeightAllowance); @@ -8137,7 +8170,7 @@

Stuff

} { - updates.db_fullblock = basedb + shielddb + Math.max(0, shield_bonus); + updates.db_fullblock = basedb + shielddb + Math.max(0, shield_bonus) + passivedodgebonus; updates.db_fullblock_info = "Full Block\n" + `${F(basedb)} Base DB\n` + `${F(shielddb)} Shield DB\n` + @@ -8813,7 +8846,7 @@

Stuff

-Revision bc7546705a0b894be77c0f7961bdec4cd5fa07a9 +Revision 6803083e27121b1ff2b4d20aface6c2d8964bd23 diff --git a/RolemasterUnified_Official/sheet.json b/RolemasterUnified_Official/sheet.json index 1d3e12b03650..7f1d4117f256 100644 --- a/RolemasterUnified_Official/sheet.json +++ b/RolemasterUnified_Official/sheet.json @@ -8,5 +8,5 @@ "legacy": false, "printable": true, "compendium": "RMU", - "version": "1711916359" + "version": "1712554923" } diff --git a/RolemasterUnified_Official/updates.md b/RolemasterUnified_Official/updates.md index 52645891aef1..364981687293 100644 --- a/RolemasterUnified_Official/updates.md +++ b/RolemasterUnified_Official/updates.md @@ -1,3 +1,14 @@ +2024-04-07 + + - Fix grammar when casting spells; "cast from Spells List, not casts Spell List" + - Weight Allowance calculation now shows + - Fix DB blocking calculation + - Talents: + - Fix change of tier tracking + - Make removal work + - Levelup Talents now persist + - Fix typo on 'received' + 2024-03-31 - More roll template improvements From 1ab465e2b237e56b819dea9604331a56e8ff07be Mon Sep 17 00:00:00 2001 From: Brett Nash Date: Tue, 9 Apr 2024 12:56:27 -0700 Subject: [PATCH 2/2] Fix spell (sepll) typo --- .../rolemasterunified.css | 5 ++ .../rolemasterunified.html | 80 ++++++++++++------- RolemasterUnified_Official/sheet.json | 2 +- 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/RolemasterUnified_Official/rolemasterunified.css b/RolemasterUnified_Official/rolemasterunified.css index 715bf19f7e46..8fdc8e64e480 100644 --- a/RolemasterUnified_Official/rolemasterunified.css +++ b/RolemasterUnified_Official/rolemasterunified.css @@ -771,6 +771,11 @@ div.repcontrol { border-radius: 3px !important; } +.rollbutton.jq { + border: 1px solid red; +} + + diff --git a/RolemasterUnified_Official/rolemasterunified.html b/RolemasterUnified_Official/rolemasterunified.html index d6b57dede6be..9440e95971d6 100644 --- a/RolemasterUnified_Official/rolemasterunified.html +++ b/RolemasterUnified_Official/rolemasterunified.html @@ -1,18 +1,11 @@ - - Roll= - {{#rollLess() roll1 fumble}}{{roll2}}{{/rollLess() roll1 fumble}} - {{#^rollLess() roll1 fumble}}{{roll1}}{{/^rollLess() roll1 fumble}} - - -
{{actor}} {{verb}} {{action}}:
- Result: + Result: {{#rollLess() um 5}} {{rolll}} (= {{bonus}} + {{um}} - {{rollsub}}) (Open Ended Low) @@ -32,6 +25,29 @@
+ +
+ {{actor}} {{verb}} {{action}}:
+ Result: + {{#rollLess() um 5}} + {{rolll}} (= {{bonus}} + {{mod}} + {{um}} - {{rollsub}}) + (Open Ended Low) + {{/rollLess() um 5}} + {{#^rollLess() um 5}} + {{rollh}} (= {{bonus}} + {{mod}} + {{um}}) + {{/^rollLess() um 5}} + {{#rollTotal() um 33}} +
Breakage check? (33) + {{/rollTotal() um 33}} + {{#rollTotal() um 77}} +
Breakage check? (77) + {{/rollTotal() um 77}} + {{#rollTotal() um 66}} +
Unusual event! (66) + {{/rollTotal() um 66}} +
+
+
{{actor}} rolls Initialive:
@@ -39,18 +55,8 @@
- + @@ -3704,7 +3710,7 @@

Spells

-
+
@@ -3725,7 +3731,7 @@

Spells

-
+
@@ -3746,7 +3752,7 @@

Spells

-
+
@@ -3767,7 +3773,7 @@

Spells

-
+
@@ -3788,7 +3794,7 @@

Spells

-
+
@@ -3809,7 +3815,7 @@

Spells

-
+
@@ -3830,7 +3836,7 @@

Spells

-
+
@@ -3851,7 +3857,7 @@

Spells

-
+
@@ -8840,13 +8846,31 @@

Stuff

return Math.floor(Math.random() * x) + 1; } +/* +$20('button.roll').on('click', async (e) => { + const roll = e.altKey ? '[[1d100+30]]' : '[[1d20]]'; + const results = await startRoll(roll); + finishRoll(results.rollId); + });*/ + + +$20('button').on('click', (e) => { + $20('button').addClass('jq'); +}); + +/* +$20('button.rollbutton').on('mouseleave', (e) => { + $20('button.rollbutton').removeClass('jq'); +}); + */ + -Revision 6803083e27121b1ff2b4d20aface6c2d8964bd23 +Revision d6fd12d54ba0b44048a7f32e27b4f6430cf400b2 diff --git a/RolemasterUnified_Official/sheet.json b/RolemasterUnified_Official/sheet.json index 7f1d4117f256..e79d1b5e1d43 100644 --- a/RolemasterUnified_Official/sheet.json +++ b/RolemasterUnified_Official/sheet.json @@ -8,5 +8,5 @@ "legacy": false, "printable": true, "compendium": "RMU", - "version": "1712554923" + "version": "1712692545" }