Skip to content

Commit

Permalink
Merge pull request #13329 from nashidau/master
Browse files Browse the repository at this point in the history
RolemasterUnified Official: Urgent fix for ~ behaviour change
  • Loading branch information
NorWhal committed Sep 19, 2024
2 parents e90e5f4 + 18b84a6 commit 27e6d05
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
35 changes: 28 additions & 7 deletions RolemasterUnified_Official/rolemasterunified.html
Original file line number Diff line number Diff line change
Expand Up @@ -8738,7 +8738,7 @@ <h3>Custom Spell List</h3>
const tiers = parseIntDefault(tdata.data.Tiers, 1);
const cost = parseIntDefault(tdata.data.Cost, 0);
const costpertier = parseIntDefault(tdata.data['Cost per Tier'], cost);
console.log("change talen purchase", tiers, cost, costpertier, tdata);
console.log("change talent purchase", tiers, cost, costpertier, tdata);
let list = []
if (tiers > 1) {
showChoices([`${basename} .talent_tier_show`])
Expand Down Expand Up @@ -8768,10 +8768,12 @@ <h3>Custom Spell List</h3>
}

function changeTalentPurchaseTier(ev) {
let cost = parseIntDefault(ev.newValue.split("~")[1], -111);
// Workaround for the Roll20 API change that added expansion ids to
// strings randomly.
const str = ev.newValue?.replace(/\?expansion=\d*$/, "") || "";
let cost = parseIntDefault(str.split("~")[1], -111) || -111;
if (cost == -111) {
console.log(ev.newValue.split("~"));
rmuerror("Unable to extract cost from ", ev.newValue);
rmuerror("Unable to extract cost from ", ev.newValue, str);
cost = 0;
}
RMUCosts.update(ev.sourceSection, cost, 1);
Expand Down Expand Up @@ -9271,6 +9273,20 @@ <h3>Custom Spell List</h3>
})

addPendingFunction("LevelupFinish: update all skills", RMUSkills.updateAllSkills);
addPendingFunction("LevelupFinish: Set HP/PP", () => {
getAttrsPending(["bodydevelopment_bonus", "powerdevelopment_bonus"], (data) => {
updates = {}
if (data.bodydevelopment_bonus) {
updates.hp = data.bodydevelopment_bonus;
updates.hp_max = data.bodydevelopment_bonus;
}
if (data.powerdevelopment_bonus) {
updates.pp = data.powerdevelopment_bonus;
updates.pp_max = data.powerdevelopment_bonus;
}
setAttrsPending(updates);
});
});
addPendingFunction("LevelupFinish: Front page", updateFrontPage);
addPendingFunction("LevelupFinish: Finish cmancer (roll20)", finishCharactermancer)
pendingInfo();
Expand Down Expand Up @@ -10050,7 +10066,10 @@ <h3>Custom Spell List</h3>
return getTranslationByKey(aname) + '~' + aname;
}

function optionDecode(str) {
function optionDecode(dirty) {
// Workaround for the Roll20 API change that added expansion ids to
// strings randomly.
const str = dirty.replace(/\?expansion=\d*$/, "");
if (!str.includes("~")) {
console.log("optionDecode doesn't have a ~: ", str);
return str;
Expand Down Expand Up @@ -10080,10 +10099,12 @@ <h3>Custom Spell List</h3>
if (!str || !str.includes("~")) {
return str;
}
return str.split("~")[1];
// Workaround for the Roll20 API change that added expansion ids to
// strings randomly.
const str2 = str?.replace(/\?expansion=\d*$/, "");
return str2.split("~")[1];
}


const weaponGroups = ['meleeweaponsgroup','rangedweaponsgroup','unarmedgroup','shieldgroup'];

function updateSecondary(values) {
Expand Down
2 changes: 1 addition & 1 deletion RolemasterUnified_Official/sheet.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"legacy": false,
"printable": true,
"compendium": "RMU",
"version": "1726553860"
"version": "1726720015"
}
12 changes: 12 additions & 0 deletions RolemasterUnified_Official/updates.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 2024-9-19

Urgent fix for a roll20 API change. Some of the values in fields from the
charactermancer started getting expansion ids shoved on the return values.
(if they contain a ~).

So before we look parse the string, remove any expansion ids on the end.


Sheet updates:
- Force HP and PP to max on levelup

# 2024-9-17

Miscalenous bug fix week!
Expand Down

0 comments on commit 27e6d05

Please sign in to comment.