Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ljosberinn/4bb854aab0051082277f870fa5be1482 to your computer and use it in GitHub Desktop.
Save ljosberinn/4bb854aab0051082277f870fa5be1482 to your computer and use it in GitHub Desktop.
How to sim profession items in conjunction with your current gear in bags

Caveat

This will only work for results that are instantly visible in the Droptimizer result box:

image

  • it will skip anything that is a loss (obviously)
  • if there are more results below the fold, these aren't queryable when the script runs. if you want to get those in too, you need to rerun the script when they are visible after you scrolled

Keep in mind that weapon category is cosmetic for 1h / 2h respectively, aka don't unnecessarily bloat your iterations by simming the difference between a max ilvl 1h sword and max ilvl 1h axe.

Instructions

const [goToEquippedDroptimizerButton] = $$("button.Button").filter(
  (button) => button.textContent === "Go to equipped"
);
const panel = goToEquippedDroptimizerButton.closest(".Panel");
const list = panel.lastChild.lastChild;

const result = [];

for (let i = 0; i < list.childElementCount; i++) {
  const child = list.childNodes[i];
  const parentFlex = child.lastChild.firstChild;
  const [percentage] = Array.from(parentFlex.querySelectorAll("p.Text"))
    .filter((p) => p.textContent.endsWith("%"))
    .map((p) => p.textContent.slice(0, -1));

  if (percentage.startsWith("-") || percentage === "—") {
    continue;
  }

  const firstChildFlex = parentFlex.querySelector("div.Flex");
  const [itemNameText, itemLevelText, slotText] =
    firstChildFlex.querySelectorAll("p.Text");
  const itemName = itemNameText.textContent;
  const itemLevel = itemLevelText.textContent;

  let slot = slotText.textContent.toLowerCase().split(" ").join("_");

  if (slot.includes("finger") || slot.includes("trinket")) {
    slot = slot.replace("_", "");
  }

  const url = new URL(parentFlex.querySelector("a").href);
  const itemId = url.pathname.replace("/item=", "");

  const bonusIds = (url.searchParams.get("bonus") ?? "").split(":").join("/");
  const craftedStats = (url.searchParams.get("crafted-stats") ?? "")
    .split(":")
    .join("/");
  const craftingQuality = url.searchParams.get("crafting-quality");
  const enchant = url.searchParams.get("ench");
  const gems = url.searchParams.get("gems");

  result.push(`# ${itemName} (${itemLevel})`);

  const entry = [
    `${slot}=`,
    `id=${itemId}`,
    `bonus_id=${bonusIds}`,
    `crafting_quality=${craftingQuality > 5 ? 5 : craftingQuality}`,
    `crafted_stats=${craftedStats}`,
    enchant ? `enchant_id=${enchant}` : null,
    gems ? `gem_id=${gems}` : null,
  ]
    .filter(Boolean)
    .join(",");

  result.push(`# ${entry}`);
  result.push("#");
}

copy(result.join("\n"));
  • in your clipboard (press paste) somewhere you now have for example this:
# Obsidian Seared Invoker (447)
# main_hand=,id=190517,bonus_id=8840/8836/8902/1537,crafting_quality=5,crafted_stats=32/36,enchant_id=6655
#
# Illuminating Pillar of the Isles (447)
# main_hand=,id=194898,bonus_id=8840/8836/8902/1537,crafting_quality=5,crafted_stats=32/36,enchant_id=6655
#
# Obsidian Seared Runeaxe (447)
# main_hand=,id=190512,bonus_id=8840/8836/8902/1537,crafting_quality=5,crafted_stats=32/36,enchant_id=6655
#
# Primal Molten Spellblade (447)
# main_hand=,id=190506,bonus_id=8840/8836/8902/1537,crafting_quality=5,crafted_stats=32/36,enchant_id=6655
#
# Obsidian Seared Hexsword (447)
# main_hand=,id=190511,bonus_id=8840/8836/8902/1537,crafting_quality=5,crafted_stats=32/36,enchant_id=6655
#
# Crackling Codex of the Isles (447)
# off_hand=,id=194879,bonus_id=8840/8836/8902/1537,crafting_quality=5,crafted_stats=32/36
#
# Flame-Touched Treads (447)
# feet=,id=193421,bonus_id=8840/8836/8902/1537,crafting_quality=5,crafted_stats=32/36,enchant_id=6607
#
# Vibrant Wildercloth Shawl (447)
# back=,id=193511,bonus_id=8840/8836/8902/1537,crafting_quality=5,crafted_stats=32/36,enchant_id=6592
#
# Ring-Bound Hourglass (447)
# finger1=,id=193000,bonus_id=8840/8836/8902/8783/8784/1537/523,crafting_quality=5,crafted_stats=32/36,enchant_id=6562,gem_id=192961
#
  • paste it somewhere briefly until you've gathered all your sims

  • use /simc ingame and copy that

  • paste it in a separate file for comparison

  • find ### Gear from Bags in the ingame export

    image

  • find the end of the section, indicated by an empty line

  • paste in what you've collected from your sims

  • you can now use the extended/manipulated ingame export in Top Gear:

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment