`
rankingsDiv.setAttribute('class','widget-content widget-content-area text-left mb-3');
menuLeft.insertBefore(rankingsDiv, firstLeftChild);
const equipmentDiv = document.createElement('div');
equipmentDiv.innerHTML = equipmentDivContent
equipmentDiv.setAttribute('class','widget mb-3');
menuRight.insertBefore(equipmentDiv, firstRightChild);
const arrayEle = rankingsEle.match(/\{"id":"[0-9]+","name":"[^"]*","pic":"[^"]*","stat":[0-9]+,/g)
const arrayPower = rankingsPower.match(/\{"id":"[0-9]+","name":"[^"]*","stat":"[0-9]+","pic":"[^"]*",/g)
let tableEle = ''
let tablePower = ''
for (let i = 0; i < 20; i++) {
const obj = arrayEle[i]
const id = obj.match(/"id":"([0-9]+)"/i)[1]
const name = obj.match(/"name":"([^"]*)"/i)[1]
const pic = obj.match(/"pic":"([^"]*)"/i)[1]
const stat = parseInt(obj.match(/"stat":([0-9]+)/i)[1]).toLocaleString()
if (name == charName){
tableEle += `
`);
};
await Promise.all(array.map(tableRows));
document.querySelector("#mvRgaSelectDiv").innerHTML = `
`
document.querySelector("#mvStart").addEventListener('click', async function(){
const rows = document.querySelectorAll('.rga-selected');
const array = [];
if (rows.length == 0){
alert ('Please select at least 1 RGA');
} else {
this.outerHTML = '
(.*?)<\/td> | (.*?)<\/td> | (.*?)<\/td> | .*?<\/td><\/tr>/i)
const profileData = await superfetchProfile(`profile?id=${string[1]}`);
const character = profileData.name;
const level = profileData.level;
rgas.push([`rg_sess_id=${string[2]}&suid=${string[1]}&serverid=${serverNo}`,string[3],string[1],character,level]);
});
if (rows.length == 1){
GM_addStyle(`.mv-rga-cell{display:none;}`)
};
await mv(rgas);
};
});
};
const rows = document.querySelectorAll('table.mv-rga-select-table tbody tr');
rows.forEach(tr => {
tr.addEventListener('click', async function (){
this.classList.toggle('rga-selected');
});
});
async function mv(rgas){
document.querySelector("#blankOverlay").outerHTML = `
`
var heightHeader = document.querySelector("#mvHeader").clientHeight + 10;
document.querySelector("#mvContent").setAttribute('style',`top:${heightHeader}px`)
const open = document.querySelectorAll(".open-btn")
open.forEach(function(button){
button.addEventListener('click',async function(){
const alt = this.outerHTML.match(/alt="([^"]*)"/i)[1];
var currentPosition = document.getElementById(`div-${alt}`).getBoundingClientRect();
document.getElementById(`div-${alt}`).style.top = currentPosition.top + 200 + 'px';
var heightDiv = document.getElementById(`div-${alt}`).clientHeight;
document.querySelector("#mvContent").style.top = heightDiv + 10 + 'px';
await new Promise(resolve => setTimeout(resolve, 500));
const vh = window.innerHeight;
document.querySelector('#mvContent').style.height = '';
});
});
const close = document.querySelectorAll(".close-btn")
close.forEach(function(button){
button.addEventListener('click',async function(){
const div = this.parentElement.parentElement.outerHTML.match(/id="([^"]*)"/i)[1];
var currentPosition = document.getElementById(div).getBoundingClientRect();
document.getElementById(div).style.top = currentPosition.top - 200 + 'px';
var heightHeader = document.querySelector("#mvHeader").clientHeight + 10;
document.querySelector("#mvContent").style.top = heightHeader + "px";
const vh = window.innerHeight;
document.querySelector('#mvContent').style.height = vh - heightHeader - 10 + 'px';
});
});
document.querySelector("#character-overview").addEventListener('click', async function(){
await mvCharacterOverview(rgas)
});
document.querySelector("#character-stats").addEventListener('click', async function(){
await mvCharacterStats(rgas)
});
document.querySelector("#character-factions").addEventListener('click', async function(){
await mvCharacterFactions(rgas)
});
document.querySelector("#character-collections").addEventListener('click', async function(){
await mvCharacterCollections(rgas)
});
document.querySelector("#character-skills").addEventListener('click', async function(){
await mvCharacterSkills(rgas)
});
document.querySelector("#character-underlings").addEventListener('click', async function(){
await mvCharacterUnderlings(rgas)
});
document.querySelector("#character-god-slayer").addEventListener('click', async function(){
await mvCharacterGodSlayer(rgas)
});
document.querySelector("#character-codex").addEventListener('click', async function(){
await mvCharacterCodex(rgas)
});
document.querySelector("#equipment-equipped").addEventListener('click', async function(){
await mvEquipmentEquipped(rgas)
});
const slots = Array.from(document.querySelectorAll(".eq-slot"));
for (let i = 0; i < slots.length; i++) {
slots[i].addEventListener('click',async function(){
const slot = this.innerHTML.toLowerCase();
await mvEquipmentSlot(rgas,slot);
});
};
document.querySelector("#equipment-chaos-gem").addEventListener('click', async function(){
await mvEquipmentChaosGem(rgas)
});
document.querySelector("#equipment-badge").addEventListener('click',async function(){
await mvEquipmentBadge(rgas)
});
document.querySelector("#equipment-orbs").addEventListener('click',async function(){
await mvEquipmentOrbs(rgas)
});
document.querySelector("#equipment-rune").addEventListener('click',async function(){
await mvEquipmentRune(rgas)
});
document.querySelector("#equipment-booster").addEventListener('click',async function(){
await mvEquipmentBooster(rgas)
});
document.querySelector("#equipment-crests").addEventListener('click',async function(){
await mvEquipmentCrests(rgas)
});
document.querySelector("#equipment-augments").addEventListener('click',async function(){
await mvEquipmentAugments(rgas)
});
document.querySelector("#storage-backpack").addEventListener('click', async function(){
await mvStorageBackpack(rgas)
});
const bpType = Array.from(document.querySelectorAll(".bp-tab"));
for (let i = 0; i < bpType.length; i++) {
bpType[i].addEventListener('click', async function(){
const tab = this.outerHTML.match(/alt="([^"]*)"/i)[1];
await mvStorageItems(rgas,tab);
});
};
document.querySelector("#storage-equipment").addEventListener('click', async function(){
await mvStorageEquipment(rgas)
});
document.querySelector("#storage-vault").addEventListener('click', async function(){
await mvStorageVault(rgas)
});
document.querySelector("#storage-augments").addEventListener('click', async function(){
await mvStorageAugments(rgas)
});
const tabs = Array.from(document.querySelectorAll(".mv-plus"));
for (let i = 0; i < tabs.length; i++) {
tabs[i].addEventListener('click',async function(){
const string = await mmplus('AuthCheck|rganame');
const tab = this.outerHTML.match(/id="plus-([^"]*)"/i)[1];
if (tab == "events"){
const events = Array.from(document.querySelectorAll(".woz-top"));
for (let i = 0; i < events.length; i++) {
events[i].addEventListener('click',async function(){
const event = this.innerHTML;
await mvEvents(rgas,event,string);
});
};
document.querySelector("#plus-events-holidays").addEventListener('click', async function(){ await mvHolidays(rgas,string) });
}
else if (tab == "item-slotting"){
await mvItemSlotting(rgas,string)
}
else if (tab == "max-rage"){
await mvMaxRage(rgas,string)
};
});
};
};
};
async function mvCharacterOverview(rgas){
const endpoints = ['profile','supplies'];
const array = await mvFetch(rgas,endpoints);
let totMr = 0;
let totPower = 0;
let totEle = 0;
let totChaos = 0;
let totRpt = 0;
let totSupplies = 0;
const rows = [];
const table = async (i) => {
const charclass = i.profile.class;
const crew = i.profile.crewname;
const rage = i.profile.currentrage.toLocaleString();
const exp = i.profile.exp.toLocaleString();
const tolvl = i.profile.tolevel.toLocaleString();
const today = i.profile.growthtoday.toLocaleString();
const yesterday = i.profile.growthyesterday.toLocaleString();
const strength = i.profile.strength;
const supplies = parseInt(i.supplies.replace(/\s/g,'').match(/([0-9]+)%<\/td>/i)[1])
const gold = i.profile.gold.toLocaleString();
rows.push(`${i.static}${charclass} | ${crew} | ${rage} | ${exp} | ${tolvl} | ${today} | ${yesterday} | ${strength} | ${supplies} | ${gold} | `);
totMr += i.profile.maxrage;
totPower += i.profile.power;
totEle += i.profile.elemental;
totChaos += i.profile.chaos;
totRpt += i.profile.rageperturn;
totSupplies += parseInt(i.supplies.replace(/\s/g,'').match(/([0-9]+)%<\/td>/i)[1])
};
await Promise.all(array.map(table));
const avgSupplies = (totSupplies/array.length).toFixed(2);
document.querySelector("#mvContent").innerHTML = `
TOTAL POWER |
TOTAL ELEMENTAL |
TOTAL CHAOS |
TOTAL RPT |
TOTAL MAX RAGE |
SUPPLIES (MAX ALL) |
${totPower.toLocaleString()} |
${totEle.toLocaleString()} |
${totChaos.toLocaleString()} |
${totRpt.toLocaleString()} |
${totMr.toLocaleString()} |
${avgSupplies}% |
char | | rga | lvl | class | crew | rage | experience | to level | growth today | yesterday | strength | supplies | gold |
${rows.join('')}
`
document.querySelector("#maxAllSuppliesLink").addEventListener('click', async function(){
const loadingDiv = document.createElement("div");
loadingDiv.innerHTML = `loading ⧖`
loadingDiv.id = "loadingDiv"
document.body.appendChild(loadingDiv);
const maxAllSupplies = async (i) => {
const string = i.static.match(/href="profile\?(rg_sess_id=[A-Za-z0-9]+&suid=[0-9]+&serverid=[0-9]+)"/i)[1];
await fetch(`supplies?${string}`, {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({'buymax': 'Buy Max',})})
};
await Promise.all(array.map(maxAllSupplies));
document.querySelector("#avgSupplies").innerHTML = "MAXED"
document.querySelector("#loadingDiv").remove();
});
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvCharacterStats(rgas){
const endpoints = ['profile','home'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const mr = i.profile.maxrage.toLocaleString();
const power = i.profile.power.toLocaleString();
const ele = i.profile.elemental.toLocaleString();
const atk = i.profile.attack.toLocaleString();
const hp = i.profile.hp.toLocaleString();
const chaos = i.profile.chaos.toLocaleString();
const res1 = i.home.holyresist;
const res2 = i.home.arcaneresist;
const res3 = i.home.shadowresist;
const res4 = i.home.fireresist;
const res5 = i.home.kineticresist;
const rpt = i.profile.rageperturn.toLocaleString();
const ept = i.profile.expperturn.toLocaleString();
const wilderness = i.profile.wilderness.toLocaleString();
rows.push(`
${i.static}
${mr.toLocaleString()} |
${power} |
${ele} |
${atk} |
${hp} |
${chaos} |
${res1} |
${res2} |
${res3} |
${res4} |
${res5} |
${rpt.toLocaleString()} |
${(mr/rpt).toFixed(1)} |
${ept} |
${wilderness} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | max rage | power | ele | atk | hp | chaos | res | res | res | res | res | rpt | mr:rpt | ept | wilderness |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvCharacterFactions(rgas){
const endpoints = ['profile','home'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const faction = i.profile.faction;
const a = i.home.alvar;
const d = i.home.delruk;
const v = i.home.vordyn;
const c = i.home.codex;
const t = a + d + v
rows.push(`
${i.static}
${faction} |
${a} |
${d} |
${v} |
${t} |
${c} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | current faction | alvar loyalty | delruk loyalty | vordyn loyalty | total loyalty | codex level |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvCharacterSkills(rgas){
const endpoints = ['home','cast_skills?C=7','profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const wall = i.skills.match(/alt="Shield Wall"/i) ? "X" : "";
const slayer = i.skills.match(/alt="God Slayer"/i) ? "X" : "";
const grind = i.skills.match(/alt="Daily Grind"/i) ? "X" : "";
const influence = i.skills.match(/alt="Triworld Influence"/i) ? "X" : "";
const skillclass = i.home.skillclass;
const skillpoints = i.home.skillpoints;
const active = i.profile.skills.images;
rows.push(`${i.static}${skillclass} | ${skillpoints} | ${wall} | ${slayer} | ${grind} | ${influence} | ${active.join('')} | `);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | class | skill points |  |  |  |  | active skills |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvCharacterUnderlings(rgas){
const endpoints = ['profile','home'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const lings = i.profile.underlings;
const loyalty = i.home.underlingloyalty * 10;
const allLings = i.profile.underlingids;
let allLingsAtk = 0;
let allLingsHp = 0;
let allLingsPower = 0;
let allLingsExp = 0;
if (allLings){
const lingLoop = async (lingid) => {
const id = lingid
const lingProfile = await superfetchProfile(`profile?id=${id}`);
allLingsAtk += lingProfile.attack;
allLingsHp += lingProfile.hp;
allLingsPower += lingProfile.power;
allLingsExp += lingProfile.exp;
};
await Promise.all(allLings.map(lingLoop));
}
const maxAtk = allLingsAtk >= 11236 ? "100%" : (allLingsAtk/11236*100).toFixed(1) + "%"
const maxHp = allLingsHp >= 25545 ? "100%" : (allLingsHp/25545*100).toFixed(1) + "%"
rows.push(`${i.static}${lings} | ${allLingsExp.toLocaleString()} | ${allLingsPower.toLocaleString()} | ${loyalty} | ${maxAtk} | ${maxHp} | `);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | lings | total experience | total power | loyalty enhancement | ATK % MAXED BUFF | HP % MAXED BUFF |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvCharacterGodSlayer(rgas){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const allgods = await info("Array of all gods");
const rows = [];
const table = async (i) => {
const crew = i.profile.crewname;
const completed = i.profile.completedgodslayer.split(',')
const needed = allgods.filter(item => !completed.includes(item));
const list = needed.map(i => i.replace(/(,| ,| the|The| of).*/gi, ''));
rows.push(`${i.static}${crew} | ${i.profile.godslayer} | ${list.join(', ')} | `);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
`
await filterTables();
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvCharacterCollections(rgas){
const endpoints = ['collections'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const parser = new DOMParser()
const x = parser.parseFromString(i.collections, 'text/html');
const anjou = (x.querySelector("#divCollections > div.row > div:nth-child(1) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
const reikar = (x.querySelector("#divCollections > div.row > div:nth-child(2) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
const lorren = (x.querySelector("#divCollections > div.row > div:nth-child(3) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
const lucile = (x.querySelector("#divCollections > div.row > div:nth-child(4) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
const weima = (x.querySelector("#divCollections > div.row > div:nth-child(5) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
const souma = (x.querySelector("#divCollections > div.row > div:nth-child(6) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
const vanisha = (x.querySelector("#divCollections > div.row > div:nth-child(7) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
const drolba = (x.querySelector("#divCollections > div.row > div:nth-child(8) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
const quibel = (x.querySelector("#divCollections > div.row > div:nth-child(9) > div > div > div.user-info.w-100.pr-3 > ul").innerHTML.match(/img/g) || []).length + " / 3"
rows.push(`${i.static}${anjou} | ${reikar} | ${lorren} | ${lucile} | ${weima} | ${souma} | ${vanisha} | ${drolba} | ${quibel} | `);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | anjou | reikar | lorren | lucile | weima | souma | vanisha | drolba | quibel |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvCharacterCodex(rgas){
const endpoints = ['changefaction'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const completed = (i.changefaction.match(/Triworld Codex Chapter [0-9]+ /g) || ['0']).map(i => parseInt(i.match(/[0-9]+/i)))
const incomplete = [];
for (let i = 1; i <= 50; i++) {
if (!completed.includes(i)) { incomplete.push(i) };
};
rows.push(`${i.static}${completed.length} | ${incomplete.join(',')} | `);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
`
await filterTables();
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentEquipped(rgas,slot){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const slotsize = 'height:35px;width:35px'
const mr = i.profile.maxrage.toLocaleString();
const power = i.profile.power.toLocaleString();
const ele = i.profile.elemental.toLocaleString();
const core = ` `
const head = ` `
const neck = ` `
const weapon = ` `
const body = ` `
const shield = ` `
const belt = ` `
const pants = ` `
const ring = ` `
const foot = ` `
const chaosgem = ` `
const badge = ` `
const rune = ` `
const orb1 = ` `
const orb2 = ` `
const orb3 = ` `
rows.push(`${i.static}${power} | ${ele} | ${mr.toLocaleString()} | ${core} | ${head} | ${neck} | ${weapon} | ${body} | ${shield} | ${belt} | ${pants} | ${ring} | ${foot} | ${chaosgem} | ${badge} | ${rune} | ${orb1} | ${orb2} | ${orb3} | `);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | POW | ELE | MR | COR | HED | NCK | WEP | BDY | SHD | BELT | PNT | RNG | FOT | GEM | BDG | RNE | ORB | ORB | ORB |
${rows.join('').replace(/onclick="[^"]*"/g,'')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentSlot(rgas,slot){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const itemid = i.profile[slot].id;
const itemData = await superfetchItem(itemid);
rows.push(`
${i.static}
${itemData.name} |
 |
${itemData.augs} |
${itemData.gems} |
${itemData.atk.toLocaleString()} |
${itemData.hp.toLocaleString()} |
${itemData.ele.toLocaleString()} |
${itemData.chaosdmg} |
${itemData.resist} |
${itemData.chaosres} |
${itemData.vile} |
${itemData.rpt.toLocaleString()} |
${itemData.ept.toLocaleString()} |
${itemData.rampage}% |
${itemData.critical}% |
${itemData.maxrage.toLocaleString()} |
${itemData.block}% |
${itemData.eleblock}% |
${itemData.ps} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | name | img | augs | gem | atk | hp | ele | chs | res | res | vle | rpt | ept | rmp | crt | mr | blk | blk | ps |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentChaosGem(rgas){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const itemid = i.profile.gem.id;
const itemData = await superfetchItem(itemid);
rows.push(`
${i.static}
${itemData.name} |
 |
${itemData.chaosdmg.toLocaleString()} |
${itemData.rampage}% |
${itemData.critical}% |
${itemData.maxrage.toLocaleString()} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | name | img | chaos | rampage | critical | max rage |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentBadge(rgas){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const itemid = i.profile.badge.id;
const itemData = await superfetchItem(itemid);
rows.push(`
${i.static}
${itemData.name} |
 |
${itemData.atk.toLocaleString()} |
${itemData.hp.toLocaleString()} |
${itemData.ele.toLocaleString()} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | name | img | atk | hp | elemental |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentOrbs(rgas){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const orb1id = i.profile.orb1.id;
const orb2id = i.profile.orb2.id;
const orb3id = i.profile.orb3.id;
const orb1Data = await superfetchItem(orb1id);
const orb2Data = await superfetchItem(orb2id);
const orb3Data = await superfetchItem(orb3id);
rows.push(`
${i.static}
 |
 |
 |
${orb1Data.name} |
${orb2Data.name} |
${orb3Data.name} |
${(orb1Data.maxrage + orb2Data.maxrage + orb3Data.maxrage).toLocaleString()} |
${(orb1Data.ele + orb2Data.ele + orb3Data.ele).toLocaleString()} |
${(orb1Data.atk + orb2Data.atk + orb3Data.atk).toLocaleString()} |
${(orb1Data.hp + orb2Data.hp + orb3Data.hp).toLocaleString()} |
${(orb1Data.rpt + orb2Data.rpt + orb3Data.rpt).toLocaleString()} |
${(orb1Data.ept + orb2Data.ept + orb3Data.ept).toLocaleString()} |
${(orb1Data.chaosdmg + orb2Data.chaosdmg + orb3Data.chaosdmg).toLocaleString()} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | img | img | img | orb 1 | orb 2 | orb 3 | mr | ele | atk | hp | rpt | ept | chaos |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentRune(rgas){
const endpoints = ['profile','ajax/backpackcontents.php?tab=quest'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const fusers = (i.quest.match(/data-name="Elemental Fuser" data-itemqty="([0-9]+)"/i) || [0,0])[1];
const itemid = i.profile.rune.id;
const itemData = await superfetchItem(itemid);
rows.push(`
${i.static}
${itemData.name} |
 |
${itemData.ele.toLocaleString()} |
${fusers} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | name | img | elemental |  |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentBooster(rgas){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const itemid = i.profile.booster.id;
const itemData = await superfetchItem(itemid);
rows.push(`
${i.static}
${itemData.name} |
 |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | booster | img |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentCrests(rgas){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const crest1 = await superfetchItem(i.profile.ccrest.id);
const crest2 = await superfetchItem(i.profile.pcrest.id);
const crest3 = await superfetchItem(i.profile.fcrest.id);
const crest4 = await superfetchItem(i.profile.acrest.id);
rows.push(
`
${i.static}
 |
 |
 |
 |
${crest1.name} |
${crest3.name} |
${crest2.name} |
${crest4.name} |
`
);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | img | img | img | img | class | ferocity | preservation | affliction |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvEquipmentAugments(rgas){
const endpoints = ['profile'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
let totalOpen = 0;
const table = async (i) => {
const core = await superfetchItem(i.profile.core.id);
const head = await superfetchItem(i.profile.head.id);
const neck = await superfetchItem(i.profile.neck.id);
const weapon = await superfetchItem(i.profile.weapon.id);
const body = await superfetchItem(i.profile.body.id);
const shield = await superfetchItem(i.profile.shield.id);
const belt = await superfetchItem(i.profile.belt.id);
const pants = await superfetchItem(i.profile.pants.id);
const ring = await superfetchItem(i.profile.ring.id);
const foot = await superfetchItem(i.profile.foot.id);
const allaugs = core.augs + head.augs + neck.augs + weapon.augs + body.augs + shield.augs + belt.augs + pants.augs + ring.augs + foot.augs
const augcount = (allaugs.match(/itempopup\(event,'[0-9]+_[0-9]+'\)/g) || []).length
totalOpen += core.openaugs + head.openaugs + neck.openaugs + weapon.openaugs + body.openaugs + shield.openaugs + belt.openaugs + pants.openaugs + ring.openaugs + foot.openaugs
rows.push(`${i.static}${augcount} | ${allaugs} | `)
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
TOTAL OPEN AUG SLOTS |
${totalOpen} |
char | | rga | lvl | count | slotted augments |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvStorageBackpack(rgas){
const endpoints = ['ajax/backpackcontents.php?tab=regular'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const match = i.regular.replace(/\s+/g, ' ').replace(/[\n\r]/g,'').match(/src="[^"]*" alt="[^"]*" ONMOUSEOVER="itempopup\(event,'[0-9]+'\)"/g) || [];
const items = match.length < 250 ? match.map(i => ` `) : ['Too many items to display'];
rows.push('' + i.static + '' + items.join('') + ' | ')
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | backpack items |
${rows.join('')}
`
const selectable = document.querySelectorAll('img.mv-selectable');
for (var i = 0; i < selectable.length; i++){
const item = selectable[i];
item.addEventListener('click', async function(){
item.classList.toggle('mv-backpack-selected')
})
}
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvStorageItems(rgas,tab){
const endpoints = [`ajax/backpackcontents.php?tab=${tab}`];
const array = await mvFetch(rgas,endpoints);
const headerArray = [];
const itemsList = async (i) => {
const itemsParse = i[tab].replace(/\s+/g, ' ').replace(/[\n\r]/g,'').replace(/'/g,'').match(/src="[^"]*" alt="[^"]*"/g);
if (itemsParse){
for (let n = 0; n < itemsParse.length; n++) {
headerArray.push(itemsParse[n]);
};
};
};
await Promise.all(array.map(itemsList));
headerArray.sort((a, b) => {
const altA = a.match(/alt="([^"]*)"/)[1];
const altB = b.match(/alt="([^"]*)"/)[1];
return altA.localeCompare(altB);
});
const header = ([...new Set(headerArray)]).map(i => `![]() | `);
const noOfTables = Math.ceil(header.length/18);
const headers = []
const rows = []
for (let i = 0; i < noOfTables; i++) {
const slicedHeader = header.slice(i*18,(i+1)*18);
headers[i+1] = slicedHeader;
const row = []
const table = async (a) => {
const names = slicedHeader.join('').match(/event,'[^']*'/g).map(p => p.match(/'([^']*)'/)[1]);
const item = a[tab].replace(/\s+/g, ' ').replace(/[\n\r]/g,'').replace(/'/g,'');
let cells = a.static;
for (let n = 0; n < names.length; n++) {
const regex = new RegExp(`data-itemidqty="[0-9]+" data-name="${names[n]}"`);
const count = (item.match(regex) || ['itemidqty="0"']).map(m => m.match(/itemidqty="([0-9]+)"/)[1]);
cells += '' + count + ' | ';
};
row.push('' + cells + ' ');
};
await Promise.all(array.map(table));
rows[i+1] = row;
};
document.querySelector("#mvContent").innerHTML = `
char | | rga | lvl | ${headers[1].join('')}
${rows[1].join('')}
`
if (noOfTables > 1){
const tableLinks = [];
for (let i = 0; i < noOfTables; i++) {
tableLinks.push(`${i+1}`)
};
document.querySelector("#tableNoSpan").innerHTML = `${tableLinks.join('')}`
for (let i = 0; i < noOfTables; i++) {
document.querySelector(`#items-table-${i+1}`).addEventListener('click', async function(){
document.querySelector("#mv-table-container").innerHTML = `
char | | rga | lvl | ${headers[i+1].join('')}
${rows[i+1].join('')}
`
await sortableTables();
});
};
};
await sortableTables();
document.querySelector("#loadingDiv").remove();
}
async function mvStorageEquipment(rgas){
const endpoints = ['augmentequip'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
let tableMsg = ''
const table = async (i) => {
if (i.augmentequip.match(/Manage Augments<\/h1>/i)){;
const items = i.augmentequip.match(/ /g)
if (items){
rows.push('' + i.static + '' + items.join('') + ' | ')[1]
};
} else {
tableMsg = 'Equipment will only display for the originating RGA because security word is required to access items'
};
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
${tableMsg}
char | | rga | lvl | all equipment |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
}
async function mvStorageVault(rgas){
const endpoints = ['vault'];
const array = await mvFetch(rgas,endpoints);
let tableMsg = ''
const rows = [];
const table = async (i) => {
if (i.vault.match(/Currently Storing/i)){;
const match = i.vault.replace(/[\n\r]/g,'').replace(/.*images\/vault_inventory\.gif/i,'').match(/src="[^"]*" ONMOUSEOVER="itempopup\(event,'[0-9]+'\)"/g)
if (match){
const items = match.map(m => ` `);
rows.push('' + i.static + '' + items.join('') + ' | ')[1]
};
} else {
tableMsg = 'Vault items will only display for the originating RGA because security word is required to access items'
};
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
${tableMsg}
char | | rga | lvl | all equipment |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvStorageAugments(rgas){
const endpoints = ['augmentequip'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
let tableMsg = ''
const table = async (i) => {
if (i.augmentequip.match(/Manage Augments<\/h1>/i)){;
const match = i.augmentequip.match(/width="20" height="20" src="[^"]*" onmouseover="itempopup\(event,'[0-9]+'\)"/g)
if (match){
const items = match.map(m => ` `);
rows.push('' + i.static + '' + items.join('') + ' | ')[1]
};
} else {
tableMsg = 'Augments will only display for the originating RGA because security word is required to access items'
};
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
${tableMsg}
char | | rga | lvl | all augments |
${rows.join('')}
`
await sortableTables();
document.querySelector("#loadingDiv").remove();
};
async function mvItemSlotting(rgas,string){
document.querySelector("#mvContent").innerHTML = `
`
document.querySelector("#itemLink").addEventListener('input', async function() {
const input = document.querySelector("#itemLink").value;
const link = input.match(/itemlink\?id=[0-9]+/i);
if (link){
const itemidNew = link.toString().match(/[0-9]+/);
const sNew = await superfetchItem(itemidNew);
const imgNew = sNew.img;
const nameNew = sNew.name;
const eleNew = sNew.ele;
const mrNew = sNew.maxrage;
const slot = sNew.slot;
if (!string.match('Full')){ rgas = rgas.slice(0, 2) };
const endpoints = ['profile','equipment?r=0'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const mrChar = i.profile.maxrage;
const eleChar = i.profile.elemental;
const itemid = i.profile[slot].id;
const s = await superfetchItem(itemid);
const imgCurrent = s.img;
const nameCurrent = s.name;
const eleCurrent = s.ele;
const mrCurrent = s.maxrage;
rows.push(`
${i.static}
${eleChar.toLocaleString()} |
${mrChar.toLocaleString()} |
|
 |
${nameCurrent} |
${eleCurrent.toLocaleString()} |
${mrCurrent.toLocaleString()} |
|
 |
${nameNew} |
${eleNew.toLocaleString()} |
${mrNew.toLocaleString()} |
|
${(eleNew-eleCurrent).toLocaleString()} |
${(mrNew-mrCurrent).toLocaleString()} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#item-slotting-div").innerHTML = `
character |
|
rga |
lvl |
tot ele |
tot mr |
|
img |
current item |
ele |
mr |
|
img |
new item |
ele |
mr |
|
ele change |
mr change |
${rows.join('')}
`
await sortableTables();
if (!string.match('Full')){ await mvNotSpecial("ITEM SLOTTING") };
document.querySelector("#loadingDiv").remove();
} else {
alert('Invalid item link entered');
};
});
};
async function mvMaxRage(rgas,string){
const endpoints = ['home','profile'];
if (!string.match('Full')){ rgas = rgas.slice(0, 2) };
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const mr = i.home.maxrage;
const charclass = i.profile.class;
const upgraded = i.home.mrupgrades.purchased;
const max = i.home.mrupgrades.max;
const available = max - upgraded;
let mrFromItems = 0;
let mrFromGems = 0;
let missingGems = 40;
let costToGem = 0;
const core = await superfetchItem(i.profile.core.id);
const head = await superfetchItem(i.profile.head.id);
const neck = await superfetchItem(i.profile.neck.id);
const weapon = await superfetchItem(i.profile.weapon.id);
const body = await superfetchItem(i.profile.body.id);
const shield = await superfetchItem(i.profile.shield.id);
const belt = await superfetchItem(i.profile.belt.id);
const pants = await superfetchItem(i.profile.pants.id);
const ring = await superfetchItem(i.profile.ring.id);
const foot = await superfetchItem(i.profile.foot.id);
const eq = [core,head,neck,weapon,body,shield,belt,pants,ring,foot];
for (let n = 0; n < 10; n++) {
const item = eq[n];
const rarity = item.rarity;
const maxrage = item.maxrage;
mrFromItems += maxrage;
const gems = item.gems;
let x = gems == 3 ? 0.15 : gems == 2 ? 0.3225 : gems == 1 ? 0.520875 : gems == 0 ? 0.74900625 : 0;
if (charclass == "Monster") {
x *= 1.1
} else if (charclass == "Pop Star"){
x *= 1.05
};
mrFromGems += (maxrage * x);
missingGems -= gems;
if (rarity != ''){
const upgrades = await info("Cost to Full Gem");
costToGem += upgrades[rarity][gems]
};
}
const maxMr = Math.ceil(mrFromGems) + mr + available;
const perPoint = missingGems == 0 ? 0 : Math.ceil(mrFromGems/costToGem)
rows.push(`
${i.static}
${charclass} |
${mr.toLocaleString()} |
${upgraded.toLocaleString()} |
${available.toLocaleString()} |
${missingGems} |
${(Math.ceil(mrFromGems) + available).toLocaleString()} |
${costToGem.toLocaleString()} |
${maxMr.toLocaleString()} |
${perPoint} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char |
rga |
|
lvl |
class |
max rage |
char upgrades |
upgrades available
| missing gems |
max gains |
full gem cost |
mr if maxed |
mr per point |
${rows.join('')}
`
await sortableTables();
if (!string.match('Full')){ await mvNotSpecial("MAX RAGE") };
document.querySelector("#loadingDiv").remove();
};
async function mvEvents(rgas,event,string){
const peram = event == "WAR OF ZHUL" ? "woz" : "top"
const qItemLong = event == "WAR OF ZHUL" ? "Summoning Shard" : "Trial Insignia"
const qItemShort = event == "WAR OF ZHUL" ? "shards" : "insignias"
const qItemImg = event == "WAR OF ZHUL" ? "images/warshard.jpg" : "images/items/trialinsignia.jpg"
let runsLeft;
const eventPage = await superfetch(`event?eventid=${peram}`);
if (eventPage.match('START COUNTDOWN')){
runsLeft = 31;
} else if (eventPage.match(/countdown = ([0-9]+)/i)){
const timer = parseInt(eventPage.match(/countdown = ([0-9]+)/i)[1])*1000;
const now = ((new Date().getTime()) - 18000000);
runsLeft = (timer-now)/3600000/10.8;
} else {
runsLeft = 31;
};
if (!string.match('Full')){ rgas = rgas.slice(0, 2) };
const endpoints = ['home','ajax/backpackcontents.php?tab=quest','ajax/backpackcontents.php?tab=potion'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const regex = new RegExp(`data-itemidqty="[0-9]+" data-name="${qItemLong}"`);
const table = async (i) => {
const fury = parseInt((i.potion.match(/data-itemidqty="([0-9]+)" data-name="Recharge the Fury"/i) || [0,0])[1]);
const spark = parseInt((i.potion.match(/data-itemidqty="([0-9]+)" data-name="Spark the Fury"/i) || [0,0])[1]);
const elepot = parseInt((i.potion.match(/data-itemidqty="([0-9]+)" data-name="Potion of Elemental Resistance"/i) || [0,0])[1]);
const kixpot = parseInt((i.potion.match(/data-itemidqty="([0-9]+)" data-name="Kix Potion"/i) || [0,0])[1]);
const amdirpot = parseInt((i.potion.match(/data-itemidqty="([0-9]+)" data-name="Potion of Amdir"/i) || [0,0])[1]);
const squidpot = parseInt((i.potion.match(/data-itemidqty="([0-9]+)" data-name="Squidberry Juice"/i) || [0,0])[1]);
const wonderlandpot = parseInt((i.potion.match(/data-itemidqty="([0-9]+)" data-name="Wonderland Potion"/i) || [0,0])[1]);
const refills = fury + (spark/2);
const qitem = parseInt((i.quest.match(regex) || '0').toString().match(/[0-9]+/i));
const mr = i.home.maxrage;
const rpt = i.home.rageperturn;
rows.push(`
${i.static}
${fury} |
${spark} |
${elepot} |
${kixpot} |
${amdirpot} |
${squidpot} |
${wonderlandpot} |
${qitem} |
${mr.toLocaleString()} |
${rpt.toLocaleString()} |
${Math.ceil(runsLeft*(mr+rpt)/20000+qitem)} |
|
${Math.ceil(refills*mr/20000) + Math.ceil(runsLeft*(mr+rpt)/20000+qitem)} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char |
|
rga |
lvl |
 |
 |
 |
 |
 |
 |
 |
 |
max rage |
rpt |
proj tot ${qItemShort} |
furys to use |
new proj ${qItemShort} |
${rows.join('')}
`
const furyInput = Array.from(document.querySelectorAll(".fury-math-input"));
for (let i = 0; i < furyInput.length; i++) {
furyInput[i].addEventListener('input',async function(){
const cellInput = parseFloat(this.value);
const cellOutput = this.parentNode.parentNode.querySelector('.fury-math-output');
const cellMaxRage = parseInt(this.parentNode.parentNode.querySelector('.max-rage').innerHTML.replace(/,/g,''));
const cellQItem = parseInt(this.parentNode.parentNode.querySelector('.projected-qitem').innerHTML.replace(/,/g,''));
cellOutput.innerHTML = Math.ceil(((cellInput*cellMaxRage)/20000) + cellQItem);
});
};
await sortableTables();
if (!string.match('Full')){ await mvNotSpecial(event) };
document.querySelector("#loadingDiv").remove();
};
async function mvHolidays(rgas,string){
if (!string.match('Full')){ rgas = rgas.slice(0, 2) };
const endpoints = ['home','ajax/backpackcontents.php?tab=quest'];
const array = await mvFetch(rgas,endpoints);
const rows = [];
const table = async (i) => {
const mr = i.home.maxrage;
const rpt = i.home.rageperturn;
const components = parseInt((i.quest.match(/data-itemidqty="([0-9]+)" data-name="Server Components"/i) || [0,0])[1]);
const canes = parseInt((i.quest.match(/data-itemidqty="([0-9]+)" data-name="Candy Cane"/i) || [0,0])[1]);
rows.push(`
${i.static}
${mr.toLocaleString()} |
${rpt.toLocaleString()} |
${components} |
${canes} |
`);
};
await Promise.all(array.map(table));
document.querySelector("#mvContent").innerHTML = `
char |
|
rga |
lvl |
max rage |
rpt |
 |
 |
${rows.join('')}
`
await sortableTables();
if (!string.match('Full')){ await mvNotSpecial("HOLIDAYS") };
document.querySelector("#loadingDiv").remove();
}
async function mvFetch(rgas,endpoints){
const loadingDiv = document.createElement("div");
loadingDiv.innerHTML = `loading ⧖`
loadingDiv.id = "loadingDiv"
document.body.appendChild(loadingDiv);
const array = [];
const fetch = async (endpoint) => {
for (let i = 0; i < rgas.length; i++) {
const key = endpoint.match(/[a-zA-Z]{2,}(?![a-zA-Z])/g)?.pop();
const login = rgas[i][0]
const url = endpoint.match(/\?/i) ? endpoint.replace(/\?/i,`?${login}&`) : `${endpoint}?${login}`
let data;
if (url.match("profile")){
data = await superfetchProfile(url)
} else if (url.match("home")){
data = await superfetchHome(url);
} else {
data = await superfetch(url);
};
if (!array[i]) { array[i] = {} };
if (!array[i].static) {
array[i].static = `
${rgas[i][3]} |
|
${rgas[i][1]} |
${rgas[i][4]} |
`
};
array[i][key] = data;
};
};
await Promise.all(endpoints.map(fetch));
if (!document.querySelector("#mvCopyChars")){
await mvCopy();
};
return array;
};
async function mvCopy(){
var copyDiv = document.createElement('div');
copyDiv.innerHTML = ''
copyDiv.style.position = 'fixed';
copyDiv.style.bottom = '15px';
copyDiv.style.left = '15px';
copyDiv.id = "mvCopyChars"
copyDiv.style.zIndex = '9999';
copyDiv.style.cursor = 'pointer';
document.body.appendChild(copyDiv);
document.querySelector("#mvCopyChars").setAttribute('onmouseover',`statspopup(event,'Copy list of selected chars to clipboard')`);
document.querySelector("#mvCopyChars").setAttribute('onmouseout','kill()');
document.querySelector("#mvCopyChars").addEventListener('click', async function(){
const checkboxes = document.querySelectorAll(".mv-checkbox");
const selectedCharsArray = [];
const loopThroughCheckboxes = async (i) => {
if(i.checked){
selectedCharsArray.push(i.outerHTML.match(/name="([^"]*)"/i)[1]);
};
};
await Promise.all(Array.from(checkboxes).map(loopThroughCheckboxes));
if (selectedCharsArray.length > 0){
navigator.clipboard.writeText(selectedCharsArray.join(','))
.then(function() {
alert(`Copied ${selectedCharsArray.length} names to clipboard: ${selectedCharsArray.join(',')}`)
}).catch(function(err) {
alert('Unable to copy: ', err);
});
} else {
alert('No characters selected');
};
});
};
async function mvItemSpec(itemid){
const item = (await superfetch(`item_rollover.php?id=${itemid}`)).replace(/ \(\+[0-9]+\)<\/span>/g,'').replace(//g,'').replace(/,|%/g,'');
const slot = (item.match(/\[Slot - (.*?)\] /i) || ['','slot unknown'])[1].toLowerCase();
const img = itemid > 0 ? ` /i) || ['',''])[1]}" onmouseover="itempopup(event,'${itemid}')" onmouseout="kill()"> | ` : ' | ';
const rarity = (item.match(/text-shadow: #47462E 1px 1px 2px;color:#([A-Za-z0-9]+)/i) || ['',''])[1];
const name = `` + (item.match(/align="left">(.*?)<\/td>/i) || ['',''])[1].replace('td colspan="2"','a')+' | ';
const cloned = item.match(/\[Cloned: .*?\]/i) ? true : false;
const augs = '' + (item.match(/src="[^"]*" ONMOUSEOVER="itempopup\(event'[0-9]+_[0-9]+'\)"/g) || []).map(i => ` `).join('') + ' | ';
const openaugs = item.match(/\/images\/augslot\.jpg/) ? item.match(/\/images\/augslot\.jpg/g).length : 0;
const gems = '' +(4-((item.match(/src="\/images\/gemslot2\.jpg"/g) || []).length)) + ' | ';
const atk = '' + parseInt((item.match(/\+([0-9]+) ATK /i) || [0,0])[1]).toLocaleString() + ' | ';
const hp = '' + parseInt((item.match(/\+([0-9]+) HP /i) || [0,0])[1]).toLocaleString() + ' | ';
const ele1 = parseInt((item.match(/\+([0-9]+) Holy<\/span>/i) || [0,0])[1]);
const ele2 = parseInt((item.match(/\+([0-9]+) Arcane<\/span>/i) || [0,0])[1]);
const ele3 = parseInt((item.match(/\+([0-9]+) Shadow<\/span>/i) || [0,0])[1]);
const ele4 = parseInt((item.match(/\+([0-9]+) Fire<\/span>/i) || [0,0])[1]);
const ele5 = parseInt((item.match(/\+([0-9]+) Kinetic<\/span>/i) || [0,0])[1]);
const elemental = '' + (ele1 + ele2 + ele3 + ele4 + ele5).toLocaleString() + ' | ';;
const ele6 = '' + parseInt((item.match(/\+([0-9]+) Chaos<\/span>/i) || [0,0])[1]).toLocaleString() + ' | ';
const res1 = parseInt((item.match(/\+([0-9]+) Holy Resist/i) || [0,0])[1]);
const res2 = parseInt((item.match(/\+([0-9]+) Arcane Resist/i) || [0,0])[1]);
const res3 = parseInt((item.match(/\+([0-9]+) Shadow Resist/i) || [0,0])[1]);
const res4 = parseInt((item.match(/\+([0-9]+) Fire Resist/i) || [0,0])[1]);
const res5 = parseInt((item.match(/\+([0-9]+) Kinetic Resist/i) || [0,0])[1]);
const resist = '' + (res1 + res2 + res3 + res4 + res5).toLocaleString() + ' | ';;
const res6 = '' + (item.match(/\+([0-9]+) Chaos Resist/i) || [0,0])[1] + ' | ';
const vile = '' + parseInt((item.match(/\+([0-9]+) vile energy/i) || [0,0])[1]).toLocaleString() + ' | ';
const rpt = '' + parseInt((item.match(/\+([0-9]+) rage per hr/i) || [0,0])[1]).toLocaleString() + ' | ';
const ept = '' + parseInt((item.match(/\+([0-9]+) exp per hr/i) || [0,0])[1]).toLocaleString() + ' | ';
const rampage = '' + (item.match(/\+([0-9]+) rampage/i) || [0,0])[1] + ' | ';
const critical = '' + (item.match(/\+([0-9]+) critical hit/i) || [0,0])[1] + ' | ';
const mr = '' + parseInt((item.match(/\+([0-9]+) max rage/i) || [0,0])[1]).toLocaleString() + ' | ';
const block = '' + (item.match(/\+([0-9]+) block/i) || [0,0])[1] + ' | ';
const eleblock = '' + (item.match(/\+([0-9]+) elemental block/i) || [0,0])[1] + ' | ';
const ps = '' + (item.match(/\+(\d+(\.\d+)?) perfect strike/i) || [0,0])[1] + ' | ';;
return {slot:slot,img:img,name:name,rarity:rarity,cloned:cloned,augs:augs,openaugs:openaugs,gems:gems,atk:atk,hp:hp,elemental:elemental,ele6:ele6,resist:resist,res6:res6,vile:vile,rpt:rpt,ept:ept,rampage:rampage,critical:critical,mr:mr,block:block,eleblock:eleblock,ps:ps};
};
async function mvNotSpecial(tab){
document.querySelector("#banner").innerHTML = `
`
};
async function openPotionBp(){
window.XMLHttpRequest.prototype.realOpen = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function(method, url) {
if (url.includes('ajax/backpackcontents.php?tab=potion')) {
this.onreadystatechange = function() {
if (this.readyState === 4) {
var pbp = this.responseText;
const inbp = pbp.replace(/'/g,'').match(/data-name="[^"]*"/g).map(pot => pot.match(/"([^"]*)"/i)[1]);
info("All Potions").then(array => {
const allpots = array.map(([item]) => item);
const missing = allpots.filter(item => !inbp.includes(item) && item != "Boost One" && item != "Boost Two" && item != "Boost Three" && item != "Boost Four" && item != "Boost Five");
if (GM_getValue('auth').match('Full')){
document.querySelector("#backpackitemct").innerHTML = `missing `
} else {
document.querySelector("#backpackitemct").innerHTML = `missing `
};
});
};
};
};
this.realOpen.apply(this, arguments);
};
};
async function blankOverlay(server,serverNo,rgaName,charId){
if (document.querySelector("#mmOnOff")){
document.querySelector("#mmOnOff").remove();
};
appsMenuClose();
$("body").append(`
`);
document.body.style.overflow = 'hidden';
document.querySelector("#blankOverlay").setAttribute('style',`background:#000000;padding:20px;`)
};
async function itemOnHover(){
const tip = document.getElementById('dhtmltooltip');
const observerCallback = async () => {
if (tip.innerHTML.match(/id="itemtable"/i)) {
observer.disconnect();
await parse(tip);
await itemOnHover();
};
};
const observer = new MutationObserver(observerCallback);
observer.observe(tip, { attributes: true, childList: true, subtree: true });
async function parse(tip){
if (tip.innerHTML.match(/Triworld Codex Chapter [0-9]+/i)){
const codex = tip.innerHTML.match(/(Triworld Codex Chapter [0-9]+)/i)[1];
tip.innerHTML = tip.innerHTML.replace('[Slot - Other]',' ')
const changefaction = await superfetch(`changefaction`);
const codexCheckDiv = document.querySelector("#codexCheck");
if (changefaction.match(codex) && codexCheckDiv){
document.querySelector("#codexCheck").innerHTML = `${codex} has already been activated on this account`
} else if (codexCheckDiv) {
document.querySelector("#codexCheck").innerHTML = `${codex} has not been activated on this account`
}
return;
};
let itemHoly = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Holy/i) || [0,0])[1]);
let itemArcane = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Arcane/i) || [0,0])[1]);
let itemShadow = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Shadow/i) || [0,0])[1]);
let itemFire = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Fire/i) || [0,0])[1]);
let itemKinetic = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Kinetic/i) || [0,0])[1]);
let itemChaos = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Chaos/i) || [0,0])[1]);
let itemHolyRes = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Holy Resist/i) || [0,0])[1]);
let itemArcaneRes = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Arcane Resist/i) || [0,0])[1]);
let itemShadowRes = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Shadow Resist/i) || [0,0])[1]);
let itemFireRes = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Fire Resist/i) || [0,0])[1]);
let itemKineticRes = parseInt((tip.innerHTML.replace(/,/g,'').match(/\+([0-9]+) Kinetic Resist/i) || [0,0])[1]);
let augsHoly = 0
let augsArcane = 0
let augsShadow = 0
let augsFire = 0
let augsKinetic = 0
let augsChaos = 0
let augsHolyRes = 0
let augsArcaneRes = 0
let augsShadowRes = 0
let augsFireRes = 0
let augsKineticRes = 0
const allAugs = tip.innerHTML.match(/[0-9]+_[0-9]+/g) || []
const augs = async (iid) => {
const aug = await superfetch(`item_rollover.php?id=${iid}`);
itemHoly -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Holy/i) || [0,0])[1]);
augsHoly += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Holy/i) || [0,0])[1]);
itemHolyRes -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Holy Resist/i) || [0,0])[1]);
augsHolyRes += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Holy Resist/i) || [0,0])[1]);
itemArcane -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Arcane/i) || [0,0])[1]);
augsArcane += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Arcane/i) || [0,0])[1]);
itemArcaneRes -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Arcane Resist/i) || [0,0])[1]);
augsArcaneRes += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Arcane Resist/i) || [0,0])[1]);
itemShadow -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Shadow/i) || [0,0])[1]);
augsShadow += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Shadow/i) || [0,0])[1]);
itemShadowRes -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Shadow Resist/i) || [0,0])[1]);
augsShadowRes += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Shadow Resist/i) || [0,0])[1]);
itemFire -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Fire/i) || [0,0])[1]);
augsFire += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Fire/i) || [0,0])[1]);
itemFireRes -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Fire Resist/i) || [0,0])[1]);
augsFireRes += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Fire Resist/i) || [0,0])[1]);
itemKinetic -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Kinetic/i) || [0,0])[1]);
augsKinetic += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Kinetic/i) || [0,0])[1]);
itemKineticRes -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Kinetic Resist/i) || [0,0])[1]);
augsKineticRes += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Kinetic Resist/i) || [0,0])[1]);
itemChaos -= parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Chaos/i) || [0,0])[1]);
augsChaos += parseInt((aug.replace(/,/g,'').match(/\+([0-9]+) Chaos/i) || [0,0])[1]);
};
await Promise.all(allAugs.map(augs));
if (augsHoly > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Holy/i,` +${itemHoly.toLocaleString()} (+${augsHoly}) Holy`) }
if (augsHolyRes > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Holy Resist/i,` +${itemHolyRes.toLocaleString()} (+${augsHolyRes}) Holy Resist`) }
if (augsArcane > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Arcane/i,` +${itemArcane.toLocaleString()} (+${augsArcane}) Arcane`) }
if (augsArcaneRes > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Arcane Resist/i,` +${itemArcaneRes.toLocaleString()} (+${augsArcaneRes}) Arcane Resist`) }
if (augsShadow > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Shadow/i,` +${itemShadow.toLocaleString()} (+${augsShadow}) Shadow`) }
if (augsShadowRes > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Shadow Resist/i,` +${itemShadowRes.toLocaleString()} (+${augsShadowRes}) Shadow Resist`) }
if (augsFire > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Fire/i,` +${itemFire.toLocaleString()} (+${augsFire}) Fire`) }
if (augsFireRes > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Fire Resist/i,` +${itemFireRes.toLocaleString()} (+${augsFireRes}) Fire Resist`) }
if (augsKinetic > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Kinetic/i,` +${itemKinetic.toLocaleString()} (+${augsKinetic}) Kinetic`) }
if (augsKineticRes > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Kinetic Resist/i,` +${itemKineticRes.toLocaleString()} (+${augsKineticRes}) Kinetic Resist`) }
if (augsChaos > 0){ tip.innerHTML = tip.innerHTML.replace(/ \+(.*?) Chaos/i,` +${itemChaos.toLocaleString()} (+${augsChaos}) Chaos`) }
};
};
async function itemDropMenu(server,serverNo,rgaName){
const menu = document.getElementById('dropmenudiv');
const observerCallback = async () => {
observer.disconnect();
const tip = document.getElementById('dhtmltooltip');
if (tip.innerHTML.match(/Triworld Codex Chapter [0-9]+/i)){
await codexMenuModify(menu,tip);
};
if (tip.innerHTML.match('Augment') && !tip.innerHTML.match('Add Augment Slot') && !tip.innerHTML.match('Remove All Augments') && !tip.innerHTML.match('Remove Augment')){
await augmentMenuModify(menu,tip);
}
if (tip.innerHTML.match('Badge of Absolution')){
await absolutionMenuModify(menu,tip);
}
await itemDropMenu(server,serverNo,rgaName);
};
const observer = new MutationObserver(observerCallback);
observer.observe(menu, { attributes: true, childList: true, subtree: true });
async function codexMenuModify(menu,tip){
const charId = (document.body.innerHTML.match(/outwar\.com\/page\?x=([0-9]+)/i) || [0,0])[1]
const codex = tip.innerHTML.match(/(Triworld Codex Chapter [0-9]+)/i)[1];
const newLink = document.createElement('a');
newLink.href = "javascript:void(0);";
newLink.onclick = async function() {
GM_addStyle(`#overlayWidget{text-align:center;}`)
await blankOverlay(server,serverNo,rgaName,charId);
document.querySelector("#overlayWidget").innerHTML = ' '
const rgaCharIds = document.body.innerHTML.replace(/[\n\r]/g,'').match(/ |