Created
November 30, 2017 17:08
-
-
Save bmodeprogrammer/00a20244faf1e79d62f3d97393d1cfac to your computer and use it in GitHub Desktop.
expedition, arena and filter auction and attack on circus automaticly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(function () { | |
"use strict"; | |
const waiting_timeA = 1 * 60000, | |
waiting_timeB = 1 * 60000, | |
monster_type = 0, // 0 - 3 | |
current_exp = 'kkkkkkkkkk', | |
words_missions = ['masmorras', 'Campo Viking'], | |
good_items = ['poirins', 'liths', 'zeindras', 'ibiwans', 'kerrannas', 'facilidade', 'bacias', 'sugos', 'delicadeza', 'magia', 'conflito', 'rapidez', 'brilho', 'rayols', 'Erradica', 'espalhan', 'lucro', 'thiens', 'frabos', 'perdi'], | |
merce = ['herege', 'grande mestre', 'lanceiro de elite'], | |
merceMinLevel = 60, | |
cura = 100, | |
melhorias = ['violeta', 'amolar', 'protector', 'verde'], | |
expeditions = (localStorage.getItem('exp') === 'true'), | |
working = (localStorage.getItem('work') === 'true'); | |
init(); | |
if (expeditions) { | |
const exp = document.getElementById('cooldown_bar_expedition'), | |
exp_wait = (exp.children[0].className.indexOf('cooldown_bar_fill_ready') < 0), | |
dungeon = document.getElementById('cooldown_bar_dungeon'), | |
dungeon_wait = (dungeon.children[0].className.indexOf('cooldown_bar_fill_ready') < 0), | |
isOnExp = document.querySelector('.expedition_name') !== null, | |
isOnDungeon = document.querySelector('input[value$=Masmorra]') !== null, | |
needToClick = document.querySelector('input[value=Normal]'), | |
pantheon = document.querySelector('a[title=Pantheon]'), | |
isOnPan = document.querySelector('#quest_header_accepted') !== null, | |
ct = document.getElementById('cooldown_bar_ct'), | |
ct_wait = (ct.children[0].className.indexOf('cooldown_bar_fill_ready') < 0), | |
not = document.getElementById('linknotification'); | |
not && not.click(); | |
if (!exp_wait && dungeon_wait && !ct_wait) { | |
try { | |
if (isOnPan) { | |
const finish = document.querySelector('.quest_slot_button_finish'); | |
finish && finish.click(); | |
const restart = document.querySelector('.quest_slot_button_restart'); | |
restart && restart.click(); | |
const cooldown = document.querySelector('#quest_header_cooldown'); | |
if (cooldown === null) { | |
const missions = document.querySelectorAll('.contentboard_slot_inactive'); | |
let flag = false; | |
for (let m of missions) { | |
const title = m.children[1].textContent; | |
let acept; | |
if (title.indexOf(current_exp) >= 0 && title.indexOf('tua escolha') >= 0) { | |
acept = m.querySelector('a'); | |
acept && acept.click(); | |
flag = true; | |
break; | |
} | |
for (let words of words_missions) { | |
if (title.indexOf(words) >= 0) { | |
flag = true; | |
acept = m.querySelector('a'); | |
acept && acept.click(); | |
break; | |
} | |
} | |
if (flag) break; | |
} | |
if (!flag) { | |
document.querySelector('input[value$=novas]').click(); | |
} | |
} | |
} else { | |
pantheon.click(); | |
} | |
} catch (err) { | |
console.error(err); | |
} finally { | |
console.log('will reload soon'); | |
setTimeout(function () { | |
location.reload(); | |
}, Math.floor(Math.random() * waiting_timeB) + waiting_timeA); | |
} | |
} else { | |
console.log("dungeon_wait", dungeon_wait); | |
if (exp_wait && false) { | |
if (isOnExp) { | |
document.querySelectorAll('.expedition_button')[monster_type].click(); | |
} else { | |
exp.children[2].click(); | |
} | |
} else if (dungeon_wait && false) { | |
if (!ct_wait) { | |
if (document.querySelector('.attack')) { | |
var attacks = Array.from(document.querySelector('.attack').parentNode.parentNode.parentNode.childNodes) | |
.filter(e => e.nodeType == Node.ELEMENT_NODE); | |
attacks.shift(); | |
attacks.reduce((arr, elem) => { | |
var importantTds = Array.from(elem.childNodes).filter(e => e.nodeType == Node.ELEMENT_NODE); | |
arr.push({ | |
nivel: parseInt(importantTds[1].textContent), | |
attack: Array.from(importantTds[3].childNodes).filter(e => e.nodeType == Node.ELEMENT_NODE)[0] | |
}); | |
return arr; | |
}, []).sort((a, b) => a.nivel - b.nivel)[1].attack.click(); | |
} else { | |
ct.children[2].click(); | |
} | |
} | |
} else { | |
if (isOnDungeon || needToClick) { | |
if (needToClick) { | |
needToClick.click(); | |
} else { | |
Array.from(document.querySelectorAll('img')).filter(e => e.src.indexOf('combatloc.gif') >= 0)[0].click(); | |
} | |
} else { | |
dungeon.children[2].click(); | |
} | |
setTimeout(() => location.reload(), 60000 * 10); | |
} | |
} | |
} | |
getInfoOnLeilao(); | |
getInfoOnLeilaoMerce(); | |
function init() { | |
const mainMenu = document.querySelector('#mainmenu'), | |
work = document.createElement('a'), | |
exp = document.createElement('a'); | |
exp.className = 'menuitem'; | |
work.className = 'menuitem'; | |
work.style = 'cursor:pointer'; | |
exp.style = 'cursor:pointer'; | |
exp.appendChild(document.createTextNode(expeditions ? ' Stop Expeditions' : 'Expeditions')); | |
work.appendChild(document.createTextNode(working ? 'Stop Work' : 'Work')); | |
work.addEventListener('click', function (e) { | |
if (!working) { | |
localStorage.setItem('work', 'true'); | |
work.textContent = 'Stop work'; | |
} else { | |
localStorage.setItem('work', 'false'); | |
} | |
location.reload(); | |
}); | |
exp.addEventListener('click', function (e) { | |
if (!expeditions) { | |
localStorage.setItem('exp', 'true'); | |
exp.textContent = 'Stop Expeditions'; | |
} else { | |
localStorage.setItem('exp', 'false'); | |
} | |
location.reload(); | |
}); | |
mainMenu.insertBefore(exp, mainMenu.children[6]); | |
mainMenu.insertBefore(work, mainMenu.children[7]); | |
} | |
function getInfoOnLeilao() { | |
const itemType = document.querySelector('select[name=itemType]'); | |
if (itemType) { | |
const body = document.querySelector('form[name=filterForm]').querySelector('tbody'), | |
tr = document.createElement('tr'), | |
td = document.createElement('td'), | |
button = document.createElement('button'); | |
td.colSpan = 2; | |
td.style = 'text-align:center'; | |
button.type = "button"; | |
button.className = 'awesome-button'; | |
button.appendChild(document.createTextNode('Custom Filter')); | |
td.appendChild(button); | |
tr.appendChild(td); | |
body.appendChild(tr); | |
button.addEventListener('click', function () { | |
let tooltip; | |
const divs = Array.from(document.querySelectorAll('[data-price-gold]')).filter(e => { | |
tooltip = JSON.parse(e.get('data-tooltip'))[0][0][0].toLowerCase(); | |
for (let item of good_items) { | |
if (~tooltip.indexOf(item)) return true; | |
} | |
for (let m of merce) { | |
if (~tooltip.indexOf(m) && parseInt(e.get('data-level')) >= merceMinLevel) | |
return true; | |
} | |
for (let m of melhorias) { | |
if (~tooltip.indexOf(m) && parseInt(e.get('data-level')) >= merceMinLevel) | |
return true; | |
} | |
}).map(e => e.parentElement.parentElement.parentElement.parentElement); | |
const actionTable = document.getElementById('auction_table'), | |
tbody = actionTable.querySelector('tbody'); | |
tbody.innerHTML = ''; | |
const size = divs.length; | |
for (let i = 0, div, divB; i < size; i += 2) { | |
div = divs[i]; | |
const tr = document.createElement('tr'), | |
td = document.createElement('td'), | |
tdB = document.createElement('td'); | |
td.width = '50%'; | |
tdB.width = '50%'; | |
td.appendChild(div); | |
tr.appendChild(td); | |
if ((i + 1) !== size) { | |
divB = divs[i + 1]; | |
tdB.appendChild(divB); | |
tr.appendChild(tdB); | |
} | |
tbody.appendChild(tr); | |
} | |
}); | |
} | |
} | |
function getInfoOnLeilaoMerce() { | |
const itemType = document.querySelector('select[name=itemType]'); | |
if (itemType) { | |
const body = document.querySelector('form[name=filterForm]').querySelector('tbody'), | |
tr = document.createElement('tr'), | |
td = document.createElement('td'), | |
button = document.createElement('button'); | |
td.colSpan = 2; | |
td.style = 'text-align:center'; | |
button.type = "button"; | |
button.className = 'awesome-button'; | |
button.appendChild(document.createTextNode('Custom Filter Merce')); | |
td.appendChild(button); | |
tr.appendChild(td); | |
body.appendChild(tr); | |
button.addEventListener('click', function () { | |
let items; | |
const divs = Array.from(document.querySelectorAll('[data-price-gold]')).filter(e => { | |
items = JSON.parse(e.get('data-tooltip'))[0]; | |
for (let item of items) { | |
if (~item[0].indexOf('Cura +')) { | |
if (parseInt(item[0].split('+')[1]) > cura) | |
return true; | |
} | |
} | |
}).map(e => e.parentElement.parentElement.parentElement.parentElement); | |
const actionTable = document.getElementById('auction_table'), | |
tbody = actionTable.querySelector('tbody'); | |
tbody.innerHTML = ''; | |
const size = divs.length; | |
for (let i = 0, div, divB; i < size; i += 2) { | |
div = divs[i]; | |
const tr = document.createElement('tr'), | |
td = document.createElement('td'), | |
tdB = document.createElement('td'); | |
td.width = '50%'; | |
tdB.width = '50%'; | |
td.appendChild(div); | |
tr.appendChild(td); | |
if ((i + 1) !== size) { | |
divB = divs[i + 1]; | |
tdB.appendChild(divB); | |
tr.appendChild(tdB); | |
} | |
tbody.appendChild(tr); | |
} | |
}); | |
} | |
} | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment