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 +5671,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 +5680,6 @@
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 +5914,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 +6164,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 +6190,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 +6235,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 +6254,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 +6270,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 +6286,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 +6311,17 @@
-// - Maybe call this Movement?
+// - Maybe call this Movement
// Update all the crud on the frontpage of the charcter sheet.
//
@@ -7933,9 +7964,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 +8176,7 @@