From 3b727770e9ff46ddd03fe1797c366c5485151800 Mon Sep 17 00:00:00 2001 From: Brett Nash Date: Wed, 11 Dec 2024 17:12:44 -0800 Subject: [PATCH] RolemasterUnified Official: Item fixes for Treasure Law Also known as the Author is an Idiot bugfix release for Treasure Law. - Allow drops from all magic item types - Save descriptions for all items (even new format) - Funky line as you lose hits or PP - Fix a maneuver penalty error which was messing up item drops --- .../rolemasterunified.css | 159 +++++++++++++++++- .../rolemasterunified.html | 113 ++++++++++--- RolemasterUnified_Official/sheet.json | 2 +- RolemasterUnified_Official/updates.md | 9 + 4 files changed, 258 insertions(+), 25 deletions(-) diff --git a/RolemasterUnified_Official/rolemasterunified.css b/RolemasterUnified_Official/rolemasterunified.css index 5589718ea42..ef58d9cf463 100644 --- a/RolemasterUnified_Official/rolemasterunified.css +++ b/RolemasterUnified_Official/rolemasterunified.css @@ -998,7 +998,7 @@ div.attacks { display: grid; /*grid-template-columns: 5em 1fr 2em 2em;*/ /* 10em unitl I get icons */ - grid-template-columns: 5em 1fr 10em 10em 12em; + grid-template-columns: 2em 5em 1fr 10em 10em 12em; } .inventorytitle { @@ -1253,6 +1253,163 @@ div.attacks { /* vim: set sts=4 sw=4 syn=css : */ + + + +/* ----- BAR TRACK ----- */ +.bar-track { + background-color: lightgrey;/* #313031; /* Dark Grey */ + width: 100px; + height: 7px; + margin: 2px; + border-radius: 5px; + overflow: hidden; + place-items:center start; + display:grid; + grid-template-areas:'content'; + --tensSize:0%; + --onesSize:0%; + --decimalSize:0%; + --trackGoodColor:green; + --trackBadColor:red; +} + +.bar-progress { + /* Note that this calculation is done in this element so that the changing values of the size variables cascade to it properly and + update the value as the sizes are updated */ + --trackPercentage: calc(var(--tensSize) + var(--onesSize) + var(--decimalSize)); + box-sizing: border-box; + grid-area:content; + background-color: color-mix(in oklab,var(--trackGoodColor) var(--trackPercentage),var(--trackBadColor)); /* Green fading to red as damage taken */ + width: var(--trackPercentage); + height: 100%; + transition: width 0.25s ease-in-out, background-color 0.25s ease-in-out; +} + +/* ----- BAR PROGRESS STEPS ----- */ +/* 10's steps */ +.bar-value[value^="1"]:not([value^="1."]):not([value="1"]) + .bar-track{ + --tensSize: 10%; +} +.bar-value[value^="2"]:not([value^="2."]):not([value="2"]) + .bar-track{ + --tensSize: 20%; +} +.bar-value[value^="3"]:not([value^="3."]):not([value="3"]) + .bar-track{ + --tensSize: 30%; +} +.bar-value[value^="4"]:not([value^="4."]):not([value="4"]) + .bar-track{ + --tensSize: 40%; +} +.bar-value[value^="5"]:not([value^="5."]):not([value="5"]) + .bar-track{ + --tensSize: 50%; +} +.bar-value[value^="6"]:not([value^="6."]):not([value="6"]) + .bar-track{ + --tensSize: 60%; +} +.bar-value[value^="7"]:not([value^="7."]):not([value="7"]) + .bar-track{ + --tensSize: 70%; +} +.bar-value[value^="8"]:not([value^="8."]):not([value="8"]) + .bar-track{ + --tensSize: 80%; +} +.bar-value[value^="9"]:not([value^="9."]):not([value="9"]) + .bar-track{ + --tensSize: 90%; +} +.bar-value[value^="10"]:not([value^="10."]):not([value="10"]) + .bar-track{ + --tensSize: 100%; +} +/* Ones sizing */ +.bar-value:is([value*="1."],[value$="1"]:not([value*="."])) + .bar-track{ + --onesSize: 1% +} +.bar-value:is([value*="2."],[value$="2"]:not([value*="."])) + .bar-track{ + --onesSize: 2% +} +.bar-value:is([value*="3."],[value$="3"]:not([value*="."])) + .bar-track{ + --onesSize: 3% +} +.bar-value:is([value*="4."],[value$="4"]:not([value*="."])) + .bar-track{ + --onesSize: 4% +} +.bar-value:is([value*="5."],[value$="5"]:not([value*="."])) + .bar-track{ + --onesSize: 5% +} +.bar-value:is([value*="6."],[value$="6"]:not([value*="."])) + .bar-track{ + --onesSize: 6% +} +.bar-value:is([value*="7."],[value$="7"]:not([value*="."])) + .bar-track{ + --onesSize: 7% +} +.bar-value:is([value*="8."],[value$="8"]:not([value*="."])) + .bar-track{ + --onesSize: 8% +} +.bar-value:is([value*="9."],[value$="9"]:not([value*="."])) + .bar-track{ + --onesSize: 9% +} +/* decimal sizing */ +.bar-value:is([value*=".0"],[value*=".1"]) + .bar-track{ + --decimalSize: 0.1%; +} +.bar-value[value*=".2"] + .bar-track{ + --decimalSize: 0.2%; +} +.bar-value[value*=".3"] + .bar-track{ + --decimalSize: 0.3%; +} +.bar-value[value*=".4"] + .bar-track{ + --decimalSize: 0.4%; +} +.bar-value[value*=".5"] + .bar-track{ + --decimalSize: 0.5%; +} +.bar-value[value*=".6"] + .bar-track{ + --decimalSize: 0.6%; +} +.bar-value[value*=".7"] + .bar-track{ + --decimalSize: 0.7%; +} +.bar-value[value*=".8"] + .bar-track{ + --decimalSize: 0.8%; +} +.bar-value[value*=".9"] + .bar-track{ + --decimalSize: 0.9%; +} + + +/* vim: set sts=4 sw=4 syn=css : */ + + + +.accordian { + cursor: pointer; + width: 100%; + height: 100%; + color: rgba(0,0,0,0); +} + +.accordiantoggle { + display: none; +} + +.accordian:checked ~ .accordiantoggle { + display: block; +} + +.accordian::after { + + content: "\25B2"; + color: rgba(0,0,0,1); +} +.accordian:checked::after { + content: "\25BC"; + color: rgba(0,0,0,1); +} + +.active:after { +} + + + /* https://cssloaders.github.io */ .loader{ diff --git a/RolemasterUnified_Official/rolemasterunified.html b/RolemasterUnified_Official/rolemasterunified.html index 0c55409b6d8..54d3ebce9c3 100644 --- a/RolemasterUnified_Official/rolemasterunified.html +++ b/RolemasterUnified_Official/rolemasterunified.html @@ -2384,12 +2384,18 @@

Creature

/
+ +
+ + +
+
Hits Penalty: - +
@@ -2439,6 +2445,13 @@

Creature

/ + +
+ + +
+
+
@@ -2680,12 +2693,18 @@

Status

/
+ +
+ + +
+
Hits Penalty: - +
@@ -2735,6 +2754,13 @@

Status

/ + +
+ + +
+
+
@@ -5104,6 +5130,7 @@

Stuff

Carried

+ Equipped Item Weight @@ -5112,6 +5139,7 @@

Carried

+ @@ -5126,26 +5154,30 @@

Carried

># - +
+ + +
-

-

Total Weight:
-
Weight Allowance:
- -
Encumberance Penalty:
- -
Perception Penalty:
- -
Ranged Penalty:
-
Spell Casting Armor Enc%
-
Spell Casting Metal Armor Enc%
-

+
+
Total Weight:
+
Weight Allowance:
+ +
Encumberance Penalty:
+ +
Perception Penalty:
+ +
Ranged Penalty:
+
Spell Casting Armor Enc%
+
Spell Casting Metal Armor Enc%
+

Backpack

+ Item Weight @@ -5155,6 +5187,7 @@

Backpack

+ @@ -5165,6 +5198,10 @@

Backpack

+
+ +
+
@@ -5175,6 +5212,7 @@

Backpack

Home / Storage

+ Item Weight @@ -5184,6 +5222,7 @@

Home / Storage

+ @@ -5194,6 +5233,9 @@

Home / Storage

+
+ +
@@ -5374,7 +5416,7 @@

Custom Spell List


-Revision 26977e485a7d748c3ae34fc47c676bfabc128473 +Revision a49aec882b1eee649a9420c37e26b7d43a95e8c8
@@ -11677,8 +11719,8 @@

Custom Spell List

// External methods go here let RMUInventory = {} -RMUInventory.itemfields = [ "itemname", "itemweight", "itemcount", "itemsystem", "itemmaterial", "itemnotes", -"itemequipped"]; +RMUInventory.itemfields = [ "itemname", "itemweight", "itemcount", "itemsystem", + "itemmaterial", "itemnotes", "itemequipped"]; { // Scope the whole file: Use let/const only ;-) @@ -11711,7 +11753,9 @@

Custom Spell List

if (material) { update[`${prefix}_itemmaterial`] = material; } - if (data.Notes) { + if (data['data-description']) { + update[`${prefix}_itemnotes`] = data['data-description']; + } else if (data.Notes) { update[`${prefix}_itemnotes`] = data.Notes; } @@ -11890,6 +11934,7 @@

Custom Spell List

getSectionIDsPending(`repeating_stuff`, ids => { let percept = 0; let rangedpenalty = 0; + let maneuver_penalty = 0; let toget = ['base_at_misc', 'perception_misc'] ids.forEach(id => { toget.push(`repeating_stuff_${id}_itemname`); @@ -12280,18 +12325,22 @@

Custom Spell List

onCheck("change:drop_data", event => drop.handleDrop()); +const potentialInventory = { + "Item": true, "Magic Item": true, "Magic Items": true, + "Herb": true, "Herbs": true, +}; drop.handleDrop = function() { console.log("Handle drop"); getAttrs(['drop_name', 'drop_data', 'drop_category'], (drop) => { console.log(drop); - if (drop.drop_category === 'Item') { + if (potentialInventory[drop.drop_category] === true) { RMUInventory.itemDrop(drop.drop_name, drop.drop_data); } else if (drop.drop_category == 'Creature' || drop.drop_category == 'NPC') { creature.newCreature("Creature", drop.drop_data); } else { - console.log("Don't know how to handle a ", drop.drop_category); + rmuerror("Don't know how to handle a ", drop.drop_category); } }); } @@ -13982,6 +14031,9 @@

Custom Spell List

hp = ev.hits } update.hp_max = hp; + if (pp < 0) { + pp = 0; + } update.pp_max = pp /* update.bar1_max = ev.bodydevelopment_bonus; @@ -13991,7 +14043,7 @@

Custom Spell List

// if (!ev.hasOwnProperty(hp)) { // update.hp = ev.bodydevelopment_bonus; // } - setAttrs(update, { 'silent':true }); + setAttrs(update, { silent:true }); }); }); @@ -14016,6 +14068,7 @@

Custom Spell List

getAttrs(['hp', 'hp_max'], (values) => { let update = {}; let ratio = values.hp / values.hp_max; + let hppercent = Math.min(Math.max(ratio || 0,0) * 100,100); if (ratio > 0.75) { update.hppenalty = 0; } else if (ratio > 0.5) { @@ -14028,7 +14081,21 @@

Custom Spell List

update.hppenalty = -100; } update.bar1_value = values.hp; // FIXME: this doesn't do much - setAttrs(update); + update.hp_percent = hppercent; + setAttrs(update, { slient: true}); + }); +}); + +onCheck("change:pp", (_) => { + getAttrs(['pp', 'pp_max'], (values) => { + let update = {} + if (values.pp == values.pp_max) { + update.pp_percent = 100; + } else { + let ratio = +values.pp / +values.pp_max; + update.pp_percent = Math.min(Math.max(ratio || 1,0) * 100,100); + } + setAttrs(update, { silent: true }); }); }); diff --git a/RolemasterUnified_Official/sheet.json b/RolemasterUnified_Official/sheet.json index 9f59ea6e196..02edd3cd96b 100644 --- a/RolemasterUnified_Official/sheet.json +++ b/RolemasterUnified_Official/sheet.json @@ -8,5 +8,5 @@ "legacy": false, "printable": true, "compendium": "RMU", - "version": "1733856892" + "version": "1733965952" } diff --git a/RolemasterUnified_Official/updates.md b/RolemasterUnified_Official/updates.md index 79bc75bf09f..97a5f39e9d6 100644 --- a/RolemasterUnified_Official/updates.md +++ b/RolemasterUnified_Official/updates.md @@ -1,3 +1,12 @@ +# 2024-12-12 + +The Author is an Idiot bugfix release for Treasure Law. + +- Allow drops from all magic item types +- Save descriptions for all items (even new format) +- Funky line as you lose hits or PP +- Fix a maneuver penalty error which was messing up item drops + # 2024-12-10 - Finalise handling of Professions with selectable Base lists