|
The question is not of any priority, it is just one more function that can be easily implemented and taken care of.
The code is also given below, just that it would be better if PC himself who has done such a good job would take it with the rest of the automation. Afterall automation is what PC is doing so well.
The function after adding in module 'skill'
function skill_exec(){
var levelUp = false;
delete boss.actions.skill;
if (boss.preferences.skill == 'none') return;
if (boss.new_level)
levelUp = true;
else {
if ( boss.preferences.job == 'none') return;
var header = document.getElementById('app8743457343_statusMenu');
var divs = Utils.getElementsByClassName('wrap3outer', header);
for (var i = 0; i < divs.length; i++) {
var str = divs[i].innerHTML;
str = str.replace(/,/g,'');
var re = /Level Up/;
var result = str.match(re);
if (result)
levelUp = true;
}
}
if (boss.preferences.skill == "recovery_max" && Page.c_page == 'boss'){
var header = document.getElementById('app8743457343_content');
var announcement = Utils.getElementsByClassName('announcement', header)[0].innerHTML;
announcement = announcement.replace(/,/g,'');
var result = announcement.match(/You have ?\$?([0-9]+)/);
var points = 0;
if (result)
points = parseInt(result[1]);
if (!(points >= 2))
levelUp = false;
}
if (levelUp) {
var action = new Object();
action.message = "Leveling up...";
action.page = 'boss';
action.func = 'skill_levelUp';
action.params = [];
action.time = 0;
boss.actions.skill = action;
} else {
var action = new Object();
action.message = "Waiting for next level up...";
action.page = 'boss';
action.time = boss.actions.jobs.time + 1;
boss.actions.skill = action;
}
}
function skill_levelUp(params, timer){
var obj = Utils.getElementsByXPath('//a[contains(@href, "type=' + boss.preferences.skill + '")]')[0];
var url = obj.href;
Timer.start(url, "Increasing skill...", 3);
}
function skill_preferencesInterface(prefs){
if (boss.preferences.skill == undefined) boss.preferences.skill = 'none';
var div = document.createElement('div');
div.innerHTML = '<label>Skill to automatically level up: </label>';
var select = document.createElement('select');
var option;
select.name = 'skillList';
option = '<option>None<option>Attack Strength<option>Defense Strength<option>Max Energy<option>Max Health<option>Stamina';
select.innerHTML = option;
div.appendChild(select);
prefs.form.insertBefore(div, prefs.button);
}
function skill_preferencesHandler(form, boss) {
var select = form.elements.namedItem('skillList');
if (boss.preferences.skill != select.options[select.selectedIndex].value) {
boss.preferences.skill = select.options[select.selectedIndex].value;
return true;
}
return false;
}
|