.*/i,'').match(/event,'([0-9]+)'/g);
if (itemsId){
for (let i = 0; i < itemsId.length; i++) {
const iid = itemsId[i].match(/[0-9]+/i)[0];
const item = await superfetch(`item_rollover.php?id=${iid}`);
const parse = item.match(/color:#([A-Za-z0-9]+)" align="left">(.*?)<\/td>/i)
const name = parse[2]
const gems = 4-(item.match(/\/images\/gemslot2\.jpg/) ? item.match(/\/images\/gemslot2\.jpg/g).length : 0);
const augs = item.match(/img width="9" style="border:1px solid #666666;margin:2px;"/) ? item.match(/img width="9" style="border:1px solid #666666;margin:2px;"/g).length : 0;
const open = item.match(/\/images\/augslot\.jpg/) ? item.match(/\/images\/augslot\.jpg/g).length : 0;
const atk = parseInt((item.replace(/(\([^)]*\)|<[^>]*>|,|\s)/g, '').match(/\+([0-9]+)ATK/i) || [0,0])[1])
const hp = parseInt((item.replace(/(\([^)]*\)|<[^>]*>|,|\s)/g, '').match(/\+([0-9]+)HP/i) || [0,0])[1])
const maxrage = parseInt((item.replace(/(\([^)]*\)|<[^>]*>|,|\s)/g, '').match(/\+([0-9]+)maxrage/i) || [0,0])[1])
if (gems != 4){
const rarity = parse[1];
const upgrades = await info("Cost to Gem");
const cost = upgrades[rarity][gems];
tableData.push(`
✘ |
|
${name} |
${gems} |
${augs+open} |
${open} |
${Math.ceil((atk+hp)*0.15/cost)} |
${Math.ceil(maxrage*0.15/cost)} |
`);
};
};
};
};
await Promise.all(charIdArray.map(inventory));
document.querySelector("#itemStorageDiv").innerHTML = `
 |
 |
Item |
Gems |
Aug Slots |
Open Augs |
ATK+HP Gained per Point with one gem added |
Max Rage gained per Point with one gem added |
${tableData.join('')}
`
const itemLinks = document.querySelectorAll(".itemLink")
for (let i = 0; i < itemLinks.length; i++) {
const link = itemLinks[i]
const iid = link.outerHTML.match(/id="iid([0-9]+)"/)[1]
document.querySelector(`#iid${iid}`).addEventListener('click',function(){
document.querySelector(`#check${iid}`).checked = true;
});
document.querySelector(`#delete${iid}`).addEventListener('click',function(){
document.querySelector(`#row${iid}`).remove();
});
};
sortableTables();
};
async function appMobAttacker(server,serverNo,rgaName,charId){
GM_addStyle(`
#mobAtkWidget {text-align:center;}
.mob-div > input {width: 100px;font-size: 10px;padding: 5px;margin:5px;}
.mob-div > img {height: 100px;width: 100px;border-radius: 15px;border:2px SOLID #313131;cursor: pointer;margin:5px;}
.mob-div {display: inline-block;margin-bottom: 1rem;font-family: monospace;font-size: 12px;text-align: center;}
#authSlider{display:none;}
.mob-selected{border: 3px #00CC00 SOLID !important;padding: 3px !important;animation: mob-selected 1s infinite;}
@keyframes mob-selected{0% {filter: saturate(100%);} 50% {filter: saturate(250%); } 100% {filter: saturate(100%);}}
`)
document.querySelector("#overlayWidget").innerHTML = `
`
if (GM_getValue('savedRgas') != "no sessions saved" && GM_getValue('savedRgas')){
const rgas = GM_getValue('savedRgas').match(/rg_sess_id=[A-Za-z0-9]+&suid=[0-9]+&serverid=[0-9]+/g);
await loadChars(rgas);
} else {
await loadChars([`rg_sess_id=${rgaName}&suid=${charId}&serverid=${serverNo}`]);
};
async function loadChars(rgas){
const strings = []
const parseChars = async (string) => {
const session = string.match(/rg_sess_id=([A-Za-z0-9]+)/)[1];
const auth = await mmplus(`AuthCheck|${session}`);
if (!auth.match("Full")){
return;
};
const startingId = string.match(/suid=([0-9]+)/i)[1];
const ajax = await superfetch(`ajax/accounts.php?t_serv=${serverNo}&${string}`);
const chars = ajax.match(/"id":"[0-9]+"/g).map(id => id.match(/[0-9]+/i));
chars.forEach(async char => {
strings.push(string.replace(startingId,char));
});
};
await Promise.all(rgas.map(parseChars));
let mobs = {
"seeping":{charNames:[],charIds:[],quest:2092,id:4379,mobName:'SEEPING',roomNum:32876,mobImg:'images/mobs/chaosgolem5.jpg'},
"deluged":{charNames:[],charIds:[],quest:2093,id:4380,mobName:'DELUGED',roomNum:32878,mobImg:'images/mobs/chaosgolem2.jpg'},
"volatile":{charNames:[],charIds:[],quest:2094,id:4381,mobName:'VOLATILE',roomNum:32877,mobImg:'images/mobs/chaosgolem4.jpg'},
"lorren3":{charNames:[],charIds:[],quest:1532,id:3731,mobName:'PERPETUAL',roomNum:26616,mobImg:'images/mobs/mobc62.jpg'},
"aestor3":{charNames:[],charIds:[],quest:1891,id:3920,mobName:'ROENOV',roomNum:27528,mobImg:'images/mobs/mobm93.jpg'},
"aestor4":{charNames:[],charIds:[],quest:1916,id:3921,mobName:'SKITTOR',roomNum:27527,mobImg:'images/mobs/mobz2.jpg'},
"aestor5":{charNames:[],charIds:[],quest:1917,id:3922,mobName:'ERGON',roomNum:27526,mobImg:'images/mobs/mobi18.jpg'},
"ferocity":{charNames:[],charIds:[],quest:2035,id:4038,mobName:'ULKOR',roomNum:28122,mobImg:'images/mobs/mobc48.jpg'},
"class":{charNames:[],charIds:[],quest:2033,id:4035,mobName:'YOUNIS',roomNum:28113,mobImg:'images/mobs/mobk9.jpg'},
"hovok":{charNames:[],charIds:[],quest:0,id:4046,mobName:'HOVOK',roomNum:28123,mobImg:'images/mobs/mobm91.jpg'},
"rank5":{charNames:[],charIds:[],quest:1941,id:3931,mobName:'DARKLORD',roomNum:27608,mobImg:'images/mobs/moba76.jpg'},
"rank10":{charNames:[],charIds:[],quest:1942,id:3932,mobName:'FIREPRIEST',roomNum:27609,mobImg:'images/mobs/mobh85.jpg'},
"rank15":{charNames:[],charIds:[],quest:1943,id:3933,mobName:'ENCHANTER',roomNum:27632,mobImg:'images/mobs/mobi58.jpg'},
"rank20":{charNames:[],charIds:[],quest:1944,id:3934,mobName:'DIVINER',roomNum:27633,mobImg:'images/mobs/mobz78.jpg'},
"normok2":{charNames:[],charIds:[],quest:2047,id:4050,mobName:'CORVOK',roomNum:27624,mobImg:'images/mobs/mobd12.jpg'},
"invader":{charNames:[],charIds:[],quest:2359,id:5274,mobName:'INVADER',roomNum:37878,mobImg:'images/mobs/mobh31.png'},
"thief":{charNames:[],charIds:[],quest:0,id:3519,mobName:'THIEF',roomNum:26199,mobImg:'images/mobs/mobz59.jpg'},
"betrayer":{charNames:[],charIds:[],quest:0,id:3520,mobName:'BETRAYER',roomNum:26200,mobImg:'images/mobs/mobz41.jpg'},
"plant":{charNames:[],charIds:[],quest:0,id:4392,mobName:'PLANT',roomNum:31686,mobImg:'images/mobs/woodsplant.jpg'},
"gveiled":{charNames:[],charIds:[],quest:0,id:5301,mobName:'GUARD',roomNum:42619,mobImg:'images/mobs/veiledguard.png'},
"kveiled":{charNames:[],charIds:[],quest:0,id:5302,mobName:'KEEPER',roomNum:42620,mobImg:'images/mobs/veiledkeeper.png'},
"aprecision":{charNames:[],charIds:[],quest:0,id:5481,mobName:'PRECISION',roomNum:0,mobImg:'images/mobs/owmob784.png'},
"dprecision":{charNames:[],charIds:[],quest:0,id:5482,mobName:'PRECISION',roomNum:0,mobImg:'images/mobs/owmob176.png'},
"vprecision":{charNames:[],charIds:[],quest:0,id:5483,mobName:'PRECISION',roomNum:0,mobImg:'images/mobs/owmob1129.png'}
};
const circArray = [];
const oorArray = [];
async function scanChars(string){
const profile = await superfetch(`profile?${string}`);
const kbp = await superfetch(`ajax/backpackcontents.php?tab=key&${string}`);
const veiledteleporter = kbp.match(/data-name="Veiled Teleporter"/i);
const veiledidol = kbp.match(/data-name="Veiled Idol"/i);
const groveinsignia = kbp.match(/data-name="Grove Insignia"/i);
const id = string.match(/rg_sess_id=([A-Za-z0-9]+)/i)[1] + '&' + string.match(/suid=([0-9]+)/i)[1];
const name = profile.match(/
(.*?)<\/font>/i)[1];
const rage = parseInt(profile.replace(/[\n\r,]/g, '').match(/(.*?)/i)[1]);
const circ = profile.match(/Circumspect/i) ? "Yes" : "No";
const factionMatch = profile.match(/FACTION<\/font><\/b><\/td>\n.*?([A-Za-z]+) \((.*?)\)/i)
const faction = factionMatch[1];
const loyalty = factionMatch[2] === "" ? 0 : parseInt(factionMatch[2]);
if (rage < 1000){
oorArray.push(name);
} else {
for (const mobName of Object.keys(mobs)) {
const mob = mobs[mobName];
const quest = mob.quest == 0 ? "noquest" : await superfetch(`quest_info.php?questnum=${mob.quest}&${string}`);
if (quest != "error"){
if (mobName == "hovok"){
const quantum = await superfetch(`quest_info.php?questnum=${2038}&${string}`);
const explosive = await superfetch(`quest_info.php?questnum=${2039}&${string}`);
const violent = await superfetch(`quest_info.php?questnum=${2040}&${string}`);
const onslaught = await superfetch(`quest_info.php?questnum=${2041}&${string}`);
if (quantum != "error" || explosive != "error" || violent != "error" || onslaught != "error"){
const search = await superfetch(`mob_search.php?target=${mob.id}&${string}`);
if (search.match(/Quest help activated/i)){
mob.charNames.push(name);
mob.charIds.push(id);
};
};
} else if (mobName.match("veiled")){
if (mobName == "gveiled" && veiledteleporter){
const search = await superfetch(`mob_search.php?target=${mob.id}&${string}`);
if (search.match(/Quest help activated/i)){
mob.charNames.push(name);
mob.charIds.push(id);
};
} else if (mobName == "kveiled" && veiledidol){
const search = await superfetch(`mob_search.php?target=${mob.id}&${string}`);
if (search.match(/Quest help activated/i)){
mob.charNames.push(name);
mob.charIds.push(id);
};
};
} else if (mobName.match("precision")){
if (mobName == "aprecision" && faction == "Alvar" && loyalty >= 1 && groveinsignia){
const search = await superfetch(`mob_search.php?target=${mob.id}&${string}`);
if (search.match(/Quest help activated/i)){
mob.charNames.push(name);
mob.charIds.push(id);
};
} else if (mobName == "dprecision" && faction == "Delruk" && loyalty >= 1 && groveinsignia){
const search = await superfetch(`mob_search.php?target=${mob.id}&${string}`);
if (search.match(/Quest help activated/i)){
mob.charNames.push(name);
mob.charIds.push(id);
};
} else if (mobName == "vprecision" && faction == "Vordyn" && loyalty >= 1 && groveinsignia){
const search = await superfetch(`mob_search.php?target=${mob.id}&${string}`);
if (search.match(/Quest help activated/i)){
mob.charNames.push(name);
mob.charIds.push(id);
};
};
} else {
const search = await superfetch(`mob_search.php?target=${mob.id}&${string}`);
if (search.match(/Quest help activated/i)){
mob.charNames.push(name);
mob.charIds.push(id);
};
};
};
};
};
};
await Promise.all(strings.map(scanChars));
const divs = [];
if (oorArray.length > 0){
divs.push(``);
};
for (const mobName of Object.keys(mobs)) {
const mob = mobs[mobName]
if (mob.charIds.length > 0){
divs.push(`
`);
};
};
document.querySelector("#mobAtkWidget").innerHTML = `
CLICK MOB IMAGES TO SELECT TARGETS
${divs.join('')}
`
const textBoxes = document.querySelectorAll(".list-of-chars");
textBoxes.forEach(i => {
i.addEventListener('click',function(){
i.select();
});
});
const mobPics = document.querySelectorAll(".mob-img");
mobPics.forEach(i => {
i.addEventListener('click',function(){
i.classList.toggle('mob-selected');
});
});
document.querySelector("#attackMobs").addEventListener('click',async function(){
const cmd = [`NewMobAtk|rganame|${server}|`];
const selectedMobs = document.querySelectorAll(".mob-selected");
selectedMobs.forEach(i => {
const mobName = i.outerHTML.match(/name="([^"]*)"/i)[1];
const selectedChars = i.outerHTML.match(/alt="([^"]*)"/i)[1];
cmd.push(`${mobName}|${selectedChars.replace(/amp;/g,'')}`);
});
document.querySelector("#attackMobs").remove();
await mmplus(cmd.join("\n"));
GM_addStyle('#authSlider{display:revert !important;}');
});
};
};
async function appGladiator(server,serverNo,rgaName,charId){
GM_addStyle(`
div.app-glad-div{ display:flex; height:96%; justify-content:center; }
div.app-glad-div-outer{ height:100%; }
div.app-glad-div-inner{ background-color:#060818; border-radius:10px !important; color:#FFFFFF; padding:20px; margin:1rem;box-shadow:0 5px 5px 0 rgba(0,0,0,1);transition: height 0.5s ease;}
div.glad-hide{opacity:0;transition: opacity 0.5s ease;}
img.glad-mob-img{ width:150px; height:150px; border-radius:10px; margin-bottom:1rem;cursor:pointer;box-shadow:0 5px 5px 0 rgba(0,0,0,1);}
#gladRankings{height:100%;overflow:auto;flex:1;margin-bottom:1rem;box-shadow:0 5px 5px 0 rgba(0,0,0,1);}
#rankingsTable{text-align:left;}
input.glad-txt{background:#FFFFFF !important;color:#000000 !important;opacity:1 !important;}
div.glad-skills > div > img {width:25px;height:25px;margin:4px;border-radius:10px;box-shadow:0 3px 3px 0 rgba(0,0,0,0.5);background:#000000;transition:0.25s ease-out;}
#available,#active,#missing{margin-top:0.5rem;}
img.glad-caster-selected{border:2px #00CC00 SOLID !important;padding:3px !important;}
`)
const kbp = await superfetch('ajax/backpackcontents.php?tab=key');
const admission = kbp.match(/data-name="Gladiator Arena Admission"/i);
if (admission){
const ajax = await superfetch('ajax_changeroomb');
const room = ajax.match(/"curRoom":"([0-9]+)"/i)[1];
if (room == "28031"){
document.querySelector("#overlayWidget").innerHTML = `
Current Rankings
Available Skills & Potions
`
const gladTxt = await superfetch('gladiator');
const parser = new DOMParser();
const gladHtml = parser.parseFromString(gladTxt, 'text/html');
const divQuest = gladHtml.querySelectorAll(".divQuest");
const gladNames = [];
divQuest.forEach(div => {
if (div.innerHTML.match('Will retreat in')){
gladNames.push(div.innerHTML.match(/(.*?)<\/h1>/i)[1]);
};
});
const mobArray = [];
const gladiators = async (name) => {
const ajax = await superfetch('ajax_changeroomb');
const regex = new RegExp(`"name":"${name}","level":"[0-9]+","rage":"[0-9]+","h":"[^"]*","encid":"[^"]*","mobId":"[0-9]+","spawnId":"[0-9]+","image":"[^"]*"`,'i');
const string = ajax.match(regex).toString();
const mobImg = 'images/' + string.match(/"image":"([^"]*)"/i)[1];
const spawnId = string.match(/"spawnId":"([0-9]+)"/)[1]
const mobId = string.match(/"mobId":"([0-9]+)"/i)[1]
mobArray.push(`
`);
};
await Promise.all(gladNames.map(gladiators))
document.querySelector("#gladAvailable").innerHTML = mobArray.join('
')
const allGlads = document.querySelectorAll(".glad-mob-img");
allGlads.forEach(img => {
img.addEventListener('click', async function(){
GM_addStyle('div.glad-hide{opacity:1 !important;}');
const spawnId = img.outerHTML.match(/id="([0-9]+)"/i)[1];
const mobId = img.outerHTML.match(/alt="([0-9]+)"/i)[1];
const mobName = img.outerHTML.match(/name="([^"]*)"/i)[1];
document.querySelector("#atkGlad").outerHTML = ``
await appGladiatorGetRankings(mobId,charId);
await appGladiatorColumnRight(server,charId);
await appGladiatorSelect();
document.querySelector("#refreshRankings").addEventListener('click', async function(){
document.querySelector("#gladRankings").innerHTML = `
`
await appGladiatorGetRankings(mobId,charId);
});
document.querySelector("#atkGlad").addEventListener('click', async function(){
const stopAttacks = document.querySelector("#stopAttacks").value.replace(/,/g,'');
const stopDamage = document.querySelector("#stopDamage").value.replace(/,/g,'');
if (isNaN(stopAttacks) || isNaN(stopDamage) || stopAttacks == '' || stopDamage == ''){
alert('ERROR: Please enter target amounts for number of attacks and damage');
} else {
await mmplus(`MultiMobAtk|rganame|${server}|${charId}|${stopAttacks}|${spawnId}|${stopDamage}`);
};
});
});
});
document.querySelector("#castBoosts").addEventListener('click', async function(){
const confirmBoost = confirm('Casting boosts will cost 25 points');
if (confirmBoost){
await superfetch('userbuff.php?castboost=1',true);
await superfetch('userbuff.php?castboost=1',true);
await superfetch('userbuff.php?castboost=1',true);
await superfetch('userbuff.php?castboost=1',true);
await superfetch('userbuff.php?castboost=1',true);
await appGladiatorColumnRight(server,charId);
};
});
document.querySelector("#castSelected").addEventListener('click', async function() {
const selectedImages = document.querySelector("#available").querySelectorAll("img.glad-caster-selected");
const imgIds = Array.from(selectedImages).map(img => img.id);
await mmplus(`Cast|rganame|${server}|${charId}|${imgIds.join(',')}`);
});
document.querySelector("#refreshAll").addEventListener('click', async function(){
document.querySelector("#active").innerHTML = `
`
document.querySelector("#available").innerHTML = `
`
document.querySelector("#missing").innerHTML = `
`
await appGladiatorColumnRight(server,charId);
});
} else {
document.querySelector("#overlayWidget").innerHTML = `Must be in the Gladiator Arena
`
document.querySelector("#goTo28031").addEventListener('click', async function(){
await goToRoomNum(server,charId,28031);
});
};
} else {
document.querySelector("#overlayWidget").innerHTML = `Missing Gladiator Admission key
`
document.querySelector("#goTo50").addEventListener('click', async function(){
await goToRoomNum(server,charId,50);
});
};
};
async function appGladiatorGetRankings(mobId,charId){
const gladPageTxt = await superfetch(`gladiator?mobid=${mobId}`,true);
const parser = new DOMParser();
const gladPageHtml = parser.parseFromString(gladPageTxt, 'text/html');
const divs = Array.from(gladPageHtml.querySelectorAll('.mt-lg-0 .grid-item')).map(div => div.innerHTML);
let columns = divs.indexOf("Atks") + 1;
const rankArrays = [];
let tempArray = [];
divs.forEach((div, index) => {
tempArray.push(div);
if ((index + 1) % (columns) === 0) {
rankArrays.push(tempArray);
tempArray = [];
}
});
const rows = [];
let myRow = ['No attacks found'];
rankArrays.forEach(col => {
let row = ''
for (let i = 0; i < columns; i++) {
row += `${col[i]} | `
};
rows.push(`${row}
`);
if (col.toString().match(`id=${charId}`)){
myRow = col.slice(0, -1);
};
});
document.querySelector("#gladRankings").innerHTML = `
${rows.join('').replace(//g,'')}
`
document.querySelector("#myRank").innerHTML = `
`
};
async function appGladiatorColumnRight(server,charId,spawnId){
const profile = await superfetch('profile',true);
let allCastAndBp = [];
const allCast = profile.match(/
/g) || [];
for (let i = 0; i < allCast.length; i++) {
allCastAndBp.push(allCast[i].match(/src="([^"]*)"/)[1].replace(/\/skills\/\.\./,'').replace(/ /g,'%20'));
};
let skillsArray = [];
let skillIdArray = [];
const classEndpoints = ['cast_skills.php','cast_skills.php?C=4','cast_skills.php?C=5','cast_skills.php?C=6','cast_skills.php?C=7']
const skillClasses = await Promise.all(classEndpoints.map(endpoint => fetch(endpoint).then(res => res.text())));
for (let i = 0; i < skillClasses.length; i++) {
const skillIds = skillClasses[i].match(/loadskill\([0-9]+\)/g) || [];
for (let i = 0; i < skillIds.length; i++) {
skillIdArray.push(skillIds[i].match(/[0-9]+/i))
};
};
const skillInfos = await Promise.all(skillIdArray.map(endpoint => fetch(`skills_info.php?id=${endpoint}`).then(res => res.text())));
for (let i = 0; i < skillInfos.length; i++) {
const info = skillInfos[i]
if (info.match(``)){
const skillName = info.match(/(.*?)<\/h5>/i)[1]
const skillImg = info.match(/style="[^"]*" src="([^"]*)"/i)[1]
const skillId = info.match(/value="([0-9]+)"/i)[1]
const skillText = info.replace(/'/g,'').match(/.*[\n\r](.*)<\/div>/)[1]
if (!profile.match(skillImg)){
skillsArray.push(`
`)
};
};
};
const potionBp = await fetch('ajax/backpackcontents.php?tab=potion').then(res => res.text());
const allPots = potionBp.match(/data-iid="[0-9]+" id="[^"]*" class="[^"]*" src="[^"]*" alt=".*?"/g);
for (let i = 0; i < allPots.length; i++) {
const potion = allPots[i]
const potId = potion.match(/data-iid="([0-9]+)"/i)[1]
const potImg = potion.match(/src="([^"]*)"/i)[1]
const potName = potion.match(/alt="([^"]*)"/i)[1]
if (!profile.replace(/skills\/\.\.\//g,'').match(potImg)){
skillsArray.push(`
`);
allCastAndBp.push(potImg.replace(/ /g,'%20'));
};
};
const infoAllPots = await info("All Potions")
const missingPotsArray = [];
for (let i = 0; i < infoAllPots.length; i++) {
const potName = infoAllPots[i][0];
const potImg = infoAllPots[i][1];
if (!allCastAndBp.includes(potImg) && !potImg.match(/images\/items\/icon_vial_[A-Za-z0-9]+\.jpg/i)) {
missingPotsArray.push(`
`)
};
};
document.querySelector("#active").innerHTML = allCast.join('').replace(/skills\/\.\.\//g,'');
document.querySelector("#available").innerHTML = skillsArray.join('');
document.querySelector("#missing").innerHTML = missingPotsArray.join('');
};
async function appGladiatorSelect(){
const warning = ['/images/rfury.jpg','/images/items/haste.png','/images/items/sfury.jpg','/images/items/whiskeypot.png','/images/items/itemz80.gif','/images/items/pvpimmune.jpg'];
$('#available').on('click','img',(function() {
if (this.outerHTML.match(/name="([^"]*)"/i)){
const img = this.outerHTML.match(/src="([^"]*)"/i)[1];
const name = this.outerHTML.match(/name="([^"]*)"/i)[1];
const hasSelectedClass = $(this).hasClass('glad-caster-selected');
if (warning.includes(img) && !hasSelectedClass){
const confirmSelect = confirm(`Are you sure you want to select ${name}?`);
if (confirmSelect){
$(this).toggleClass("glad-caster-selected");
};
} else {
$(this).toggleClass("glad-caster-selected");
};
} else {
$(this).toggleClass("glad-caster-selected");
};
}));
};
async function appMobRaider(server,serverNo,rgaName,charId){
GM_addStyle(`
div.mobImgDiv {display: inline-block;font-size: 10px;text-align: center;font-family: monospace,monospace;height: 105px;width: 100px;margin-left:3px;margin-right:3px;margin-bottom:20px;}
img.mobImg {box-shadow: 5px 5px 5px rgba(0, 0, 0, 1);cursor: pointer;width: 95px;height: 95px;border-radius: 5px;margin-bottom: 5px;transition: 0.25s ease-out;}
.mob-selected{border: 4px #00CC00 SOLID !important;width: 95px !important;height: 95px !important;padding: 3px !important;}
div.dataDivs {text-align:left;overflow:auto;height:95%;display:inline-block;margin:0.4%;padding:20px;background-color:#000000;border-radius:10px;box-shadow: 5px 5px 5px rgba(0, 0, 0, 1);width:24%;}
#topDiv {text-align:center;height:50%;overflow:auto;}
#bottomDiv{overflow:auto;height:50%;width:100%;padding:10px;text-align:center;}
button.btn-mm{font-size:12px;padding:0.5rem;}
#selectedRaidMob{animation: tileanimate 2s infinite;box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);}
@keyframes tileanimate{0% {filter: saturate(100%);} 50% {filter: saturate(250%); } 100% {filter: saturate(100%);}}
`);
document.querySelector("#overlayWidget").innerHTML = `
SELECTED MOBS
None
Characters required: 0
Characters selected: 0
SELECTED CHARACTERS
AVAILABLE CHARACTERS
SAVED GROUPS

Locker

Morrik

Grouz

Crawling

Conductor

Demonic

Elexocutioner

Chaotic

Sharkrat

Vullianne

Kaggar

Cheigon

Zyssi

Priest

Serpent

Steed

Sorcerer

Doomlord

Novice

Great

Grand

1 Rival

2 Rival

3 Rival

4 Rival

5 Rival

6 Rival

7 Rival

8 Rival

9 Rival

10 Rival
`
const mobs = document.querySelectorAll('.mobImg');
for (var i = 0; i < mobs.length; i++){
mobs[i].addEventListener('click', async function(){
const selectedMobs = [];
const minJoiners = [0];
this.classList.toggle('mob-selected');
const selected = document.querySelectorAll('.mob-selected');
selected.forEach(mob => {
selectedMobs.push(mob.outerHTML.match(/id="([^"]*)"/i)[1]);
minJoiners.push(parseInt(mob.outerHTML.match(/alt="([^"]*)"/i)[1]));
});
document.querySelector("#mobsList").innerHTML = selectedMobs.join(', ');
const minMax = Math.max(...minJoiners);
document.querySelector("#minCount").innerHTML = minMax
});
};
const profile = await superfetch(`profile?id=${charId}`);
const crew = (profile.match(/(.*?)<\/a>/i) || ['',''])[1];
const myaccount = await superfetch('myaccount');
const regex = new RegExp(`[A-Za-z0-9]+<\\/a><\\/td> | [0-9]+<\\/td> | ${crew}<\\/td>`,'g')
const chars = myaccount.replace(/[\n\r]/g,'').replace(/ style="text-align: center;"/g,'').replace(/ <\/a>/g,'').match(regex).map(m => `<${m.match(/suid=[0-9]+&serverid=[0-9]+">.*?<\/a>/)}`);
const rows = [];
for (var c = 0; c < chars.length; c++){
const id = chars[c].match(/suid=([0-9]+)/i)[1];
const name = chars[c].replace(/<.*?>/g,'');
const check = ``;
rows.push(`${check} | ${name} | `);
};
document.querySelector("#availableCharacters").innerHTML = ``
await loadSavedGroups();
async function loadSavedGroups(){
const groups = [];
let count = 0
for (let i = 0; i < 10000000; i++) {
const value = GM_getValue(`mobRaiderGroup(${i})`);
if (value){
count++
const groupname = value.split(',').slice(0, 1);
const groupchars = value.split(',').slice(1);
const html = `
|
${groupname} |
[del] |
`
groups.push(html);
} else {
break;
};
};
document.querySelector("#groupList").innerHTML = `
`
const sel = document.querySelectorAll('.select-group')
const del = document.querySelectorAll('.delete-group')
for (let i = 0; i < sel.length; i++) {
sel[i].addEventListener('click', async function(){
document.querySelectorAll('.checkbox').forEach(checkbox => checkbox.checked = false);
const charIds = (this.outerHTML.match(/alt="([^"]*)"/i)[1]).split(',');
charIds.forEach(async id => {
var checkbox = document.getElementById(id);
if (checkbox) checkbox.checked = true;
await updateSelectedChars();
});
});
del[i].addEventListener('click', async function(){
const num = this.outerHTML.match(/id="group([0-9]+)"/i)[1]
GM_deleteValue(`mobRaiderGroup(${num})`);
document.querySelector(`#groupRow${num}`).remove();
});
};
};
const boxes = document.querySelectorAll('.checkbox')
for (let i = 0; i < boxes.length; i++) {
boxes[i].addEventListener('click', async function(){
await updateSelectedChars();
});
};
async function updateSelectedChars(){
const allChecked = document.querySelectorAll('.checkbox:checked')
document.querySelector("#charCount").innerHTML = allChecked.length;
const nameList = (Array.from(allChecked).map(node => node.outerHTML.match(/name="([^"]*)"/i)[1])).join(',');
document.querySelector("#nameList").innerHTML = nameList;
};
document.querySelector("#saveGroup").addEventListener('click', async function(){
if (document.querySelector("#charCount").innerHTML == "0"){
alert('Please select characters before trying to save a group');
return;
};
var name = prompt("Enter a name for the group");
if (name == ''){
alert ('You did not enter a name. The group was not saved');
} else {
const allChecked = document.querySelectorAll('.checkbox:checked');
const idList = (Array.from(allChecked).map(node => node.outerHTML.match(/id="([0-9]+)"/i)[1])).join(',');
const listName = name.replace(/ /g,'').replace(/,/g,'');
for (let i = 0; i < 10000000; i++) {
const value = GM_getValue(`mobRaiderGroup(${i})`);
if (!value){
GM_setValue(`mobRaiderGroup(${(i)})`, listName + ',' + idList);
await loadSavedGroups();
break;
};
};
};
});
document.querySelector("#raidMob").addEventListener('click', async function(){
const reqChars = parseInt(document.querySelector("#minCount").innerHTML)
const selChars = parseInt(document.querySelector("#charCount").innerHTML)
if (selChars >= reqChars){
const allChecked = document.querySelectorAll('.checkbox:checked');
const idList = (Array.from(allChecked).map(node => node.outerHTML.match(/id="([^"]*)"/i)[1])).join(',');
const mobs = [];
const selected = document.querySelectorAll('.mob-selected');
selected.forEach(mob => {
mobs.push(mob.outerHTML.match(/id="([^"]*)"/i)[1]);
mob.classList.toggle('mob-selected');
document.querySelector("#mobsList").innerHTML = 'None';
});
await mmplus(`RaidMob|rganame|${server}|${mobs.join(',')}|${idList}`);
} else {
alert(`Please select ${reqChars} characters to raid with`);
};
});
};
async function casterMenuOpen() {
travelMenuClose();
appsMenuClose();
searchMenuClose();
document.querySelector("#btnCaster > img").classList.toggle('rotate180');
GM_addStyle (`#btnCaster > img {transition: transform 0.5s ease;}`);
GM_addStyle (`.rotate180 {transform: rotate(180deg);}`);
document.querySelector("#btnCaster").removeEventListener("click",casterMenuOpen);
setTimeout(function() {document.querySelector("#btnCaster").addEventListener("click", casterMenuClose);},1000);
if (casterMenuCreated == false){
const profile = await superfetch('profile');
let potsArray = [];
const potionBp = await fetch('ajax/backpackcontents.php?tab=potion').then(res => res.text());
const allPots = potionBp.match(/data-iid="[0-9]+" id="[^"]*" class="[^"]*" src="[^"]*"/g);
for (let i = 0; i < allPots.length; i++) {
const potion = allPots[i]
const potId = potion.match(/data-iid="([0-9]+)"/i)[1]
const potImg = potion.match(/src="([^"]*)"/i)[1]
if (!profile.replace(/skills\/\.\.\//g,'').match(potImg)){
potsArray.push(`
`);
};
};
let skillsArray = [];
let skillIdArray = [];
const classEndpoints = ['cast_skills.php','cast_skills.php?C=4','cast_skills.php?C=5','cast_skills.php?C=6','cast_skills.php?C=7']
const skillClasses = await Promise.all(classEndpoints.map(endpoint => fetch(endpoint).then(res => res.text())));
for (let i = 0; i < skillClasses.length; i++) {
const skillIds = skillClasses[i].match(/loadskill\([0-9]+\)/g) || [];
for (let i = 0; i < skillIds.length; i++) {
skillIdArray.push(skillIds[i].match(/[0-9]+/i))
};
};
const skillInfos = await Promise.all(skillIdArray.map(endpoint => fetch(`skills_info.php?id=${endpoint}`).then(res => res.text())));
for (let i = 0; i < skillInfos.length; i++) {
const info = skillInfos[i]
if (info.match(``)){
const skillName = info.match(/(.*?)<\/h5>/i)[1]
const skillImg = info.match(/style="[^"]*" src="([^"]*)"/i)[1]
const skillId = info.match(/value="([0-9]+)"/i)[1]
const skillText = info.replace(/'/g,'').match(/.*[\n\r](.*)<\/div>/)[1]
if (!profile.match(skillImg)){
skillsArray.push(`
`)
};
};
};
const casterHtml = `
Skills
${skillsArray.join(' ')}
Potions
${potsArray.join(' ')}
`
var image = document.querySelector("#btnCaster").getBoundingClientRect();
var newDiv = document.createElement('div');
newDiv.id = 'casterDiv';
newDiv.classList.toggle('widget');
newDiv.innerHTML = casterHtml;
newDiv.style.position = 'absolute';
newDiv.style.top = image.top + window.scrollY + 'px';
newDiv.style.left = image.left + window.scrollX-650 + 'px';
document.body.appendChild(newDiv);
$(function () {
$('#casterDiv').on('click','img',(function() {
$(this).toggleClass("caster-selected");
}));
});
};
let serverNo;
let server;
if (window.location.toString().match('sigil')){
serverNo = 1
server = 'sigil'
};
if (window.location.toString().match('torax')){
serverNo = 2
server = 'torax'
};
const charId = document.body.innerHTML.match(/outwar\.com\/page\?x=([0-9]+)/i)[1]
document.querySelector("#casterSelectAll").addEventListener('click', function() {
$("#casterSkills > img").addClass("caster-selected");
});
document.querySelector("#casterDeselectAll").addEventListener('click', function() {
$("#casterSkills > img").removeClass("caster-selected");
});
document.querySelector("#casterCastAll").addEventListener('click', async function() {
const selectedImages = document.querySelector("#casterDiv").querySelectorAll("img.caster-selected");
const imgIds = Array.from(selectedImages).map(img => img.id);
await mmplus(`Cast|rganame|${server}|${charId}|${imgIds.join(',')}`);
await casterMenuClose();
});
GM_addStyle (`#casterDiv {animation: moveAnimation 0.5s ease forwards;position:fixed;}`)
GM_addStyle (`@keyframes moveAnimation {0% {width:700px;height:0px;position:fixed;top:0px;} 100% {width:700px;height:535px;position:fixed;top:45px;}}`)
casterMenuCreated = true;
};
async function searchMenuOpen() {
travelMenuClose();
appsMenuClose();
casterMenuClose();
document.querySelector("#btnSearch > img").classList.toggle('rotate180');
GM_addStyle (`#btnSearch > img {transition: transform 0.5s ease;}`);
GM_addStyle (`.rotate180 {transform: rotate(180deg);}`);
document.querySelector("#btnSearch").removeEventListener("click", searchMenuOpen);
document.querySelector("#btnSearch").addEventListener("click", searchMenuClose);
if (searchMenuCreated == false){
const searchHtml = `
Search
`
var image = document.querySelector("#btnSearch").getBoundingClientRect();
var newDiv = document.createElement('div');
newDiv.id = 'searchDiv';
newDiv.classList.toggle('widget');
newDiv.innerHTML = searchHtml;
newDiv.style.position = 'absolute';
newDiv.style.top = image.top + window.scrollY + 'px';
newDiv.style.left = image.left + window.scrollX-220 + 'px';
document.body.appendChild(newDiv);
document.querySelector("#treasurySearch").addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
const treasuryLookupItem = document.querySelector("#treasurySearch").value.replace(/ /g,'+')
window.location.href = `treasury?search_for=${treasuryLookupItem}`
};
});
document.querySelector("#rgaSearch").addEventListener("keyup", async function(event) {
if (event.keyCode === 13) {
document.body.style.pointerEvents = 'none';
document.querySelector("#container").setAttribute('style','opacity:0.25; transition: opacity 0.5s ease;');
document.querySelector("body > center > div.sub-header-container").setAttribute('style','opacity:0.25; transition: opacity 0.5s ease;');
const startingCharId = document.body.innerHTML.match(/
`;
const charDropdown = document.body.innerHTML.replace(/[\n\r]/g,'').match(/