Skip to content

Instantly share code, notes, and snippets.

@stellarLuminant
Created September 21, 2020 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stellarLuminant/a80a821eca8f9410fe8c3e74ff06e4fc to your computer and use it in GitHub Desktop.
Save stellarLuminant/a80a821eca8f9410fe8c3e74ff06e4fc to your computer and use it in GitHub Desktop.
Muledump: Potions to Max for All Chars
{
// JS Muledump script for summing up pots to max across all characters currently in view.
// "Character Stats: Left to max" option needs to be enabled for this to work.
// Paste this in Console after muledump fully loads.
// Explanation:
// .char .sname gets the elements that read the stat name i.e. "HP" or "ATT"
// check this element to make sure it's the stat we want
// the element directly below this one is the one with the actual value
// make sure that the child is .stat.max as that ensures that it calculates the left-to-max value.
// if there are two values, take the second one and remove the parentheses from them
// otherwise just use the value directly
// then add them all up
let sumPotsToMax = (statName) => Array .from(document.querySelectorAll(".char .sname"))
.filter((element) => element.innerHTML === statName)
.map((element) => element.nextSibling.querySelector(".stat.max"))
.map((element) => {
if (element.innerText.includes("(")) {
let statInParens = element.innerText.split(" ")[1];
return Number(statInParens.substring(1, statInParens.length - 1))
}
return Number(element.innerText);
})
.reduce((sum, value) => sum + value, 0);
let sumLifeToMax = () => sumPotsToMax("HP");
let sumManaToMax = () => sumPotsToMax("MP");
let sumAttackToMax = () => sumPotsToMax("ATT");
let sumDefenseToMax = () => sumPotsToMax("DEF");
let sumSpeedToMax = () => sumPotsToMax("SPD");
let sumDexterityToMax = () => sumPotsToMax("DEX");
let sumVitalityToMax = () => sumPotsToMax("VIT");
let sumWisdomToMax = () => sumPotsToMax("WIS");
let sumAllPotsToMax = () => `Life: ${sumLifeToMax()} \n`
+ `Mana: ${sumManaToMax()} \n`
+ `Attack: ${sumAttackToMax()} \n`
+ `Defense: ${sumDefenseToMax()} \n`
+ `Speed: ${sumSpeedToMax()} \n`
+ `Dexterity: ${sumDexterityToMax()} \n`
+ `Vitality: ${sumVitalityToMax()} \n`
+ `Wisdom: ${sumWisdomToMax()} \n`;
sumAllPotsToMax();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment