Originally Posted by
packetlossc
Has anyone run any Artificing with the most recent script? For some reason it seems to think resources (other than my grandmaster artificers) are needed for gather tasks.
Gateway select first person and script can select additional assets by this(below code), after gathering "refining" needs coal if I remember correctly... not sure what kind issue you have, script changes are mostly done on section what handels "character switch".
Code:
* Selects the highest level asset for the i'th button in the list. Uses an iterative approach
* in order to apply a sufficient delay after the asset is assigned
*
* @param {Array} The list of buttons to use to click and assign assets for
* @param {int} i The current iteration number. Will select assets for the i'th button
* @param {Deferred} jQuery Deferred object to resolve when all of the assets have been assigned
*/
function SelectItemFor(buttonListIn, i, def, prof) {
buttonListIn[i].click();
WaitForState("").done(function() {
var $assets = $("div.modal-item-list a").has("img[src*='_Resource_'],img[src*='_Assets_']");
var $persons = $("div.modal-item-list a").has("img[src*='_Follower_']");
var quality = [".Special",".Gold",".Silver",".Bronze"];
var ic, $it;
var clicked = false;
// Try to avoid using up higher rank assets needlessly
if (prof.taskName === "Leadership") {
var mercenarys = $("div.modal-item-list a.Bronze:contains('Mercenary')");
var guards = $("div.modal-item-list a.Bronze:contains('Guard')");
var footmen = $("div.modal-item-list a.Bronze:contains('Footman')");
if (mercenarys.length) { clicked = true; mercenarys[0].click(); }
else if (guards.length) { clicked = true; guards[0].click(); }
else if (footmen.length) { clicked = true; footmen[0].click(); }
}
// check resources & assets for best quality, in descending order
for (ic in quality) {
$it = $assets.filter(quality[ic]);
if ($it.length) {
$it[0].click();
clicked = true;
break;
}
}
// if no asset was selected, check for persons for best speed, in descending order
if (!clicked) {
for (ic in quality) {
$it = $persons.filter(quality[ic]);
if ($it.length) {
$it[0].click();
clicked = true;
break;
}
}
}
// if nothing was found at all, return immediately (skip other optional slots)
if (!clicked) {
$("button.close-button").click();
console.log("Nothing more to click..");
WaitForState("").done(function() {
// Let main loop continue
def.resolve();
});
}
console.log("Clicked item");
WaitForState("").done(function() {
// Get the new set of select buttons created since the other ones are removed when the asset loads
var buttonList = $("h3:contains('Optional Assets:')").closest("div").find("button");
if(i < buttonList.length - 1) {
SelectItemFor(buttonList, i+1, def, prof);
}
else {
// Let main loop continue
def.resolve();
}
});
});
}