Greasy Fork 还支持 简体中文。

Neverwinter gateway - Professions Robot

Automatically selects professions for empty slots

目前為 2015-06-15 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Neverwinter gateway - Professions Robot
  3. // @description Automatically selects professions for empty slots
  4. // @namespace https://greasyfork.org/scripts/9812-neverwinter-gateway-professions-robot/
  5. // @include http://gateway*.playneverwinter.com/*
  6. // @include https://gateway*.playneverwinter.com/*
  7. // @include http://gateway.*.perfectworld.eu/*
  8. // @include https://gateway.*.perfectworld.eu/*
  9. // @require https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js
  10. // @resource jqUI_CSS https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/cupertino/jquery-ui.css
  11. // @originalAuthor Mustex/Bunta
  12. // @modifiedBy NW gateway Professions Bot Developers & Contributors
  13.  
  14. // @version 4.1
  15. // @license http://creativecommons.org/licenses/by-nc-sa/3.0/us/
  16. // @grant GM_getValue
  17. // @grant GM_setValue
  18. // @grant GM_listValues
  19. // @grant GM_deleteValue
  20. // @grant GM_addStyle
  21. // @grant GM_getResourceText
  22. // ==/UserScript==
  23.  
  24. /*
  25. Developers & Contributors
  26. - BigRedBrent
  27. - Bluep
  28. - dlebedynskyi
  29. - Frankescript
  30. - Kakoura
  31. - mac-nw
  32. - Nametaken
  33. - noonereally
  34. - Numberb
  35. - Phr33d0m
  36. - Rotten_mind
  37. - WloBeb
  38.  
  39. RELEASE NOTES
  40. 4.1
  41. - Added failsafe to prevent script getting stuck when can't claim task result
  42. - AddProfile() improved (thanks dlebedynskyi)
  43. - Added Failed task tracker to prevent script lockup on failed tasks
  44. - Added settings copy tab
  45. - Added script version display
  46. - Added Settings Listing to Advanced tab
  47. - Added Item Listing to Advanced tab (thanks WloBeb script idea)
  48. - Override display at visit tab
  49. - Various fixes
  50. 4.0
  51. - Per slot task & profile allocation tab (functional)
  52. - Settings are saved per account / char.
  53. - Settings are saved via event - should fix the freeze (save button removed).
  54. - Chars always loaded from the model.
  55. - Settings UI updated on log in.
  56. - UI functions add for easier refactoring
  57. - Per char setting override.
  58. - Per char automatic daily SCA.
  59. - Profession next visit tab + reset added.
  60. - Inital support for multiple tab run in the same browser.
  61. - Translation support (thanks WloBeb)
  62. - Profile adjustments
  63. - addProfile() for easier profiles (thanks WloBeb, dlebedynskyi)
  64.  
  65. Check Changelog.txt for the full changelog:
  66. http://rawgit.com/Phr33d0m/NW-Profession-Bot/master/Changelog.txt
  67. */
  68.  
  69. // Make sure it's running on the main page, no frames
  70.  
  71. var scriptVersion = 4.1;
  72. var forceSettingsResetOnUpgrade = true;
  73. var forceResetOnVerBelow = 3.5;
  74.  
  75. if(window.self !== window.top) {
  76. throw "";
  77. }
  78. var current_Gateway = _select_Gateway();
  79. // Set global console variables
  80. var fouxConsole = {
  81. log: function() {},
  82. info: function() {},
  83. error: function() {},
  84. warn: function() {}
  85.  
  86. };
  87. var console = unsafeWindow.console || fouxConsole;
  88. var chardiamonds = [];
  89. var zaxdiamonds = 0;
  90. var chargold = [];
  91. var definedTask = {};
  92. var translation = {};
  93. var failedTasksList = [];
  94. var failedProfiles = {};
  95. var collectTaskAttempts = new Array(9); var k = 9; while (k) {collectTaskAttempts[--k] = 0}; //collectTaskAttempts.fill(0); js6
  96. var antiInfLoopTrap = {// without this script sometimes try to start the same task in infinite loop (lags?)
  97. prevCharName: "unknown", // character name which recently launched a task
  98. prevTaskName: "unknown", // name of the task previously launched
  99. startCounter: 0, // how many times the same character starts the same task
  100. currCharName: "unknown", // character name which try to launch new task
  101. currTaskName: "unknown", // name of the new task to launch
  102. trapActivation: 15 // number of repetition to activation trap
  103. };
  104. // Page Reloading function
  105. // Every second the page is idle or loading is tracked
  106. var loading_reset = false; // Enables a periodic reload if this is toggled on by the Auto Reload check box on the settings panel
  107. var s_paused = false; // extend the paused setting to the Page Reloading function
  108.  
  109. // Include JqueryUI CSS
  110. var jqUI_CssSrc = GM_getResourceText("jqUI_CSS");
  111. /*jqUI_CssSrc = jqUI_CssSrc.replace (/url\(images\//g, "url(https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/dark-hive/images/");*/
  112. jqUI_CssSrc = jqUI_CssSrc.replace(/url\(images\//g, "url(https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/cupertino/images/");
  113. jqUI_CssSrc = jqUI_CssSrc.replace(/font-size: 1\.1em/g, "font-size: 0.9em");
  114. GM_addStyle(jqUI_CssSrc);
  115.  
  116.  
  117. function _select_Gateway() { // Check for Gateway used to
  118. if(window.location.href.indexOf("gatewaytest") > -1) { // detect gatewaytest Url
  119. console.log("GatewayTEST detected");
  120. return "http://gatewaytest.playneverwinter.com";
  121. } else if(window.location.href.indexOf("nw.ru.perfectworld") > -1) {
  122. console.log("GatewayRU detected");
  123. return "http://gateway.nw.ru.perfectworld.eu";
  124. } else { // must go somewhere
  125. console.log("Gateway detected");
  126. return "http://gateway.playneverwinter.com";
  127. }
  128. }
  129.  
  130. (function() {
  131. var $ = unsafeWindow.$;
  132.  
  133. //MAC-NW
  134. $.fn.waitUntilExists = function(handler, shouldRunHandlerOnce, isChild) {
  135. var found = 'found';
  136. var $this = $(this.selector);
  137. var $elements = $this.not(function() {
  138. return $(this).data(found);
  139. }).each(handler).data(found, true);
  140. if (!isChild) {
  141. (window.waitUntilExists_Intervals = window.waitUntilExists_Intervals || {})[this.selector] = window.setInterval(function() {
  142. $this.waitUntilExists(handler, shouldRunHandlerOnce, true);
  143. }, 500);
  144. } else if (shouldRunHandlerOnce && $elements.length) {
  145. window.clearInterval(window.waitUntilExists_Intervals[this.selector]);
  146. }
  147. return $this;
  148. }
  149. // MAC-NW - Wait for tooltip to come up so we can alter the list
  150. $('.tooltip-menu button').waitUntilExists(function() {
  151. // Tooltip has open menu itemtooltip
  152. if ($('button.tooltip-menu button[data-url-silent^="/inventory/item-open"]') && !$('.tooltip-menu div.tooltip-openall').length && !$('.tooltip-menu button[data-url-silent^="/inventory/item-open"]').hasClass('disabled'))
  153. try {
  154. var thisItem = eval("client.dataModel.model." + $('.tooltip-menu button[data-url-silent^="/inventory/item-open"]').attr('data-url-silent').split("=")[1]);
  155. if (thisItem.count > 1) {
  156. if (thisItem.count >= 99)
  157. thisItem.count = 99;
  158. var openAllClick = "for (i = 1; i <= " + thisItem.count + "; i++){ window.setTimeout(function () {client.sendCommand('GatewayInventory_OpenRewardPack', '" + thisItem.uid + "');}, 500); }";
  159. $('div.tooltip-menu').append('<div class="input-field button menu tooltip-openall"><div class="input-bg-left"></div><div class="input-bg-mid"></div><div class="input-bg-right"></div>\
  160. <button class="&nbsp;" onclick="' + openAllClick + '">Open All (' + thisItem.count + ')</button></div>');
  161. //$('a.nav-dungeons').trigger('click'); window.setTimeout(function(){ $('a.nav-inventory').trigger('click'); },2000);
  162. }
  163. } catch (e) {
  164. console.log("ERROR: Did not succeed to add open all tooltip.");
  165. }
  166. });
  167.  
  168. $('.vendor-quantity-block span.attention').waitUntilExists(function() {
  169. if ($('.vendor-quantity-block span.attention span').length)
  170. $('.vendor-quantity-block span.attention').replaceWith('<div class="input-field button"><div class="input-bg-left"></div><div class="input-bg-mid"></div><div class="input-bg-right"></div><button onclick="$(\'.modal-confirm input\').val(\'' + $(".vendor-quantity-block span.attention span").text() + '\');">All (' + $(".vendor-quantity-block span.attention span").text() + ')</button></div>');
  171. });
  172.  
  173. $('div.notification div.messages li').waitUntilExists(function() {
  174. if ($("div.notification div.messages li").length > 2)
  175. $("div.notification div.messages li").eq(0).remove();
  176. });
  177.  
  178. // Always disable SCA tutorial if its active
  179. $('#help-dimmer.help-cont.whenTutorialActive').waitUntilExists(function() {
  180. client.toggleHelp();
  181. });
  182.  
  183. //MAC-NW
  184.  
  185. var state_loading = 0; // If "Page Loading" takes longer than 30 seconds, reload page (maybe a javascript error)
  186. var state_loading_time = 30; // default of 30 seconds
  187. var state_idle = 0; // If the page is idle for longer than 60 seconds, reload page (maybe a javascript error)
  188. var state_idle_time = 120; // default of 120 seconds
  189. var reload_hours = [2, 5, 8, 11, 14, 17, 20, 23]; // logout and reload every three hours - 2:29 - 5:29 - 8:29 - 11:29 - 14:29 - 17:29 - 20:29 - 23:29
  190. var last_location = ""; // variable to track reference to page URL
  191. var reload_timer = setInterval(function() {
  192. if (!s_paused) {
  193. if (antiInfLoopTrap.startCounter >= antiInfLoopTrap.trapActivation) {
  194. unsafeWindow.location.href = current_Gateway;
  195. return;
  196. }
  197. if (loading_reset) {
  198. var loading_date = new Date();
  199. var loading_sec = Number(loading_date.getSeconds());
  200. var loading_min = Number(loading_date.getMinutes());
  201. var loading_hour = Number(loading_date.getHours());
  202. if (reload_hours.indexOf(loading_hour) >= 0 && loading_min == 29 && loading_sec < 2) {
  203. console.log("Auto Reload");
  204. unsafeWindow.location.href = current_Gateway;
  205. return;
  206. }
  207. }
  208.  
  209. // check for errors
  210. if ($("title").text().match(/Error/) || $("div.modal-content h3").text().match(/Disconnected/)) {
  211. console.log("Error detected - relogging");
  212. unsafeWindow.location.href = current_Gateway;
  213. return;
  214. }
  215.  
  216. if ($("div.loading-image:visible").length) {
  217. last_location = location.href;
  218. state_idle = 0;
  219. if (state_loading >= state_loading_time) {
  220. console.log("Page Loading too long");
  221. state_loading = 0;
  222. location.reload();
  223. } else {
  224. state_loading++;
  225. console.log("Page Loading ...", state_loading + "s");
  226. }
  227. }
  228. // TODO: Add check for gateway disconnected
  229. //<div class="modal-content" id="modal_content"><h3>Disconnected from Gateway</h3><p>You have been disconnected.</p><button type="button" class="modal-button" onclick="window.location.reload(true);">Close</button>
  230.  
  231.  
  232. /* Can't use idle check with dataModel methods
  233. else if (location.href == last_location) {
  234. state_loading = 0;
  235. if (state_idle >= state_idle_time) {
  236. console.log("Page Idle too long");
  237. state_idle = 0;
  238. unsafeWindow.location.href = current_Gateway ; // edited by RottenMind
  239. }
  240. else {
  241. state_idle++;
  242. // comment out to avoid console spam
  243. //console.log("Page Idle ...", state_idle + "s");
  244. }
  245. }
  246. */
  247. else {
  248. last_location = location.href;
  249. state_loading = 0;
  250. state_idle = 0;
  251. }
  252. }
  253. }, 1000);
  254. })();
  255.  
  256. (function() {
  257.  
  258. addTranslation();
  259.  
  260. /**
  261. * Add a string of CSS to the main page
  262. *
  263. * @param {String} cssString The CSS to add to the main page
  264. */
  265.  
  266. function AddCss(cssString) {
  267. var head = document.getElementsByTagName('head')[0];
  268. if (!head)
  269. return;
  270. var newCss = document.createElement('style');
  271. newCss.type = "text/css";
  272. newCss.innerHTML = cssString;
  273. head.appendChild(newCss);
  274. }
  275.  
  276. function countLeadingSpaces(str) {
  277. return str.match(/^(\s*)/)[1].length;
  278. }
  279.  
  280. // Setup global closure variables
  281. var $ = unsafeWindow.jQuery;
  282. var timerHandle = 0;
  283. var dfdNextRun = $.Deferred();
  284. var curCharNum = 0; // current character counter
  285. var lastCharNum = curCharNum;
  286. var curCharName = '';
  287. var curCharFullName = '';
  288. var chartimers = {};
  289. var maxLevel = 25;
  290. var delay = {
  291. SHORT: 1000,
  292. MEDIUM: 5000,
  293. LONG: 30000,
  294. MINS: 300000,
  295. DEFAULT: 10000, // default delay
  296. TIMEOUT: 60000, // delay for cycle processing timeout
  297. };
  298.  
  299. var lastDailyResetTime = null;
  300.  
  301.  
  302. // Forcing settings clear !
  303. var ver = parseFloat(GM_getValue("script_version", 0));
  304. if ((ver < forceResetOnVerBelow) && forceSettingsResetOnUpgrade) {
  305. var str = "Detected an upgrade from old version or fresh install.<br />Procceding will wipe all saved settings.<br />Please set characters to active after log in.";
  306. $('<div id="dialog-confirm" title="Setting wipe confirm">' + str + '</div>').dialog({
  307. resizable: true,
  308. width: 500,
  309. modal: false,
  310. buttons: {
  311. "Continue": function() {
  312. $( this ).dialog( "close" );
  313. window.setTimeout(function() {
  314. var keys = GM_listValues();
  315. for (i = 0; i < keys.length; i++) {
  316. var key = keys[i];
  317. GM_deleteValue(key);
  318. }
  319. GM_setValue("script_version", scriptVersion);
  320. window.setTimeout(function() {
  321. unsafeWindow.location.href = current_Gateway;
  322. }, 50);
  323. }, 0);
  324. },
  325. Cancel: function() {
  326. $( this ).dialog( "close" );
  327. }
  328. }
  329. });
  330. return;
  331. }
  332.  
  333.  
  334. function addProfile(profession, profile, base){
  335. maxLevel = maxLevel || 25;
  336. definedTask = definedTask || {};
  337. //general prototype for profession
  338. var professionBase = {
  339. taskListName: typeof(profession) ==='string' ? profession : profession.taskListName, // Friendly name used at the UI
  340. taskName: typeof(profession) ==='string' ? profession : profession.taskName, // String used at the gateway
  341. taskDefaultPriority: 2, // Priority to allocate free task slots: 0 - High, 1 - Medium, 2 - Low
  342. taskActive: true,
  343. taskDefaultSlotNum: 0,
  344. taskDescription: "",
  345. profiles: []
  346. };
  347.  
  348.  
  349. //creating new profession or using existing one
  350. var professionSet = (typeof profession === 'object')
  351. ? jQuery.extend(true, professionBase, profession)
  352. : definedTask[profession] || professionBase;
  353. if(!professionSet) {return;}
  354. if(!definedTask[profession]) {definedTask[profession] = professionSet;}
  355. if(!profile) {return;}
  356.  
  357. //profile prototype
  358. var profileBase = {
  359. profileName: 'Add profile name',
  360. isProfileActive: true,
  361. level: {}
  362. };
  363. //getting new profile formated
  364. var newProfile = jQuery.extend(true, profileBase, profile),
  365. baseProfile;
  366. //getting base to extend
  367. base = base || (professionSet.taskListName === 'Leadership' ? 'XP' : 'default');
  368. if(base && typeof base === 'string') {
  369. var existing = professionSet.profiles.filter(function(e) {return e.profileName === base;});
  370. if(existing && existing.length) {baseProfile = existing[0];}
  371. }
  372.  
  373. //setting levels
  374. var baseLevels = baseProfile ? baseProfile.level : [],
  375. rec = 0;
  376. for(var i = 0; i <= maxLevel; i++) {
  377. //recur has priority
  378. if (rec > 0 ){
  379. rec -=1;
  380. //setting empty array to handle later by fallback
  381. newProfile.level[i] = newProfile.level[i] || [];
  382. }
  383. if(newProfile.level && newProfile.level[i]){
  384. //override for arrays
  385. if (Array.isArray(newProfile.level[i]) && newProfile.level[i].length){
  386. //cancel rec since new array is defined
  387. rec = 0;
  388. //process array
  389. var ind = newProfile.level[i].indexOf('+');
  390. if (ind>-1){
  391. var def = newProfile.level[i].splice(0, ind);
  392. var tail = newProfile.level[i].splice(1, newProfile.level[i].length);
  393. def = def.concat(baseLevels[i] || [], tail || []);
  394. newProfile.level[i] = def;
  395. }
  396. }//process '+N'
  397. else if (typeof newProfile.level[i] == 'string'
  398. && newProfile.level[i][0] === '+'){
  399. rec = parseInt(newProfile.level[i].replace(/\D/g,''));
  400. rec = rec > 0 ? rec : 0;
  401. //setting empty array to handle later by fallback
  402. newProfile.level[i] = [];
  403. rec -=1;
  404. }
  405. }
  406. //falback to base if not defined
  407. else{
  408. var baseLevel = baseLevels[i] || [];
  409. newProfile.level[i] = baseLevel;
  410. }
  411. //fallback from empty array to copy one before
  412. if (Array.isArray(newProfile.level[i]) && !newProfile.level[i].length && i> 0){
  413. newProfile.level[i] = newProfile.level[i-1];
  414. }
  415. }
  416. console.info("profile added ",newProfile.profileName, newProfile);
  417. professionSet.profiles.push(newProfile);
  418. }
  419.  
  420. /*
  421. * Tasklist can be modified to configure the training you want to perform.
  422. * The configurable options window sets how many profession slots you want to use for each profession.
  423. * The level array below for each professions specifies the tasks you want to learn at each crafting level.
  424. * Each craft slot will pick the first task that meets requirements.
  425. * See http://pastebin.com/VaGntEha for Task Name Map.
  426. * Some names above do not match, use below code to check:
  427. * var tasks = client.dataModel.model.craftinglist['craft_' + profname].entries.filter(function(entry) { return entry.def && entry.def.displayname == taskname; }); tasks[0].def.name;
  428. */
  429.  
  430. definedTask["Leadership"] = {
  431. taskListName: "Leadership", // Friendly name used at the UI
  432. taskName: "Leadership", // String used at the gateway
  433. taskDefaultPriority: 2, // Priority to allocate free task slots: 0 - High, 1 - Medium, 2 - Low
  434. taskActive: true,
  435. taskDefaultSlotNum: 9,
  436. taskDescription: "",
  437. profiles: [{
  438. profileName: "AD",
  439. isProfileActive: true,
  440. level: {
  441. 0: ["Leadership_Tier0_Intro_1"],
  442. 1: ["Leadership_Tier0_Intro_5", "Leadership_Tier0_Intro_4", "Leadership_Tier0_Intro_3", "Leadership_Tier0_Intro_2"],
  443. 2: ["Leadership_Tier1_Feedtheneedy", "Leadership_Tier1_2_Guardduty", "Leadership_Tier1_2_Training"],
  444. 3: ["Leadership_Tier1_Feedtheneedy", "Leadership_Tier1_2_Guardduty", "Leadership_Tier1_2_Training"],
  445. 4: ["Leadership_Tier1_Feedtheneedy", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty", "Leadership_Tier1_2_Training"],
  446. 5: ["Leadership_Tier1_4_Protect", "Leadership_Tier1_5_Explore", "Leadership_Tier1_2_Guardduty"],
  447. 6: ["Leadership_Tier1_4_Protect", "Leadership_Tier1_5_Explore", "Leadership_Tier1_2_Guardduty"],
  448. 7: ["Leadership_Tier1_4_Protect", "Leadership_Tier1_5_Explore", "Leadership_Tier1_2_Guardduty"],
  449. 8: ["Leadership_Tier1_4_Protect", "Leadership_Tier1_5_Explore", "Leadership_Tier1_2_Guardduty"],
  450. 9: ["Leadership_Tier1_4_Protect", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  451. // Begin prioritizing "Battle Undead"
  452. 10: ["Leadership_Tier2_10_Battle", "Leadership_Tier1_4_Protect", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  453. 11: ["Leadership_Tier2_10_Battle", "Leadership_Tier1_4_Protect", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  454. 12: ["Leadership_Tier2_10_Battle", "Leadership_Tier1_4_Protect", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  455. // Add "protect diamonds rare" and the patrol quest as a backup
  456. 13: ["Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier2_10_Battle", "Leadership_Tier1_4_Protect", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  457. 14: ["Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier2_10_Battle", "Leadership_Tier1_4_Protect", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  458. 15: ["Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier2_10_Battle", "Leadership_Tier1_4_Protect", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  459. // AD Production mode: Spellplague + Battle Undead
  460. 16: ["Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  461. 17: ["Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier3_17_Deliver", "Leadership_Tier2_12_Taxes", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  462. 18: ["Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier3_17_Deliver", "Leadership_Tier2_12_Taxes", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  463. 19: ["Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier3_17_Deliver", "Leadership_Tier2_12_Taxes", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  464. // 20
  465.  
  466. 20: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_20_Destroy", "Leadership_Tier2_12_Taxes",
  467. "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  468. ],
  469. 21: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_20_Destroy", "Leadership_Tier2_12_Taxes",
  470. "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  471. ],
  472. 22: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_20_Destroy",
  473. "Leadership_Tier2_12_Taxes", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  474. ],
  475. 23: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_20_Destroy",
  476. "Leadership_Tier2_12_Taxes", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  477. ],
  478. 24: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_20_Destroy",
  479. "Leadership_Tier2_12_Taxes", "Leadership_Tier4_24r_Killdragon", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  480. ],
  481. 25: ["Leadership_Tier4_25r_Huntexperiment", "Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier3_13r_Protectdiamonds",
  482. "Leadership_Tier3_20_Destroy", "Leadership_Tier2_12_Taxes", "Leadership_Tier4_24r_Killdragon", "Leadership_Tier4_25_Battleelementalcultists", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle",
  483. "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  484. ],
  485. },
  486. }, {
  487. profileName: "XP",
  488. isProfileActive: true,
  489. level: {
  490. 0: ["Leadership_Tier0_Intro_1"],
  491. 1: ["Leadership_Tier0_Intro_5", "Leadership_Tier0_Intro_4", "Leadership_Tier0_Intro_3", "Leadership_Tier0_Intro_2"],
  492. 2: ["Leadership_Tier1_Feedtheneedy", "Leadership_Tier1_2_Guardduty", "Leadership_Tier1_2_Training"],
  493. 3: ["Leadership_Tier1_Feedtheneedy", "Leadership_Tier1_2_Guardduty", "Leadership_Tier1_2_Training"],
  494. 4: ["Leadership_Tier1_Feedtheneedy", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty", "Leadership_Tier1_2_Training"],
  495. 5: ["Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty"],
  496. 6: ["Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty"],
  497. 7: ["Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty"],
  498. 8: ["Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty"],
  499. 9: ["Leadership_Tier1_5_Explore", "Leadership_Tier2_9_Chart", "Leadership_Tier1_4_Protect"],
  500. 10: ["Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty"],
  501. 11: ["Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty"],
  502. 12: ["Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier1_2_Guardduty"],
  503. 13: ["Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  504. 14: ["Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  505. 15: ["Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  506. 16: ["Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  507. 17: ["Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  508. 18: ["Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  509. 19: ["Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  510. //20
  511.  
  512. 20: ["Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  513. 21: ["Leadership_Tier4_21_Training", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier3_13_Training", "Leadership_Tier1_5_Explore", "Leadership_Tier1_4_Protect", "Leadership_Tier2_7_Training"],
  514. 22: ["Leadership_Tier4_21_Training", "Leadership_Tier4_22_Guardclerics", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  515. 23: ["Leadership_Tier4_23_Guardnoble", "Leadership_Tier4_21_Training", "Leadership_Tier4_22_Guardclerics", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  516. 24: ["Leadership_Tier4_23_Guardnoble", "Leadership_Tier4_21_Training", "Leadership_Tier4_22_Guardclerics", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  517. 25: ["Leadership_Tier4_25r_Huntexperiment", "Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier3_13r_Protectdiamonds",
  518. "Leadership_Tier3_20_Destroy", "Leadership_Tier2_12_Taxes", "Leadership_Tier4_24r_Killdragon", "Leadership_Tier4_25_Battleelementalcultists", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle",
  519. "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  520. ],
  521. },
  522. }]
  523. };
  524.  
  525. addProfile("Leadership", {
  526. profileName: "Resource/AD",
  527. level: {
  528. // DL
  529. 16: ["Leadership_Tier3_16r_Buildshelters", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_16_Fight", "Leadership_Tier3_13_Patrol", "Leadership_Tier3_17_Deliver", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  530. 17: ["Leadership_Tier3_16r_Buildshelters", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_17_Deliver", "Leadership_Tier3_13_Patrol", "Leadership_Tier3_17_Deliver", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  531. 18: ["Leadership_Tier3_16r_Buildshelters", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_17r_Raidmines", "Leadership_Tier3_13_Patrol", "Leadership_Tier3_17_Deliver", , "Leadership_Tier3_17_Deliver", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  532. 19: ["Leadership_Tier3_16r_Buildshelters", "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier3_17r_Raidmines", "Leadership_Tier3_13_Patrol", "Leadership_Tier3_17_Deliver", , "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"],
  533. // 20
  534. 20: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3",
  535. "Leadership_Tier3_20_Destroy", "Leadership_Tier3_18_Resell", "Leadership_Tier3_13r_Protectdiamonds",
  536. "Leadership_Tier3_16r_Buildshelters", "Leadership_Tier3_13_Patrol", "Leadership_Tier3_19_Acquire", "Leadership_Tier3_17_Deliver",
  537. "Leadership_Tier3_15_Rescue", "Leadership_Tier2_9_Chart", "Leadership_Tier2_12_Taxes", "Leadership_Tier1_5_Explore"
  538. ],
  539. 21: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_21r_Killelemental",
  540. "Leadership_Tier3_20_Destroy", "Leadership_Tier4_21_Protectmagic",
  541. "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier2_12_Taxes", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  542. ],
  543. 22: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_21r_Killelemental",
  544. "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier3_20_Destroy", "Leadership_Tier4_21_Protectmagic", "Leadership_Tier4_22_Guardclerics",
  545. "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier2_12_Taxes", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  546. ],
  547. 23: ["Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3",
  548. "Leadership_Tier4_23r_Securepilgrimage", "Leadership_Tier4_21r_Killelemental",
  549. "Leadership_Tier4_23_Guardnoble", "Leadership_Tier3_20_Destroy", "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier4_21_Protectmagic", "Leadership_Tier4_22_Guardclerics",
  550. "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier2_12_Taxes", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  551. ],
  552. 24: ["Leadership_Tier4_24r_Killdragon",
  553. "Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_23r_Securepilgrimage",
  554. "Leadership_Tier4_24_Wizardsseneschal", "Leadership_Tier4_23_Guardnoble", "Leadership_Tier3_20_Destroy", "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier4_21_Protectmagic", "Leadership_Tier4_22_Guardclerics", "Leadership_Tier4_21r_Killelemental",
  555. "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier2_12_Taxes", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  556. ],
  557. 25: ["Leadership_Tier4_25r_Huntexperiment", "Leadership_Tier4_24r_Killdragon",
  558. "Leadership_Tier3_20r_Master2", "Leadership_Tier3_20r_Master1", "Leadership_Tier3_20r_Master3", "Leadership_Tier4_23r_Securepilgrimage",
  559. "Leadership_Tier4_25_Battleelementalcultists", "Leadership_Tier4_24_Wizardsseneschal", "Leadership_Tier4_23_Guardnoble", "Leadership_Tier3_20_Destroy", "Leadership_Tier4_22r_Capturebandithq", "Leadership_Tier4_21_Protectmagic", "Leadership_Tier4_22_Guardclerics", "Leadership_Tier4_21r_Killelemental",
  560. "Leadership_Tier3_13r_Protectdiamonds", "Leadership_Tier2_12_Taxes", "Leadership_Tier3_16_Fight", "Leadership_Tier2_10_Battle", "Leadership_Tier3_13_Patrol", "Leadership_Tier2_9_Chart", "Leadership_Tier1_5_Explore"
  561. ],
  562. }
  563. }, "AD");
  564.  
  565. addProfile("Leadership", {
  566. profileName: "Assets",
  567. isProfileActive: true,
  568. level: {
  569. 3: ["Leadership_Tier3_13_Recruit", "Leadership_Tier2_7_Recruit", "Leadership_Tier1_2_Recruit"],
  570. }
  571. });
  572.  
  573. definedTask["Winter Event"] = {
  574. taskListName: "WinterEvent",
  575. taskName: "WinterEvent",
  576. taskDefaultPriority: 1,
  577. taskDefaultSlotNum: 0,
  578. taskActive: true,
  579. taskDescription: "",
  580. profiles: [{
  581. profileName: "default",
  582. isProfileActive: true,
  583. level: {
  584. 0: ["Event_Winter_Tier0_Intro"],
  585. 1: ["Event_Winter_Tier1_Rankup", /*"Event_Winter_Tier1_Shiny_Lure",*/
  586. "Event_Winter_Tier1_Refine", "Event_Winter_Tier1_Gather"
  587. ],
  588. 2: ["Event_Winter_Tier1_Rankup_2", /*"Event_Winter_Tier1_Fishingpole_Blue","Event_Winter_Tier1_Shiny_Lure_Mass",*/
  589. "Event_Winter_Tier1_Refine_2", "Event_Winter_Tier1_Gather_2"
  590. ],
  591. 3: [ /*"Event_Winter_Tier1_Heros_Feast","Event_Winter_Tier1_Lightwine","Event_Winter_Tier1_Sparkliest_Gem","Event_Winter_Tier1_Mesmerizing_Lure",*/
  592. "Event_Winter_Tier1_Gather_3"
  593. ],
  594. },
  595. }]
  596. };
  597.  
  598. definedTask["Siege Event"] = {
  599. taskListName: "SiegeEvent",
  600. taskName: "Event_Siege",
  601. taskDefaultPriority: 1,
  602. taskDefaultSlotNum: 0,
  603. taskActive: true,
  604. taskDescription: "",
  605. profiles: [{
  606. profileName: "default",
  607. isProfileActive: true,
  608. level: {
  609. 0: ["Event_Siege_Tier0_Intro"], // Hire a Siege Master
  610. //1:["Event_Siege_Tier1_Donate_Minorinjury"], // Create Defense Supplies from Minor Injury Kits
  611. //1:["Event_Siege_Tier1_Donate_Injury"], // Create Defense Supplies from Injury Kits
  612. //1:["Event_Siege_Tier1_Donate_Majorinjury"], // Create Defense Supplies from Major Injury Kits
  613. //1:["Event_Siege_Tier1_Donate_Altar_10"], // Create Defense Supplies from 10 Portable Altars
  614. //1:["Event_Siege_Tier1_Donate_Altar_50"], // Create Defense Supplies from 50 Portable Altars
  615. //1:["Event_Siege_Tier1_Donate_Resources_T2"], // Create Defense Supplies from Tier 2 crafting resources
  616. //1:["Event_Siege_Tier1_Donate_Resources_T3"], // Create Defense Supplies from Tier 3 crafting resources
  617. 1: ["Event_Siege_Tier1_Donate_Resources_T3", "Event_Siege_Tier1_Donate_Resources_T2", "Event_Siege_Tier1_Donate_Minorinjury", "Event_Siege_Tier1_Donate_Injury", "Event_Siege_Tier1_Donate_Majorinjury", "Event_Siege_Tier1_Donate_Altar_10"],
  618. },
  619. }]
  620. };
  621.  
  622. definedTask["Black Ice Shaping"] = {
  623. taskListName: "BlackIce",
  624. taskName: "BlackIce",
  625. taskDefaultPriority: 1,
  626. taskDefaultSlotNum: 0,
  627. taskActive: true,
  628. taskDescription: "",
  629. profiles: [{
  630. profileName: "default",
  631. isProfileActive: true,
  632. level: {
  633. 1: ["Blackice_Tier1_Process_Blackice","Blackice_Tier1_Recruit_Blackice_Smith"],
  634. 2: ["Blackice_Tier1_Process_Blackice","Blackice_Tier2_Recruit_Assistant_Cryomancer"],
  635. 3: ["Blackice_Tier1_Process_Blackice","Blackice_Tier2_Recruit_Assistant_Cryomancer"],
  636. 4: ["Blackice_Tier1_Process_Blackice","Blackice_Tier2_Recruit_Assistant_Cryomancer"],
  637. 5: ["Blackice_Tier1_Process_Blackice","Blackice_Tier2_Recruit_Assistant_Cryomancer"],
  638. /*
  639. 1:["Forge Hammerstone Pick","Gather Raw Black Ice","Truesilver Pick Grip","Process Raw Black Ice","Upgrade Chillwright","Hire an additional Chillwright"],
  640. 2:["Forge Hammerstone Pick","Gather Raw Black Ice","Truesilver Pick Grip","Process Raw Black Ice","Upgrade Chillwright","Hire an additional Chillwright"],
  641. 3:["Forge Hammerstone Pick","Gather Raw Black Ice","Truesilver Pick Grip","Process Raw Black Ice","Upgrade Chillwright","Hire an additional Chillwright"],
  642. */
  643. },
  644. }]
  645. };
  646.  
  647. definedTask["Jewelcrafting"] = {
  648. taskListName : "Jewelcrafting",
  649. taskName : "Jewelcrafting",
  650. taskDefaultPriority : 1,
  651. taskDefaultSlotNum : 0,
  652. taskActive : true,
  653. taskDescription : "",
  654. profiles : [{
  655. profileName : "default",
  656. isProfileActive : true,
  657. level : {
  658. 0 : ["Jewelcrafting_Tier0_Intro"],
  659. 1 : ["Jewelcrafting_Tier1_Waist_Offense_1", "Jewelcrafting_Tier1_Refine_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  660. 2 : ["Jewelcrafting_Tier1_Waist_Offense_1", "Jewelcrafting_Tier1_Refine_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  661. 3 : ["Jewelcrafting_Tier1_Neck_Offense_1", "Jewelcrafting_Tier1_Waist_Offense_1", "Jewelcrafting_Tier1_Refine_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  662. 4 : ["Jewelcrafting_Tier1_Neck_Offense_1", "Jewelcrafting_Tier1_Waist_Misc_1", "Jewelcrafting_Tier1_Refine_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  663. 5 : ["Jewelcrafting_Tier1_Neck_Offense_1", "Jewelcrafting_Tier1_Waist_Misc_1", "Jewelcrafting_Tier1_Refine_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  664. 6 : ["Jewelcrafting_Tier1_Neck_Misc_1", "Jewelcrafting_Tier1_Waist_Misc_1", "Jewelcrafting_Tier1_Refine_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  665. 7 : ["Jewelcrafting_Tier2_Waist_Offense_2", "Jewelcrafting_Tier2_Refine_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  666. 8 : ["Jewelcrafting_Tier2_Waist_Offense_2", "Jewelcrafting_Tier2_Refine_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  667. 9 : ["Jewelcrafting_Tier2_Neck_Offense_2", "Jewelcrafting_Tier2_Waist_Offense_2", "Jewelcrafting_Tier2_Refine_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  668. 10 : ["Jewelcrafting_Tier2_Waist_Misc_2", "Jewelcrafting_Tier2_Neck_Offense_2", "Jewelcrafting_Tier2_Refine_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  669. 11 : ["Jewelcrafting_Tier2_Waist_Misc_2", "Jewelcrafting_Tier2_Neck_Offense_2", "Jewelcrafting_Tier2_Refine_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  670. 12 : ["Jewelcrafting_Tier2_Waist_Misc_2", "Jewelcrafting_Tier2_Neck_Offense_2", "Jewelcrafting_Tier2_Refine_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  671. 13 : ["Jewelcrafting_Tier2_Neck_Misc_2", "Jewelcrafting_Tier2_Waist_Misc_2", "Jewelcrafting_Tier2_Refine_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  672. 14 : ["Jewelcrafting_Tier3_Waist_Offense_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  673. 15 : ["Jewelcrafting_Tier3_Waist_Offense_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  674. 16 : ["Jewelcrafting_Tier3_Neck_Offense_3", "Jewelcrafting_Tier3_Waist_Offense_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  675. 17 : ["Jewelcrafting_Tier3_Neck_Offense_3", "Jewelcrafting_Tier3_Waist_Offense_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  676. 18 : ["Jewelcrafting_Tier3_Neck_Offense_3", "Jewelcrafting_Tier3_Waist_Misc_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  677. 19 : ["Jewelcrafting_Tier3_Neck_Offense_3", "Jewelcrafting_Tier3_Waist_Misc_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  678. 20 : ["Jewelcrafting_Tier3_Neck_Misc_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  679. 21 : ["Jewelcrafting_Tier3_Neck_Misc_3", "Jewelcrafting_Tier4_Refine_Basic", "Jewelcrafting_Tier4_Gather_Basic", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  680. 22 : ["Jewelcrafting_Tier4_Neck_Base_3", "Jewelcrafting_Tier4_Refine_Basic", "Jewelcrafting_Tier4_Gather_Basic", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  681. 23 : ["Jewelcrafting_Tier4_Neck_Defense_3", "Jewelcrafting_Tier4_Neck_Offense_3", "Jewelcrafting_Tier4_Gather_Basic", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  682. 24 : ["Jewelcrafting_Tier4_Neck_Misc_3", "Jewelcrafting_Tier3_Neck_Misc_3", "Jewelcrafting_Tier4_Gather_Basic", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  683. //basic resources for lvl 16 and 15 items.
  684. 25 : ["Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  685. },
  686. }]
  687. };
  688.  
  689. addProfile("Jewelcrafting", {
  690. profileName : "mass refining",
  691. isProfileActive : true,
  692. useMassTask : true,
  693. level : {
  694. 0: ["Jewelcrafting_Tier0_Intro"],
  695. 1: ["Jewelcrafting_Tier1_Refine_Basic_Mass", "Jewelcrafting_Tier1_Gather_Basic"],
  696. 2: '+25',
  697. 7: ["Jewelcrafting_Tier2_Refine_Basic_Mass"],
  698. 8 : '+25',
  699. 14: ["Jewelcrafting_Tier3_Refine_Basic_Mass"],
  700. 15 : '+25',
  701. 21: ["Jewelcrafting_Tier4_Refine_Basic_Mass"],
  702. 22 : '+25',
  703. },
  704. });
  705.  
  706. addProfile("Jewelcrafting", {
  707. profileName: "21->25 gather",
  708. isProfileActive: true,
  709. level: {
  710. 21: ["Jewelcrafting_Tier4_Refine_Basic_Mass", "Jewelcrafting_Tier4_Gather_Basic"],
  711. 22: '+25'
  712. },
  713. });
  714.  
  715.  
  716. addProfile("Jewelcrafting", {
  717. profileName: "Craft Purple Neck",
  718. isProfileActive: true,
  719. level: {
  720. // we care only about neck items that we can start pile up at lvl 16
  721. 16: ["Jewelcrafting_Tier3_Neck_Offense_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  722. 17 : '+25',
  723. 25: ["Jewelcrafting_Tier4_Neck_Offense_4_Purple", //Exquisite Adamant Necklace of Piercing
  724. "Jewelcrafting_Tier4_Neck_Misc_4_Purple", // Exquisite Adamant Necklace of Recovery
  725. "Jewelcrafting_Tier4_Neck_Defense_4_Purple",//Exquisite Adamant Necklace of Regeneration
  726. "Jewelcrafting_Tier4_Ring_Offense_4_Purple",//Exquisite Adamant Ring of Piercing
  727. "Jewelcrafting_Tier4_Ring_Misc_4_Purple",//Exquisite Adamant Ring of Recovery
  728. "Jewelcrafting_Tier4_Ring_Defense_4_Purple",//Exquisite Adamant Ring of Regeneration
  729. "Jewelcrafting_Tier3_Neck_Offense_3",
  730. "Jewelcrafting_Tier2_Refine_Basic", "Jewelcrafting_Tier1_Refine_Basic"],
  731. },
  732. });
  733. addProfile("Jewelcrafting", {
  734. profileName: "Craft Purple Rings",
  735. isProfileActive: true,
  736. level: {
  737. // we care only about neck items that we can start pile up at lvl 15
  738. 15: ["Jewelcrafting_Tier3_Ring_Offense_3", "Jewelcrafting_Tier3_Refine_Basic", "Jewelcrafting_Tier3_Gather_Basic", "Jewelcrafting_Tier2_Gather_Basic", "Jewelcrafting_Tier1_Gather_Basic"],
  739. 16 :'+25',
  740. 25: ["Jewelcrafting_Tier4_Ring_Offense_4_Purple", //Exquisite Adamant Ring of Piercing
  741. "Jewelcrafting_Tier4_Ring_Misc_4_Purple", //Exquisite Adamant Ring of Recovery
  742. "Jewelcrafting_Tier4_Ring_Defense_4_Purple", //Exquisite Adamant Ring of Regeneration
  743. "Jewelcrafting_Tier4_Neck_Offense_4_Purple", //Exquisite Adamant Necklace of Piercing
  744. "Jewelcrafting_Tier4_Neck_Misc_4_Purple", // Exquisite Adamant Necklace of Recovery
  745. "Jewelcrafting_Tier4_Neck_Defense_4_Purple",//Exquisite Adamant Necklace of Regeneration
  746. "Jewelcrafting_Tier3_Ring_Offense_3",
  747. "Jewelcrafting_Tier3_Refine_Basic"]
  748. },
  749. });
  750.  
  751. addProfile("Jewelcrafting", {
  752. profileName: "Craft Purple lvl 25",
  753. isProfileActive: true,
  754. level: {
  755. 25: ["Jewelcrafting_Tier4_Ring_Offense_4_Purple", //Exquisite Adamant Ring of Piercing
  756. "Jewelcrafting_Tier4_Ring_Misc_4_Purple", //Exquisite Adamant Ring of Recovery
  757. "Jewelcrafting_Tier4_Ring_Defense_4_Purple", //Exquisite Adamant Ring of Regeneration
  758. "Jewelcrafting_Tier4_Neck_Offense_4_Purple", //Exquisite Adamant Necklace of Piercing
  759. "Jewelcrafting_Tier4_Neck_Misc_4_Purple", // Exquisite Adamant Necklace of Recovery - !!check name!!
  760. "Jewelcrafting_Tier4_Neck_Defense_4_Purple",//Exquisite Adamant Necklace of Regeneration
  761. "Jewelcrafting_Tier3_Refine_Basic"//timeout task
  762. ],
  763. },
  764. });
  765.  
  766. definedTask["Mailsmithing"] = {
  767. taskListName : "Mailsmithing",
  768. taskName : "Armorsmithing_Med",
  769. taskDefaultPriority : 1,
  770. taskDefaultSlotNum : 0,
  771. taskActive : true,
  772. taskDescription : "",
  773. profiles : [{
  774. profileName : "default",
  775. isProfileActive : true,
  776. level : {
  777. 0 : ["Med_Armorsmithing_Tier0_Intro"],
  778. 1 : ["Med_Armorsmithing_Tier1_Gather_Basic"],
  779. 2 : ["Med_Armorsmithing_Tier1_Chain_Armor_1", "Med_Armorsmithing_Tier1_Chain_Pants_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  780. 3 : ["Med_Armorsmithing_Tier1_Chain_Armor_1", "Med_Armorsmithing_Tier1_Chain_Boots_Set_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  781. 4 : ["Med_Armorsmithing_Tier1_Chain_Armor_1", "Med_Armorsmithing_Tier1_Chain_Boots_Set_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  782. 5 : ["Med_Armorsmithing_Tier1_Chain_Armor_Set_1", "Med_Armorsmithing_Tier1_Chain_Boots_Set_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  783. 6 : ["Med_Armorsmithing_Tier1_Chain_Armor_Set_1", "Med_Armorsmithing_Tier1_Chain_Boots_Set_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  784. 7 : ["Med_Armorsmithing_Tier1_Chain_Armor_Set_1", "Med_Armorsmithing_Tier2_Chain_Boots_Set_1", "Med_Armorsmithing_Tier2_Chain_Shirt", "Med_Armorsmithing_Tier1_Gather_Basic", "Med_Armorsmithing_Tier1_Gather_Basic"],
  785. 8 : ["Med_Armorsmithing_Tier2_Chain_Armor_Set_1", "Med_Armorsmithing_Tier2_Chain_Pants_1", "Med_Armorsmithing_Tier2_Chain_Boots_Set_1", "Med_Armorsmithing_Tier2_Chain_Shirt", "Med_Armorsmithing_Tier1_Gather_Basic"],
  786. 9 : ["Med_Armorsmithing_Tier2_Chain_Armor_Set_1", "Med_Armorsmithing_Tier2_Chain_Pants_1", "Med_Armorsmithing_Tier2_Chain_Boots_Set_1", "Med_Armorsmithing_Tier2_Chain_Shirt", "Med_Armorsmithing_Tier1_Gather_Basic"],
  787. 10 : ["Med_Armorsmithing_Tier2_Chain_Armor_Set_1", "Med_Armorsmithing_Tier2_Chain_Pants_1", "Med_Armorsmithing_Tier2_Chain_Boots_Set_1", "Med_Armorsmithing_Tier2_Chain_Shirt_2", "Med_Armorsmithing_Tier1_Gather_Basic", "Med_Armorsmithing_Tier1_Gather_Basic"],
  788. 11 : ["Med_Armorsmithing_Tier2_Chain_Armor_Set_1", "Med_Armorsmithing_Tier2_Chain_Pants_2", "Med_Armorsmithing_Tier2_Chain_Boots_Set_1", "Med_Armorsmithing_Tier2_Chain_Shirt_2", "Med_Armorsmithing_Tier2_Chain_Pants_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  789. 12 : ["Med_Armorsmithing_Tier2_Chain_Armor_Set_1", "Med_Armorsmithing_Tier2_Chain_Pants_2", "Med_Armorsmithing_Tier2_Chain_Boots_Set_1", "Med_Armorsmithing_Tier2_Chain_Shirt_2", "Med_Armorsmithing_Tier2_Chain_Pants_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  790. 13 : ["Med_Armorsmithing_Tier2_Chain_Armor_Set_1", "Med_Armorsmithing_Tier2_Chain_Pants_2", "Med_Armorsmithing_Tier2_Chain_Boots_Set_1", "Med_Armorsmithing_Tier2_Chain_Shirt_2", "Med_Armorsmithing_Tier2_Chain_Pants_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  791. 14 : ["Med_Armorsmithing_Tier2_Chain_Armor_Set_1", "Med_Armorsmithing_Tier2_Chain_Pants_2", "Med_Armorsmithing_Tier3_Chain_Shirt", "Med_Armorsmithing_Tier3_Chain_Boots_Set_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  792. 15 : ["Med_Armorsmithing_Tier3_Chain_Armor_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants", "Med_Armorsmithing_Tier3_Chain_Shirt2", "Med_Armorsmithing_Tier3_Chain_Boots_Set_1", "Med_Armorsmithing_Tier1_Gather_Basic"],
  793. 16 : ["Med_Armorsmithing_Tier3_Chain_Armor_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants2", "Med_Armorsmithing_Tier3_Chain_Shirt2", "Med_Armorsmithing_Tier3_Chain_Helm_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants", "Med_Armorsmithing_Tier1_Gather_Basic"],
  794. 17 : ["Med_Armorsmithing_Tier3_Chain_Armor_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants2", "Med_Armorsmithing_Tier3_Chain_Shirt2", "Med_Armorsmithing_Tier3_Chain_Helm_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants", "Med_Armorsmithing_Tier1_Gather_Basic"],
  795. 18 : ["Med_Armorsmithing_Tier3_Chain_Armor_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants2", "Med_Armorsmithing_Tier3_Chain_Shirt2", "Med_Armorsmithing_Tier3_Chain_Helm_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants", "Med_Armorsmithing_Tier1_Gather_Basic"],
  796. 19 : ["Med_Armorsmithing_Tier3_Chain_Armor_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants2", "Med_Armorsmithing_Tier3_Chain_Shirt2", "Med_Armorsmithing_Tier3_Chain_Helm_Set_1", "Med_Armorsmithing_Tier3_Chain_Pants", "Med_Armorsmithing_Tier1_Gather_Basic"],
  797. 20 : ["Med_Armorsmithing_Tier3_Chain_Pants"],
  798. 21 : ["Med_Armorsmithing_Tier3_Chain_Pants"],
  799. 22 : ["Med_Armorsmithing_Tier3_Chain_Pants"],
  800. 23 : ["Med_Armorsmithing_Tier3_Chain_Pants"],
  801. 24 : ["Med_Armorsmithing_Tier3_Chain_Pants"],
  802. 25 : ["Crafted_Med_Armorsmithing_T4_Refine_Basic", "Crafted_Med_Armorsmithing_T4_Gather_Basic"],
  803. }
  804. }]
  805. };
  806. addProfile("Mailsmithing", {
  807. profileName : "mass refining",
  808. isProfileActive : true,
  809. useMassTask : true,
  810. level : {
  811. 0: ["Med_Armorsmithing_Tier0_Intro"],
  812. 1: ["Med_Armorsmithing_Tier1_Refine_Basic_Mass", "Med_Armorsmithing_Tier1_Gather_Basic"],
  813. 2: "+25",
  814. 7: ["Med_Armorsmithing_Tier2_Refine_Basic_Mass"],
  815. 8: "+25",
  816. 14: ["Med_Armorsmithing_Tier3_Refine_Basic_Mass"],
  817. 15: "+25",
  818. 21: ["Crafted_Med_Armorsmithing_T4_Refine_Basic_Mass"],
  819. 22: "+25",
  820. },
  821. });
  822.  
  823. addProfile("Mailsmithing", {
  824. profileName: "21->25 gather",
  825. isProfileActive: true,
  826. level: {
  827. 21: ["Crafted_Med_Armorsmithing_T4_Refine_Basic_Mass", "Crafted_Med_Armorsmithing_T4_Gather_Basic_Mass"],
  828. 22: "+25",
  829. 25: ["Crafted_Med_Armorsmithing_T4_Refine_Basic", "Crafted_Med_Armorsmithing_T4_Gather_Basic"],
  830. },
  831. });
  832.  
  833. addProfile("Mailsmithing", {
  834. profileName: "Berserker's Chausses and rares",
  835. isProfileActive: true,
  836. level: {
  837. 25: ["Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  838. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  839. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  840. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  841.  
  842. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  843. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  844. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  845. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  846.  
  847. "Crafted_Med_Armorsmithing_Scale_T4_Green_Pants_Dps",//Berserker's Elemental Chausses
  848. "Med_Armorsmithing_Tier3_Refine_Basic"
  849.  
  850. ],
  851. },
  852. });
  853.  
  854. addProfile("Mailsmithing", {
  855. profileName: "Soldier's Chausses and rares",
  856. isProfileActive: true,
  857. level: {
  858. 25: ["Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  859. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  860.  
  861. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  862. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  863.  
  864. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  865. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  866. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  867. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  868.  
  869. "Crafted_Med_Armorsmithing_Scale_T4_Green_Pants_Tank",//Soldier's Elemental Chausses
  870. "Med_Armorsmithing_Tier3_Refine_Basic"
  871. ],
  872. },
  873. });
  874. addProfile("Mailsmithing", {
  875. profileName: "Soldier's Chainmail and rares",
  876. isProfileActive: true,
  877. level: {
  878. 25: ["Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  879. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  880. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  881. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  882. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  883. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  884. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  885. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  886.  
  887. "Crafted_Med_Armorsmithing_Scale_T4_Green_Shirt_Tank",//Soldier's Elemental Chainmail
  888. "Med_Armorsmithing_Tier3_Refine_Basic"
  889. ],
  890. },
  891. });
  892.  
  893. addProfile("Mailsmithing", {
  894. profileName: "Berserker's Chainmail and rares",
  895. isProfileActive: true,
  896. level: {
  897. 25: ["Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  898. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  899.  
  900. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  901. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  902. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  903. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  904. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  905. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  906.  
  907. "Crafted_Med_Armorsmithing_Scale_T4_Green_Shirt_Dps",//Berserker's Elemental Chainmail
  908. "Med_Armorsmithing_Tier3_Refine_Basic"
  909. ],
  910. },
  911. });
  912.  
  913. addProfile("Mailsmithing", {
  914. profileName: "Zealot's Chausses and rares",
  915. isProfileActive: true,
  916. level: {
  917. 25: ["Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  918. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  919. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  920. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  921.  
  922. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  923. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  924.  
  925. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  926. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  927.  
  928. "Crafted_Med_Armorsmithing_Chain_T4_Green_Pants_Dps",//Berserker's Elemental Chainmail
  929. "Med_Armorsmithing_Tier3_Refine_Basic"
  930. ],
  931. },
  932. });
  933.  
  934. addProfile("Mailsmithing", {
  935. profileName: "Zealot's Chainmail and rares",
  936. isProfileActive: true,
  937. level: {
  938. 25: ["Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  939. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  940. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  941. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  942. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  943. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  944.  
  945. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  946. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  947.  
  948. "Crafted_Med_Armorsmithing_Chain_T4_Green_Shirt_Dps",//Zealot's Elemental Chainmail
  949. "Med_Armorsmithing_Tier3_Refine_Basic"
  950. ],
  951. },
  952. });
  953. addProfile("Mailsmithing", {
  954. profileName: "Prelate's Chainmail and rares",
  955. isProfileActive: true,
  956. level: {
  957. 25: ["Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  958. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  959.  
  960. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  961. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  962. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  963. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  964.  
  965. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  966. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  967.  
  968. "Crafted_Med_Armorsmithing_Chain_T4_Green_Shirt_Tank",//Prelate's Elemental Chainmail
  969. "Med_Armorsmithing_Tier3_Refine_Basic"
  970. ],
  971. },
  972. });
  973.  
  974. addProfile("Mailsmithing", {
  975. profileName: "Prelate's Chausses and rares",
  976. isProfileActive: true,
  977. level: {
  978. 25: ["Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  979. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  980. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  981. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  982. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  983. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  984.  
  985. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  986. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  987.  
  988. "Crafted_Med_Armorsmithing_Chain_T4_Green_Pants_Tank",//Prelate's Elemental Chainmail
  989. "Med_Armorsmithing_Tier3_Refine_Basic"
  990. ]
  991. },
  992. });
  993.  
  994. addProfile("Mailsmithing", {
  995. profileName: "craft rares only",
  996. isProfileActive: true,
  997. level: {
  998. 25: ["Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Tank", //Prelate's Exquisite Elemental Chausses
  999. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Tank", //Prelate's Exquisite Elemental Chainmail
  1000. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Pants_Dps", //Zealot's Exquisite Elemental Chausses
  1001. "Crafted_Med_Armorsmithing_Chain_T4_Purple_Shirt_Dps", //Zealot's Exquisite Elemental Chainmail
  1002. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Soldier's Exquisite Elemental Chausses
  1003. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Dps", //Soldier's Exquisite Elemental Chainmail
  1004.  
  1005. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Pants_Dps", //Berserker's Exquisite Elemental Chausses
  1006. "Crafted_Med_Armorsmithing_Scale_T4_Purple_Shirt_Tank", //Berserker's Exquisite Elemental Chainmail
  1007. "Med_Armorsmithing_Tier2_Refine_Basic"]
  1008. }
  1009. });
  1010.  
  1011. addProfile("Mailsmithing", {
  1012. profileName: "Wondrous Sprocket",
  1013. isProfileActive: false,
  1014. level: {
  1015. 6: ["Med_Armorsmithing_Tier1_Event_Gond"],
  1016. 7: "+25",
  1017. },
  1018. });
  1019.  
  1020. definedTask["Platesmithing"] = {
  1021. taskListName: "Platesmithing",
  1022. taskName: "Armorsmithing_Heavy",
  1023. taskDefaultPriority: 1,
  1024. taskDefaultSlotNum: 0,
  1025. taskActive: true,
  1026. taskDescription: "",
  1027. profiles: [{
  1028. profileName: "default",
  1029. isProfileActive: true,
  1030. level: {
  1031. 0: ["Hvy_Armorsmithing_Tier0_Intro"],
  1032. 1: ["Hvy_Armorsmithing_Tier1_Plate_Boots_1", "Hvy_Armorsmithing_Tier1_Plate_Shirt_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1033. 2: ["Hvy_Armorsmithing_Tier1_Plate_Armor_1", "Hvy_Armorsmithing_Tier1_Plate_Pants_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1034. 3: ["Hvy_Armorsmithing_Tier1_Plate_Armor_1", "Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1035. 4: ["Hvy_Armorsmithing_Tier1_Plate_Armor_1", "Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1036. 5: ["Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1037. 6: ["Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1038. 7: ["Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Shirt", "Hvy_Armorsmithing_Tier2_Shield_Set_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1039. 8: ["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Pants_1", "Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Shirt", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1040. 9: ["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Pants_1", "Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Shirt", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1041. 10: ["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Pants_1", "Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Shirt_2", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1042. 11: ["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Pants_2", "Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Shirt_2", "Hvy_Armorsmithing_Tier2_Plate_Pants_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1043. 12: ["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Pants_2", "Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Shirt_2", "Hvy_Armorsmithing_Tier2_Plate_Pants_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1044. 13: ["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Pants_2", "Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Shirt_2", "Hvy_Armorsmithing_Tier2_Plate_Pants_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1045. 14: ["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier2_Plate_Pants_2", "Hvy_Armorsmithing_Tier3_Plate_Shirt", "Hvy_Armorsmithing_Tier3_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1046. 15: ["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants", "Hvy_Armorsmithing_Tier3_Plate_Shirt2", "Hvy_Armorsmithing_Tier3_Plate_Boots_Set_1", "Hvy_Armorsmithing_Tier1_Gather_Basic", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1047. 16: ["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants2", "Hvy_Armorsmithing_Tier3_Plate_Shirt2", "Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1048. 17: ["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants2", "Hvy_Armorsmithing_Tier3_Plate_Shirt2", "Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1049. 18: ["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants2", "Hvy_Armorsmithing_Tier3_Plate_Shirt2", "Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1050. 19: ["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants2", "Hvy_Armorsmithing_Tier3_Plate_Shirt2", "Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1", "Hvy_Armorsmithing_Tier3_Plate_Pants", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1051. 20: ["Hvy_Armorsmithing_Tier3_Plate_Pants"],
  1052. 21: ["Hvy_Armorsmithing_Tier3_Plate_Pants"],
  1053. 22: ["Hvy_Armorsmithing_Tier3_Plate_Pants"],
  1054. 23: ["Hvy_Armorsmithing_Tier3_Plate_Pants"],
  1055. 24: ["Hvy_Armorsmithing_Tier3_Plate_Pants"],
  1056. 25: ["Crafted_Hvy_Armorsmithing_T4_Refine_Basic_Mass", "Crafted_Hvy_Armorsmithing_T4_Gather_Basic_Mass"],
  1057. },
  1058. }]
  1059. };
  1060.  
  1061. addProfile("Platesmithing", {
  1062. profileName : "mass refining",
  1063. isProfileActive : true,
  1064. useMassTask : true,
  1065. level : {
  1066. 0: ["Hvy_Armorsmithing_Tier0_Intro"],
  1067. 1: ["Hvy_Armorsmithing_Tier1_Refine_Basic_Mass", "Hvy_Armorsmithing_Tier1_Gather_Basic"],
  1068. 2: "+25",
  1069. 7: ["Hvy_Armorsmithing_Tier2_Refine_Basic_Mass"],
  1070. 8: "+25",
  1071. 14: ["Hvy_Armorsmithing_Tier3_Refine_Basic_Mass"],
  1072. 15: "+25",
  1073. 21: ["Crafted_Hvy_Armorsmithing_T4_Refine_Basic_Mass"],
  1074. 22: "+25",
  1075. },
  1076. });
  1077.  
  1078. addProfile("Platesmithing", {
  1079. profileName: "21->25 gather",
  1080. isProfileActive: true,
  1081. level: {
  1082. 21: ["Crafted_Hvy_Armorsmithing_T4_Refine_Basic_Mass", "Crafted_Hvy_Armorsmithing_T4_Gather_Basic_Mass"],
  1083. 22: "+25",
  1084. },
  1085. });
  1086.  
  1087. addProfile("Platesmithing", {
  1088. profileName: "Wondrous Sprocket",
  1089. isProfileActive: false,
  1090. level: {
  1091. 6: ["Hvy_Armorsmithing_Tier1_Event_Gond"],
  1092. 7: "+25",
  1093. },
  1094. });
  1095.  
  1096. definedTask["Leatherworking"] = {
  1097. taskListName : "Leatherworking",
  1098. taskName : "Leatherworking",
  1099. taskDefaultPriority : 1,
  1100. taskDefaultSlotNum : 0,
  1101. taskActive : true,
  1102. taskDescription : "",
  1103. profiles : [{
  1104. profileName : "default",
  1105. isProfileActive : true,
  1106. level : {
  1107. 0 : ["Leatherworking_Tier0_Intro_1"],
  1108. 1 : ["Leatherworking_Tier1_Leather_Boots_1", "Leatherworking_Tier1_Leather_Shirt_1", "Leatherworking_Tier1_Gather_Basic"],
  1109. 2 : ["Leatherworking_Tier1_Leather_Armor_1", "Leatherworking_Tier1_Leather_Pants_1", "Leatherworking_Tier1_Gather_Basic"],
  1110. 3 : ["Leatherworking_Tier1_Leather_Armor_1", "Leatherworking_Tier1_Leather_Boots_Set_1", "Leatherworking_Tier1_Gather_Basic"],
  1111. 4 : ["Leatherworking_Tier1_Leather_Armor_1", "Leatherworking_Tier1_Leather_Boots_Set_1", "Leatherworking_Tier1_Gather_Basic"],
  1112. 5 : ["Leatherworking_Tier1_Leather_Armor_Set_1", "Leatherworking_Tier1_Leather_Boots_Set_1", "Leatherworking_Tier1_Gather_Basic"],
  1113. 6 : ["Leatherworking_Tier1_Leather_Armor_Set_1", "Leatherworking_Tier1_Leather_Boots_Set_1", "Leatherworking_Tier1_Gather_Basic"],
  1114. 7 : ["Leatherworking_Tier1_Leather_Armor_Set_1", "Leatherworking_Tier2_Leather_Boots_Set_1", "Leatherworking_Tier2_Leather_Shirt", "Leatherworking_Tier1_Gather_Basic"],
  1115. 8 : ["Leatherworking_Tier2_Leather_Armor_Set_1", "Leatherworking_Tier2_Leather_Pants_1", "Leatherworking_Tier2_Leather_Boots_Set_1", "Leatherworking_Tier2_Leather_Shirt", "Leatherworking_Tier1_Gather_Basic"],
  1116. 9 : ["Leatherworking_Tier2_Leather_Armor_Set_1", "Leatherworking_Tier2_Leather_Pants_1", "Leatherworking_Tier2_Leather_Boots_Set_1", "Leatherworking_Tier2_Leather_Shirt", "Leatherworking_Tier1_Gather_Basic"],
  1117. 10 : ["Leatherworking_Tier2_Leather_Armor_Set_1", "Leatherworking_Tier2_Leather_Pants_1", "Leatherworking_Tier2_Leather_Boots_Set_1", "Leatherworking_Tier2_Leather_Shirt_2", "Leatherworking_Tier1_Gather_Basic"],
  1118. 11 : ["Leatherworking_Tier2_Leather_Armor_Set_1", "Leatherworking_Tier2_Leather_Pants_2", "Leatherworking_Tier2_Leather_Boots_Set_1", "Leatherworking_Tier2_Leather_Shirt_2", "Leatherworking_Tier2_Leather_Pants_1", "Leatherworking_Tier1_Gather_Basic"],
  1119. 12 : ["Leatherworking_Tier2_Leather_Armor_Set_1", "Leatherworking_Tier2_Leather_Pants_2", "Leatherworking_Tier2_Leather_Boots_Set_1", "Leatherworking_Tier2_Leather_Shirt_2", "Leatherworking_Tier2_Leather_Pants_1", "Leatherworking_Tier1_Gather_Basic"],
  1120. 13 : ["Leatherworking_Tier2_Leather_Armor_Set_1", "Leatherworking_Tier2_Leather_Pants_2", "Leatherworking_Tier2_Leather_Boots_Set_1", "Leatherworking_Tier2_Leather_Shirt_2", "Leatherworking_Tier2_Leather_Pants_1", "Leatherworking_Tier1_Gather_Basic"],
  1121. 14 : ["Leatherworking_Tier2_Leather_Armor_Set_1", "Leatherworking_Tier2_Leather_Pants_2", "Ornate Leatherworking_Tier1_Leather_Shirt_1", "Leatherworking_Tier3_Leather_Boots_Set_1", "Leatherworking_Tier1_Gather_Basic"],
  1122. 15 : ["Leatherworking_Tier3_Leather_Armor_Set_1", "Leatherworking_Tier3_Leather_Pants", "Leatherworking_Tier3_Leather_Shirt2", "Leatherworking_Tier3_Leather_Boots_Set_1", "Leatherworking_Tier1_Gather_Basic"],
  1123. 16 : ["Leatherworking_Tier3_Leather_Armor_Set_1", "Leatherworking_Tier3_Leather_Pants2", "Leatherworking_Tier3_Leather_Shirt2", "Leatherworking_Tier3_Leather_Helm_Set_1", "Leatherworking_Tier3_Leather_Pants", "Leatherworking_Tier1_Gather_Basic"],
  1124. 17 : ["Leatherworking_Tier3_Leather_Armor_Set_1", "Leatherworking_Tier3_Leather_Pants2", "Leatherworking_Tier3_Leather_Shirt2", "Leatherworking_Tier3_Leather_Helm_Set_1", "Leatherworking_Tier3_Leather_Pants", "Leatherworking_Tier1_Gather_Basic"],
  1125. 18 : ["Leatherworking_Tier3_Leather_Armor_Set_1", "Leatherworking_Tier3_Leather_Pants2", "Leatherworking_Tier3_Leather_Shirt2", "Leatherworking_Tier3_Leather_Helm_Set_1", "Leatherworking_Tier3_Leather_Pants", "Leatherworking_Tier1_Gather_Basic"],
  1126. 19 : ["Leatherworking_Tier3_Leather_Armor_Set_1", "Leatherworking_Tier3_Leather_Pants2", "Leatherworking_Tier3_Leather_Shirt2", "Leatherworking_Tier3_Leather_Helm_Set_1", "Leatherworking_Tier3_Leather_Pants", "Leatherworking_Tier1_Gather_Basic"],
  1127. //19:["Leather Armor +4","Fancy Leather Pants","Fancy Leather Shirt","Leather Helm +4","Ornate Leather Pants","Upgrade Tanner","Upgrade Skinner","Hire an additional Skinner"],
  1128. 20 : ["Leatherworking_Tier3_Leather_Pants"],
  1129. 21 : ["Leatherworking_Tier3_Leather_Pants"],
  1130. 22 : ["Leatherworking_Tier3_Leather_Pants"],
  1131. 23 : ["Leatherworking_Tier3_Leather_Pants"],
  1132. 24 : ["Leatherworking_Tier3_Leather_Pants"],
  1133. 25 : ["Leatherworking_Tier4_Refine_Basic", "Leatherworking_Tier4_Gather_Basic"],
  1134. },
  1135. } ]
  1136. };
  1137. addProfile("Leatherworking", {
  1138. profileName : "mass refining",
  1139. isProfileActive : true,
  1140. useMassTask : true,
  1141. level : {
  1142. 0: ["Leatherworking_Tier0_Intro_1"],
  1143. 1: ["Leatherworking_Tier1_Refine_Basic_Mass", "Leatherworking_Tier1_Gather_Basic"],
  1144. 2: "+25",
  1145. 7: ["Leatherworking_Tier2_Refine_Basic_Mass"],
  1146. 8: "+25",
  1147. 14: ["Leatherworking_Tier3_Refine_Basic_Mass"],
  1148. 15: "+25",
  1149. 21: ["Leatherworking_Tier4_Refine_Basic_Mass"],
  1150. 22: "+25",
  1151. },
  1152. });
  1153.  
  1154. addProfile("Leatherworking", {
  1155. profileName: "20->25 gather",
  1156. isProfileActive: true,
  1157. level: {
  1158. 20: ["Leatherworking_Tier3_Leather_Pants"],
  1159. 21: ["Leatherworking_Tier4_Refine_Basic_Mass", "Leatherworking_Tier4_Gather_Basic"],
  1160. 22: "+25",
  1161. 25: ["Leatherworking_Tier4_Refine_Basic", "Leatherworking_Tier4_Gather_Basic"],
  1162. },
  1163. });
  1164.  
  1165. addProfile("Leatherworking", {
  1166. profileName: "craft purples only",
  1167. level: {
  1168. //purples first. shirts > tunics > pants.
  1169. 25: ["Leatherworking_Tier4_Leather_Shirt_Special_2", //Exquisite Elemental Shirt
  1170. "Leatherworking_Tier4_Leather_Shirt_Special_2_Set2", //Exquisite Elemental Tunic
  1171. "Leatherworking_Tier4_Leather_Pants_Special_2_Set2", //Exquisite Elemental Trousers
  1172. "Leatherworking_Tier4_Leather_Pants_Special_2", //Exquisite Elemental Pants
  1173. "Leatherworking_Tier3_Gather_Basic"]
  1174. }
  1175. });
  1176.  
  1177. addProfile("Leatherworking", {
  1178. profileName: "craft Elemental Shirts",
  1179. level: {
  1180. //purples first. shirts > tunics > pants.
  1181. 25: ['Leatherworking_Tier4_Leather_Shirt_Special_2', //Exquisite Elemental Shirt
  1182. 'Leatherworking_Tier4_Leather_Shirt_Special_2_Set2', //Exquisite Elemental Tunic
  1183. 'Leatherworking_Tier4_Leather_Pants_Special_2_Set2', //Exquisite Elemental Trousers
  1184. 'Leatherworking_Tier4_Leather_Pants_Special_2', //Exquisite Elemental Pants
  1185. 'Leatherworking_Tier4_Leather_Shirt2', //Elemental Leather Shirt
  1186. "Leatherworking_Tier3_Gather_Basic"
  1187. ]
  1188. }
  1189. });
  1190.  
  1191. addProfile("Leatherworking", {
  1192. profileName: "craft Elemental Tunic",
  1193. level: {
  1194. //purples first. shirts > tunics > pants.
  1195. 25: ['Leatherworking_Tier4_Leather_Shirt_Special_2_Set2', //Exquisite Elemental Tunic
  1196. 'Leatherworking_Tier4_Leather_Shirt_Special_2', //Exquisite Elemental Shirt
  1197. 'Leatherworking_Tier4_Leather_Pants_Special_2_Set2', //Exquisite Elemental Trousers
  1198. 'Leatherworking_Tier4_Leather_Pants_Special_2', //Exquisite Elemental Pants
  1199. 'Leatherworking_Tier4_Leather_Shirt2_Set2', //Elemental Leather Tunic
  1200. 'Leatherworking_Tier3_Gather_Basic'
  1201. ]
  1202. }
  1203. });
  1204. addProfile("Leatherworking", {
  1205. profileName: "craft Elemental Trousers",
  1206. level: {
  1207. //purples first. shirts > tunics > pants.
  1208. 25: ['Leatherworking_Tier4_Leather_Pants_Special_2_Set2', //Exquisite Elemental Trousers
  1209. 'Leatherworking_Tier4_Leather_Pants_Special_2', //Exquisite Elemental Pants
  1210. 'Leatherworking_Tier4_Leather_Shirt_Special_2_Set2', //Exquisite Elemental Tunic
  1211. 'Leatherworking_Tier4_Leather_Shirt_Special_2', //Exquisite Elemental Shirt
  1212. 'Leatherworking_Tier4_Leather_Pants2_Set2', //Elemental Leather Trousers
  1213. 'Leatherworking_Tier3_Gather_Basic'
  1214. ]
  1215. }
  1216. });
  1217.  
  1218. addProfile("Leatherworking", {
  1219. profileName: "craft Elemental Pants",
  1220. level: {
  1221. //purples first. shirts > tunics > pants.
  1222. 25: ['Leatherworking_Tier4_Leather_Pants_Special_2', //Exquisite Elemental Pants
  1223. 'Leatherworking_Tier4_Leather_Pants_Special_2_Set2', //Exquisite Elemental Trousers
  1224. 'Leatherworking_Tier4_Leather_Shirt_Special_2_Set2', //Exquisite Elemental Tunic
  1225. 'Leatherdeworking_Tier4_Leather_Shirt_Special_2', //Exquisite Elemental Shirt
  1226. 'Leatherworking_Tier4_Leather_Pants2', //Elemental Leather Trousers
  1227. 'Leatherworking_Tier3_Gather_Basic'
  1228. ]
  1229. }
  1230. });
  1231.  
  1232. addProfile("Leatherworking", {
  1233. profileName: "Wondrous Sprocket",
  1234. isProfileActive: false,
  1235. level: {
  1236. 6: ["Leatherworking_Tier1_Event_Gond"],
  1237. 7: "+25",
  1238. },
  1239. });
  1240.  
  1241. definedTask["Tailoring"] = {
  1242. taskListName: "Tailoring",
  1243. taskName: "Tailoring",
  1244. taskDefaultPriority: 1,
  1245. taskDefaultSlotNum: 0,
  1246. taskActive: true,
  1247. taskDescription: "",
  1248. profiles: [{
  1249. profileName: "default",
  1250. isProfileActive: true,
  1251. level: {
  1252. 0: ["Tailoring_Tier0_Intro"],
  1253. 1: ["Tailoring_Tier1_Cloth_Boots_1", "Tailoring_Tier1_Cloth_Shirt_1", "Tailoring_Tier1_Gather_Basic"],
  1254. 2: ["Tailoring_Tier1_Cloth_Armor_1", "Tailoring_Tier1_Cloth_Pants_1", "Tailoring_Tier1_Gather_Basic"],
  1255. 3: ["Tailoring_Tier1_Cloth_Armor_1", "Tailoring_Tier1_Cloth_Boots_Set_1", "Tailoring_Tier1_Gather_Basic"],
  1256. 4: ["Tailoring_Tier1_Cloth_Armor_1", "Tailoring_Tier1_Cloth_Boots_Set_1", "Tailoring_Tier1_Gather_Basic"],
  1257. 5: ["Tailoring_Tier1_Cloth_Armor_Set_1", "Tailoring_Tier1_Cloth_Boots_Set_1", "Tailoring_Tier1_Gather_Basic"],
  1258. 6: ["Tailoring_Tier1_Cloth_Armor_Set_1", "Tailoring_Tier1_Cloth_Boots_Set_1", "Tailoring_Tier1_Gather_Basic"],
  1259. 7: ["Tailoring_Tier1_Cloth_Armor_Set_1", "Tailoring_Tier2_Cloth_Boots_Set_1", "Tailoring_Tier2_Cloth_Shirt", "Tailoring_Tier1_Gather_Basic", "Tailoring_Tier1_Gather_Basic"],
  1260. 8: ["Tailoring_Tier2_Cloth_Armor_Set_1", "Tailoring_Tier2_Cloth_Pants_1", "Tailoring_Tier2_Cloth_Boots_Set_1", "Tailoring_Tier2_Cloth_Shirt", "Tailoring_Tier1_Gather_Basic"],
  1261. 9: ["Tailoring_Tier2_Cloth_Armor_Set_1", "Tailoring_Tier2_Cloth_Pants_1", "Tailoring_Tier2_Cloth_Boots_Set_1", "Tailoring_Tier2_Cloth_Shirt", "Tailoring_Tier1_Gather_Basic"],
  1262. 10: ["Tailoring_Tier2_Cloth_Armor_Set_1", "Tailoring_Tier2_Cloth_Pants_1", "Tailoring_Tier2_Cloth_Boots_Set_1", "Tailoring_Tier2_Cloth_Shirt_2", "Tailoring_Tier1_Gather_Basic"],
  1263. 11: ["Tailoring_Tier2_Cloth_Armor_Set_1", "Tailoring_Tier2_Cloth_Pants_2", "Tailoring_Tier2_Cloth_Boots_Set_1", "Tailoring_Tier2_Cloth_Shirt_2", "Tailoring_Tier2_Cloth_Pants_1", "Tailoring_Tier1_Gather_Basic"],
  1264. 12: ["Tailoring_Tier2_Cloth_Armor_Set_1", "Tailoring_Tier2_Cloth_Pants_2", "Tailoring_Tier2_Cloth_Boots_Set_1", "Tailoring_Tier2_Cloth_Shirt_2", "Tailoring_Tier2_Cloth_Pants_1", "Tailoring_Tier1_Gather_Basic"],
  1265. 13: ["Tailoring_Tier2_Cloth_Armor_Set_1", "Tailoring_Tier2_Cloth_Pants_2", "Tailoring_Tier2_Cloth_Boots_Set_1", "Tailoring_Tier2_Cloth_Shirt_2", "Tailoring_Tier2_Cloth_Pants_1", "Tailoring_Tier1_Gather_Basic"],
  1266. 14: ["Tailoring_Tier2_Cloth_Armor_Set_1", "Tailoring_Tier2_Cloth_Pants_2", "Tailoring_Tier3_Cloth_Shirt", "Tailoring_Tier3_Cloth_Boots_Set_1", "Tailoring_Tier1_Gather_Basic"],
  1267. 15: ["Tailoring_Tier3_Cloth_Armor_Set_1", "Tailoring_Tier3_Cloth_Pants", "Tailoring_Tier3_Cloth_Shirt2", "Tailoring_Tier3_Cloth_Boots_Set_1", "Tailoring_Tier1_Gather_Basic"],
  1268. 16: ["Tailoring_Tier3_Cloth_Armor_Set_1", "Tailoring_Tier3_Cloth_Pants", "Tailoring_Tier3_Cloth_Shirt2", "Tailoring_Tier3_Cloth_Helm_Set_1", "Tailoring_Tier1_Gather_Basic"],
  1269. 17: ["Tailoring_Tier3_Cloth_Armor_Set_1", "Tailoring_Tier3_Cloth_Pants2_Set2", "Tailoring_Tier3_Cloth_Shirt2", "Tailoring_Tier3_Cloth_Helm_Set_1", "Tailoring_Tier1_Gather_Basic"],
  1270. 18: ["Tailoring_Tier3_Cloth_Armor_Set_3", "Tailoring_Tier3_Cloth_Armor_Set_2", "Tailoring_Tier3_Cloth_Armor_Set_1", "Tailoring_Tier3_Cloth_Pants2_Set2", "Tailoring_Tier3_Cloth_Shirt2", "Tailoring_Tier3_Cloth_Helm_Set_1", "Tailoring_Tier3_Cloth_Pants", "Tailoring_Tier1_Gather_Basic"],
  1271. 19: ["Tailoring_Tier3_Cloth_Armor_Set_3", "Tailoring_Tier3_Cloth_Armor_Set_2", "Tailoring_Tier3_Cloth_Armor_Set_1", "Tailoring_Tier3_Cloth_Pants2_Set2", "Tailoring_Tier3_Cloth_Shirt2", "Tailoring_Tier3_Cloth_Helm_Set_1", "Tailoring_Tier3_Cloth_Pants", "Tailoring_Tier1_Gather_Basic"],
  1272. //19:["Cloth Robes +4","Fancy Cloth Pants","Fancy Cloth Shirt","Cloth Cap +4","Ornate Cloth Pants","Upgrade Outfitter","Upgrade Weaver","Hire an additional Weaver"],
  1273. 20: ["Tailoring_Tier3_Cloth_Pants"],
  1274. 21: ["Tailoring_Tier3_Cloth_Pants"],
  1275. 22: ["Tailoring_Tier3_Cloth_Pants"],
  1276. 23: ["Tailoring_Tier3_Cloth_Pants"],
  1277. 24: ["Tailoring_Tier3_Cloth_Pants"],
  1278. 25: ["Crafted_Tailoring_T4_Refine_Basic", "Crafted_Tailoring_T4_Gather_Basic"],
  1279. },
  1280. }]
  1281. };
  1282.  
  1283. addProfile("Tailoring", {
  1284. profileName : "mass refining",
  1285. isProfileActive : true,
  1286. useMassTask : true,
  1287. level : {
  1288. 0: ["Tailoring_Tier0_Intro"],
  1289. 1: ["Tailoring_Tier1_Refine_Basic_Mass", "Tailoring_Tier1_Gather_Basic"],
  1290. 2: "+25",
  1291. 7: ["Tailoring_Tier2_Refine_Basic_Mass"],
  1292. 8: "+25",
  1293. 14: ["Tailoring_Tier3_Refine_Basic_Mass"],
  1294. 15: "+25",
  1295. 21: ["Crafted_Tailoring_T4_Refine_Basic_Mass"],
  1296. 22: "+25",
  1297. },
  1298. });
  1299.  
  1300. addProfile("Tailoring", {
  1301. profileName: "21->25 gather",
  1302. isProfileActive: true,
  1303. level: {
  1304. 21: ["Crafted_Tailoring_T4_Refine_Basic_Mass", "Crafted_Tailoring_T4_Gather_Basic_Mass"],
  1305. 22: "+25",
  1306. 25: ["Crafted_Tailoring_T4_Refine_Basic", "Crafted_Tailoring_T4_Gather_Basic"],
  1307. },
  1308. });
  1309.  
  1310. addProfile("Tailoring", {
  1311. profileName: "Wondrous Sprocket",
  1312. isProfileActive: false,
  1313. level: {
  1314. 6: ["Tailoring_Tier1_Event_Gond"],
  1315. 7: "+25",
  1316. },
  1317. });
  1318.  
  1319.  
  1320. definedTask["Artificing"] = {
  1321. taskListName: "Artificing",
  1322. taskName: "Artificing",
  1323. taskDefaultPriority: 1,
  1324. taskDefaultSlotNum: 0,
  1325. taskActive: true,
  1326. taskDescription: "",
  1327. profiles: [{
  1328. profileName: "default",
  1329. isProfileActive: true,
  1330. level: {
  1331. 0: ["Artificing_Tier0_Intro_1"],
  1332. 1: ["Artificing_Tier1_Pactblade_Convergence_1", "Artificing_Tier1_Symbol_Virtuous_1", "Artificing_Tier1_Gather_Basic"],
  1333. 2: ["Artificing_Tier1_Pactblade_Convergence_1", "Artificing_Tier1_Icon_Virtuous_1", "Artificing_Tier1_Gather_Basic"],
  1334. 3: ["Artificing_Tier1_Pactblade_Convergence_1", "Artificing_Tier1_Icon_Virtuous_1", "Artificing_Tier1_Gather_Basic"],
  1335. 4: ["Artificing_Tier1_Pactblade_Convergence_2", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier1_Gather_Basic"],
  1336. 5: ["Artificing_Tier1_Pactblade_Convergence_2", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier1_Gather_Basic"],
  1337. 6: ["Artificing_Tier1_Pactblade_Convergence_2", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier1_Gather_Basic"],
  1338. 7: ["Artificing_Tier2_Pactblade_Temptation_3", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1339. 8: ["Artificing_Tier2_Pactblade_Temptation_3", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1340. 9: ["Artificing_Tier2_Pactblade_Temptation_3", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1341. 10: ["Artificing_Tier2_Pactblade_Temptation_3", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1342. 11: ["Artificing_Tier2_Pactblade_Temptation_3", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1343. 12: ["Artificing_Tier2_Pactblade_Temptation_3", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1344. 13: ["Artificing_Tier2_Pactblade_Temptation_3", "Artificing_Tier1_Icon_Virtuous_2", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1345. 14: ["Artificing_Tier3_Pactblade_Temptation_4", "Artificing_Tier3_Icon_Virtuous_4", "Artificing_Tier3_Refine_Basic", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1346. 15: ["Artificing_Tier3_Pactblade_Temptation_4", "Artificing_Tier3_Icon_Virtuous_4", "Artificing_Tier3_Refine_Basic", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1347. 16: ["Artificing_Tier3_Pactblade_Temptation_4", "Artificing_Tier3_Icon_Virtuous_4", "Artificing_Tier3_Refine_Basic", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1348. 17: ["Artificing_Tier3_Pactblade_Temptation_5", "Artificing_Tier3_Icon_Virtuous_5", "Artificing_Tier3_Refine_Basic", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1349. 18: ["Artificing_Tier3_Pactblade_Temptation_5", "Artificing_Tier3_Icon_Virtuous_5", "Artificing_Tier3_Refine_Basic", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1350. 19: ["Artificing_Tier3_Pactblade_Temptation_5", "Artificing_Tier3_Icon_Virtuous_5", "Artificing_Tier3_Refine_Basic", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1351. //19:["Virtuous Icon +5","Upgrade Engraver","Upgrade Carver","Hire an additional Carver"],
  1352. 20: ["Artificing_Tier3_Pactblade_Temptation_5", "Artificing_Tier3_Icon_Virtuous_5", "Artificing_Tier3_Refine_Basic", "Artificing_Tier2_Refine_Basic", "Artificing_Tier1_Gather_Basic"],
  1353. 21: ["Artificing_Tier4_Gather_Basic"],
  1354. 22: ["Artificing_Tier4_Gather_Basic"],
  1355. 23: ["Artificing_Tier4_Gather_Basic"],
  1356. 24: ["Artificing_Tier4_Gather_Basic"],
  1357. 25: ["Artificing_Tier4_Refine_Basic", "Artificing_Tier4_Gather_Basic"],
  1358. },
  1359. }]
  1360. };
  1361.  
  1362. addProfile("Artificing", {
  1363. profileName : "mass refining",
  1364. isProfileActive : true,
  1365. useMassTask : true,
  1366. level : {
  1367. 0: ["Artificing_Tier0_Intro_1"],
  1368. 1: ["Artificing_Tier1_Refine_Basic_Mass", "Artificing_Tier1_Gather_Basic"],
  1369. 2: "+25",
  1370. 7: ["Artificing_Tier2_Refine_Basic_Mass"],
  1371. 8: "+25",
  1372. 14: ["Artificing_Tier3_Refine_Basic_Mass"],
  1373. 15: "+25",
  1374. 21: ["Artificing_Tier4_Refine_Basic_Mass"],
  1375. 22: "+25",
  1376. },
  1377. });
  1378.  
  1379. addProfile("Artificing", {
  1380. profileName: "Wondrous Sprocket",
  1381. isProfileActive: false,
  1382. level: {
  1383. 6: ["Artificing_Tier1_Event_Gond"],
  1384. 7: "+25",
  1385. },
  1386. });
  1387.  
  1388.  
  1389. definedTask["Weaponsmithing"] = {
  1390. taskListName: "Weaponsmithing",
  1391. taskName: "Weaponsmithing",
  1392. taskDefaultPriority: 1,
  1393. taskDefaultSlotNum: 0,
  1394. taskActive: true,
  1395. taskDescription: "",
  1396. profiles: [{
  1397. profileName: "default",
  1398. isProfileActive: true,
  1399. level: {
  1400. 0: ["Weaponsmithing_Tier0_Intro"],
  1401. 1: ["Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1402. 2: ["Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1403. 3: ["Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1404. 4: ["Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1405. 5: ["Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1406. 6: ["Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1407. 7: ["Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1408. 8: ["Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1409. 9: ["Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1410. 10: ["Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1411. 11: ["Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1412. 12: ["Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1413. 13: ["Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1414. 14: ["Weaponsmithing_Tier3_Dagger_4", "Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1415. 15: ["Weaponsmithing_Tier3_Dagger_4", "Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1416. 16: ["Weaponsmithing_Tier3_Dagger_4", "Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1417. 17: ["Weaponsmithing_Tier3_Dagger_4", "Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1418. 18: ["Weaponsmithing_Tier3_Dagger_4", "Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1419. 19: ["Weaponsmithing_Tier3_Dagger_4", "Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1420. 20: ["Weaponsmithing_Tier3_Dagger_Set_2", "Weaponsmithing_Tier2_Dagger_3", "Weaponsmithing_Tier1_Dagger_2", "Weaponsmithing_Tier1_Dagger_1", "Weaponsmithing_Tier1_Gather_Basic"],
  1421. //19:["Dagger+4","Upgrade Grinder","Upgrade Smelter","Hire an additional Smelter"],
  1422. 21: ["Weaponsmithing_Tier4_Gather_Basic"],
  1423. 22: ["Weaponsmithing_Tier4_Gather_Basic"],
  1424. 23: ["Weaponsmithing_Tier4_Gather_Basic"],
  1425. 24: ["Weaponsmithing_Tier4_Gather_Basic"],
  1426. 25: ["Weaponsmithing_Tier4_Refine_Basic", "Weaponsmithing_Tier4_Gather_Basic"],
  1427. },
  1428. }]
  1429. };
  1430.  
  1431. addProfile("Weaponsmithing", {
  1432. profileName : "mass refining",
  1433. isProfileActive : true,
  1434. useMassTask : true,
  1435. level : {
  1436. 0: ["Weaponsmithing_Tier0_Intro"],
  1437. 1: ["Weaponsmithing_Tier1_Refine_Basic_Mass", "Weaponsmithing_Tier1_Gather_Basic"],
  1438. 2: "+25",
  1439. 7: ["Weaponsmithing_Tier2_Refine_Basic_Mass"],
  1440. 8: "+25",
  1441. 14: ["Weaponsmithing_Tier3_Refine_Basic_Mass"],
  1442. 15: "+25",
  1443. 21: ["Weaponsmithing_Tier4_Refine_Basic_Mass"],
  1444. 22: "+25",
  1445. },
  1446. });
  1447.  
  1448. addProfile("Weaponsmithing", {
  1449. profileName: "Wondrous Sprocket",
  1450. isProfileActive: false,
  1451. level: {
  1452. 6: ["Weaponsmithing_Tier1_Event_Gond"],
  1453. 7: "+25",
  1454. },
  1455. });
  1456.  
  1457. definedTask["Alchemy"] = {
  1458. taskListName: "Alchemy",
  1459. taskName: "Alchemy",
  1460. taskDefaultPriority: 1,
  1461. taskDefaultSlotNum: 0,
  1462. taskActive: true,
  1463. taskDescription: "",
  1464. profiles: [{
  1465. profileName: "default",
  1466. isProfileActive: true,
  1467. level: {
  1468. 0: ["Alchemy_Tier0_Intro_1"],
  1469. 1: ["Alchemy_Tier1_Experiment_Rank2", "Alchemy_Tier1_Experimentation_Rank1", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier1_Gather_Basic"],
  1470. 2: ["Alchemy_Tier1_Experiment_Rank3", "Alchemy_Tier1_Experimentation_Rank2", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier1_Gather_Basic"],
  1471. 3: ["Alchemy_Tier1_Experiment_Rank4", "Alchemy_Tier1_Experimentation_Rank3", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier1_Gather_Basic"],
  1472. 4: ["Alchemy_Tier1_Experiment_Rank5", "Alchemy_Tier1_Experimentation_Rank4", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier1_Gather_Basic"],
  1473. 5: ["Alchemy_Tier1_Experiment_Rank6", "Alchemy_Tier1_Experimentation_Rank5", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier1_Gather_Basic"],
  1474. 6: ["Alchemy_Tier1_Experiment_Rank7", "Alchemy_Tier1_Experimentation_Rank6", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier1_Gather_Basic"],
  1475. 7: ["Alchemy_Tier2_Experiment_Rank08", "Alchemy_Tier2_Experimentation_Rank07", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier2_Gather_Basic"],
  1476. 8: ["Alchemy_Tier2_Experiment_Rank09", "Alchemy_Tier2_Experimentation_Rank08", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier2_Gather_Basic"],
  1477. 9: ["Alchemy_Tier2_Experiment_Rank10", "Alchemy_Tier2_Experimentation_Rank09", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier2_Gather_Basic"],
  1478. 10: ["Alchemy_Tier2_Experiment_Rank11", "Alchemy_Tier2_Experimentation_Rank10", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier2_Gather_Basic"],
  1479. 11: ["Alchemy_Tier2_Experiment_Rank12", "Alchemy_Tier2_Experimentation_Rank11", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier2_Gather_Basic"],
  1480. 12: ["Alchemy_Tier2_Experiment_Rank13", "Alchemy_Tier2_Experimentation_Rank12", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier2_Gather_Basic"],
  1481. 13: ["Alchemy_Tier2_Experiment_Rank14", "Alchemy_Tier2_Experimentation_Rank13", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier1_Refine_Basic", "Alchemy_Tier2_Gather_Basic"],
  1482. 14: ["Alchemy_Tier3_Experiment_Rank15", "Alchemy_Tier3_Experimentation_Rank14", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Basic"],
  1483. 15: ["Alchemy_Tier3_Experiment_Rank16", "Alchemy_Tier3_Experimentation_Rank15", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Basic"],
  1484. 16: ["Alchemy_Tier3_Experiment_Rank17", "Alchemy_Tier3_Experimentation_Rank16", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Basic"],
  1485. 17: ["Alchemy_Tier3_Experiment_Rank18", "Alchemy_Tier3_Experimentation_Rank17", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Basic"],
  1486. 18: ["Alchemy_Tier3_Experiment_Rank19", "Alchemy_Tier3_Experimentation_Rank18", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Basic"],
  1487. 19: ["Alchemy_Tier3_Experiment_Rank20", "Alchemy_Tier3_Experimentation_Rank19", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier2_Refine_Basic", "Alchemy_Tier1_Refine_Special", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Basic"],
  1488. 20: ["Alchemy_Tier3_Experiment_Rank21", "Alchemy_Tier3_Experimentation_Rank20", "Alchemy_Tier2_Aquaregia", "Alchemy_Tier4_Refine_Basic", "Alchemy_Tier4_Gather_Components", "Alchemy_Tier4_Gather_Basic"],
  1489. 21: ["Alchemy_Tier4_Experiment_Rank22", "Alchemy_Tier4_Experimentation_Rank21", "Alchemy_Tier2_Aquaregia", "Alchemy_Tier4_Refine_Basic", "Alchemy_Tier4_Gather_Components", "Alchemy_Tier4_Gather_Basic"],
  1490. 22: ["Alchemy_Tier4_Experiment_Rank23", "Alchemy_Tier4_Experimentation_Rank22", "Alchemy_Tier4_Aquaregia_2", "Alchemy_Tier4_Refine_Basic", "Alchemy_Tier4_Gather_Components", "Alchemy_Tier1_Gather_Basic"],
  1491. 23: ["Alchemy_Tier4_Experiment_Rank24", "Alchemy_Tier4_Experimentation_Rank23", "Alchemy_Tier4_Aquaregia_2", "Alchemy_Tier4_Refine_Basic", "Alchemy_Tier4_Gather_Components", "Alchemy_Tier1_Gather_Basic"],
  1492. 24: ["Alchemy_Tier4_Experiment_Rank25", "Alchemy_Tier4_Experimentation_Rank24", "Alchemy_Tier4_Aquaregia_2", "Alchemy_Tier4_Refine_Basic", "Alchemy_Tier4_Gather_Components", "Alchemy_Tier1_Gather_Basic"],
  1493. 25: ["Alchemy_Tier4_Experimentation_Rank25", "Alchemy_Tier4_Create_Elemental_Unified", "Alchemy_Tier4_Create_Elemental_Aggregate", "Alchemy_Tier3_Protection_Potion_Major", "Alchemy_Tier3_Potency_Potion_Major", "Alchemy_Tier4_Aquaregia_2", "Alchemy_Tier4_Refine_Basic", "Alchemy_Tier1_Gather_Basic"],
  1494. },
  1495. }]
  1496. };
  1497.  
  1498.  
  1499. addProfile("Alchemy", {
  1500. profileName: "Aqua Regia",
  1501. level: {
  1502. 20: ["Alchemy_Tier2_Aquaregia", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Components"],
  1503. 21: "+25",
  1504. 22: ["Alchemy_Tier4_Aquaregia_2", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Components"],
  1505. 23: "+25",
  1506. }
  1507. });
  1508. addProfile("Alchemy", {
  1509. profileName: "Aqua Vitae",
  1510. level: {
  1511. 20: ["Alchemy_Tier2_Aquavitae_2", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Components"],
  1512. 21: "+25",
  1513. }
  1514. });
  1515. addProfile("Alchemy", {
  1516. profileName: "Protection Superior",
  1517. level: {
  1518. 25: ["Alchemy_Tier4_Experimentation_Rank25", "Alchemy_Tier4_Protection_Potion_Superior", "Alchemy_Tier4_Create_Elemental_Aggregate", "Alchemy_Tier3_Protection_Potion_Major", "Alchemy_Tier2_Aquaregia", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Components"],
  1519. }
  1520. });
  1521. addProfile("Alchemy", {
  1522. profileName: "Potency Superior",
  1523. level: {
  1524. 25: ["Alchemy_Tier4_Experimentation_Rank25", "Alchemy_Tier4_Potency_Potion_Superior", "Alchemy_Tier4_Create_Elemental_Aggregate", "Alchemy_Tier3_Potency_Potion_Major", "Alchemy_Tier2_Aquaregia", "Alchemy_Tier3_Refine_Basic", "Alchemy_Tier3_Gather_Components"],
  1525. }
  1526. });
  1527.  
  1528. addProfile("Alchemy", {
  1529. profileName: "Blue & Green Vitriol",
  1530. isProfileActive: true,
  1531. level: {
  1532. 1: ["Alchemy_Tier1_Refine_Basic", "Alchemy_Tier1_Gather_Components"],
  1533. 2: "+25",
  1534. },
  1535. });
  1536.  
  1537. addProfile("Alchemy", {
  1538. profileName: "Wondrous Sprocket",
  1539. isProfileActive: false,
  1540. level: {
  1541. 6: ["Alchemy_Tier1_Event_Gond"],
  1542. 7: "+25",
  1543. },
  1544. });
  1545.  
  1546.  
  1547. // Profession priority list by order
  1548. var tasklist = [
  1549. definedTask["Leadership"],
  1550. definedTask["Jewelcrafting"],
  1551. definedTask["Alchemy"],
  1552. definedTask["Weaponsmithing"],
  1553. definedTask["Artificing"],
  1554. definedTask["Mailsmithing"],
  1555. definedTask["Platesmithing"],
  1556. definedTask["Leatherworking"],
  1557. definedTask["Tailoring"],
  1558. definedTask["Black Ice Shaping"],
  1559. definedTask["Winter Event"],
  1560. definedTask["Siege Event"],
  1561. ];
  1562.  
  1563. var customProfiles = []; // [ { taskName: 'name', baseProfile: 'profileName' / null, profile: JSON.parsed_from_input }, { } ....]
  1564. var scriptSettings = {};
  1565.  
  1566. // Populated at login
  1567. var loggedAccount = null;
  1568. var UIaccount = null;
  1569. var accountSettings = {};
  1570. var charSettingsList = [];
  1571. var charNamesList = [];
  1572. var charStatisticsList = []; // array of char names with the charStatistics for each char.
  1573.  
  1574. var defaultCharStatistics = {
  1575. general: {
  1576. nextTask: null,
  1577. lastVisit: null,
  1578. lastSCAVisit: null,
  1579. refineCounter: 0,
  1580. refineCounterReset: Date.now(),
  1581. diamonds: 0,
  1582. gold: 0,
  1583. rad: 0,
  1584. rBI: 0,
  1585. BI: 0,
  1586. refined: 0,
  1587. refineLimitLeft: 0,
  1588. emptyBagSlots: 0,
  1589. activeSlots: 0,
  1590. },
  1591. professions: {
  1592. // Names must match unsafeWindow.client.dataModel.model.ent.main.itemassignmentcategories.categories.displayname
  1593. "Leadership": { level: 0, workersUsed: [], workersUnused: [] },
  1594. "Alchemy": { level: 0, workersUsed: [], workersUnused: [] },
  1595. "Jewelcrafting": { level: 0, workersUsed: [], workersUnused: [] },
  1596. "Weaponsmithing": { level: 0,workersUsed: [], workersUnused: [] },
  1597. "Artificing": { level: 0, workersUsed: [], workersUnused: [] },
  1598. "Mailsmithing": { level: 0, workersUsed: [], workersUnused: []},
  1599. "Platesmithing": { level: 0, workersUsed: [], workersUnused: [] },
  1600. "Leatherworking": { level: 0, workersUsed: [], workersUnused: [] },
  1601. "Tailoring": { level: 0, workersUsed: [], workersUnused: [] },
  1602. "Black Ice Shaping": { level: 0, workersUsed: [], workersUnused: [] },
  1603. /*
  1604. "Winter Event": { level: 0, workersUsed: [], workersUnused: [] },
  1605. "Siege Event": { level: 0, workersUsed: [], workersUnused: [] },
  1606. */
  1607. },
  1608. tools: {
  1609. "Awl":{used:[],unused:[]},
  1610. "Shears":{used:[],unused:[]},
  1611. "Hammer":{used:[],unused:[]},
  1612. "Needle":{used:[],unused:[]},
  1613. "Bellows":{used:[],unused:[]},
  1614. "Bezelpusher":{used:[],unused:[]},
  1615. "Mortar":{used:[],unused:[]},
  1616. "Anvil":{used:[],unused:[]},
  1617. "Grindstone":{used:[],unused:[]},
  1618. "Philosophersstone":{used:[],unused:[]},
  1619. "Loupe":{used:[],unused:[]},
  1620. "Graver":{used:[],unused:[]},
  1621. "Crucible":{used:[],unused:[]},
  1622. "Tongs":{used:[],unused:[]},
  1623. },
  1624. trackedResources: [],
  1625. slotUse: [],
  1626. };
  1627.  
  1628. /* For searching unsafeWindow.client.dataModel.model.ent.main.inventory.assignedslots / unsafeWindow.client.dataModel.model.ent.main.inventory.notassignedslots
  1629. This needs some design change. */
  1630.  
  1631. // The definitions themselves are at the bottom of the script
  1632. var workerList = workerDefinition();
  1633. var toolList = toolListDefinition();
  1634.  
  1635. var trackResources = [{
  1636. fname: 'Aqua Regia',
  1637. name: 'Crafting_Resource_Aquaregia'
  1638. }, {
  1639. fname: 'Aqua Vitae',
  1640. name: 'Crafting_Resource_Aquavitae'
  1641. }, {
  1642. fname: 'Residuum',
  1643. name: 'Crafting_Resource_Residuum'
  1644. }, {
  1645. fname: 'Mining Claim',
  1646. name: 'Crafting_Resource_Mining_Claim'
  1647. }, {
  1648. fname: 'e.Aggregate',
  1649. name: 'Crafting_Resource_Elemental_Aggregate'
  1650. }, {
  1651. fname: 'UE',
  1652. name: 'Crafting_Resource_Elemental_Unified'
  1653. },
  1654. ];
  1655.  
  1656. var defaultScriptSettings = {
  1657. general: {
  1658. saveCharNextTime: true,
  1659. scriptPaused: false,
  1660. language: 'en',
  1661. scriptDebugMode: true,
  1662. scriptAutoReload: false,
  1663. autoLogin: false,
  1664. autoLoginAccount: "",
  1665. autoLoginPassword: "",
  1666. autoReload: false,
  1667. scriptDelayFactor: 1,
  1668. maxCollectTaskAttempts: 2,
  1669. }
  1670. };
  1671.  
  1672.  
  1673. // Loading script settings.
  1674. var tempScriptSettings;
  1675. try {
  1676. tempScriptSettings = JSON.parse(GM_getValue("settings__script", "{}"));
  1677. } catch (e) {
  1678. tempScriptSettings = null;
  1679. }
  1680. if (!tempScriptSettings) {
  1681. console.warn('Script settings couldn\'t be retrieved, loading defaults.');
  1682. tempScriptSettings = {};
  1683. };
  1684. scriptSettings = $.extend(true, {}, defaultScriptSettings, tempScriptSettings);
  1685. // Loading custom profiles.
  1686. try {
  1687. customProfiles = JSON.parse(GM_getValue("custom_profiles", null));
  1688. } catch (e) {
  1689. customProfiles = null;
  1690. }
  1691. if (!customProfiles) {
  1692. console.warn('Custom profiles couldn\'t be retrieved.');
  1693. customProfiles = [];
  1694. };
  1695. customProfiles.forEach(function (cProfile, idx) {
  1696. if (!cProfile.profile.hasOwnProperty('recursiveList')){ cProfile.profile.recursiveList = false;}
  1697. addProfile(cProfile.taskName, cProfile.profile, cProfile.baseProfile);
  1698. });
  1699. unsafeWindow.console.log('DebugMode set to: ' + scriptSettings.general.scriptDebugMode);
  1700. console = scriptSettings.general.scriptDebugMode ? unsafeWindow.console || fouxConsole : fouxConsole;
  1701.  
  1702. var delay_modifier = parseFloat(scriptSettings.general.scriptDelayFactor);
  1703. delay.SHORT *= delay_modifier; delay.MEDIUM *= delay_modifier; delay.LONG *= delay_modifier;
  1704. delay.MINS *= 1; delay.DEFAULT *= delay_modifier; delay.TIMEOUT *= delay_modifier;
  1705.  
  1706.  
  1707. var defaultAccountSettings = {
  1708. vendorSettings: {
  1709. vendorJunk: false,
  1710. vendorKitsLimit: false,
  1711. vendorAltarsLimit: false,
  1712. vendorKitsAll: false,
  1713. vendorAltarsAll: false,
  1714. vendorProfResults: false,
  1715. vendorPots1: false,
  1716. vendorPots2: false,
  1717. vendorPots3: false,
  1718. vendorPots4: false,
  1719. vendorPots5: false,
  1720. vendorEnchR1: false,
  1721. vendorEnchR2: false,
  1722. vendorEnchR3: false,
  1723. },
  1724. professionSettings: {
  1725. fillOptionals: true,
  1726. autoPurchaseRes: true,
  1727. trainAssets: true,
  1728. smartLeadershipAssets: true,
  1729. skipPatrolTask: 'AD&Lvl20',
  1730. },
  1731. generalSettings: {
  1732. refineAD: true,
  1733. openRewards: false,
  1734. keepOneUnopened: false,
  1735. runSCA: 'free',
  1736. SCADailyReset: Date.now() - 24*60*60*1000,
  1737. },
  1738. consolidationSettings: {
  1739. bankCharName: "",
  1740. transferRate: 100,
  1741. consolidate: false,
  1742. minCharBalance: 10000,
  1743. minToTransfer: 50000,
  1744. },
  1745. };
  1746.  
  1747.  
  1748. var defaultCharSettings = {
  1749. charName: "",
  1750. general: {
  1751. active: false,
  1752. overrideGlobalSettings: false,
  1753. manualTaskSlots: false,
  1754. },
  1755. vendorSettings: {
  1756. vendorJunk: false,
  1757. vendorKitsLimit: false,
  1758. vendorAltarsLimit: false,
  1759. vendorKitsAll: false,
  1760. vendorAltarsAll: false,
  1761. vendorProfResults: false,
  1762. vendorPots1: false,
  1763. vendorPots2: false,
  1764. vendorPots3: false,
  1765. vendorPots4: false,
  1766. vendorPots5: false,
  1767. vendorEnchR1: false,
  1768. vendorEnchR2: false,
  1769. vendorEnchR3: false,
  1770. },
  1771. professionSettings: {
  1772. fillOptionals: true,
  1773. autoPurchaseRes: true,
  1774. trainAssets: true,
  1775. skipPatrolTask: 'AD&Lvl20',
  1776. smartLeadershipAssets: true,
  1777. },
  1778. generalSettings: {
  1779. refineAD: true,
  1780. keepOneUnopened: false,
  1781. openRewards: false,
  1782. runSCA: 'free',
  1783. },
  1784. consolidationSettings: {
  1785. consolidate: false,
  1786. minCharBalance: 10000,
  1787. minToTransfer: 50000,
  1788. },
  1789. taskListSettings: {},
  1790. taskListSettingsManual: [],
  1791. };
  1792.  
  1793. //Adding taskList defaults.
  1794. tasklist.forEach(function(task) {
  1795. var profileNames = [];
  1796. task.profiles.forEach(function(profile) {
  1797. if (profile.isProfileActive) profileNames.push({
  1798. name: profile.profileName,
  1799. value: profile.profileName
  1800. });
  1801. });
  1802. defaultCharSettings.taskListSettings[task.taskListName] = {};
  1803. defaultCharSettings.taskListSettings[task.taskListName].taskSlots = task.taskDefaultSlotNum;
  1804. defaultCharSettings.taskListSettings[task.taskListName].taskProfile = profileNames[0].value;
  1805. defaultCharSettings.taskListSettings[task.taskListName].taskPriority = task.taskDefaultPriority;
  1806. });
  1807.  
  1808. for (var i = 0; i < 9; i++) {
  1809. defaultCharSettings.taskListSettingsManual[i] = {};
  1810. defaultCharSettings.taskListSettingsManual[i].Profession = tasklist[0].taskListName;
  1811. defaultCharSettings.taskListSettingsManual[i].Profile = tasklist[0].profiles[0].profileName;
  1812. defaultCharSettings.taskListSettingsManual[i].fillAssets = 0;
  1813. }
  1814. // 0 - default, 1 - do not fill, 2 - people (white to purple), 3 - people (purple to white), 4 - tools
  1815. var charSlotsFillAssetsOptions = ['default', 'Do not fill', 'people (white to purple)', 'people (purple to white)', 'tools'];
  1816.  
  1817. // Usable only after login (return account or char settings, depending on override and match)
  1818. function getSetting(group, name) {
  1819. var override = false;
  1820. if (typeof(charSettingsList[curCharName]) !== undefined && typeof(charSettingsList[curCharName].general) !== undefined) {
  1821. override = charSettingsList[curCharName].general.overrideGlobalSettings;
  1822. }
  1823. else console.warn("overrideGlobalSettings could not been reached." );
  1824.  
  1825. if (override) {
  1826. if (typeof(charSettingsList[curCharName][group]) !== undefined &&
  1827. typeof(charSettingsList[curCharName][group][name]) !== undefined) {
  1828. return charSettingsList[curCharName][group][name];
  1829. }
  1830. else console.warn("charSetting value could not been reached for " + group + " " + name);
  1831. }
  1832. if (typeof(accountSettings[group]) !== undefined &&
  1833. typeof(accountSettings[group][name]) !== undefined) {
  1834. return accountSettings[group][name];
  1835. }
  1836. else console.warn("accountSettings value could not been reached for " + group + " " + name);
  1837. return null;
  1838. }
  1839.  
  1840.  
  1841. // UI Settings
  1842. var settingnames = [
  1843. //{scope: 'script', group: 'general', name: 'scriptPaused', title: 'Pause Script', type: 'checkbox', pane: 'main', tooltip: 'Disable All Automation'},
  1844. {scope: 'script', group: 'general', name: 'language', title: tr('settings.main.language'), type: 'select', pane: 'main', tooltip: tr('settings.main.language.tooltip'),
  1845. opts: [ { name: 'english', value: 'en'},
  1846. { name: 'polski', value: 'pl'},
  1847. { name: 'français', value: 'fr'}],
  1848. onchange : function(newValue) {
  1849. GM_setValue('language', newValue);
  1850. }
  1851. },
  1852. {scope: 'script', group: 'general', name: 'scriptDebugMode', title: tr('settings.main.debug'), type: 'checkbox', pane: 'main', tooltip: tr('settings.main.debug.tooltip'),
  1853. onchange: function(newValue) {
  1854. unsafeWindow.console.log('DebugMode set to: ' + newValue);
  1855. console = newValue ? unsafeWindow.console || fouxConsole : fouxConsole;
  1856. }
  1857. },
  1858. {scope: 'script', group: 'general', name: 'autoReload', title: tr('settings.main.autoreload'), type: 'checkbox', pane: 'main', tooltip: tr('settings.main.autoreload.tooltip')},
  1859. {scope: 'script', group: 'general', name: 'scriptDelayFactor', title: tr('settings.main.incdelay'), type: 'select', pane: 'main', tooltip: tr('settings.main.incdelay.tooltip'),
  1860. opts: [ { name: 'default - 1', value: '1'},
  1861. { name: '1.5', value: '1.5'},
  1862. { name: '2', value: '2'},
  1863. { name: '2.5', value: '2.5'},
  1864. { name: '3', value: '3'}],
  1865. },
  1866. {scope: 'script', group: 'general', name: 'autoLogin', title: tr('settings.main.autologin'), type: 'checkbox', pane: 'main', tooltip: tr('settings.main.autologin.tooltip')},
  1867. {scope: 'script', group: 'general', name: 'autoLoginAccount', title: tr('settings.main.nw_username'), type: 'text', pane: 'main', tooltip: tr('settings.main.nw_username.tooltip')},
  1868. {scope: 'script', group: 'general', name: 'autoLoginPassword', title: tr('settings.main.nw_password'), type: 'password', pane: 'main', tooltip: tr('settings.main.nw_password.tooltip')},
  1869. {scope: 'script', group: 'general', name: 'saveCharNextTime', title: tr('settings.main.savenexttime'), type: 'checkbox', pane: 'main', tooltip: tr('settings.main.savenexttime.tooltip')},
  1870. {scope: 'script', group: 'general', name: 'maxCollectTaskAttempts', title: 'Number of attempts to collect task result', type: 'select', pane: 'main', tooltip: 'After this number of attempts the the script will continue without collecting',
  1871. opts: [ { name: '1', value: 1}, { name: '2', value: 2}, { name: '3', value: 3}], },
  1872. {scope: 'account', group: 'generalSettings', name: 'openRewards', title: tr('settings.account.openrewards'), type: 'checkbox', pane: 'main', tooltip: tr('settings.account.openrewards.tooltip')},
  1873. {scope: 'account', group: 'generalSettings', name: 'keepOneUnopened', title: 'Keep one reward box unopened', type: 'checkbox', pane: 'main', tooltip: 'Used to reserve the slots for the reward boxes'},
  1874. {scope: 'account', group: 'generalSettings', name: 'refineAD', title: tr('settings.account.refinead'), type: 'checkbox', pane: 'main', tooltip: tr('settings.account.refinead.tooltip')},
  1875. {scope: 'account', group: 'generalSettings', name: 'runSCA', title: tr('settings.account.runSCA'), type: 'select', pane: 'main', tooltip: tr('settings.account.runSCA.tooltip'),
  1876. opts: [ { name: 'never', value: 'never'},
  1877. { name: 'free time', value: 'free'},
  1878. { name: 'always', value: 'always'}],
  1879. },
  1880. {scope: 'account', group: 'professionSettings', name: 'fillOptionals', type: 'checkbox', pane: 'prof', title: 'Fill Optional Assets', tooltip: 'Enable to include selecting the optional assets of tasks'},
  1881. {scope: 'account', group: 'professionSettings', name: 'autoPurchaseRes', type: 'checkbox', pane: 'prof', title: 'Auto Purchase Resources', tooltip: 'Automatically purchase required resources from gateway shop (100 at a time)'},
  1882. {scope: 'account', group: 'professionSettings', name:'trainAssets', type:'checkbox', pane:'prof', title:'Train Assets', tooltip:'Enable training/upgrading of asset worker resources'},
  1883. {scope: 'account', group: 'professionSettings', name:'smartLeadershipAssets', type:'checkbox', pane:'prof', title:'Smart Asset allocation for leadership', tooltip:'Try to spread and fill non-common assets and supplement with common if needed'},
  1884. {scope: 'account', group: 'professionSettings', name:'skipPatrolTask', type:'select', pane:'prof', title:'Skip Patrol task if > 10 claims', tooltip:'Skip \"Patrol the Mines\" leadership task if there are more than 10 mining claims in the inventory (Never, Always, On AD profile, if Leadership level is &gt;= 20, or both of the above )',
  1885. opts:[{name:'never',value:'never'},{name:'always',value:'always'},{name:'AD profile',value:'ad'},{name:'Leadership lvl 20',value:'ld20'},{name:'AD&Lvl20',value:'AD&Lvl20'}]},
  1886. {scope: 'account', group: 'vendorSettings', name:'vendorJunk', type:'checkbox', pane:'vend', title:'Auto Vendor junk..', tooltip:'Vendor all (currently) winterfest fireworks+lanterns'},
  1887. {scope: 'account', group: 'vendorSettings', name:'vendorKitsLimit', type:'checkbox', pane:'vend', title:'Vendor/Maintain Node Kit Stacks', tooltip:'Limit skill kits stacks to 50, vendor kits unusable by class, remove all if player has one bag or full bags'},
  1888. {scope: 'account', group: 'vendorSettings', name:'vendorAltarsLimit', type:'checkbox', pane:'vend', title:'Vendor/Maintain Altar Stacks', tooltip:'Limit Altars to 80,remove all if player has one bag or full bags'},
  1889. {scope: 'account', group: 'vendorSettings', name:'vendorKitsAll', type:'checkbox', pane:'vend', title:'Vendor All Node Kits', tooltip:'Sell ALL skill kits.'},
  1890. {scope: 'account', group: 'vendorSettings', name:'vendorAltarsAll', type:'checkbox', pane:'vend', title:'Vendor All Altar', tooltip:'Sell ALL Altars.'},
  1891. {scope: 'account', group: 'vendorSettings', name:'vendorProfResults',type:'checkbox',pane:'vend', title:'Vendor/Maintain Prof Crafted Levelup Items', tooltip:'Vendor off Tier 1 to 5 items produced and reused for leveling crafting professions.'},
  1892. {scope: 'account', group: 'vendorSettings', name:'vendorPots1', type:'checkbox', pane:'vend', title:'Auto Vendor minor potions (lvl 1)', tooltip:'Vendor all minor potions (lvl 1) found in player bags'},
  1893. {scope: 'account', group: 'vendorSettings', name:'vendorPots2', type:'checkbox', pane:'vend', title:'Auto Vendor lesser potions (lvl 15)',tooltip:'Vendor all lesser potions (lvl 15) found in player bags'},
  1894. {scope: 'account', group: 'vendorSettings', name:'vendorPots3', type:'checkbox', pane:'vend', title:'Auto Vendor potions (lvl 30)', tooltip:'Vendor all potions (lvl 30) found in player bags'},
  1895. {scope: 'account', group: 'vendorSettings', name:'vendorPots4', type:'checkbox', pane:'vend', title:'Auto Vendor greater potions (lvl 45)', tooltip:'Vendor all greater potions (lvl 45) found in player bags'},
  1896. {scope: 'account', group: 'vendorSettings', name:'vendorPots5', type:'checkbox', pane:'vend', title:'Auto Vendor major potions (lvl 60)', tooltip:'Auto Vendor major potions (lvl 60)'},
  1897. {scope: 'account', group: 'vendorSettings', name:'vendorEnchR1', type:'checkbox', pane:'vend', title:'Auto Vendor enchants & runes Rank 1', tooltip:'Vendor all Rank 1 enchantments & runestones found in player bags'},
  1898. {scope: 'account', group: 'vendorSettings', name:'vendorEnchR2', type:'checkbox', pane:'vend', title:'Auto Vendor enchants & runes Rank 2', tooltip:'Vendor all Rank 2 enchantments & runestones found in player bags'},
  1899. {scope: 'account', group: 'vendorSettings', name:'vendorEnchR3', type:'checkbox', pane:'vend', title:'Auto Vendor enchants & runes Rank 3', tooltip:'Vendor all Rank 3 enchantments & runestones found in player bags'},
  1900. {scope: 'account', group: 'consolidationSettings', name:'consolidate', type:'checkbox',pane:'bank', title:'Consolidate AD via ZAX', tooltip:'Automatically attempt to post, cancel and withdraw AD via ZAX and consolidate to designated character',border:true},
  1901. {scope: 'account', group: 'consolidationSettings', name:'bankCharName', type:'text', pane:'bank', title:'Character Name of Banker', tooltip:'Enter name of the character to hold account AD'},
  1902. {scope: 'account', group: 'consolidationSettings', name:'minToTransfer', type:'text', pane:'bank', title:'Min AD for Transfer', tooltip:'Enter minimum AD limit for it to be considered for transfer off a character'},
  1903. {scope: 'account', group: 'consolidationSettings', name:'minCharBalance', type:'text', pane:'bank', title:'Min Character balance', tooltip:'Enter the amount of AD to always keep available on characters'},
  1904. {scope: 'account', group: 'consolidationSettings', name:'transferRate', type:'text', pane:'bank', title:'AD per Zen Rate (in zen)', tooltip:'Enter default rate to use for transferring through ZAX'},
  1905.  
  1906. {scope: 'char', group: 'general', name: 'active', type:'checkbox', pane: 'main_not_tab', title: 'Active', tooltip: 'The char will be processed by the script'},
  1907. {scope: 'char', group: 'general', name:'overrideGlobalSettings', type:'checkbox', pane:'main_not_tab', title:'Override account settings for this char', tooltip:''},
  1908. {scope: 'char', group: 'general', name:'manualTaskSlots', type:'checkbox', pane:'main_not_tab', title:'Use manual task allocation tab', tooltip:'Per slot profile allocation'},
  1909. {scope: 'char', group: 'generalSettings', name: 'openRewards', title: 'Open Reward Chests', type: 'checkbox', pane: 'main', tooltip: 'Enable opening of leadership chests on character switch' },
  1910. {scope: 'char', group: 'generalSettings', name: 'keepOneUnopened', title: 'Keep one reward box unopened', type: 'checkbox', pane: 'main', tooltip: 'Used to reserve the slots for the reward boxes'},
  1911. {scope: 'char', group: 'generalSettings', name: 'refineAD', title: 'Refine AD', type: 'checkbox', pane: 'main', tooltip: 'Enable refining of AD on character switch'},
  1912. {scope: 'char', group: 'generalSettings', name: 'runSCA', title: 'Run SCA', type: 'select', pane: 'main', tooltip: 'Running SCA adventures reward after professions',
  1913. opts: [ { name: 'never', value: 'never'},
  1914. { name: 'free time', value: 'free'},
  1915. { name: 'always', value: 'always'}],
  1916. },
  1917. {scope: 'char', group: 'professionSettings', name: 'fillOptionals', type: 'checkbox', pane: 'prof', title: 'Fill Optional Assets', tooltip: 'Enable to include selecting the optional assets of tasks'},
  1918. {scope: 'char', group: 'professionSettings', name: 'autoPurchaseRes', type: 'checkbox', pane: 'prof', title: 'Auto Purchase Resources', tooltip: 'Automatically purchase required resources from gateway shop (100 at a time)'},
  1919. {scope: 'char', group: 'professionSettings', name: 'trainAssets', type:'checkbox', pane:'prof', title:'Train Assets', tooltip:'Enable training/upgrading of asset worker resources'},
  1920. {scope: 'char', group: 'professionSettings', name:'smartLeadershipAssets', type:'checkbox', pane:'prof', title:'Smart Asset allocation for leadership', tooltip:'Try to spread and fill non-common assets and supplement with common if needed'},
  1921. {scope: 'char', group: 'professionSettings', name:'skipPatrolTask', type:'select', pane:'prof', title:'Skip Patrol task if > 10 claims', tooltip:'Skip \"Patrol the Mines\" leadership task if there are more than 10 mining claims in the inventory (Never, Always, On AD profile, if Leadership level is &gt;= 20, or both of the above )',
  1922. opts:[{name:'never',value:'never'},{name:'always',value:'always'},{name:'AD profile',value:'ad'},{name:'Leadership lvl 20',value:'ld20'},{name:'AD&Lvl20',value:'AD&Lvl20'}]},
  1923. {scope: 'char', group: 'vendorSettings', name:'vendorJunk', type:'checkbox', pane:'vend', title:'Auto Vendor junk..', tooltip:'Vendor all (currently) winterfest fireworks+lanterns'},
  1924. {scope: 'char', group: 'vendorSettings', name:'vendorKitsLimit', type:'checkbox', pane:'vend', title:'Vendor/Maintain Altar Node Kit Stacks', tooltip:'Limit skill kits stacks to 50/Altars80, vendor kits unusable by class, remove all if player has one bag or full bags'},
  1925. {scope: 'char', group: 'vendorSettings', name:'vendorAltarsLimit', type:'checkbox', pane:'vend', title:'Vendor/Maintain Altar Stacks', tooltip:'Limit Altars to 80,remove all if player has one bag or full bags'},
  1926. {scope: 'char', group: 'vendorSettings', name:'vendorKitsAll', type:'checkbox', pane:'vend', title:'Vendor All Node Kits', tooltip:'Sell ALL skill kits.'},
  1927. {scope: 'char', group: 'vendorSettings', name:'vendorAltarsAll', type:'checkbox', pane:'vend', title:'Vendor All Altar', tooltip:'Sell ALL Altars.'},
  1928. {scope: 'char', group: 'vendorSettings', name:'vendorProfResults',type:'checkbox',pane:'vend', title:'Vendor/Maintain Prof Crafted Levelup Items', tooltip:'Vendor off Tier 1 to 5 items produced and reused for leveling crafting professions.'},
  1929. {scope: 'char', group: 'vendorSettings', name:'vendorPots1', type:'checkbox', pane:'vend', title:'Auto Vendor minor potions (lvl 1)', tooltip:'Vendor all minor potions (lvl 1) found in player bags'},
  1930. {scope: 'char', group: 'vendorSettings', name:'vendorPots2', type:'checkbox', pane:'vend', title:'Auto Vendor lesser potions (lvl 15)',tooltip:'Vendor all lesser potions (lvl 15) found in player bags'},
  1931. {scope: 'char', group: 'vendorSettings', name:'vendorPots3', type:'checkbox', pane:'vend', title:'Auto Vendor potions (lvl 30)', tooltip:'Vendor all potions (lvl 30) found in player bags'},
  1932. {scope: 'char', group: 'vendorSettings', name:'vendorPots4', type:'checkbox', pane:'vend', title:'Auto Vendor greater potions (lvl 45)', tooltip:'Vendor all greater potions (lvl 45) found in player bags'},
  1933. {scope: 'char', group: 'vendorSettings', name:'vendorPots5', type:'checkbox', pane:'vend', title:'Auto Vendor major potions (lvl 60)', tooltip:'Auto Vendor major potions (lvl 60)'},
  1934. {scope: 'char', group: 'vendorSettings', name:'vendorEnchR1', type:'checkbox', pane:'vend', title:'Auto Vendor enchants & runes Rank 1', tooltip:'Vendor all Rank 1 enchantments & runestones found in player bags'},
  1935. {scope: 'char', group: 'vendorSettings', name:'vendorEnchR2', type:'checkbox', pane:'vend', title:'Auto Vendor enchants & runes Rank 2', tooltip:'Vendor all Rank 2 enchantments & runestones found in player bags'},
  1936. {scope: 'char', group: 'vendorSettings', name:'vendorEnchR3', type:'checkbox', pane:'vend', title:'Auto Vendor enchants & runes Rank 3', tooltip:'Vendor all Rank 3 enchantments & runestones found in player bags'},
  1937. {scope: 'char', group: 'consolidationSettings', name:'consolidate', type:'checkbox',pane:'bank', title:'Consolidate AD via ZAX', tooltip:'Automatically attempt to post, cancel and withdraw AD via ZAX and consolidate to designated character',border:true},
  1938. {scope: 'char', group: 'consolidationSettings', name:'minToTransfer', type:'text', pane:'bank', title:'Min AD for Transfer', tooltip:'Enter minimum AD limit for it to be considered for transfer off a character'},
  1939. {scope: 'char', group: 'consolidationSettings', name:'minCharBalance', type:'text', pane:'bank', title:'Min Character balance', tooltip:'Enter the amount of AD to always keep available on characters'},
  1940. ];
  1941.  
  1942. /*
  1943. // TODO: fix debug console on save call
  1944. // call the onsave for the setting if it exists
  1945. if (typeof(settingnames[i].onsave) === "function") {
  1946. console.log("Calling 'onsave' for", settingnames[i].name);
  1947. settingnames[i].onsave(settings[settingnames[i].name], settings[settingnames[i].name]);
  1948. }
  1949. }
  1950. */
  1951. // Page Settings
  1952. var PAGES = Object.freeze({
  1953. LOGIN: {
  1954. name: "Login",
  1955. path: "div#login"
  1956. },
  1957. GUARD: {
  1958. name: "Guard",
  1959. path: "div#page-accountguard"
  1960. },
  1961. });
  1962.  
  1963. /**
  1964. * Uses the page settings to determine which page is currently displayed
  1965. */
  1966.  
  1967. function GetCurrentPage() {
  1968. var pageReturn;
  1969. $.each(PAGES, function(index, page) {
  1970. if ($(page["path"]).filter(":visible").length) {
  1971. pageReturn = page["name"];
  1972. return false;
  1973. }
  1974. });
  1975. return pageReturn;
  1976. }
  1977.  
  1978. /**
  1979. * Logs in to gateway
  1980. * No client.dataModel exists at this stage
  1981. */
  1982.  
  1983. function page_LOGIN() {
  1984. //if (!$("form > p.error:visible").length && settings["autologin"]) {
  1985. // No previous log in error - attempt to log in
  1986. if (scriptSettings.general.autoLogin) {
  1987. console.log("Setting username");
  1988. $("input#user").val(scriptSettings.general.autoLoginAccount);
  1989. console.log("Setting password");
  1990. $("input#pass").val(scriptSettings.general.autoLoginPassword);
  1991. console.log("Clicking Login Button");
  1992. $("div#login > input").click();
  1993. //}
  1994. }
  1995. dfdNextRun.resolve(delay.LONG);
  1996.  
  1997. }
  1998.  
  1999. /**
  2000. * Action to perform on account guard page
  2001. */
  2002.  
  2003. function page_GUARD() {
  2004. // Do nothing on the guard screen
  2005. dfdNextRun.resolve(delay.LONG);
  2006. }
  2007.  
  2008. /**
  2009. * Collects rewards for tasks or starts new tasks
  2010. * Function is called once per new task and returns true if an action is created
  2011. * If no action is started function returns false to switch characters
  2012. */
  2013.  
  2014. function processCharacter() {
  2015. // Switch to professions page to show task progression
  2016. unsafeWindow.location.hash = "#char(" + encodeURI(unsafeWindow.client.getCurrentCharAtName()) + ")/professions";
  2017.  
  2018. // Collect rewards for completed tasks and restart
  2019. if (unsafeWindow.client.dataModel.model.ent.main.itemassignments.complete) {
  2020. if (!unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.every(function(entry, idx) {
  2021. if (entry.hascompletedetails && (collectTaskAttempts[idx] < scriptSettings.general.maxCollectTaskAttempts)) {
  2022. unsafeWindow.client.professionTaskCollectRewards(entry.uassignmentid);
  2023. collectTaskAttempts[idx]++;
  2024. return false;
  2025. }
  2026. return true;
  2027. })) {
  2028. dfdNextRun.resolve(delay.SHORT);
  2029. return true;
  2030. }
  2031. }
  2032.  
  2033. // Check for available slots and start new task
  2034. console.log("Looking for empty slots.");
  2035. var slots = unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.filter(function(entry) {
  2036. return (!entry.islockedslot && !entry.uassignmentid);
  2037. });
  2038. if (slots.length) {
  2039. if (charSettingsList[curCharName].general.manualTaskSlots) {
  2040. var slotIndex = slots[0].slotindex;
  2041. var _task = tasklist.filter(function(task) {
  2042. return task.taskListName === charSettingsList[curCharName].taskListSettingsManual[slotIndex].Profession;
  2043. })[0];
  2044. var _profile = _task.profiles.filter(function(profile) {
  2045. return profile.profileName === charSettingsList[curCharName].taskListSettingsManual[slotIndex].Profile;
  2046. })[0];
  2047.  
  2048. if (failedProfiles[_task.taskListName].indexOf(_profile.profileName) === -1) {
  2049. console.warn("Profile ", _profile.profileName, " for task ", _task.taskListName, " failed previously, skipping slot");
  2050. return false; // TODO: Should skip the slot and not the char entierly.
  2051. }
  2052.  
  2053. console.log("Allocating per slot. For slot #" + slotIndex + " profession: " + _task.taskListName + " profile: " + _profile.profileName);
  2054. unsafeWindow.client.professionFetchTaskList('craft_' + _task.taskName);
  2055. window.setTimeout(function() {
  2056. createNextTask(_task, _profile, 0);
  2057. }, delay.SHORT);
  2058. return true;
  2059. }
  2060. else {
  2061. // Go through the professions to assign tasks until specified slots filled
  2062. console.log("Prioritizing task lists.");
  2063. var charTaskList = tasklist
  2064. .filter(function(task) {
  2065. return ((charSettingsList[curCharName].taskListSettings[task.taskListName].taskSlots > 0) && (failedTasksList.indexOf(task.taskListName) === -1)) ;
  2066. })
  2067. .sort(function(a, b) {
  2068. return (charSettingsList[curCharName].taskListSettings[a.taskListName].taskPriority - charSettingsList[curCharName].taskListSettings[b.taskListName].taskPriority);
  2069. });
  2070.  
  2071. console.log("Attempting to fill the slot.");
  2072. for (var i = 0; i < charTaskList.length; i++) {
  2073. var currentTasks = unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.filter(function(entry) {
  2074. return entry.category == charTaskList[i].taskName;
  2075. });
  2076. if (currentTasks.length < charSettingsList[curCharName].taskListSettings[charTaskList[i].taskListName].taskSlots) {
  2077. unsafeWindow.client.professionFetchTaskList('craft_' + charTaskList[i].taskName);
  2078. var profile = charTaskList[i].profiles.filter(function(profile) {
  2079. return profile.profileName == charSettingsList[curCharName].taskListSettings[charTaskList[i].taskListName].taskProfile;
  2080. })[0];
  2081. console.log('Selecting profile: ' + profile.profileName);
  2082.  
  2083. window.setTimeout(function() {
  2084. createNextTask(charTaskList[i], profile, 0);
  2085. }, delay.SHORT);
  2086. return true;
  2087. }
  2088. }
  2089. };
  2090. console.log("All task counts assigned");
  2091. } else {
  2092. console.log("No available task slots");
  2093. }
  2094.  
  2095. // TODO: Add code to get next task finish time
  2096. chartimers[curCharNum] = getNextFinishedTask();
  2097.  
  2098. // Add diamond count
  2099. chardiamonds[curCharNum] = unsafeWindow.client.dataModel.model.ent.main.currencies.diamonds;
  2100. console.log(curCharName + "'s", "Astral Diamonds:", chardiamonds[curCharNum]);
  2101. // Add gold count
  2102. chargold[curCharNum] = parseInt(unsafeWindow.client.dataModel.model.ent.main.currencies.gold);
  2103. return false;
  2104. }
  2105.  
  2106.  
  2107.  
  2108. // Running SCA for a single Char (based on CycleSCA)
  2109. function processCharSCA(charIdx) {
  2110. var _hasLoginDaily = 0;
  2111. var _scaHashMatch = /\/adventures$/;
  2112. var _charName = charNamesList[charIdx];
  2113. var _fullCharName = _charName + "@" + loggedAccount;
  2114. /*
  2115. if (!scriptSettings.paused)
  2116. PauseSettings("pause");
  2117. */
  2118. if (!_scaHashMatch.test(unsafeWindow.location.hash)) {
  2119. return;
  2120. } else if (unsafeWindow.location.hash != "#char(" + encodeURI(_fullCharName) + ")/adventures") {
  2121. unsafeWindow.location.hash = "#char(" + encodeURI(_fullCharName) + ")/adventures";
  2122. }
  2123.  
  2124. WaitForState("").done(function() {
  2125. try {
  2126. _hasLoginDaily = client.dataModel.model.gatewaygamedata.dailies.left.logins;
  2127. } catch (e) {
  2128. window.setTimeout(function() {
  2129. processCharSCA(charIdx);
  2130. }, delay.SHORT);
  2131. return;
  2132. }
  2133.  
  2134. console.log("Checking SCA Dialy for " + _charName );
  2135.  
  2136. // Do SCA daily dice roll if the button comes up
  2137. WaitForState(".daily-dice-intro").done(function() {
  2138. $(".daily-dice-intro button").trigger('click');
  2139. WaitForState(".daily-awards-button").done(function() {
  2140. $(".daily-awards-button button").trigger('click');
  2141. });
  2142. });
  2143. //console.log("after dice");
  2144. WaitForNotState(".modal-window.daily-dice").done(function() {
  2145. charStatisticsList[_charName].general.lastSCAVisit = Date.now();
  2146. GM_setValue("statistics__char__" + _fullCharName , JSON.stringify(charStatisticsList[_charName]));
  2147. updateCounters();
  2148.  
  2149. //Adjusting for the time the SCA took
  2150. var chardelay;
  2151. if (chartimers[curCharNum] != null) {
  2152. chardelay = (chartimers[curCharNum]).getTime() - (new Date()).getTime() - unsafeWindow.client.getServerOffsetSeconds() * 1000;
  2153. if (chardelay < delay.SHORT) {
  2154. chardelay = delay.SHORT;
  2155. }
  2156. }
  2157. else chardelay = delay.SHORT;
  2158. if (chardelay > (delay.SHORT * 3)) unsafeWindow.location.hash = "#char(" + encodeURI(_fullCharName) + ")/professions";
  2159. console.log("Finished SCA check for " + charNamesList[charIdx] + " delay " + chardelay);
  2160. dfdNextRun.resolve(chardelay);
  2161. });
  2162. });
  2163. }
  2164.  
  2165.  
  2166.  
  2167. /**
  2168. * Switch to a character's swordcoast adventures and collect the daily reward
  2169. */
  2170.  
  2171. function processSwordCoastDailies(_charStartIndex) {
  2172. var _accountName = unsafeWindow.client.dataModel.model.loginInfo.publicaccountname;
  2173. var _charIndex = (!_charStartIndex || parseInt(_charStartIndex) > (charNamesList.length + 1) || parseInt(_charStartIndex) < 0) ? 0 : parseInt(_charStartIndex);
  2174. var _fullCharName = charNamesList[_charIndex] + '@' + _accountName;
  2175. var _hasLoginDaily = 0;
  2176. var _isLastChar = false;
  2177. var _scaHashMatch = /\/adventures$/;
  2178. if (!scriptSettings.paused)
  2179. PauseSettings("pause");
  2180.  
  2181. // Switch to professions page to show task progression
  2182. if (!_scaHashMatch.test(unsafeWindow.location.hash)) {
  2183. return;
  2184. } else if (unsafeWindow.location.hash != "#char(" + encodeURI(_fullCharName) + ")/adventures") {
  2185. unsafeWindow.location.hash = "#char(" + encodeURI(_fullCharName) + ")/adventures";
  2186. }
  2187.  
  2188. if (_charIndex >= (charNamesList.length -1))
  2189. _isLastChar = true;
  2190.  
  2191. WaitForState("").done(function() {
  2192. try {
  2193. _hasLoginDaily = client.dataModel.model.gatewaygamedata.dailies.left.logins;
  2194. } catch (e) {
  2195. // TODO: Use callback function
  2196. window.setTimeout(function() {
  2197. processSwordCoastDailies(_charIndex);
  2198. }, delay.SHORT);
  2199. return;
  2200. }
  2201.  
  2202. console.log("Checking SCA Dialy for", _fullCharName, "...");
  2203.  
  2204. // Do SCA daily dice roll if the button comes up
  2205. WaitForState(".daily-dice-intro").done(function() {
  2206. $(".daily-dice-intro button").trigger('click');
  2207. WaitForState(".daily-awards-button").done(function() {
  2208. $(".daily-awards-button button").trigger('click');
  2209. });
  2210. });
  2211.  
  2212. // If Dice roll dialog is non existant
  2213. WaitForNotState(".modal-window.daily-dice").done(function() {
  2214. charStatisticsList[charNamesList[_charIndex]].general.lastSCAVisit = Date.now();
  2215. GM_setValue("statistics__char__" + _fullCharName , JSON.stringify(charStatisticsList[charNamesList[_charIndex]]));
  2216. updateCounters();
  2217. if (_isLastChar) {
  2218. window.setTimeout(function() {
  2219. PauseSettings("unpause");
  2220. }, 3000);
  2221. } else {
  2222. window.setTimeout(function() {
  2223. processSwordCoastDailies(_charIndex + 1);
  2224. }, 3000);
  2225. }
  2226. });
  2227. });
  2228. }
  2229.  
  2230. /**
  2231. * Finds the task finishing next & returns the date or NULL otherwise
  2232. *
  2233. * @return {Date} / {null}
  2234. */
  2235.  
  2236. function getNextFinishedTask() {
  2237. var tmpNext,
  2238. next = null;
  2239. unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.forEach(function(entry) {
  2240. if (entry.uassignmentid) {
  2241. tmpNext = new Date(entry.ufinishdate);
  2242. if (!next || tmpNext < next) {
  2243. next = tmpNext;
  2244. }
  2245. }
  2246. });
  2247. if (next) {
  2248. console.log("Next finished task at " + next.toLocaleString());
  2249. } else {
  2250. console.log("No next finishing date found!!");
  2251. }
  2252. return next;
  2253. }
  2254.  
  2255. /**
  2256. * Iterative approach to finding the next task to assign to an open slot.
  2257. *
  2258. * @param {Array} prof The tasklist for the profession being used
  2259. * @param {int} i The current task number being attempted
  2260. */
  2261.  
  2262. function createNextTask(prof, profile, i) {
  2263. // TODO: Use callback function
  2264. if (!unsafeWindow.client.dataModel.model.craftinglist || unsafeWindow.client.dataModel.model.craftinglist === null || !unsafeWindow.client.dataModel.model.craftinglist['craft_' + prof.taskName] || unsafeWindow.client.dataModel.model.craftinglist['craft_' + prof.taskName] === null) {
  2265. console.log('Task list not loaded for:', prof.taskName);
  2266. window.setTimeout(function() {
  2267. createNextTask(prof, profile, i);
  2268. }, delay.SHORT);
  2269. return false;
  2270. }
  2271.  
  2272. // Check level
  2273. var level = unsafeWindow.client.dataModel.model.ent.main.itemassignmentcategories.categories.filter(function(entry) {
  2274. return entry.name == prof.taskName;
  2275. })[0].currentrank;
  2276. var list = profile.level[level];
  2277. if(list.length <= i) {
  2278. console.log("Task list exhausted for ", prof.taskListName, " at level ", level, " profile: ", profile.profileName);
  2279. failedTasksList.push(prof.taskListName);
  2280. if (typeof failedProfiles[prof.taskListName] === 'undefined') {
  2281. failedProfiles[prof.taskListName] = [];
  2282. failedProfiles[prof.taskListName].push(profile.profileName);
  2283. }
  2284. dfdNextRun.resolve(delay.SHORT);
  2285. //switchChar();
  2286. return false;
  2287. }
  2288. console.log(prof.taskName, "is level", level);
  2289. console.log("createNextTask", list.length, i);
  2290.  
  2291. var taskName = list[i];
  2292. console.log("Searching for task:", taskName);
  2293.  
  2294. // Search for task to start
  2295. var task = searchForTask(taskName, prof.taskName, profile, level);
  2296.  
  2297. // Finish createNextTask function
  2298. if (task === null) {
  2299. console.log("Skipping task selection to purchase resources");
  2300. dfdNextRun.resolve();
  2301. return true;
  2302. }
  2303. if (task) {
  2304. antiInfLoopTrap.currTaskName = task.def.name;
  2305. antiInfLoopTrap.currCharName = unsafeWindow.client.getCurrentCharAtName();
  2306. task = '/professions-tasks/' + prof.taskName + '/' + task.def.name;
  2307. console.log('Task Found');
  2308. unsafeWindow.location.hash = unsafeWindow.location.hash.replace(/\)\/.+/, ')' + task);
  2309. WaitForState("div.page-professions-taskdetails").done(function() {
  2310. // Click all buttons and select an item to use in the slot
  2311. var def = $.Deferred();
  2312. var buttonList = $('.taskdetails-assets:eq(1)').find("button");
  2313. if (buttonList.length && getSetting('professionSettings','fillOptionals')) {
  2314. SelectItemFor(buttonList, 0, def, prof);
  2315. } else {
  2316. def.resolve();
  2317. }
  2318. def.done(function() {
  2319. // All items are populated
  2320. console.log("Items Populated");
  2321. // Click the Start Task Button
  2322. //Get the start task button if it is enabled
  2323. var enabledButton = $(".footer-professions-taskdetails .button.epic:not('.disabled') button");
  2324. if (enabledButton.length) {
  2325. console.log("Clicking Start Task Button");
  2326. enabledButton.trigger('click');
  2327. WaitForState("").done(function() {
  2328. // Done
  2329. dfdNextRun.resolve(delay.SHORT);
  2330. });
  2331. if (antiInfLoopTrap.prevCharName == antiInfLoopTrap.currCharName && antiInfLoopTrap.prevTaskName == antiInfLoopTrap.currTaskName) {
  2332. antiInfLoopTrap.startCounter++;
  2333. console.log(antiInfLoopTrap.prevCharName + " starts " + antiInfLoopTrap.prevTaskName + " " + antiInfLoopTrap.startCounter + " time in row");
  2334. } else {
  2335. antiInfLoopTrap.prevCharName = antiInfLoopTrap.currCharName;
  2336. antiInfLoopTrap.prevTaskName = antiInfLoopTrap.currTaskName;
  2337. antiInfLoopTrap.startCounter = 1;
  2338. }
  2339. if (antiInfLoopTrap.startCounter >= 10) {
  2340. console.log("Restart needed: " + (antiInfLoopTrap.trapActivation - antiInfLoopTrap.startCounter) + " loop circuits to restart");
  2341. }
  2342. return true;
  2343. } else { // Button not enabled, something required was probably missing
  2344. // Go back
  2345. $(".footer-professions-taskdetails .button button.resetWindow").trigger('click');
  2346. WaitForState("").done(function() {
  2347. // continue with the next one
  2348. console.log('Finding next task');
  2349. createNextTask(prof, profile, i + 1);
  2350. });
  2351. }
  2352. });
  2353. });
  2354. } else {
  2355. console.log('Finding next task');
  2356. createNextTask(prof, profile, i + 1);
  2357. }
  2358. }
  2359. /** Count resouce in bags
  2360. *
  2361. * @param {string} name The name of resource
  2362. */
  2363.  
  2364. function countResource(name) {
  2365. var count = 0;
  2366. var _bags = unsafeWindow.client.dataModel.model.ent.main.inventory.bags;
  2367. console.log("Checking bags for " + name);
  2368. $.each(_bags, function(bi, bag) {
  2369. bag.slots.forEach(function(slot) {
  2370. if (slot && slot.name === name) {
  2371. count = count + slot.count;
  2372. }
  2373. });
  2374. });
  2375. return count;
  2376. }
  2377.  
  2378. function countUnusedResource(name) {
  2379. var count = 0;
  2380. var bag = unsafeWindow.client.dataModel.model.ent.main.inventory.tradebag;
  2381. bag.forEach(function(slot) {
  2382. if (slot && slot.name === name) {
  2383. count = count + slot.count;
  2384. }
  2385. });
  2386. return count;
  2387. }
  2388.  
  2389. function countUsedResource(name) {
  2390. return countResource(name) - countUnusedResource(name);
  2391. }
  2392.  
  2393. /**
  2394. * Checks task being started for requirements and initiates beginning task if found
  2395. *
  2396. * @param {string} taskname The name of the task being started
  2397. * @param {string} profname The name of the profession being used
  2398. * @param {Deferred} dfd Deferred object to process on return
  2399. */
  2400.  
  2401. function searchForTask(taskname, profname, profile, professionLevel) {
  2402. // Return first object that matches exact craft name
  2403. // edited by WloBeb - start Patrol the Mines task only if char has less than 10 Mining Claims
  2404. var skip_setting = getSetting('professionSettings', 'skipPatrolTask');
  2405. if (taskname == "Leadership_Tier3_13_Patrol" && (skip_setting == 'always' ||
  2406. (skip_setting == 'ad' && profile.profileName == "AD") || (skip_setting == 'ld20' && professionLevel >= 20) ||
  2407. (skip_setting == 'AD&Lvl20' && professionLevel >= 20 && profile.profileName == "AD"))) {
  2408. if (countResource("Crafting_Resource_Mining_Claim") >= 10) {
  2409. console.log("Too many Mining Claims: skiping");
  2410. return false;
  2411. }
  2412. }
  2413.  
  2414. var thisTask = unsafeWindow.client.dataModel.model.craftinglist['craft_' + profname].entries.filter(function(entry) {
  2415. return entry.def && entry.def.name == taskname;
  2416. })[0];
  2417.  
  2418. // If no task is returned we either have three of this task already, the task is a rare that doesn't exist currently, or we have the name wrong in tasklist
  2419. if (!thisTask) {
  2420. console.log('Could not find task for:', taskname);
  2421. return false;
  2422. }
  2423.  
  2424. // start task if requirements are met
  2425. if (!thisTask.failedrequirementsreasons.length) {
  2426. return thisTask;
  2427. }
  2428.  
  2429. // Too high level
  2430. if (thisTask.failslevelrequirements) {
  2431. console.log("Task level is too high:", taskname);
  2432. return false;
  2433. }
  2434.  
  2435. var searchItem = null;
  2436. var searchAsset = false;
  2437.  
  2438. // Check for and buy missing armor & weapon leadership assets
  2439. if (thisTask.failsresourcesrequirements && profname == "Leadership" && getSetting('professionSettings','autoPurchaseRes')) {
  2440. var failedAssets = thisTask.required.filter(function(entry) {
  2441. return !entry.fillsrequirements;
  2442. });
  2443. var failedArmor = failedAssets.filter(function(entry) {
  2444. return entry.categories.indexOf("Armor") >= 0;
  2445. });
  2446. var failedWeapon = failedAssets.filter(function(entry) {
  2447. return entry.categories.indexOf("Weapon") >= 0;
  2448. });
  2449. if (failedArmor.length || failedWeapon.length) {
  2450. var _buyResult = false;
  2451. var _charGold = unsafeWindow.client.dataModel.model.ent.main.currencies.gold;
  2452. var _charSilver = unsafeWindow.client.dataModel.model.ent.main.currencies.silver;
  2453. var _charCopper = unsafeWindow.client.dataModel.model.ent.main.currencies.copper;
  2454. var _charCopperTotal = _charCopper + (_charSilver * 100) + (_charGold * 10000);
  2455.  
  2456. // Buy Leadership Armor Asset
  2457. if (failedArmor.length && _charCopperTotal >= 10000) {
  2458. console.log("Buying leadership asset:", failedArmor[0].icon);
  2459. _buyResult = buyTaskAsset(18);
  2460. unsafeWindow.client.professionFetchTaskList("craft_Leadership");
  2461. }
  2462. // Buy Leadership Infantry Weapon Asset
  2463. else if (failedWeapon.length && _charCopperTotal >= 5000) {
  2464. console.log("Buying leadership asset:", failedWeapon[0].icon);
  2465. _buyResult = buyTaskAsset(4);
  2466. unsafeWindow.client.professionFetchTaskList("craft_Leadership");
  2467. }
  2468. if (_buyResult === false)
  2469. return false;
  2470. else
  2471. return null;
  2472. }
  2473. }
  2474.  
  2475. // Missing assets or ingredients
  2476. if (thisTask.failsresourcesrequirements) {
  2477. var failedAssets = thisTask.required.filter(function(entry) {
  2478. return !entry.fillsrequirements;
  2479. });
  2480.  
  2481. // Missing required assets
  2482. if (failedAssets.length) {
  2483. var failedCrafter = failedAssets.filter(function(entry) {
  2484. return entry.categories.indexOf("Person") >= 0;
  2485. });
  2486.  
  2487. // Train Assets
  2488. if (failedCrafter.length && getSetting('professionSettings','trainAssets')) {
  2489. console.log("Found required asset:", failedCrafter[0].icon);
  2490. searchItem = failedCrafter[0].icon;
  2491. searchAsset = true;
  2492. } else {
  2493. // TODO: Automatically purchase item assets from shop
  2494. console.log("Not enough assets for task:", taskname);
  2495. return false;
  2496. }
  2497. }
  2498. // Check for craftable ingredients items and purchasable profession resources (from vendor)
  2499. else {
  2500. var failedResources = thisTask.consumables.filter(function(entry) {
  2501. return entry.required && !entry.fillsrequirements;
  2502. });
  2503.  
  2504. // Check first required ingredient only
  2505. // If it fails to buy or craft task cannot be completed anyway
  2506. // If it succeeds script will search for tasks anew
  2507. var itemName = failedResources[0].hdef.match(/\[(\w+)\]/)[1];
  2508.  
  2509. // Buy purchasable resources if auto-purchase setting is enabled
  2510. if (getSetting('professionSettings','autoPurchaseRes') && itemName.match(/^Crafting_Resource_(Charcoal|Rocksalt|Spool_Thread|Porridge|Solvent|Brimstone|Coal|Moonseasalt|Quicksilver|Spool_Threadsilk)$/)) {
  2511. // returns null if successful (task will try again) and false if unsuccessful (task will be skipped)
  2512. return buyResource(itemName);
  2513. }
  2514. // Matched profession auto-purchase item found but auto-purchase is not enabled
  2515. else if (!getSetting('professionSettings','autoPurchaseRes') && itemName.match(/^Crafting_Resource_(Charcoal|Rocksalt|Spool_Thread|Porridge|Solvent|Brimstone|Coal|Moonseasalt|Quicksilver|Spool_Threadsilk)$/)) {
  2516. console.log("Purchasable resource required:", itemName, "for task:", taskname, ". Recommend enabling Auto Purchase Resources.");
  2517. return false;
  2518. }
  2519. // craftable ingredient set to search for
  2520. else {
  2521. console.log("Found required ingredient:", itemName);
  2522. searchItem = itemName;
  2523. }
  2524. }
  2525. }
  2526.  
  2527. // either no craftable items/assets found or other task requirements are not met
  2528. // Skip crafting ingredient tasks for Leadership
  2529. if (searchItem === null || !searchItem.length || (profname == 'Leadership' && !searchAsset && !searchItem.match(/Crafting_Asset_Craftsman/))) {
  2530. console.log("Failed to resolve item requirements for task:", taskname);
  2531. return false;
  2532. }
  2533.  
  2534. var massTaskAllowed = ((profile !== undefined) && (profile.useMassTask !== undefined) && (profile.useMassTask === true));
  2535.  
  2536. // Generate list of available tasks to search ingredients/assets from
  2537. console.log("Searching ingredient tasks for:", profname);
  2538. var taskList = unsafeWindow.client.dataModel.model.craftinglist['craft_' + profname].entries.filter(function(entry) {
  2539. // remove header lines first to avoid null def
  2540. if (entry.isheader) {
  2541. return false;
  2542. }
  2543.  
  2544. // Too high level
  2545. if (entry.failslevelrequirements) {
  2546. return false;
  2547. }
  2548.  
  2549. // Rewards do not contain item we want to make
  2550. if (searchAsset) {
  2551. if (entry.def.icon != searchItem || !entry.def.name.match(/Recruit/) || entry.def.requiredrank > 14) {
  2552. return false;
  2553. }
  2554. } else {
  2555. if (!(entry.rewards.some(function(itm) {
  2556. try {
  2557. return itm.hdef.match(/\[(\w+)\]/)[1] == searchItem;
  2558. } catch (e) {}
  2559. }))) {
  2560. return false;
  2561. }
  2562. }
  2563.  
  2564. // Skip mass production tasks (don't skip for profiles with useMassTask flag == true)
  2565. if (! massTaskAllowed) {
  2566. if (entry.def.displayname.match(/^(Batch|Mass|Deep|Intensive) /)) {
  2567. return false;
  2568. }
  2569. }
  2570.  
  2571. // Skip trading tasks
  2572. if (entry.def.displayname.match(/rading$/)) {
  2573. return false;
  2574. }
  2575.  
  2576. // Skip looping Transmute tasks
  2577. if (entry.def.displayname.match(/^(Transmute|Create) /)) {
  2578. return false;
  2579. }
  2580.  
  2581. return true;
  2582. });
  2583.  
  2584. if (!taskList.length) {
  2585. console.log("No ingredient tasks found for:", taskname, searchItem);
  2586. return false;
  2587. }
  2588.  
  2589. // for profiles with useMassTask flag == true select Mass task
  2590. if (massTaskAllowed) {
  2591. for (var i=0; i<taskList.length; i++) {
  2592. if (taskList[i].def.displayname.match(/^(Batch|Mass|Deep|Intensive) /)) {
  2593. taskList = taskList.splice(i, 1);
  2594. break;
  2595. }
  2596. }
  2597. }
  2598.  
  2599. // Use more efficient Empowered task for Aqua if available.
  2600. if ((searchItem == "Crafting_Resource_Aquavitae" || searchItem == "Crafting_Resource_Aquaregia") && taskList.length > 1) {
  2601. taskList.shift();
  2602. }
  2603.  
  2604. // Should really only be one result now but lets iterate through anyway.
  2605. for (var i = 0; i < taskList.length; i++) {
  2606. console.log("Attempting search for ingredient task:", taskList[i].def.name);
  2607. var task = searchForTask(taskList[i].def.name, profname, profile, professionLevel);
  2608. if (task === null || task) {
  2609. return task;
  2610. }
  2611. }
  2612. return false;
  2613. }
  2614.  
  2615.  
  2616. /**
  2617. * Selects the highest level asset for the i'th button in the list. Uses an iterative approach
  2618. * in order to apply a sufficient delay after the asset is assigned
  2619. *
  2620. * @param {Array} The list of buttons to use to click and assign assets for
  2621. * @param {int} i The current iteration number. Will select assets for the i'th button
  2622. * @param {Deferred} jQuery Deferred object to resolve when all of the assets have been assigned
  2623. */
  2624.  
  2625. function SelectItemFor(buttonListIn, i, def, prof) {
  2626. buttonListIn[i].click();
  2627. WaitForState("").done(function() {
  2628.  
  2629. var $assets = $("div.modal-item-list a").has("img[src*='_Resource_'],img[src*='_Assets_'],img[src*='_Tools_'],img[src*='_Tool_'],img[src*='_Jewelersloupe_'],img[src*='_Bezelpusher_']"); //edited by RottenMind
  2630. var $persons = $("div.modal-item-list a").has("img[src*='_Follower_']");
  2631. var quality = [".Special", ".Gold", ".Silver", ".Bronze"];
  2632. var ic,
  2633. $it;
  2634.  
  2635. var clicked = false;
  2636.  
  2637. // Try to avoid using up higher rank assets needlessly
  2638. if (prof.taskName === "Leadership") {
  2639. var mercenarys = $('div.modal-item-list a.Bronze img[src*="Crafting_Follower_Leader_Generic_T1_01"]').parent().parent();
  2640. var guards = $('div.modal-item-list a.Bronze img[src*="Crafting_Follower_Leader_Guard_T2_01"]').parent().parent();
  2641. var footmen = $('div.modal-item-list a.Bronze img[src*="Crafting_Follower_Leader_Private_T2_01"]').parent().parent();
  2642.  
  2643. var T3_Epic = 0;
  2644. var T3_Rare = 0;
  2645. var T3_Uncommon = 0;
  2646. var usedCommon;
  2647. var _enableSmartLeadership = getSetting('professionSettings','smartLeadershipAssets');
  2648. if (_enableSmartLeadership) {
  2649. T3_Epic = countResource("Crafting_Asset_Craftsman_Leadership_T3_Epic"); // number of heroes in inventory
  2650. T3_Rare = countResource("Crafting_Asset_Craftsman_Leadership_T3_Rare"); // number of adventurers in inventory
  2651. T3_Uncommon = countResource("Crafting_Asset_Craftsman_Leadership_T3_Uncommon"); // number of man-at-arms in inventory
  2652. usedCommon = countUsedResource("Crafting_Asset_Craftsman_Leadership_T3_Common") + countUsedResource("Crafting_Asset_Craftsman_Leadership_T2_Common") + countUsedResource("Crafting_Asset_Craftsman_Leadership_T1_Common_1"); //number of used mercenarys, guards and footmans
  2653. }
  2654.  
  2655. if (!(_enableSmartLeadership) || (_enableSmartLeadership && (T3_Epic + T3_Rare + T3_Uncommon + usedCommon < parseInt(charSettingsList[curCharName].taskListSettings["Leadership"].taskSlots) * 2))) {
  2656. if (mercenarys.length) {
  2657. clicked = true;
  2658. mercenarys[0].click();
  2659. } else if (guards.length) {
  2660. clicked = true;
  2661. guards[0].click();
  2662. } else if (footmen.length) {
  2663. clicked = true;
  2664. footmen[0].click();
  2665. }
  2666. }
  2667. }
  2668.  
  2669.  
  2670. // check resources & assets for best quality, in descending order
  2671. for (ic in quality) {
  2672. $it = $assets.filter(quality[ic]);
  2673. if ($it.length) {
  2674. $it[0].click();
  2675. clicked = true;
  2676. break;
  2677. }
  2678. }
  2679.  
  2680. // if no asset was selected, check for persons for best speed, in descending order
  2681. if (!clicked) {
  2682. for (ic in quality) {
  2683. $it = $persons.filter(quality[ic]);
  2684. if ($it.length) {
  2685. $it[0].click();
  2686. clicked = true;
  2687. break;
  2688. }
  2689. }
  2690. }
  2691.  
  2692. // if nothing was found at all, return immediately (skip other optional slots)
  2693. if (!clicked) {
  2694. $("button.close-button").trigger('click');
  2695. console.log("Nothing more to click..");
  2696. WaitForState("").done(function() {
  2697. // Let main loop continue
  2698. def.resolve();
  2699. });
  2700. }
  2701.  
  2702. console.log("Clicked item");
  2703. WaitForState("").done(function() {
  2704. // Get the new set of select buttons created since the other ones are removed when the asset loads
  2705. var buttonList = $('.taskdetails-assets:eq(1)').find("button");
  2706. if (i < buttonList.length - 1) {
  2707. SelectItemFor(buttonList, i + 1, def, prof);
  2708. } else {
  2709. // Let main loop continue
  2710. def.resolve();
  2711. }
  2712. });
  2713. });
  2714. }
  2715.  
  2716.  
  2717. /**
  2718. * Will buy a given purchasable resource
  2719. *
  2720. * @param {String} item The data-tt-item id of the Resource to purchase
  2721. */
  2722.  
  2723. function buyResource(item) {
  2724. var _resourceID = {
  2725. Crafting_Resource_Charcoal: 0,
  2726. Crafting_Resource_Rocksalt: 1,
  2727. Crafting_Resource_Spool_Thread: 2,
  2728. Crafting_Resource_Porridge: 3,
  2729. Crafting_Resource_Solvent: 4,
  2730. Crafting_Resource_Brimstone: 5,
  2731. Crafting_Resource_Coal: 6,
  2732. Crafting_Resource_Moonseasalt: 7,
  2733. Crafting_Resource_Quicksilver: 8,
  2734. Crafting_Resource_Spool_Threadsilk: 9,
  2735. };
  2736. var _resourceCost = {
  2737. Crafting_Resource_Charcoal: 30,
  2738. Crafting_Resource_Rocksalt: 30,
  2739. Crafting_Resource_Spool_Thread: 30,
  2740. Crafting_Resource_Porridge: 30,
  2741. Crafting_Resource_Solvent: 20,
  2742. Crafting_Resource_Brimstone: 100,
  2743. Crafting_Resource_Coal: 500,
  2744. Crafting_Resource_Moonseasalt: 500,
  2745. Crafting_Resource_Quicksilver: 500,
  2746. Crafting_Resource_Spool_Threadsilk: 500,
  2747. };
  2748. var _charGold = unsafeWindow.client.dataModel.model.ent.main.currencies.gold;
  2749. var _charSilver = unsafeWindow.client.dataModel.model.ent.main.currencies.silver;
  2750. var _charCopper = unsafeWindow.client.dataModel.model.ent.main.currencies.copper;
  2751. var _charCopperTotal = _charCopper + (_charSilver * 100) + (_charGold * 10000);
  2752. var _resourcePurchasable = Math.floor(_charCopperTotal / _resourceCost[item]);
  2753. // Limit resource purchase to 50 quantity
  2754. var _purchaseCount = (_resourcePurchasable >= 50) ? 50 : _resourcePurchasable;
  2755.  
  2756. if (_purchaseCount < 1) {
  2757. // Not enough gold for 1 resource
  2758. console.log("Purchasing profession resources failed for: ", item, " Have: ",_charCopperTotal, " Cost Per Item: ", _resourceCost[item], " Can buy: ", _resourcePurchasable);
  2759. return false;
  2760. } else {
  2761. // Make purchase
  2762. console.log("Purchasing profession resources:", _purchaseCount + "x", item, ". Total copper available:", _charCopperTotal, ". Spending ", (_purchaseCount * _resourceCost[item]), "copper.");
  2763. unsafeWindow.client.sendCommand("GatewayVendor_PurchaseVendorItem", {
  2764. vendor: 'Nw_Gateway_Professions_Merchant',
  2765. store: 'Store_Crafting_Resources',
  2766. idx: _resourceID[item],
  2767. count: _purchaseCount
  2768. });
  2769. WaitForState("button.closeNotification").done(function() {
  2770. $("button.closeNotification").trigger('click');
  2771. });
  2772. return null;
  2773. }
  2774. }
  2775.  
  2776. /** DRAFT
  2777. * Will buy a missing leadership assets
  2778. *
  2779. * @param {String} item reference from assetID
  2780. */
  2781.  
  2782. function buyTaskAsset(_itemNo) {
  2783. var _returnHast = unsafeWindow.location.hash;
  2784. unsafeWindow.location.hash = unsafeWindow.location.hash.replace(/\)\/.+/, ')/professions/vendor');
  2785. WaitForState("").done(function() {
  2786. if ($('span.alert-red button[data-url-silent="/professions/vendor/Store_Crafting_Assets/' + _itemNo + '"]').length) {
  2787. return false;
  2788. } else if ($('button[data-url-silent="/professions/vendor/Store_Crafting_Assets/' + _itemNo + '"]').length) {
  2789. $('button[data-url-silent="/professions/vendor/Store_Crafting_Assets/' + _itemNo + '"]').trigger('click');
  2790. WaitForState(".modal-confirm button").done(function() {
  2791. $('.modal-confirm button').eq(1).trigger('click');
  2792. unsafeWindow.location.hash = _returnHast;
  2793. return null;
  2794. });
  2795. }
  2796. });
  2797. }
  2798.  
  2799. // Function used to check exchange data model and post calculated AD/Zen for transfer if all requirements are met
  2800.  
  2801. function postZaxOffer() {
  2802. // Make sure the exchange data is loaded to model
  2803. if (unsafeWindow.client.dataModel.model.exchangeaccountdata) {
  2804. // Check that there is atleast 1 free ZAX order slot
  2805. if (unsafeWindow.client.dataModel.model.exchangeaccountdata.openorders.length < 5) {
  2806. // Place the order
  2807. var exchangeDiamonds = parseInt(unsafeWindow.client.dataModel.model.exchangeaccountdata.readytoclaimescrow);
  2808. if (exchangeDiamonds > 0) {
  2809. console.log("AD in exchange: " + exchangeDiamonds);
  2810. }
  2811. // Domino effect: this new order will post all the gathered diamonds until now
  2812. var charDiamonds = parseInt(unsafeWindow.client.dataModel.model.ent.main.currencies.diamonds);
  2813. var ZenRate = parseInt(accountSettings.consolidationSettings.transferRate);
  2814. if (!ZenRate) return;
  2815. var ZenQty = Math.floor((charDiamonds + exchangeDiamonds - parseInt(getSetting('consolidationSettings','minCharBalance'))) / ZenRate);
  2816. ZenQty = (ZenQty > 5000) ? 5000 : ZenQty;
  2817. console.log("Posting ZAX buy listing for " + ZenQty + " ZEN at the rate of " + ZenRate + " AD/ZEN. AD remainder: " + charDiamonds + " - " + (ZenRate * ZenQty) + " = " + (charDiamonds - (ZenRate * ZenQty)));
  2818. unsafeWindow.client.createBuyOrder(ZenQty, ZenRate);
  2819. // set moved ad to the ad counter zax log
  2820. var ADTotal = ZenRate * ZenQty - exchangeDiamonds;
  2821. if (ADTotal > 0) {
  2822. console.log("AD moved to ZAX from", charNamesList[lastCharNum] + ":", ADTotal);
  2823. chardiamonds[lastCharNum] -= ADTotal;
  2824. console.log(charNamesList[lastCharNum] + "'s", "Astral Diamonds:", chardiamonds[lastCharNum]);
  2825. zaxdiamonds += ADTotal;
  2826. console.log("Astral Diamonds on the ZAX:", zaxdiamonds);
  2827. }
  2828. } else {
  2829. console.log("Zen Max Listings Reached (5). Skipping ZAX Posting..");
  2830. }
  2831. } else {
  2832. console.log("Zen Exchange data did not load in time for transfer. Skipping ZAX Posting..");
  2833. }
  2834. }
  2835.  
  2836. // Function used to check exchange data model and withdraw listed orders that use the settings zen transfer rate
  2837.  
  2838. function cancelZaxOffer() {
  2839. // Make sure the exchange data is loaded to model
  2840. if(unsafeWindow.client.dataModel.model.exchangeaccountdata) {
  2841. if(unsafeWindow.client.dataModel.model.exchangeaccountdata.openorders.length >= 1) {
  2842. console.log("Canceling ZAX orders");
  2843.  
  2844. var charDiamonds = parseInt(unsafeWindow.client.dataModel.model.ent.main.currencies.diamonds);
  2845. var ZenRate = parseInt(getSetting('consolidationSettings','transferRate'));
  2846.  
  2847. // cycle through the zax listings
  2848. unsafeWindow.client.dataModel.model.exchangeaccountdata.openorders.forEach(function(item) {
  2849. // find any buy orders in the list with our set zen rate
  2850. if (parseInt(item.price) == ZenRate && item.ordertype == "Buy") {
  2851. // cancel/withdraw the order
  2852. client.withdrawOrder(item.orderid);
  2853. console.log("Canceling ZAX offer for " + item.quantity + " ZEN at the rate of " + item.price + " . Total value in AD: " + item.totaltc);
  2854. }
  2855. });
  2856. } else {
  2857. console.log("No listings found on ZAX. Skipping ZAX Withrdaw..");
  2858. }
  2859. } else {
  2860. console.log("Zen Exchange data did not load in time for transfer. Skipping ZAX Withrdaw..");
  2861. }
  2862. }
  2863.  
  2864. function claimZaxOffer() {
  2865. if (unsafeWindow.client.dataModel.model.exchangeaccountdata) {
  2866. if (parseInt(unsafeWindow.client.dataModel.model.exchangeaccountdata.readytoclaimescrow) > 0) {
  2867. unsafeWindow.client.sendCommand("GatewayExchange_ClaimTC", unsafeWindow.client.dataModel.model.exchangeaccountdata.readytoclaimescrow);
  2868. console.log("Attempting to withdraw exchange balancees... ClaimTC: " + unsafeWindow.client.dataModel.model.exchangeaccountdata.readytoclaimescrow);
  2869. // clear the ad counter zax log
  2870. zaxdiamonds = 0;
  2871. }
  2872. if (parseInt(unsafeWindow.client.dataModel.model.exchangeaccountdata.readytoclaimmtc) > 0) {
  2873. unsafeWindow.client.sendCommand("GatewayExchange_ClaimMTC", unsafeWindow.client.dataModel.model.exchangeaccountdata.readytoclaimmtc);
  2874. console.log("Attempting to withdraw exchange balancees... ClaimMT: " + unsafeWindow.client.dataModel.model.exchangeaccountdata.readytoclaimmtc);
  2875. }
  2876. } else {
  2877. window.setTimeout(claimZaxOffer, delay.SHORT);
  2878. }
  2879. }
  2880.  
  2881. // MAC-NW
  2882.  
  2883. function vendorItemsLimited(_items) {
  2884. var _pbags = client.dataModel.model.ent.main.inventory.playerbags;
  2885. var _delay = 400;
  2886. var _sellCount = 0;
  2887. var _classType = unsafeWindow.client.dataModel.model.ent.main.classtype;
  2888. var _bagCount = unsafeWindow.client.dataModel.model.ent.main.inventory.playerbags.length;
  2889. var _bagUsed = 0;
  2890. var _bagUnused = 0;
  2891. var _tmpBag = [];
  2892. var _profitems = [];
  2893. // Pattern for items to leave out of auto vendoring (safeguard)
  2894. var _excludeItems = /(Gemfood|Gem_Upgrade_Resource|Artifact|Hoard|Coffer|Fuse|Ward|Preservation|Armor_Enhancement|Weapon_Enhancement|T[5-9]_Enchantment|T[5-9]_Runestones|T10_Enchantment|T10_Runestones|4c_Personal|Item_Potion_Companion_Xp|Gateway_Rewardpack|Consumable_Id_Scroll|Dungeon_Delve_Key)/; // edited by RottenMind 17.01.2015
  2895.  
  2896. /** Profession leveling result item cleanup logic for T1-4 crafted results
  2897. * Created by RM on 14.1.2015.
  2898. * List contains crafted_items, based "Mustex/Bunta NW robot 1.05.0.1L crafting list, can be used making list for items what are "Auto_Vendored".
  2899. * Items on list must be checked and tested.
  2900. */
  2901. if (getSetting('vendorSettings', 'vendorProfResults')) {
  2902. /*#2, Tier2 - tier3 mixed, upgrade, sell if inventory full, "TierX" is here "TX" */
  2903. _profitems[_profitems.length] = {
  2904. pattern: /^Crafted_(Jewelcrafting_Neck_Misc_2|Jewelcrafting_Waist_Misc_2|Med_Armorsmithing_T3_Chain_Pants|Med_Armorsmithing_T3_Chain_Shirt|Hvy_Armorsmithing_T3_Plate_Pants|Hvy_Armorsmithing_T3_Plate_Shirt|Leatherworking_T3_Leather_Pants|Leatherworking_T3_Leather_Shirt|Tailoring_T3_Cloth_Shirt|Tailoring_T3_Cloth_Pants||Artificing_T3_Pactblade_Temptation_4|Artificing_T3_Icon_Virtuous_4|Weaponsmithing_T2_Dagger_3|Weaponsmithing_T2_Dagger_3)$/,
  2905. limit: 0,
  2906. count: 0
  2907. };
  2908. /*#3, Tier2, upgrade, sell if inventory full, "TierX" is here "TX" */
  2909. _profitems[_profitems.length] = {
  2910. pattern: /^Crafted_(Jewelcrafting_Neck_Offense_2|Jewelcrafting_Waist_Offense_2|Med_Armorsmithing_T2_Chain_Armor_Set_1|Med_Armorsmithing_T2_Chain_Pants_2|Med_Armorsmithing_T2_Chain_Boots_Set_1|Med_Armorsmithing_T2_Chain_Shirt_2|Med_Armorsmithing_T2_Chain_Pants_1|Med_Armorsmithing_T2_Chain_Shirt|Hvy_Armorsmithing_T2_Plate_Armor_Set_1|Hvy_Armorsmithing_T2_Plate_Pants_2|Hvy_Armorsmithing_T2_Plate_Boots_Set_1|Hvy_Armorsmithing_T2_Plate_Shirt_2|Hvy_Armorsmithing_T2_Plate_Pants_1|Hvy_Armorsmithing_T2_Shield_Set_1|Hvy_Armorsmithing_T2_Plate_Shirt|Leatherworking_T2_Leather_Shirt|Leatherworking_T2_Leather_Boots_Set_1|Leatherworking_T2_Leather_Shirt_2|Leatherworking_T2_Leather_Pants_1|Leatherworking_T2_Leather_Armor_Set_1|Leatherworking_T2_Leather_Pants_2|Tailoring_T2_Cloth_Armor_Set_1|Tailoring_T2_Cloth_Pants_2|Tailoring_T2_Cloth_Boots_Set_1|Tailoring_T2_Cloth_Shirt_2|Tailoring_T2_Cloth_Pants_1|Artificing_T2_Pactblade_Temptation_3|Artificing_T1_Icon_Virtuous_2|Weaponsmithing_T2_Dagger_2)$/,
  2911. limit: 0,
  2912. count: 0
  2913. };
  2914. /*#4, Tier1, upgrade, sell if inventory full, "TierX" is here "TX" */
  2915. _profitems[_profitems.length] = {
  2916. pattern: /^Crafted_(Jewelcrafting_Neck_Misc_1|Jewelcrafting_Waist_Misc_1|Med_Armorsmithing_T1_Chain_Armor_Set_1|Med_Armorsmithing_T1_Chain_Boots_Set_1|Hvy_Armorsmithing_Plate_Armor_1|Hvy_Armorsmithing_T1_Plate_Armor_Set_1|Hvy_Armorsmithing_T1_Plate_Boots_Set_1|Leatherworking_T1_Leather_Boots_Set_1|Leatherworking_T1_Leather_Boots_Set_1|Leatherworking_T1_Leather_Armor_Set_1|Tailoring_T1_Cloth_Armor_1|Tailoring_T1_Cloth_Pants_1|Tailoring_T1_Cloth_Boots_Set_1|Artificing_T1_Pactblade_Convergence_2|Artificing_T1_Icon_Virtuous_2|Weaponsmithing_T1_Dagger_1)$/,
  2917. limit: 0,
  2918. count: 0
  2919. };
  2920. /*#5, Tier0, upgrade, sell if inventory full, taskilist "Tier1" is here "empty" or "_" must replace (_T1_|_)*/
  2921. _profitems[_profitems.length] = {
  2922. pattern: /^Crafted_(Jewelcrafting_Waist_Offense_1|Jewelcrafting_Neck_Offense_1|Med_Armorsmithing_Chain_Boots_1|Med_Armorsmithing_Chain_Shirt_1|Med_Armorsmithing_Chain_Armor_1|Med_Armorsmithing_Chain_Pants_1|Hvy_Armorsmithing_Plate_Boots_1|Hvy_Armorsmithing_Plate_Shirt_1|Hvy_Armorsmithing_Shield_1|Leatherworking_Tier0_Intro_1|Leatherworking_Leather_Boots_1|Leatherworking_Leather_Shirt_1|Leatherworking_Leather_Armor_1|Leatherworking_Leather_Pants_1|Tailoring_Cloth_Boots_1|Tailoring_Cloth_Shirt_1|Artificing_T1_Pactblade_Convergence_1|Artificing_Icon_Virtuous_1|Artificing_Symbol_Virtuous_1|Weaponsmithing_Dagger_1)$/,
  2923. limit: 0,
  2924. count: 0
  2925. };
  2926. }
  2927.  
  2928. $.each(_pbags, function(bi, bag) {
  2929. bag.slots.forEach(function(slot) {
  2930. // Match unused slots
  2931. if (slot === null || !slot || slot === undefined) {
  2932. _bagUnused++;
  2933. }
  2934. // Match items to exclude from auto vendoring, dont add to _tmpBag: Exclude pattern list - bound - Epic Quality - Blue Quality
  2935. else if (_excludeItems.test(slot.name) || slot.bound || slot.rarity == "Special" || slot.rarity == "Gold") {
  2936. _bagUsed++;
  2937. }
  2938. // Match everything else
  2939. else {
  2940. if (getSetting('vendorSettings', 'vendorProfResults')) {
  2941. for (i = 0; i < _profitems.length; i++) {
  2942. if (_profitems[i].pattern.test(slot.name))
  2943. _profitems[i].count++;
  2944. }
  2945. }
  2946. _tmpBag[_tmpBag.length] = slot;
  2947. _bagUsed++;
  2948. }
  2949. });
  2950. });
  2951.  
  2952. if (getSetting('vendorSettings', 'vendorProfResults')) {
  2953. _tmpBag.forEach(function(slot) {
  2954. for (i = 0; i < _profitems.length; i++) { // edited by RottenMind
  2955. if (slot && _profitems[i].pattern.test(slot.name) && Inventory_bagspace() <= 7) { // !slot.bound && _profitems[i].count > 3 &&, edited by RottenMind
  2956. var vendor = {
  2957. vendor: "Nw_Gateway_Professions_Merchant"
  2958. };
  2959. vendor.id = slot.uid;
  2960. vendor.count = 1;
  2961. console.log('Selling', vendor.count, slot.name, 'to vendor.');
  2962. window.setTimeout(function() {
  2963. client.sendCommand('GatewayVendor_SellItemToVendor', vendor);
  2964. }, _delay);
  2965. _profitems[i].count--;
  2966. break;
  2967. }
  2968. }
  2969. });
  2970. }
  2971.  
  2972. _tmpBag.forEach(function(slot) {
  2973. for (i = 0; i < _items.length; i++) {
  2974. var _Limit = (parseInt(_items[i].limit) > 99) ? 99 : _items[i].limit;
  2975. if (slot && _items[i].pattern.test(slot.name) && !slot.bound) {
  2976. // Node Kits vendor logic for restricted bag space
  2977. if (getSetting('vendorSettings', 'vendorKitsLimit') && /^Item_Consumable_Skill/.test(slot.name)) {
  2978. if (_bagCount < 2 || _bagUnused < 6 ||
  2979. (slot.name == "Item_Consumable_Skill_Dungeoneering" && (_classType == "Player_Guardian" || _classType == "Player_Greatweapon")) ||
  2980. (slot.name == "Item_Consumable_Skill_Arcana" && (_classType == "Player_Controller" || _classType == "Player_Scourge")) ||
  2981. (slot.name == "Item_Consumable_Skill_Religion" && _classType == "Player_Devoted") ||
  2982. (slot.name == "Item_Consumable_Skill_Thievery" && _classType == "Player_Trickster") ||
  2983. (slot.name == "Item_Consumable_Skill_Nature" && _classType == "Player_Archer")) {
  2984. _Limit = 0;
  2985. }
  2986. }
  2987. // Sell Items
  2988. if (slot.count > _Limit) {
  2989. _sellCount++;
  2990. var vendor = {
  2991. vendor: "Nw_Gateway_Professions_Merchant"
  2992. };
  2993. vendor.id = slot.uid;
  2994. vendor.count = slot.count - _Limit;
  2995. console.log('Selling', vendor.count, slot.name, 'to vendor.');
  2996. window.setTimeout(function() {
  2997. client.sendCommand('GatewayVendor_SellItemToVendor', vendor);
  2998. }, _delay);
  2999. _delay = _delay + 400;
  3000. break;
  3001. }
  3002. }
  3003. }
  3004. });
  3005.  
  3006. return _sellCount;
  3007. }
  3008.  
  3009. function switchChar() {
  3010.  
  3011. // detect if daily reset occurs (no more frequently than every 16 hours)
  3012. var oldRefineToday = charStatisticsList[curCharName].general.refined | 0;
  3013. var newRefineToday = unsafeWindow.client.dataModel.model.ent.main.currencies.diamondsconverted | 0;
  3014. if (newRefineToday < oldRefineToday) {
  3015. if (accountSettings.generalSettings.SCADailyReset < Date.now() - 16*60*60*1000) {
  3016. accountSettings.generalSettings.SCADailyReset = Date.now();
  3017. GM_setValue("settings__account__" + loggedAccount, JSON.stringify(accountSettings));
  3018. }
  3019. }
  3020.  
  3021. var refined_diamonds = 0;
  3022. if (getSetting('generalSettings', 'refineAD')) {
  3023. var _currencies = unsafeWindow.client.dataModel.model.ent.main.currencies;
  3024. if (_currencies.diamondsconvertleft && _currencies.roughdiamonds) {
  3025. if (_currencies.diamondsconvertleft < _currencies.roughdiamonds) {
  3026. refined_diamonds = _currencies.diamondsconvertleft
  3027. } else {
  3028. refined_diamonds = _currencies.roughdiamonds
  3029. }
  3030. chardiamonds[curCharNum] += refined_diamonds
  3031. console.log("Refining AD for", curCharName + ":", refined_diamonds);
  3032. console.log(curCharName + "'s", "Astral Diamonds:", chardiamonds[curCharNum]);
  3033. unsafeWindow.client.sendCommand('Gateway_ConvertNumeric', 'Astral_Diamonds');
  3034. WaitForState("button.closeNotification").done(function() {
  3035. $("button.closeNotification").click();
  3036. });
  3037. charStatisticsList[curCharName].general.refineCounter += refined_diamonds;
  3038.  
  3039. }
  3040. }
  3041.  
  3042. // MAC-NW -- AD Consolidation
  3043. //if (accountSettings.consolidationSettings.consolidate) {
  3044. if (getSetting('consolidationSettings','consolidate')) {
  3045. // Check that we dont take money from the character assigned as the banker // Zen Transfer / Listing
  3046. if ((accountSettings.consolidationSettings.bankCharName) && (accountSettings.consolidationSettings.bankCharName !== unsafeWindow.client.dataModel.model.ent.main.name)) {
  3047. // Check the required min AD amount on character
  3048. if (getSetting('consolidationSettings','minToTransfer') &&
  3049. parseInt(unsafeWindow.client.dataModel.model.ent.main.currencies.diamonds) >= (parseInt(getSetting('consolidationSettings','minToTransfer')) + parseInt(getSetting('consolidationSettings','minCharBalance')))) {
  3050. // Check that the rate is not less than the min & max
  3051. if (accountSettings.consolidationSettings.transferRate && parseInt(accountSettings.consolidationSettings.transferRate) >= 50 && parseInt(accountSettings.consolidationSettings.transferRate) <= 500) {
  3052. window.setTimeout(postZaxOffer, delay.SHORT);
  3053. } else {
  3054. console.log("Zen transfer rate does not meet the minimum (50) or maximum (500). Skipping ZAX Posting..");
  3055. }
  3056. } else {
  3057. console.log("Character does not have minimum AD balance to do funds transfer. Skipping ZAX Posting..");
  3058. }
  3059. }
  3060. else {
  3061. console.log("Bank char not set or bank char, skipping posting.");
  3062. }
  3063. } else {
  3064. console.log("Zen Exchange AD transfer not enabled. Skipping ZAX Posting..");
  3065. }
  3066.  
  3067. if (getSetting('generalSettings','openRewards')) {
  3068. var _pbags = unsafeWindow.client.dataModel.model.ent.main.inventory.playerbags;
  3069. var _cRewardPat = /Reward_Item_Chest|Gateway_Rewardpack/;
  3070. console.log("Opening Rewards");
  3071. $.each(_pbags, function(bi, bag) {
  3072. bag.slots.forEach(function(slot) {
  3073. if (slot && _cRewardPat.test(slot.name)) {
  3074. if (slot.count >= 99)
  3075. slot.count = 99;
  3076. var reserve = getSetting('generalSettings', 'keepOneUnopened') ? 1 : 0;
  3077. for (i = 1; i <= (slot.count - reserve); i++) {
  3078. window.setTimeout(function() {
  3079. client.sendCommand('GatewayInventory_OpenRewardPack', slot.uid);
  3080. }, 500);
  3081. }
  3082. }
  3083. });
  3084. });
  3085. }
  3086.  
  3087. // Check Vendor Options & Vendor matched items
  3088. vendorJunk();
  3089.  
  3090. // MAC-NW (endchanges)
  3091.  
  3092. // Updating statistics
  3093. var _stat = charStatisticsList[curCharName].general;
  3094. var _chardata = unsafeWindow.client.dataModel.model.ent.main.currencies;
  3095. _stat.lastVisit = Date.now();
  3096. _stat.gold = parseInt(_chardata.gold);
  3097. _stat.rad = parseInt(_chardata.roughdiamonds - refined_diamonds); // refined_diamonds: removing and adding manually to compensate for slow model update
  3098. _stat.diamonds = parseInt(_chardata.diamonds + refined_diamonds);
  3099. _stat.rBI = parseInt(_chardata.rawblackice);
  3100. _stat.BI = parseInt(_chardata.blackice);
  3101. _stat.refined = parseInt(_chardata.diamondsconverted + refined_diamonds);
  3102. _stat.diamondsconvertleft = parseInt(_chardata.refineLimitLeft);
  3103. _stat.activeSlots = unsafeWindow.client.dataModel.model.ent.main.itemassignments.active;
  3104.  
  3105. //clearing
  3106. charStatisticsList[curCharName].trackedResources = [];
  3107. $.each(charStatisticsList[curCharName].tools, function(name, obj) {
  3108. obj.used = [];
  3109. obj.unused = [];
  3110. });
  3111. $.each(charStatisticsList[curCharName].professions, function(name, obj) {
  3112. obj.workersUsed = [];
  3113. obj.workersUnused = [];
  3114. obj.level = 0;
  3115. });
  3116.  
  3117. trackResources.forEach(function(resource, ri) {
  3118. charStatisticsList[curCharName].trackedResources[ri] = 0;
  3119. });
  3120.  
  3121. // Counting tracked resources
  3122. unsafeWindow.client.dataModel.model.ent.main.inventory.bags
  3123. .filter(function(bag) {
  3124. return bag.bagid == "CraftingResources"
  3125. })
  3126. .forEach(function(bag) {
  3127. bag.slots.forEach(function(slot) {
  3128. trackResources.forEach(function(resource, ri) {
  3129. if (slot && slot.name === resource.name) {
  3130. charStatisticsList[curCharName].trackedResources[ri] += slot.count;
  3131. }
  3132. });
  3133. });
  3134. });
  3135.  
  3136. // Slot assignment
  3137. unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.forEach(function(slot, ix) {
  3138. charStatisticsList[curCharName].slotUse[ix] = slot.category;
  3139. });
  3140.  
  3141. // Workers and tools assignment and qty
  3142. unsafeWindow.client.dataModel.model.ent.main.inventory.assignedslots
  3143. .forEach(function(item) {
  3144. $.each(workerList, function(pName, pList) {
  3145. var index = pList.indexOf(item.name);
  3146. if (index > -1) {
  3147. charStatisticsList[curCharName].professions[pName].workersUsed[index] = item.count;
  3148. }
  3149. });
  3150. $.each(toolList, function(tName, tList) {
  3151. var index = tList.indexOf(item.name);
  3152. if (index > -1) {
  3153. charStatisticsList[curCharName].tools[tName].used[index] = item.count;
  3154. }
  3155. });
  3156. });
  3157.  
  3158. unsafeWindow.client.dataModel.model.ent.main.inventory.notassignedslots
  3159. .forEach(function(item) {
  3160. $.each(workerList, function(pName, pList) {
  3161. var index = pList.indexOf(item.name);
  3162. if (index > -1) {
  3163. charStatisticsList[curCharName].professions[pName].workersUnused[index] = item.count;
  3164. }
  3165. })
  3166. $.each(toolList, function(tName, tList) {
  3167. var index = tList.indexOf(item.name);
  3168. if (index > -1) {
  3169. charStatisticsList[curCharName].tools[tName].unused[index] = item.count;
  3170. }
  3171. })
  3172. });
  3173.  
  3174. // getting profession levels from currentrank, model has displayname, name, and category, using displayname (platesmithing)
  3175. // Must match the names in charStatisticsList[curCharName].professions
  3176. unsafeWindow.client.dataModel.model.ent.main.itemassignmentcategories.categories
  3177. .forEach(function(prof) {
  3178. if (charStatisticsList[curCharName].professions[prof.displayname]) {
  3179. charStatisticsList[curCharName].professions[prof.displayname].level = prof.currentrank;
  3180. }
  3181. });
  3182.  
  3183. charStatisticsList[curCharName].general.nextTask = chartimers[curCharNum];
  3184. GM_setValue("statistics__char__" + curCharFullName , JSON.stringify(charStatisticsList[curCharName]));
  3185. updateCounters();
  3186.  
  3187.  
  3188. console.log("Switching Characters");
  3189. lastCharNum = curCharNum;
  3190.  
  3191. var chardelay,
  3192. chardate = null,
  3193. nowdate = new Date();
  3194. nowdate = nowdate.getTime();
  3195. var not_active = 0;
  3196. charNamesList.every( function (charName, idx) {
  3197. if (!charSettingsList[charName].general.active) {
  3198. not_active++;
  3199. return true;
  3200. }
  3201. if (chartimers[idx] != null) {
  3202. console.log("Date found for " + charName);
  3203. if (!chardate || chartimers[idx] < chardate) {
  3204. chardate = chartimers[idx];
  3205. curCharNum = idx;
  3206. chardelay = chardate.getTime() - nowdate - unsafeWindow.client.getServerOffsetSeconds() * 1000;
  3207. if (chardelay < delay.SHORT) {
  3208. chardelay = delay.SHORT;
  3209. }
  3210. }
  3211. return true;
  3212. }
  3213. curCharNum = idx;
  3214. chardelay = delay.SHORT;
  3215. chardate = null;
  3216. console.log("No date found for " + charName + ", switching now.");
  3217. return false; // = break;
  3218. });
  3219. curCharName = charNamesList[curCharNum];
  3220. curCharFullName = curCharName + "@" + loggedAccount;
  3221. failedTasksList = [];
  3222. failedProfiles = {};
  3223. var k = 9; while (k) {collectTaskAttempts[--k] = 0}; //collectTaskAttempts.fill(0);
  3224.  
  3225. if (getSetting('consolidationSettings','consolidate')) {
  3226. // Withdraw AD from the ZAX into the banker character
  3227. if (accountSettings.consolidationSettings.bankCharName == curCharName) {
  3228. window.setTimeout(cancelZaxOffer, delay.SHORT);
  3229. }
  3230. }
  3231.  
  3232. // Count AD & Gold
  3233. var curdiamonds = zaxdiamonds;
  3234. var curgold = 0;
  3235. charNamesList.forEach( function (charName, idx) {
  3236. if (chardiamonds[idx] != null) {
  3237. curdiamonds += Math.floor(chardiamonds[idx] / 50) * 50;
  3238. }
  3239.  
  3240. if (chargold[idx] != null) {
  3241. curgold += chargold[idx];
  3242. }
  3243. });
  3244.  
  3245. console.log("Next run for " + curCharName + " in " + parseInt(chardelay / 1000) + " seconds.");
  3246. $("#prinfopane").empty();
  3247. var ptext = $("<h3 class='promo-image copy-top prh3'>Professions Robot<br />Next task for " + curCharName + "<br /><span data-timer='" + chardate + "' data-timer-length='2'></span><br />Diamonds: " + curdiamonds.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "<br />Gold: " + curgold + "</h3>")
  3248. .appendTo("#prinfopane");
  3249. if (not_active == charNamesList.length) {
  3250. ptext.append("<div class='h_warning'>No Active chars found!</div>");
  3251. console.warn("No Active chars found!");
  3252. }
  3253. GM_setValue("curCharNum_" + loggedAccount, curCharNum);
  3254.  
  3255.  
  3256. var runSCAtime = !charStatisticsList[charNamesList[lastCharNum]].general.lastSCAVisit
  3257. || ((charStatisticsList[charNamesList[lastCharNum]].general.lastSCAVisit + (1000*60*60*24)) < Date.now())
  3258. || (charStatisticsList[charNamesList[lastCharNum]].general.lastSCAVisit < accountSettings.generalSettings.SCADailyReset)
  3259. || (charStatisticsList[charNamesList[lastCharNum]].general.lastSCAVisit < lastDailyResetTime.getTime());
  3260. var sca_setting = getSetting('generalSettings','runSCA');
  3261. var runSCA = (runSCAtime && (sca_setting !== 'never'));
  3262. runSCA = runSCA && (sca_setting === 'always' || (sca_setting === 'free' && chardelay > 7000)); // More than 7 seconds for the next char swap
  3263. console.log("Check if need to run SCA for " + charNamesList[lastCharNum] + ": " + sca_setting + " " + runSCAtime);
  3264. if (runSCA) {
  3265. unsafeWindow.location.hash = unsafeWindow.location.hash.replace(/\)\/.+/, ')' + "/adventures");
  3266. processCharSCA(lastCharNum);
  3267. return;
  3268. }
  3269. dfdNextRun.resolve(chardelay);
  3270. }
  3271. /**
  3272. * Waits for the loading symbol to be hidden.
  3273. *
  3274. * @return {Deferred} A jQuery defferred object that will be resolved when loading is complete
  3275. */
  3276.  
  3277. function WaitForLoad() {
  3278. return WaitForState("");
  3279. }
  3280. /**
  3281. * Creates a deferred object that will be resolved when the state is reached
  3282. *
  3283. * @param {string} query The query for the state to wait for
  3284. * @return {Deferred} A jQuery defferred object that will be resolved when the state is reached
  3285. */
  3286.  
  3287. function WaitForState(query) {
  3288. var dfd = $.Deferred();
  3289. window.setTimeout(function() {
  3290. AttemptResolve(query, dfd);
  3291. }, delay.SHORT); // Doesn't work without a short delay
  3292. return dfd;
  3293. }
  3294.  
  3295. function WaitForNotState(query) {
  3296. var dfd = $.Deferred();
  3297. window.setTimeout(function() {
  3298. AttemptNotResolve(query, dfd);
  3299. }, delay.SHORT); // Doesn't work without a short delay
  3300. return dfd;
  3301. }
  3302. /**
  3303. * Will continually test for the given query state and resolve the given deferred object when the state is reached
  3304. * and the loading symbol is not visible
  3305. *
  3306. * @param {string} query The query for the state to wait for
  3307. * @param {Deferred} dfd The jQuery defferred object that will be resolved when the state is reached
  3308. */
  3309.  
  3310. function AttemptResolve(query, dfd) {
  3311. if ((query === "" || $(query).length) && $("div.loading-image:visible").length === 0) {
  3312. dfd.resolve();
  3313. } else {
  3314. window.setTimeout(function() {
  3315. AttemptResolve(query, dfd);
  3316. }, delay.SHORT); // Try again in a little bit
  3317. }
  3318. }
  3319. /* Opposite of AttemptResolve, will try to resolve query until it doesn't resolve. */
  3320.  
  3321. function AttemptNotResolve(query, dfd) {
  3322. if (!$(query).length && $("div.loading-image:visible").length === 0) {
  3323. dfd.resolve();
  3324. } else {
  3325. window.setTimeout(function() {
  3326. AttemptNotResolve(query, dfd);
  3327. }, delay.SHORT); // Try again in a little bit
  3328. }
  3329. }
  3330. /**
  3331. * The main process loop:
  3332. * - Determine which page we are on and call the page specific logic
  3333. * - When processing is complete, process again later
  3334. * - Use a short timer when something changed last time through
  3335. * - Use a longer timer when waiting for tasks to complete
  3336. */
  3337.  
  3338. function process() {
  3339.  
  3340. // Calculating last daily reset time
  3341. var today = new Date();
  3342. var todayRest = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate(), 10,0,0));
  3343. if (today > todayRest) lastDailyResetTime = todayRest;
  3344. else lastDailyResetTime = new Date(Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate()-1, 10,0,0));
  3345. // Make sure the settings button exists
  3346. addSettings();
  3347.  
  3348. // Enable/Disable the unconditional page reload depending on settings
  3349. loading_reset = scriptSettings.general.scriptAutoReload;
  3350. // Check if timer is paused
  3351. s_paused = scriptSettings.general.scriptPaused; // let the Page Reloading function know the pause state
  3352. if (s_paused) {
  3353. // Just continue later - the deferred object is still set and nothing will resolve it until we get past this point
  3354. timerHandle = window.setTimeout(function() {
  3355. process();
  3356. }, delay.DEFAULT);
  3357. return;
  3358. }
  3359.  
  3360. // Check for Gateway down
  3361. if (window.location.href.indexOf("gatewaysitedown") > -1) {
  3362. // Do a long delay and then retry the site
  3363. console.log("Gateway down detected - relogging in " + (delay.MINS / 1000) + " seconds");
  3364. window.setTimeout(function() {
  3365. unsafeWindow.location.href = current_Gateway;
  3366. }, delay.MINS);
  3367. return;
  3368. }
  3369.  
  3370. // Check for login or account guard and process accordingly
  3371. var currentPage = GetCurrentPage();
  3372. if (currentPage === "Login") {
  3373. page_LOGIN();
  3374. return;
  3375. } else if (currentPage === "Guard") {
  3376. page_GUARD();
  3377. return;
  3378. }
  3379.  
  3380. window.setTimeout(function() {
  3381. loginProcess();
  3382. }, delay.SHORT);
  3383.  
  3384. // Continue again later
  3385. dfdNextRun.done(function(delayTimer) {
  3386. dfdNextRun = $.Deferred();
  3387. timerHandle = window.setTimeout(function() {
  3388. process();
  3389. }, typeof delayTimer !== 'undefined' ? delayTimer : delay.DEFAULT);
  3390. });
  3391. //console.log("Process Timer Handle: " + timerHandle);
  3392. }
  3393.  
  3394. function loginProcess() {
  3395. // Get logged on account details
  3396. var accountName;
  3397. try {
  3398. accountName = unsafeWindow.client.dataModel.model.loginInfo.publicaccountname;
  3399. } catch(e) {
  3400. // TODO: Use callback function
  3401. window.setTimeout(function() {
  3402. loginProcess();
  3403. }, delay.SHORT);
  3404. return;
  3405. }
  3406.  
  3407. // Check if timer is paused again to avoid starting new task between timers
  3408. s_paused = scriptSettings.general.scriptPaused; // let the Page Reloading function know the pause state
  3409. if (s_paused) {
  3410. // Just continue later - the deferred object is still set and nothing will resolve it until we get past this point
  3411. timerHandle = window.setTimeout(function() {
  3412. process();
  3413. }, delay.DEFAULT);
  3414. return;
  3415. }
  3416.  
  3417. if (accountName) {
  3418. if (!loggedAccount || (loggedAccount != accountName)) {
  3419. loggedAccount = accountName;
  3420. console.log("Loading settings for " + accountName);
  3421.  
  3422. var tempAccountSetting;
  3423. try {
  3424. tempAccountSetting = JSON.parse(GM_getValue("settings__account__" + accountName, "{}"));
  3425. } catch (e) {
  3426. tempAccountSetting = null;
  3427. }
  3428. if (!tempAccountSetting) {
  3429. console.log('Account settings couldn\'t be retrieved, loading defaults.');
  3430. tempAccountSetting = {};
  3431. };
  3432. accountSettings = $.extend(true, {}, defaultAccountSettings, tempAccountSetting);
  3433.  
  3434. console.log("Loading character list");
  3435. charNamesList = [];
  3436. client.dataModel.model.loginInfo.choices.forEach(function(char) {
  3437. if (char.shardname == "Dungeon") return;
  3438. charNamesList.push(char.name);
  3439. });
  3440. console.log("Found names: " + charNamesList);
  3441.  
  3442. charNamesList.forEach(function(charName) {
  3443. console.log("Loading settings for " + charName);
  3444.  
  3445. var tempCharsSetting;
  3446. try {
  3447. tempCharsSetting = JSON.parse(GM_getValue("settings__char__" + charName + "@" + accountName, "{}"));
  3448. } catch (e) {
  3449. tempCharsSetting = null;
  3450. }
  3451. if (!tempCharsSetting) {
  3452. console.log('Character settings couldn\'t be retrieved, loading defaults.');
  3453. tempCharsSetting = {};
  3454. };
  3455. charSettingsList[charName] = $.extend(true, {}, defaultCharSettings, tempCharsSetting);
  3456. charSettingsList[charName].charName = charName; // for compatibility
  3457.  
  3458. console.log("Loading saved statistics for " + charName);
  3459. var tempCharsStatistics;
  3460. try {
  3461. tempCharsStatistics = JSON.parse(GM_getValue("statistics__char__" + charName + "@" + accountName, "{}"));
  3462. } catch (e) {
  3463. tempCharsStatistics = null;
  3464. }
  3465. if (!tempCharsStatistics) {
  3466. console.log('Character statistics couldn\'t be retrieved, loading defaults.');
  3467. tempCharsStatistics = {};
  3468. };
  3469. charStatisticsList[charName] = $.extend(true, {}, defaultCharStatistics, tempCharsStatistics);
  3470. })
  3471. if (scriptSettings.general.saveCharNextTime)
  3472. charNamesList.forEach( function(name, idx) {
  3473. chartimers[idx] = (new Date(charStatisticsList[name].general.nextTask));
  3474. chargold[idx] = charStatisticsList[name].general.gold;
  3475. chardiamonds[idx] = charStatisticsList[name].general.diamonds;
  3476. });
  3477. // Adding the Account and character settings / info to the UI
  3478. addSettings();
  3479. }
  3480.  
  3481. // load current character position and values
  3482. curCharNum = GM_getValue("curCharNum_" + accountName, 0);
  3483. curCharName = charNamesList[curCharNum];
  3484. curCharFullName = curCharName + '@' + accountName;
  3485.  
  3486. if (unsafeWindow.client.getCurrentCharAtName() != curCharFullName) {
  3487. loadCharacter(curCharFullName);
  3488. return;
  3489. }
  3490.  
  3491. // Try to start tasks
  3492. if (processCharacter()) {
  3493. return;
  3494. }
  3495.  
  3496. // Switch characters as necessary
  3497. switchChar();
  3498. }
  3499. }
  3500.  
  3501. function loadCharacter(charname) {
  3502. // Load character and restart next load loop
  3503. console.log("Loading gateway script for", charname);
  3504. unsafeWindow.client.dataModel.loadEntityByName(charname);
  3505.  
  3506. try {
  3507. var testChar = unsafeWindow.client.dataModel.model.ent.main.name;
  3508. unsafeWindow.client.dataModel.fetchVendor('Nw_Gateway_Professions_Merchant');
  3509. console.log("Loaded datamodel for", charname);
  3510. } catch (e) {
  3511. // TODO: Use callback function
  3512. window.setTimeout(function() {
  3513. loadCharacter(charname);
  3514. }, delay.SHORT);
  3515. return;
  3516. }
  3517.  
  3518. // MAC-NW -- AD Consolidation -- Banker Withdraw Section
  3519. if (getSetting('consolidationSettings','consolidate')) {
  3520.  
  3521. unsafeWindow.client.dataModel.fetchExchangeAccountData();
  3522.  
  3523. try {
  3524. var testExData = unsafeWindow.client.dataModel.model.exchangeaccountdata.openorders;
  3525. console.log("Loaded zen exchange data for", charname);
  3526. } catch (e) {
  3527. // TODO: Use callback function
  3528. window.setTimeout(function() {
  3529. loadCharacter(charname);
  3530. }, delay.SHORT);
  3531. return;
  3532. }
  3533.  
  3534. // First check if there's anything we have to withdraw and claim it
  3535. // Sometimes the system will literally overwrite canceled and unclaimed orders and return AD to that character
  3536. // Example: if you cancel 5 orders, don't claim them, then create another order and cancel it, that last order
  3537. // will overwrite one of your previous orders and return the AD to that other character
  3538. var exchangeDiamonds = parseInt(unsafeWindow.client.dataModel.model.exchangeaccountdata.readytoclaimescrow);
  3539. if (exchangeDiamonds > 0) {
  3540. claimZaxOffer();
  3541. }
  3542.  
  3543. // Domino effect: first check if we're out of space for new offers
  3544. if (unsafeWindow.client.dataModel.model.exchangeaccountdata.openorders.length == 5) {
  3545. // Domino effect: then withdraw as much offers as we can and claim the diamonds
  3546. window.setTimeout(cancelZaxOffer, delay.SHORT);
  3547. }
  3548.  
  3549. WaitForState("button.closeNotification").done(function() {
  3550. $("button.closeNotification").click();
  3551. });
  3552.  
  3553. unsafeWindow.client.dataModel.loadEntityByName(charname);
  3554.  
  3555. } else {
  3556. console.log("Zen Exchange AD transfer not enabled. Skipping ZAX Posting..");
  3557. }
  3558. // MAC-NW
  3559.  
  3560. // MAC-NW -- Moved Professoin Merchant loading here with testing/waiting to make sure it loads
  3561. try {
  3562. var testProfMerchant = client.dataModel.model.vendor.items;
  3563. console.log("Loaded profession merchant for", charname);
  3564. } catch (e) {
  3565. // TODO: Use callback function
  3566. window.setTimeout(function() {
  3567. loadCharacter(charname);
  3568. }, delay.SHORT);
  3569. return;
  3570. }
  3571.  
  3572. // Check Vendor Options & Vendor matched items
  3573. vendorJunk();
  3574.  
  3575. dfdNextRun.resolve();
  3576. }
  3577.  
  3578. function addSettings() {
  3579. var setEventHandlers = false;
  3580. if (!($("#settingsButton").length)) {
  3581. // Add the required CSS
  3582. AddCss("\
  3583. #settingsButton{border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); background: none repeat scroll 0% 0% rgb(238, 238, 238); display: block; position: fixed; overflow: auto; right: 0px; top: 0px; padding: 3px; z-index: 1000;}\
  3584. #pauseButton{border-bottom: 1px solid rgb(102, 102, 102); border-right: 1px solid rgb(102, 102, 102); background: none repeat scroll 0% 0% rgb(238, 238, 238); display: block; position: fixed; overflow: auto; right: 23px; top: 0px; padding: 3px; z-index: 1000;}\
  3585. #settingsPanel{position: fixed; overflow: auto; right: 0px; top: 0px; width: 650px;max-height:100%;font: 12px sans-serif; text-align: left; display: block; z-index: 1001;}\
  3586. #settings_title{font-weight: bolder; background: none repeat scroll 0% 0% rgb(204, 204, 204); border-bottom: 1px solid rgb(102, 102, 102); padding: 3px;}\
  3587. #settingsPanelButtonContainer {background: none repeat scroll 0% 0% rgb(204, 204, 204); border-top: 1px solid rgb(102, 102, 102);padding: 3px;text-align:center} \
  3588. #charPanel {width:98%;max-height:550px;overflow:auto;display:block;padding:3px;}\
  3589. .inventory-container {float: left; clear: none; width: 270px; margin-right: 20px;}\
  3590. #prinfopane {position: fixed; top: 5px; left: 200px; display: block; z-index: 1000;}\
  3591. .prh3 {padding: 5px; height: auto!important; width: auto!important; background-color: rgba(0, 0, 0, 0.7);}\
  3592. .custom-radio{width:16px;height:16px;display:inline-block;position:relative;z-index:1;top:3px;background-color:#fff;margin:0 4px 0 2px;}\
  3593. .custom-radio:hover{background-color:black;} .custom-radio.selected{background-color:red;} .custom-radio-selected-text{color:darkred;font-weight:500;}\
  3594. .custom-radio input[type='radio']{margin:1px;position:absolute;z-index:2;cursor:pointer;outline:none;opacity:0;_nofocusline:expression(this.hideFocus=true);-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);filter:alpha(opacity=0);-khtml-opacity:0;-moz-opacity:0}\
  3595. .charSettingsTab { overflow: auto; }\
  3596. .charSettingsTab div { overflow: auto; }\
  3597. #rcounters ul li span { display: inline-block; min-width: 125px; }\
  3598. #settingsPanel table { width: 100%; }\
  3599. .ranked:nth-child(6n+2) { color: purple; } .ranked:nth-child(6n+3) { color: blue; } .ranked:nth-child(6n+4) { color: green } \
  3600. .ranked2:nth-child(6n+1) { color: purple; } .ranked2:nth-child(6n+2) { color: blue; } .ranked2:nth-child(6n+3) { color: green } \
  3601. .tranked:nth-child(4n+2) { color: purple; } .tranked:nth-child(4n+3) { color: blue; } .tranked:nth-child(4n) { color: green } \
  3602. .tranked2:nth-child(4n+1) { color: purple; } .tranked2:nth-child(4n+2) { color: blue; } .tranked2:nth-child(4n+3) { color: green } \
  3603. table.professionRanks { border-collapse: collapse; } \
  3604. table.professionRanks td { height: 14px; } \
  3605. td.ranked2, td.tranked2 { border-bottom: solid 1px #555; border-top: dashed 1px #888 }\
  3606. table.professionLevels td.rotate, table.professionLevels th.rotate { height: 100px; } \
  3607. table.professionLevels td.rotate, table.professionLevels th.rotate > div { transform: translate(0, 30px) rotate(290deg); width: 30px; } \
  3608. table.professionLevels td.rotate, table.professionLevels th.rotate > div > span { border-bottom: 1px solid #ccc; padding: 5px 10px; white-space: nowrap; } \
  3609. input[type='checkbox'].settingsInput { margin: 5px 10px 5px 5px; }\
  3610. input.settingsInput { margin: 5px 5px; }\
  3611. label.settingsLabel { margin: 5px 5px; min-width: 150px; display: inline-block; }\
  3612. .inputSaved { color: #66FF66; }\
  3613. .inputSaved:after { content: \"\"; width: 8px; height: 8px; display: inline-block; background-color: #66FF66; position:relative; right: 10px; }\
  3614. .h_warning { color: red !important; }\
  3615. label.customProfiles {min-width: 150px; }\
  3616. select.customProfiles { margin: 10px }\
  3617. textarea.customProfiles { width: 500px; height: 350px; margin: 10px 0; }\
  3618. .custom_profiles_delete { height: 16px; } #custom__profiles__viewbase_btn { height: 16px; } .custom_profiles_view {height: 16px; margin: 0 4px; }\
  3619. #settingsPanel table {border-collapse: collapse; }\
  3620. tr.totals > td { border-top: 1px solid grey; padding-top: 3px; } \
  3621. .rarity_Gold {color: blue; } .rarity_Silver {color: green; } .rarity_Special {color: purple; } \
  3622. #dialog-inventory { overflow-y: scroll; font: 10px Arial; } #dialog-inventory table { width: 100% } #dialog-inventory table th { text-align: left; font-weight: bold; }\
  3623. .slt_None {color: red;} .slt_Lead {color: blue;} .slt_Alch {color: green;} .slt_Jewe {color: gold;} .slt_Leat {color: brown;}\
  3624. #copy_settings_to { width: 200px; height: 350px; margin: 5px 0;} #copy_settings_from { margin: 5px 0;}\
  3625. ");
  3626.  
  3627. // Add settings panel to page body
  3628. $("body").append(
  3629. '<div id="settingsPanel" class="ui-widget-content">\
  3630. <div id="settings_title">\
  3631. <span class="ui-icon ui-icon-wrench" style="float: left;"></span>\
  3632. <span id="settings_close" class="ui-icon ui-icon-closethick" title="Click to hide preferences" style="float: right; cursor: pointer; display: block;"\></span>\
  3633. <span style="margin:3px">Settings (script version ' + scriptVersion + ')</span>\
  3634. </div>\
  3635. <div id="script_settings"><ul></ul></div>\
  3636. <div id="account_settings">\
  3637. <div id="main_tabs"><ul></ul></div></div>\
  3638. <div id="account_info">\
  3639. <div id="info_tabs"><ul></ul></div></div>\
  3640. <div id="char_settings"></div>\
  3641. </div>');
  3642. // Add open settings button to page
  3643. $("body").append('<div id="settingsButton"><span class="ui-icon ui-icon-wrench" title="Click to show preferences" style="cursor: pointer; display: block;"></span></div>');
  3644. $("#settingsPanel").hide();
  3645. $("#settingsButton").click(function() {
  3646. $("#settingsButton").hide();
  3647. $("#pauseButton").hide();
  3648. $("#settingsPanel").show();
  3649. });
  3650.  
  3651. // Add pause button to page
  3652. $("body").append('<div id="pauseButton"></div>');
  3653. displayPause();
  3654. $("#pauseButton").click( function () {
  3655. PauseSettings();
  3656. });
  3657. // Add info pane
  3658. $("body").append("<div id='prinfopane' class='header-newrelease'>");
  3659.  
  3660. $('#update-content-inventory-bags-0 .bag-header').waitUntilExists(function() {
  3661. if ($('#update-content-inventory-bags-0 .bag-header div').length && !$('#update-content-inventory-bags-0 .bag-header div.autovendor').length) {
  3662. $('#update-content-inventory-bags-0 .bag-header').append('<div class="input-field button light autovendor"><div class="input-bg-left"></div><div class="input-bg-mid"></div><div class="input-bg-right"></div><button id="nwprofs-autovendor">Auto Vendor</button></div>');
  3663. $("button#nwprofs-autovendor").on("click", vendorJunk);
  3664. }
  3665. });
  3666.  
  3667.  
  3668. $("#settings_close,settings_cancel").click(function() {
  3669. $("#settingsButton").show();
  3670. $("#pauseButton").show();
  3671. $("#settingsPanel").hide();
  3672. });
  3673. //$('#script_settings').html('');
  3674. var tab = addTab("#script_settings", "Script settings");
  3675. addInputsUL(tab, 'script', 'main');
  3676. tab = addTab("#script_settings", "Advanced");
  3677. var thtml = "<button id='reset_settings_btn'>Reset ALL Settings</button><br /><br />";
  3678. thtml += "Must be logged in and at the correct charactar to list it's items.<br />";
  3679. thtml += "<button id='list_inventory_btn'>List Inventory</button><br /><br />";
  3680. thtml += "List settings (display all the configuration and obscure char names to char 1,2... and banker)<br />";
  3681. thtml += "<button id='list_settings_btn'>Dump settings </button><br /><br />";
  3682. tab.html(thtml);
  3683.  
  3684. $('#reset_settings_btn').button();
  3685. $('#reset_settings_btn').click(function() {
  3686. window.setTimeout(function() {
  3687. GM_setValue("settings__char__" + c_name + "@" + loggedAccount, JSON.stringify(charSettingsList[c_name]));
  3688. console.log("Saved char_task setting: " + scope + "." + group + "." + name + "." + sub_name + " For: " + c_name);
  3689. var keys = GM_listValues();
  3690. for (i = 0; i < keys.length; i++) {
  3691. var key = keys[i];
  3692. GM_deleteValue(key);
  3693. }
  3694. GM_setValue("script_version", scriptVersion);
  3695. window.setTimeout(function() {
  3696. unsafeWindow.location.href = current_Gateway;
  3697. }, 0);
  3698. }, 0);
  3699. });
  3700.  
  3701. $('#list_inventory_btn').button();
  3702. $('#list_inventory_btn').click(function() {
  3703. var _inventory;
  3704. try {
  3705. _inventory = client.dataModel.model.ent.main.inventory;
  3706. }
  3707. catch (e) {
  3708. var str = "Inventory could not be loaded, make sure you are logged in and at the correct character."
  3709. $('<div id="dialog-error-inventory" title="Error loading inventory">' + str + '</div>').dialog({
  3710. resizable: true,
  3711. width: 500,
  3712. modal: false,
  3713. });
  3714. return;
  3715. }
  3716. var inv_tbl_head = "<table><tr><th>Slot #</th><th>Qty</th><th>Item Name</th><th>Rarity</th><th>Bound</th></tr>";
  3717. var str = '';
  3718. var slotCnt = 0;
  3719. _inventory.playerbags.forEach(function (bag) {
  3720. str += '<div>' + bag.name + '</div>';
  3721. str += inv_tbl_head;
  3722. bag.slots.forEach( function (slot, slotNum) {
  3723. if (!slot) return;
  3724. slotCnt++;
  3725. str += '<tr><td>' + slotNum +
  3726. '</td><td>' + slot.count + '</td><td class=" rarity_' + slot.rarity + '">' + slot.name +
  3727. '</td><td>' + slot.rarity + '</td><td>' + (slot.bound || slot.boundtoaccount) + '</td></tr>';
  3728. });
  3729. str += '</table><br/>';
  3730. });
  3731. str += '<div>Resources</div>';
  3732. str += inv_tbl_head;
  3733. var bag = _inventory.tradebag;
  3734. bag = bag.slice(0,slotCnt);
  3735. bag.forEach( function (slot, slotNum) {
  3736. if (!slot) return;
  3737. str += '<tr><td>' + slotNum +
  3738. '</td><td>' + slot.count + '</td><td class=" rarity_' + slot.rarity + '">' + slot.name +
  3739. '</td><td>' + slot.rarity + '</td><td>' + (slot.bound || slot.boundtoaccount) + '</td></tr>';
  3740. })
  3741. str += '</table>';
  3742. $('<div id="dialog-inventory" title="Inventory listing">' + str + '</div>').dialog({
  3743. resizable: true,
  3744. width: 550,
  3745. height: 550,
  3746. modal: false,
  3747. });
  3748. });
  3749.  
  3750. $('#list_settings_btn').button();
  3751. $('#list_settings_btn').click(function() {
  3752. var str = 'Script Settings (script version ' + scriptVersion + ')\n';
  3753. var tempObj;
  3754. tempObj = $.extend(true, {}, scriptSettings);
  3755. str += '' + JSON.stringify(tempObj,null,4) + '\n';
  3756. str += 'Account Settings\n';
  3757. tempObj = $.extend(true, {}, accountSettings);
  3758. if (accountSettings.consolidationSettings.bankCharName) {
  3759. var bankIndex = charNamesList.indexOf(accountSettings.consolidationSettings.bankCharName);
  3760. if (bankIndex == -1) str += "Bank set but not found in charNamesList\n";
  3761. else str += "Bank set and found at index:" + bankIndex + "\n";
  3762. tempObj.consolidationSettings.bankCharName = "Char " + bankIndex;
  3763. }
  3764. str += '' + JSON.stringify(tempObj,null,4) + '\n';
  3765. //str += '<pre>' + JSON.stringify(tempObj,null,4) + '</pre>';
  3766.  
  3767. str += 'Char Settings\n';
  3768. charNamesList.forEach(function (charName, idx){
  3769. tempObj = $.extend(true, {}, charSettingsList[charName]);
  3770. str += 'Char ' + idx + '\n';
  3771. tempObj.charName = "Char " + idx;
  3772. str += '' + JSON.stringify(tempObj,null,4) + '\n';
  3773. })
  3774.  
  3775. $('<div id="dialog-settings" title="Settings listing"><textarea style=" width: 98%; height: 98%;">' + str + '</textarea></div>').dialog({
  3776. resizable: true,
  3777. width: 550,
  3778. height: 750,
  3779. modal: false,
  3780. });
  3781. });
  3782.  
  3783. // Custom profiles
  3784. tab = addTab("#script_settings", "Custom profiles");
  3785. var temp_html = '';
  3786. temp_html += '<div><label class="customProfiles">Task name: </label><select class=" custom_input customProfiles " id="custom_profiles_taskname">';
  3787. tasklist.forEach(function(task) {
  3788. if (!task.taskActive) return;
  3789. temp_html += '<option value="' + task.taskListName + '">' + task.taskListName + '</option>';
  3790. })
  3791. temp_html += '</select>';
  3792. temp_html += '<label class="customProfiles">Base Profile: </label><select class=" custom_input customProfiles " id="custom__profiles__baseprofile"></select>';
  3793. temp_html += '<button id="custom__profiles__viewbase_btn"></button>';
  3794. temp_html += '</div>';
  3795. temp_html += 'Input must be valid JSON: double quotes on property names & no trailing commas. <br /> Use any online validator to easily find errors. <br /> like: http://jsonformatter.curiousconcept.com/ <br /> http://json.parser.online.fr/';
  3796. temp_html += '<div><textarea id="custom_profile_textarea" class=" custom_input customProfiles ">';
  3797. temp_html += '{\n "profileName": "Example",\n "isProfileActive": true,\n "level": {\n "0": ["Alchemy_Tier0_Intro_1"],\n "1": ["Alchemy_Tier1_Refine_Basic", "Alchemy_Tier1_Gather_Components"]\n }\n}';
  3798. temp_html += '</textarea></div>';
  3799. temp_html += '<div><button id="custom__profiles__import_btn">Import</button></div>';
  3800. temp_html += '<table><tr><th>#</th><th>Task Name</th><th>Base Profile</th><th>Profile Name</th><th><th></tr>';
  3801. customProfiles.forEach(function (cProfile, idx) {
  3802. temp_html += '<tr><td>' + (idx+1) + '</td>';
  3803. temp_html += '<td>' + cProfile.taskName + '</td>';
  3804. temp_html += '<td>' + cProfile.baseProfile + '</td>';
  3805. if (typeof cProfile.profile === 'object')
  3806. temp_html += '<td>' + cProfile.profile.profileName + '</td>';
  3807. temp_html += '<td><button class="custom_profiles_view" value=' + idx + '></button><button class="custom_profiles_delete" value=' + idx + '></button></td>';
  3808. });
  3809. temp_html += '</ul>';
  3810. tab.html(temp_html);
  3811. $( ".custom_profiles_view" ).button({
  3812. icons: {
  3813. primary: "ui-icon-zoomin"
  3814. },
  3815. text: false
  3816. });
  3817. $( ".custom_profiles_view" ).click( function(e) {
  3818. var pidx = $(this).val();
  3819. var str = "Task name : " + customProfiles[pidx].taskName + "\n";
  3820. str += "Base Profile : " + customProfiles[pidx].baseProfile + "\n"
  3821. str += "Profile : \n\n";
  3822. str += JSON.stringify(customProfiles[pidx].profile,null,4);
  3823.  
  3824. $('<div id="dialog-display-custom-profile" title="Custom profile"><textarea style=" width: 98%; height: 98%;">' + str + '</textarea></div>').dialog({
  3825. resizable: true,
  3826. width: 550,
  3827. height: 750,
  3828. modal: false,
  3829. });
  3830. });
  3831.  
  3832. $( ".custom_profiles_delete" ).button({
  3833. icons: {
  3834. primary: "ui-icon-trash"
  3835. },
  3836. text: false
  3837. });
  3838. $( ".custom_profiles_delete" ).click( function(e) {
  3839. var pidx = $(this).val();
  3840. customProfiles.splice(pidx,1);
  3841. GM_setValue("custom_profiles", JSON.stringify(customProfiles));
  3842. console.log('Deleted custom profile ' + pidx);
  3843. window.setTimeout(function() {
  3844. unsafeWindow.location.href = current_Gateway;
  3845. }, 0);
  3846. });
  3847. // Set up the advanced slot selects
  3848. $("#custom_profiles_taskname").change(function(e) {
  3849. var _taskname = $(this).val();
  3850. var _profiles = tasklist.filter(function(task) {
  3851. return task.taskListName == _taskname;
  3852. })[0].profiles.filter(function(profile) {
  3853. return profile.isProfileActive
  3854. });
  3855. var profileSelect = $("#custom__profiles__baseprofile").html("");
  3856. profileSelect.append($("<option />").val(null).text("new"));
  3857. _profiles.forEach(function(profile) {
  3858. profileSelect.append($("<option />").val(profile.profileName).text(profile.profileName));
  3859. });
  3860. });
  3861. $("#custom_profiles_taskname").change();
  3862.  
  3863. $('#custom__profiles__viewbase_btn').button({
  3864. icons: {
  3865. primary: "ui-icon-zoomin"
  3866. },
  3867. text: false
  3868. });
  3869. $('#custom__profiles__viewbase_btn').click(function() {
  3870. var _taskName = $("#custom_profiles_taskname").val();
  3871. var _baseProfile = $("#custom__profiles__baseprofile").val();
  3872. var _profiles = tasklist.filter(function(task) {
  3873. return task.taskListName == _taskName;
  3874. })[0].profiles.filter(function(profile) {
  3875. return profile.profileName === _baseProfile;
  3876. });
  3877. var str = JSON.stringify(_profiles,null,4);
  3878.  
  3879. $('<div id="dialog-display-profile" title="Profile"><textarea style=" width: 98%; height: 98%;">' + str + '</textarea></div>').dialog({
  3880. resizable: true,
  3881. width: 550,
  3882. height: 750,
  3883. modal: false,
  3884. });
  3885. });
  3886.  
  3887.  
  3888. $('#custom__profiles__import_btn').button();
  3889. $('#custom__profiles__import_btn').click(function() {
  3890. window.setTimeout(function() {
  3891. var taskName = $("#custom_profiles_taskname").val();
  3892. var baseProfile = $("#custom__profiles__baseprofile").val();
  3893. var profile;
  3894. try {
  3895. profile = JSON.parse($('#custom_profile_textarea').val());
  3896. }
  3897. catch (e) {
  3898. alert("Failed to parse custom profile. JSON not valid.");
  3899. return;
  3900. }
  3901. customProfiles.push({ taskName: taskName, baseProfile: baseProfile, profile: profile });
  3902. GM_setValue("custom_profiles", JSON.stringify(customProfiles));
  3903. window.setTimeout(function() {
  3904. unsafeWindow.location.href = current_Gateway;
  3905. }, 0);
  3906. }, 0);
  3907. });
  3908. $("#script_settings").tabs({ active: false, collapsible: true });
  3909. setEventHandlers = true;
  3910. }
  3911. // Refresh is needed / Loading all the info (account, statistics and chars)
  3912. if (UIaccount != loggedAccount) {
  3913. UIaccount = loggedAccount;
  3914.  
  3915. var tabs = {
  3916. main: tr('tab.general'),
  3917. prof: tr('tab.professions'),
  3918. vend: tr('tab.vendor'),
  3919. bank: tr('tab.consolidation')
  3920. };
  3921.  
  3922. for (var key in tabs) {
  3923. var temp_tab = addTab("#main_tabs", tabs[key]);
  3924. addInputsUL(temp_tab, 'account', key);
  3925. }
  3926. var settings_copy_tab = addTab("#main_tabs", "Settings Copy");
  3927. $("div#main_tabs").tabs({ active: false, collapsible: true });
  3928.  
  3929. // Settings copy Tab
  3930. var temp_html = '';
  3931. temp_html += '<div><label class="">Copy settings from: </label><select class=" custom_input " id="copy_settings_from">';
  3932. charNamesList.forEach( function (charName) {
  3933. temp_html += '<option value="' + charName + '">' + charName + '</option>';
  3934. })
  3935. temp_html += '</select></div>';
  3936. temp_html += '<div><label class="">Copy settings to: (multiple select by holding ctrl/shift)</label></div><div><select multiple="multiple" class=" custom_input " id="copy_settings_to">';
  3937. charNamesList.forEach( function (charName) {
  3938. temp_html += '<option value="' + charName + '">' + charName + '</option>';
  3939. })
  3940. temp_html += '</select></div><div><button id="copy_settings_button" class="" value="">copy</button></div>';
  3941. settings_copy_tab.html(temp_html);
  3942. $( "#copy_settings_button" ).button();
  3943. $( "#copy_settings_button" ).click( function(e) {
  3944. var _from = $("#copy_settings_from").val();
  3945. var _fromSettings = charSettingsList[_from];
  3946. if (!_fromSettings) return;
  3947. var _to = $("#copy_settings_to").val();
  3948. _to.forEach(function (toName){
  3949. if (charNamesList.indexOf(toName) == -1) return;
  3950. var newSettings = $.extend(true, {}, _fromSettings);
  3951. newSettings.charName = toName;
  3952. charSettingsList[toName] = newSettings;
  3953. GM_setValue("settings__char__" + toName + "@" + loggedAccount, JSON.stringify(newSettings));
  3954. console.log("Copied settings from: ", _from, " to: ", toName);
  3955. })
  3956. window.setTimeout(function() {
  3957. unsafeWindow.location.href = current_Gateway;
  3958. }, 0);
  3959. });
  3960.  
  3961. //Statisitcs Tabs
  3962. var temp_tab = addTab("#info_tabs", tr('tab.counters'));
  3963. temp_tab.append("<div id='rcounters'></div>");
  3964. temp_tab = addTab("#info_tabs", tr('tab.visits'));
  3965. temp_tab.append("<div id='sca_v'></div>");
  3966. temp_tab = addTab("#info_tabs", tr('tab.workers'));
  3967. temp_tab.append("<div id='worker_overview'></div>");
  3968. temp_tab = addTab("#info_tabs", tr('tab.tools'));
  3969. temp_tab.append("<div id='tools_overview'></div>");
  3970. temp_tab = addTab("#info_tabs", tr('tab.resources'));
  3971. temp_tab.append("<div id='resource_tracker'></div>");
  3972. temp_tab = addTab("#info_tabs", tr('tab.levels'));
  3973. temp_tab.append("<div id='profession_levels'></div>");
  3974. temp_tab = addTab("#info_tabs", tr('tab.slots'));
  3975. temp_tab.append("<div id='slot_tracker'></div>");
  3976. $("#info_tabs").tabs({ active: false, collapsible: true });
  3977.  
  3978. // Adding per char settings UI
  3979. var wrp = $('<div id="charSettingsAccordion">');
  3980. $("#char_settings").append(wrp);
  3981. charNamesList.forEach( function(charName, idx) {
  3982. wrp.append('<h3>' + charName + '</h3>');
  3983. var wrp2 = $('<div id="charContainer' + idx + '">');
  3984. wrp.append(wrp2);
  3985. addInputsUL(wrp2[0], 'char', 'main_not_tab', charName);
  3986. var char_tabs = $('<div class="charSettingsTabs" id="char_tabs_' + idx + '"><ul></ul></div>');
  3987. wrp2.append(char_tabs);
  3988. var task_tab = addTab(char_tabs[0], "Tasks");
  3989.  
  3990. // Creating the Tasks custom tab
  3991. var tableHTML = $('<table><thead><tr><th>Task name</th><th># of slots</th><th>profile</th><th>priority</th></tr></thead><tbody>');
  3992. var _slotOptions = [];
  3993. for (var i = 0; i < 10; i++)
  3994. _slotOptions.push({
  3995. name: i,
  3996. value: i
  3997. });
  3998. var _priorityOptions = [{name:'high',value:0},{name:'medium',value:1},{name:'low',value:2}];
  3999.  
  4000. tasklist.forEach(function(task) {
  4001. if (!task.taskActive) return;
  4002. var _profileNames = [];
  4003. task.profiles.forEach(function(profile) {
  4004. if (profile.isProfileActive) _profileNames.push({
  4005. name: profile.profileName,
  4006. value: profile.profileName
  4007. });
  4008. });
  4009. var _slots = {scope: 'char_task', group: 'taskListSettings', name: task.taskListName, sub_name: 'taskSlots', opts: _slotOptions ,title: task.taskListName, type: 'select', pane: 'tasks1', tooltip: 'Number of slots to assign to ' + task.taskListName};
  4010. var _profile = {scope: 'char_task', group: 'taskListSettings', name: task.taskListName, sub_name: 'taskProfile', opts: _profileNames ,title: task.taskListName, type: 'select', pane: 'tasks1', tooltip: ''};
  4011. var _priority = {scope: 'char_task', group: 'taskListSettings', name: task.taskListName, sub_name: 'taskPriority', opts: _priorityOptions ,title: task.taskListName, type: 'select', pane: 'tasks1', tooltip: ''};
  4012.  
  4013. var _slt = createInput(_slots, charName, 'settingsInput', 'settingsLabel');
  4014. var _prf = createInput(_profile, charName, 'settingsInput', 'settingsLabel');
  4015. var _pr = createInput(_priority, charName, 'settingsInput', 'settingsLabel');
  4016. var tr = $("<tr>");
  4017. $("<td>").append(_slt.label).appendTo(tr);
  4018. $("<td>").append(_slt.input).appendTo(tr);
  4019. $("<td>").append(_prf.input).appendTo(tr);
  4020. $("<td>").append(_pr.input).appendTo(tr);
  4021. tr.appendTo(tableHTML);
  4022. });
  4023. task_tab.append(tableHTML);
  4024.  
  4025. // Manual Slots allocation tab
  4026. var task2_tab = addTab(char_tabs[0], "Manual Tasks");
  4027. var tableHTML2 = $('<table><thead><tr><th>Slot #</th><th>Profession</th><th>Profile</th></tr></thead><tbody>');
  4028.  
  4029. var taskOpts = [];
  4030. tasklist.forEach(function(task) {
  4031. if (!task.taskActive) return;
  4032. taskOpts.push({ name: task.taskListName, value: task.taskListName });
  4033. })
  4034. function fillProfile(taskName) {
  4035. var _profiles = tasklist.filter(function(task) {
  4036. return task.taskListName == taskName;
  4037. })[0].profiles.filter(function(profile) {
  4038. return profile.isProfileActive
  4039. });
  4040. var options = [];
  4041. _profiles.forEach(function(profile) {
  4042. options.push({ name: profile.profileName, value: profile.profileName });
  4043. });
  4044. return options;
  4045. }
  4046. // 9 slots
  4047. for (var j = 0; j < 9; j++) {
  4048. var _tasks = {scope: 'char_task', group: 'taskListSettingsManual', name: j, sub_name: 'Profession', opts: taskOpts ,title: 'Assign to slot #' +(j+1), type: 'select', pane: 'tasks2', tooltip: '',
  4049. onchange: function (newValue, elm) {
  4050. var profileId = $(elm).attr('id').split('__');
  4051. profileId[profileId.length-1] = 'Profile';
  4052. profileId = profileId.join('__');
  4053. var profileSelect = $("[id='" + profileId + "']").empty();
  4054. fillProfile(newValue).forEach(function(option) {
  4055. profileSelect.append($("<option />").val(option.value).text(option.name));
  4056. });
  4057. profileSelect.change();
  4058. }
  4059. };
  4060. var _tsk = createInput(_tasks, charName, 'settingsInput taskListSettingsManual taskListSettingsManualTask', 'settingsLabel');
  4061. var _profile = {scope: 'char_task', group: 'taskListSettingsManual', name: j, sub_name: 'Profile', opts: fillProfile($(_tsk.input).val()) ,title: '', type: 'select', pane: 'tasks2', tooltip: ''};
  4062. var _prf = createInput(_profile, charName, 'settingsInput taskListSettingsManual taskListSettingsManualProfile', 'settingsLabel');
  4063. var tr = $("<tr>");
  4064. //$("<td>").append(_slt.label).appendTo(tr);
  4065. $("<td>").append(_tsk.label).appendTo(tr);
  4066. $("<td>").append(_tsk.input).appendTo(tr);
  4067. $("<td>").append(_prf.input).appendTo(tr);
  4068. tr.appendTo(tableHTML2);
  4069. }
  4070. task2_tab.append(tableHTML2);
  4071.  
  4072. // Char settings tabs
  4073. var tabs_c = {
  4074. main: 'General settings',
  4075. prof: 'Professions',
  4076. vend: 'Vendor options',
  4077. bank: 'AD Consolidation'
  4078. };
  4079.  
  4080. for (var key in tabs_c) {
  4081. var temp_tab = addTab(char_tabs[0], tabs_c[key]);
  4082. addInputsUL(temp_tab, 'char', key, charName);
  4083. }
  4084. });
  4085. $("#charSettingsAccordion").accordion({
  4086. heightStyle: "content",
  4087. autoHeight: false,
  4088. clearStyle: true,
  4089. active: false,
  4090. collapsible: true,
  4091. });
  4092. $(".charSettingsTabs").tabs();
  4093. setEventHandlers = true;
  4094. updateCounters();
  4095. }
  4096.  
  4097. // Adding the save events
  4098. if (setEventHandlers) {
  4099. $("#settingsPanel input[type='checkbox'], #settingsPanel select").not(".custom_input").unbind("change");
  4100. $("#settingsPanel input[type='checkbox'], #settingsPanel select").change(function (evt) {
  4101. saveSetting(evt.target);
  4102. });
  4103. $("#settingsPanel input[type='text'], #settingsPanel input[type='password']").not(".custom_input").unbind("input");
  4104. $("#settingsPanel input[type='text'], #settingsPanel input[type='password']").on('input', function (evt) {
  4105. var value = $(evt.target).val();
  4106. setTimeout(function(value) {
  4107. if ($(evt.target).val() !== value) return;
  4108. saveSetting(evt.target);
  4109. }, 1000, value);
  4110. });
  4111. }
  4112. function saveSetting(elm) {
  4113. var scope = $(elm).data('scope');
  4114. var group = $(elm).data('group');
  4115. var name = $(elm).data('name');
  4116.  
  4117. var value;
  4118. if ($(elm).prop('type') === 'checkbox') value = $(elm).prop('checked');
  4119. else value = $(elm).val();
  4120.  
  4121. var fun = $(elm).data('onchange');
  4122. if (typeof fun === 'function') {
  4123. var retval = fun(value, elm);
  4124. if (retval === false ) return; // Allowing the onchange function to stop the save
  4125. }
  4126. switch (scope) {
  4127. case 'script':
  4128. scriptSettings[group][name] = value;
  4129. setTimeout(function() {
  4130. GM_setValue("settings__script", JSON.stringify(scriptSettings));
  4131. console.log("Saved script setting: " + scope + "." + group + "." + name + " Value: " + value);
  4132. $(elm).addClass("inputSaved");
  4133. setTimeout(function() {
  4134. $(elm).removeClass("inputSaved");
  4135. },1500);
  4136. }, 0);
  4137. break;
  4138. case 'account':
  4139. accountSettings[group][name] = value;
  4140. setTimeout(function() {
  4141. GM_setValue("settings__account__" + loggedAccount, JSON.stringify(accountSettings));
  4142. console.log("Saved account setting: " + scope + "." + group + "." + name + " Value: " + value + " For: " + loggedAccount);
  4143. $(elm).addClass("inputSaved");
  4144. setTimeout(function() {
  4145. $(elm).removeClass("inputSaved");
  4146. },1500);
  4147. }, 0);
  4148. break;
  4149. case 'char':
  4150. var c_name = $(elm).data('charName');
  4151. if (c_name && charSettingsList[c_name]) {
  4152. charSettingsList[c_name][group][name] = value;
  4153. setTimeout(function() {
  4154. GM_setValue("settings__char__" + c_name + "@" + loggedAccount, JSON.stringify(charSettingsList[c_name]));
  4155. console.log("Saved char setting: " + scope + "." + group + "." + name + " Value: " + value + " For: " + c_name);
  4156. $(elm).addClass("inputSaved");
  4157. setTimeout(function() {
  4158. $(elm).removeClass("inputSaved");
  4159. },1500);
  4160. }, 0);
  4161. }
  4162. break;
  4163. case 'char_task':
  4164. var sub_name = $(elm).data('sub_name');
  4165. var c_name = $(elm).data('charName');
  4166. if (c_name && charSettingsList[c_name]) {
  4167. charSettingsList[c_name][group][name][sub_name] = value;
  4168. setTimeout(function() {
  4169. GM_setValue("settings__char__" + c_name + "@" + loggedAccount, JSON.stringify(charSettingsList[c_name]));
  4170. console.log("Saved char_task setting: " + scope + "." + group + "." + name + "." + sub_name + " Value: " + value + " For: " + c_name);
  4171. $(elm).addClass("inputSaved");
  4172. setTimeout(function() {
  4173. $(elm).removeClass("inputSaved");
  4174. },1500);
  4175. }, 0);
  4176. }
  4177. break;
  4178. }
  4179. }
  4180.  
  4181. // Helper function to create input elements
  4182. function createInput( settingsItem, charName , input_css_classes, label_css_classes) {
  4183. var input;
  4184. var label;
  4185.  
  4186. var id_name;
  4187. var value;
  4188. switch (settingsItem.scope) {
  4189. case 'script':
  4190. value = scriptSettings[settingsItem.group][settingsItem.name];
  4191. id_name = "setting__script__" + settingsItem.group + "__" + settingsItem.name;
  4192. break;
  4193. case 'account':
  4194. id_name = "setting__account__" + settingsItem.group + "__" + settingsItem.name;
  4195. value = accountSettings[settingsItem.group][settingsItem.name];
  4196. break;
  4197. case 'char':
  4198. id_name = "setting__char__" + charName + "__" + settingsItem.group + "__" + settingsItem.name;
  4199. value = charSettingsList[charName][settingsItem.group][settingsItem.name];
  4200. break;
  4201. case 'char_task':
  4202. id_name = "setting__char__" + charName + "__" + settingsItem.group + "__" + settingsItem.name+ "__" + settingsItem.sub_name;
  4203. value = charSettingsList[charName][settingsItem.group][settingsItem.name][settingsItem.sub_name];
  4204. break;
  4205.  
  4206. }
  4207.  
  4208. switch (settingsItem.type) {
  4209. case 'checkbox':
  4210. case 'text':
  4211. case 'password':
  4212. input = $("<input type=\"" + settingsItem.type + "\" name=\"" + id_name + "\" id=\"" + id_name + "\" class=\"" + input_css_classes + "\" \>");
  4213. break;
  4214. case 'select':
  4215. input = $("<select name=\"" + id_name + "\" id=\"" + id_name + "\" class=\"" + input_css_classes + "\" >");
  4216. settingsItem.opts.forEach( function (option) {
  4217. input.append($("<option value=\"" + option.value + "\">" + option.name + "</option>"));
  4218. });
  4219. break;
  4220. case 'void':
  4221. break;
  4222. default:
  4223. break;
  4224.  
  4225. }
  4226. if (settingsItem.type == 'checkbox') input.prop('checked', value);
  4227. else input.val(value);
  4228. input.data('scope', settingsItem.scope);
  4229. input.data('group', settingsItem.group);
  4230. input.data('name', settingsItem.name);
  4231. if (settingsItem.sub_name) input.data('sub_name', settingsItem.sub_name);
  4232. if (charName) input.data('charName', charName);
  4233. if (settingsItem.onchange) input.data('onchange', settingsItem.onchange);
  4234. label = $('<label title="' + settingsItem.tooltip + '" class="' + label_css_classes + '" for="' + id_name + '">' + settingsItem.title + '</label>');
  4235. return { input: input, label: label };
  4236. }
  4237.  
  4238.  
  4239. function addInputsUL(parentSelector, scope, pane, charName) {
  4240.  
  4241. var settingListToAdd = settingnames.filter(function(element) {
  4242. return (element.scope == scope && element.pane == pane);
  4243. });
  4244.  
  4245. if (!charName) charName = '';
  4246. var ul = $("<ul></ul>");
  4247. settingListToAdd.forEach( function (setting) {
  4248. var to_add = createInput(setting, charName, 'settingsInput', 'settingsLabel');
  4249. var li = $("<li>");
  4250. switch (setting.type) {
  4251. case 'checkbox':
  4252. li.append(to_add.input);
  4253. li.append(to_add.label);
  4254. break;
  4255. case 'text':
  4256. case 'password':
  4257. case 'select':
  4258. case 'void':
  4259. li.append(to_add.label);
  4260. li.append(to_add.input);
  4261. break;
  4262. }
  4263. ul.append(li);
  4264. })
  4265. $(parentSelector).append(ul);
  4266. }
  4267.  
  4268. function addTab(parentSelector, tabTitle, tabId) {
  4269. if (!tabId) {
  4270. var tabs_num = $(" > ul > li", parentSelector).length + 1;
  4271. tabId = $(parentSelector).attr('id') + "_tab_" + tabs_num;
  4272. }
  4273. $(" > ul", parentSelector).append("<li><a href='#" + tabId + "'>" + tabTitle + "</a></li>");
  4274. var tab = $("<div id='" + tabId + "'></div>");
  4275. $(parentSelector).append(tab);
  4276. return tab;
  4277. }
  4278. // Close the panel
  4279. /*
  4280. $("#settingsButton").show();
  4281. $("#pauseButton img").attr("src", (settings["paused"] ? image_play : image_pause));
  4282. $("#pauseButton img").attr("title", "Click to " + (settings["paused"] ? "resume" : "pause") + " task script");
  4283. $("#pauseButton").show();
  4284. $("#settingsPanel").hide();
  4285. */
  4286. }
  4287.  
  4288. function displayPause() {
  4289. if (scriptSettings.general.scriptPaused) {
  4290. $('#pauseButton').html('<span class="ui-icon ui-icon-play" title="Click to resume task script" style="cursor: pointer; display: block;"></span>');
  4291. }
  4292. else {
  4293. $('#pauseButton').html('<span class="ui-icon ui-icon-pause" title="Click to pause task script" style="cursor: pointer; display: block;"></span>');
  4294. }
  4295. }
  4296. function PauseSettings(_action) {
  4297. switch (_action) {
  4298. case true:
  4299. case "pause":
  4300. scriptSettings.general.scriptPaused = true;
  4301. break;
  4302. case false:
  4303. case 'unpause':
  4304. scriptSettings.general.scriptPaused = false;
  4305. break;
  4306. default:
  4307. scriptSettings.general.scriptPaused = !scriptSettings.general.scriptPaused;
  4308. break;
  4309. }
  4310. setTimeout(function() {
  4311. //console.log("Pause set to", scriptSettings.general.scriptPaused);
  4312. GM_setValue("settings__script", JSON.stringify(scriptSettings));
  4313. }, 0);
  4314. displayPause();
  4315. }
  4316.  
  4317.  
  4318. function updateCounters() {
  4319.  
  4320. function formatNum(num) {
  4321. if ((num / 1000000) > 1)
  4322. return ((num / 1000000).toFixed(1) + 'm');
  4323. if ((num / 1000) > 1)
  4324. return ((num / 1000).toFixed(1) + 'k');
  4325. return Math.floor(num);
  4326. }
  4327.  
  4328. var total = [0, 0, 0, 0];
  4329. var html = '<table>';
  4330. html += "<tr><th>Character Name</th><th>#slots</th><th>R.Counter</th><th>~ad/h</th>";
  4331. html += "<th>RAD</th><th>AD</th><th>gold</th><th>rBI</th><th>BI</th><th>R.today<th></th></tr>";
  4332.  
  4333.  
  4334. charNamesList.forEach(function(charName) {
  4335. var counterTime = (Date.now() - charStatisticsList[charName].general.refineCounterReset) / 1000 / 60 / 60; // in hours.
  4336. var radh = 0;
  4337. if (counterTime > 0) radh = charStatisticsList[charName].general.refineCounter / counterTime;
  4338. var outdated = (charStatisticsList[charName].general.lastVisit < lastDailyResetTime);
  4339.  
  4340. total[0] += charStatisticsList[charName].general.refineCounter;
  4341. total[1] += charStatisticsList[charName].general.diamonds;
  4342. total[2] += charStatisticsList[charName].general.gold;
  4343. total[3] += outdated ? 0 : charStatisticsList[charName].general.refined;
  4344.  
  4345. html += "<tr>";
  4346. html += "<td>" + charName + "</td>";
  4347. html += "<td>" + charStatisticsList[charName].general.activeSlots + "</td>";
  4348. html += "<td>" + formatNum(charStatisticsList[charName].general.refineCounter) + "</td>";
  4349. html += "<td>" + formatNum(radh) + "</td>";
  4350. html += "<td>" + formatNum(charStatisticsList[charName].general.rad) + "</td>";
  4351. html += "<td>" + formatNum(charStatisticsList[charName].general.diamonds) + "</td>";
  4352. html += "<td>" + formatNum(charStatisticsList[charName].general.gold) + "</td>";
  4353. html += "<td>" + formatNum(charStatisticsList[charName].general.rBI) + "</td>";
  4354. html += "<td>" + formatNum(charStatisticsList[charName].general.BI) + "</td>";
  4355. html += "<td>" + (outdated ? "0*" : formatNum(charStatisticsList[charName].general.refined)) + "</td>";
  4356. //html += "<td>" + formatNum(charStatisticsList[charName].general.refineLimitLeft) + "</td>";
  4357. html += "</tr>";
  4358. });
  4359. html += "<tr class='totals'><td>Totals (without AD in ZAX):</td><td></td><td>" + formatNum(total[0]) + "</td><td></td>";
  4360. html += "<td></td><td>" + formatNum(total[1]) + "</td><td>" + formatNum(total[2]) + "</td>";
  4361. html += "<td></td><td></td><td>" + formatNum(total[3]) + "<td></td></tr>";
  4362. html += "</table>";
  4363. html += "*No info for this reset yet. <br />";
  4364. html += "<button>Reset Refined Counter</button>";
  4365. $('#rcounters').html(html);
  4366.  
  4367. $('#rcounters button').button();
  4368. $('#rcounters button').click(function() {
  4369. charNamesList.forEach(function(charName) {
  4370. charStatisticsList[charName].general.refineCounter = 0;
  4371. charStatisticsList[charName].general.refineCounterReset = Date.now();
  4372. // !! This can couse a freeze on slow computers.
  4373. GM_setValue("statistics__char__" + charName + "@" + loggedAccount , JSON.stringify(charStatisticsList[charName]));
  4374. });
  4375. updateCounters();
  4376. });
  4377.  
  4378. // Worker tab update.
  4379. html = '<table class="professionRanks">';
  4380. var temp = "";
  4381. html += "<tr><th>Char name</th>";
  4382. var options = "";
  4383. var workerTabSelects = ["Leadership", "Alchemy", "Leadership"];
  4384. $.each(charStatisticsList[charNamesList[0]].professions, function(profession) {
  4385. options += "<option value='" + profession + "'>" + profession + "</option>";
  4386. })
  4387.  
  4388. for (var i = 0; i < 3; i++) {
  4389. //saving current select values
  4390. if ($('#setting__worker__tab__p' + i).val()) workerTabSelects[i] = $('#setting__worker__tab__p' + i).val();
  4391. html += "<th colspan=6>" + "<select name='setting__worker__tab__p" + i + "' id='setting__worker__tab__p" + i + "'>" + options + "</select></th>";
  4392. temp += "<th>p</th><th>b</th><th>g</th><th>t3</th><th>t2</th><th>t1</th>";
  4393. }
  4394. html += "</tr><tr><th></th>" + temp + "</tr>";
  4395. charNamesList.forEach(function(charName) {
  4396. temp = "";
  4397. html += "<tr><td rowspan=2>" + charName + "</td>";
  4398. for (var i = 0; i < 3; i++) {
  4399. var list = charStatisticsList[charName].professions[workerTabSelects[i]];
  4400. for (var ix = 0; ix < 6; ix++) {
  4401. html += "<td class='ranked'>" + $.trim(list.workersUsed[ix]) + "</td>";
  4402. temp += "<td class='ranked2'>" + $.trim(list.workersUnused[ix]) + "</td>";
  4403. };
  4404. }
  4405. /*
  4406. $.each(charStatisticsList[charName].workers, function (pf, list) {
  4407. for (var ix = 0; ix < 6; ix++) {
  4408. html += "<td class='ranked'>" + $.trim(list.used[ix]) + "</td>";
  4409. temp += "<td class='ranked2'>" + $.trim(list.unused[ix]) + "</td>";
  4410. };
  4411. })
  4412. */
  4413. html += "</tr><tr>" + temp + "</tr>";
  4414. })
  4415.  
  4416. html += "</table>";
  4417. $('#worker_overview').html(html);
  4418. for (var i = 0; i < 3; i++) {
  4419. $('#setting__worker__tab__p' + i).val(workerTabSelects[i]);
  4420. $('#setting__worker__tab__p' + i).change(function() {
  4421. updateCounters();
  4422. });
  4423. }
  4424.  
  4425. // Tools tab update.
  4426. html = '<table class="professionRanks">';
  4427. var temp = "";
  4428. html += "<tr><th>Char name</th>";
  4429. var options = "";
  4430. var toolsTabSelects = ["Crucible", "Mortar", "Philosophersstone", "Graver"];
  4431. $.each(charStatisticsList[charNamesList[0]].tools, function(tool) {
  4432. options += "<option value='" + tool + "'>" + tool + "</option>";
  4433. });
  4434.  
  4435. for (var i = 0; i < 4; i++) {
  4436. //saving current select values
  4437. if ($('#setting__tools__tab__p' + i).val()) toolsTabSelects[i] = $('#setting__tools__tab__p' + i).val();
  4438. html += "<th colspan=4>" + "<select name='setting__tools__tab__p" + i + "' id='setting__tools__tab__p" + i + "'>" + options + "</select></th>";
  4439. temp += "<th>p</th><th>b</th><th>g</th><th>w</th>";
  4440. }
  4441. html += "</tr><tr><th></th>" + temp + "</tr>";
  4442. charNamesList.forEach(function(charName) {
  4443. temp = "";
  4444. html += "<tr><td rowspan=2>" + charName + "</td>";
  4445. for (var i = 0; i < 4; i++) {
  4446. var list = charStatisticsList[charName].tools[toolsTabSelects[i]];
  4447. for (var ix = 0; ix < 4; ix++) {
  4448. html += "<td class='tranked'>" + $.trim(list.used[ix]) + "</td>";
  4449. temp += "<td class='tranked2'>" + $.trim(list.unused[ix]) + "</td>";
  4450. };
  4451. }
  4452. html += "</tr><tr>" + temp + "</tr>";
  4453. })
  4454.  
  4455. html += "</table>";
  4456. $('#tools_overview').html(html);
  4457. for (var i = 0; i < 4; i++) {
  4458. $('#setting__tools__tab__p' + i).val(toolsTabSelects[i]);
  4459. $('#setting__tools__tab__p' + i).change(function() {
  4460. updateCounters();
  4461. });
  4462. }
  4463.  
  4464.  
  4465. // Resource tracker update.
  4466. html = '<table><tr><th>Character Name</th>';
  4467. trackResources.forEach(function(item) {
  4468. html += "<th>" + item.fname + "</th>";
  4469. })
  4470. html += '</tr>';
  4471. charNamesList.forEach(function(charName) {
  4472. html += '<tr><td>' + charName + '</td>';
  4473. charStatisticsList[charName].trackedResources.forEach(function(count) {
  4474. html += '<td>' + count + '</td>';
  4475. })
  4476. html += '</tr>';
  4477. })
  4478. html += "</table>";
  4479. $('#resource_tracker').html(html);
  4480.  
  4481.  
  4482. // 'profession_levels' tab
  4483. html = '<table class="professionLevels">';
  4484. html += "<tr><th class='rotate'><div><span>Character Name</div></span></th>";
  4485. html += "<th class='rotate'><div><span>#slots</div></span></th>";
  4486. $.each(charStatisticsList[charNamesList[0]].professions, function(profession) {
  4487. html += "<th class='rotate'><div><span>" + profession + "</div></span></th>";
  4488. });
  4489. html += "</tr>";
  4490. charNamesList.forEach(function(charName) {
  4491. html += "<tr>";
  4492. html += "<td>" + charName + "</td>";
  4493. html += "<td>" + charStatisticsList[charName].general.activeSlots + "</td>";
  4494. $.each(charStatisticsList[charName].professions, function(name, profData) {
  4495. html += "<td>" + profData.level + "</td>";
  4496. });
  4497. html += "</tr>";
  4498. });
  4499. html += "</table>";
  4500. $('#profession_levels').html(html);
  4501.  
  4502. // 'slot_tracker' tab
  4503. html = '<table>';
  4504. html += "<tr><th>Character Name</th>";
  4505. for (var i = 0; i < 9; i++) {
  4506. html += "<th> #" + (i + 1) + " </th>";
  4507. }
  4508. html += "</tr>";
  4509.  
  4510. charNamesList.forEach(function(charName) {
  4511. html += "<tr>";
  4512. html += "<td>" + charName + "</td>";
  4513. for (var i = 0; i < 9; i++) {
  4514. var _slot = charStatisticsList[charName].slotUse[i];
  4515. html += "<td class=' slt_"+ $.trim(_slot).substring(0, 4) + "'>" + $.trim(_slot).substring(0, 4) + " </td>";
  4516. }
  4517. html += "</tr>";
  4518. });
  4519. html += "</table>";
  4520. $('#slot_tracker').html(html);
  4521. // Visit times and SCA tab
  4522. html = '<table>';
  4523. html += "<tr><th>Character Name</th><th>Next Profession</th><th>Last SCA</th><th>Override</th></tr>";
  4524. charNamesList.forEach(function(charName, idx) {
  4525. html += "<tr>";
  4526. html += "<td>" + charName + "</td>";
  4527. if (!chartimers[idx]) html += "<td>No data</td>";
  4528. else html += "<td><button class=' visitReset ' value=" + (idx + 1) + ">reset</button><span data-timer='" + chartimers[idx] + "' data-timer-length='2'></span></td>";
  4529. if (!charStatisticsList[charName].general.lastSCAVisit) html += "<td>No data</td>";
  4530. else html += "<td>" + (new Date(charStatisticsList[charName].general.lastSCAVisit)).toLocaleString() + "</td>";
  4531. if (charSettingsList[charName].general.overrideGlobalSettings) html += "<td><span class='ui-icon ui-icon-check '></span></td>";
  4532. else html += "<td></td>";
  4533. html += "</tr>";
  4534. });
  4535. html += "</table>";
  4536. html += "<div style='margin: 5px 0;'> Last SCA reset (test #1): " + (new Date(accountSettings.generalSettings.SCADailyReset)).toLocaleString() + "</div>";
  4537. html += "<div style='margin: 5px 0;'> Last SCA reset (test #2): " + (new Date(lastDailyResetTime)).toLocaleString() + "</div>";
  4538. $('#sca_v').html(html);
  4539. $('#sca_v').append("<br /><br /><button id='settings_sca'>Cycle SCA</button>");
  4540. $('#settings_sca').button();
  4541. $("#settings_sca").click(function() {
  4542. $("#settings_close").trigger("click");
  4543. unsafeWindow.location.hash = unsafeWindow.location.hash.replace(/\)\/.+/, ')' + "/adventures");
  4544. processSwordCoastDailies();
  4545. });
  4546.  
  4547. $('.visitReset').button();
  4548. $(".visitReset").click(function() {
  4549. var value = $(this).val();
  4550. if (value) {
  4551. console.log("Reseting for " + charNamesList[value-1]);
  4552. chartimers[parseInt(value)-1] = null;
  4553. updateCounters();
  4554. clearTimeout(timerHandle);
  4555. curCharNum = GM_setValue("curCharNum_" + loggedAccount, parseInt(value)-1);
  4556. timerHandle = window.setTimeout(function() {
  4557. process();
  4558. }, delay.SHORT);
  4559. }
  4560. });
  4561. }
  4562.  
  4563. function vendorJunk(evnt) {
  4564. var _vendorItems = [];
  4565. var _sellCount = 0;
  4566. if (getSetting('vendorSettings', 'vendorKitsLimit')) {
  4567. _vendorItems[_vendorItems.length] = {
  4568. pattern: /^Item_Consumable_Skill/,
  4569. limit: 50
  4570. };
  4571. }
  4572. if (getSetting('vendorSettings', 'vendorAltarsLimit')) {
  4573. _vendorItems[_vendorItems.length] = {
  4574. pattern: /^Item_Portable_Altar$/,
  4575. limit: 80
  4576. };
  4577. }
  4578. if (getSetting('vendorSettings', 'vendorKitsAll')) {
  4579. _vendorItems[_vendorItems.length] = {
  4580. pattern: /^Item_Consumable_Skill/,
  4581. limit: 0
  4582. };
  4583. }
  4584. if (getSetting('vendorSettings', 'vendorAltarsAll')) {
  4585. _vendorItems[_vendorItems.length] = {
  4586. pattern: /^Item_Portable_Altar$/,
  4587. limit: 0
  4588. };
  4589. }
  4590. if (getSetting('vendorSettings', 'vendorEnchR1')) {
  4591. _vendorItems[_vendorItems.length] = {
  4592. pattern: /^T1_Enchantment/,
  4593. limit: 0
  4594. };
  4595. _vendorItems[_vendorItems.length] = {
  4596. pattern: /^T1_Runestone/,
  4597. limit: 0
  4598. };
  4599. }
  4600. if (getSetting('vendorSettings', 'vendorEnchR2')) {
  4601. _vendorItems[_vendorItems.length] = {
  4602. pattern: /^T2_Enchantment/,
  4603. limit: 0
  4604. };
  4605. _vendorItems[_vendorItems.length] = {
  4606. pattern: /^T2_Runestone/,
  4607. limit: 0
  4608. };
  4609. }
  4610. if (getSetting('vendorSettings', 'vendorEnchR3')) {
  4611. _vendorItems[_vendorItems.length] = {
  4612. pattern: /^T3_Enchantment/,
  4613. limit: 0
  4614. };
  4615. _vendorItems[_vendorItems.length] = {
  4616. pattern: /^T3_Runestone/,
  4617. limit: 0
  4618. };
  4619. }
  4620. if (getSetting('vendorSettings', 'vendorPots1')) {
  4621. _vendorItems[_vendorItems.length] = {
  4622. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)$/,
  4623. limit: 0
  4624. };
  4625. }
  4626. if (getSetting('vendorSettings', 'vendorPots2')) {
  4627. _vendorItems[_vendorItems.length] = {
  4628. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)_2$/,
  4629. limit: 0
  4630. };
  4631. }
  4632. if (getSetting('vendorSettings', 'vendorPots3')) {
  4633. _vendorItems[_vendorItems.length] = {
  4634. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)_3$/,
  4635. limit: 0
  4636. };
  4637. }
  4638. if (getSetting('vendorSettings', 'vendorPots4')) {
  4639. _vendorItems[_vendorItems.length] = {
  4640. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)_4$/,
  4641. limit: 0
  4642. };
  4643. }
  4644. if(getSetting('vendorSettings', 'vendorPots5')) {
  4645. _vendorItems[_vendorItems.length] = {
  4646. pattern: /^Potion_(Healing|Tidespan|Force|Fortification|Reflexes|Accuracy|Rejuvenation)_5$/,
  4647. limit: 0
  4648. };
  4649. }
  4650. if (getSetting('vendorSettings', 'vendorJunk')) {
  4651. _vendorItems[_vendorItems.length] = {
  4652. pattern: /^Item_Snowworks_/,
  4653. limit: 0
  4654. }; // Winter Festival fireworks small & large
  4655. _vendorItems[_vendorItems.length] = {
  4656. pattern: /^Item_Skylantern/,
  4657. limit: 0
  4658. }; // Winter Festival skylantern
  4659. _vendorItems[_vendorItems.length] = {
  4660. pattern: /^Item_Partypopper/,
  4661. limit: 0
  4662. }; // Party Poppers
  4663. _vendorItems[_vendorItems.length] = {
  4664. pattern: /^Item_Fireworks/,
  4665. limit: 0
  4666. }; // Fireworks
  4667. _vendorItems[_vendorItems.length] = {
  4668. pattern: /^Object_Plate_/,
  4669. limit: 0
  4670. };
  4671. _vendorItems[_vendorItems.length] = {
  4672. pattern: /^Object_Decoration_/,
  4673. limit: 0
  4674. };
  4675. _vendorItems[_vendorItems.length] = {
  4676. pattern: /_Green_T[1-5]_Unid$/,
  4677. limit: 0
  4678. }; // Unidentified Green Gear
  4679. }
  4680. if (getSetting('vendorSettings', 'vendorProfResults')) {
  4681. _vendorItems[_vendorItems.length] = {
  4682. pattern: /^Crafted_(Jewelcrafting_Waist_Offense_3|Jewelcrafting_Neck_Defense_3|Jewelcrafting_Waist_Defense_3|Med_Armorsmithing_T3_Chain_Armor_Set_1|Med_Armorsmithing_T3_Chain_Pants2|Med_Armorsmithing_T3_Chain_Shirt2|Med_Armorsmithing_T3_Chain_Helm_Set_1|Med_Armorsmithing_T3_Chain_Pants|Med_Armorsmithing_T3_Chain_Boots_Set_1|Hvy_Armorsmithing_T3_Plate_Armor_Set_1|Hvy_Armorsmithing_T3_Plate_Pants2|Hvy_Armorsmithing_T3_Plate_Shirt2|Hvy_Armorsmithing_T3_Plate_Helm_Set_1|Hvy_Armorsmithing_T3_Plate_Boots_Set_1|Leatherworking_T3_Leather_Armor_Set_1|Leatherworking_T3_Leather_Pants2|Leatherworking_T3_Leather_Shirt2|Leatherworking_T3_Leather_Helm_Set_1|Leatherworking_T3_Leather_Boots_Set_1|Tailoring_T3_Cloth_Armor_Set_3|Tailoring_T3_Cloth_Armor_Set_2|Tailoring_T3_Cloth_Armor_Set_1|Tailoring_T3_Cloth_Pants2_Set2|Tailoring_T3_Cloth_Shirt2|Tailoring_T3_Cloth_Helm_Set_1|Artificing_T3_Pactblade_Temptation_5|Artificing_T3_Icon_Virtuous_5|Weaponsmithing_T3_Dagger_4)$/,
  4683. limit: 0
  4684. };
  4685. }
  4686. if (_vendorItems.length > 0) {
  4687. console.log("Attempting to vendor selected items...");
  4688. _sellCount = vendorItemsLimited(_vendorItems);
  4689. if (_sellCount > 0 && !evnt) {
  4690. var _sellWait = _sellCount * 1000;
  4691. PauseSettings("pause");
  4692. window.setTimeout(function() {
  4693. PauseSettings("unpause");
  4694. }, _sellWait);
  4695. }
  4696. }
  4697. }
  4698.  
  4699. function addTranslation() {
  4700. var lang = GM_getValue('language', 'en');
  4701. translation = {
  4702. 'currLang': lang,
  4703. 'en': {
  4704. 'translation.needed': 'translation needed',
  4705. 'tab.general': 'General settings',
  4706. 'tab.professions': 'Professions',
  4707. 'tab.vendor': 'Vendor options',
  4708. 'tab.consolidation': 'AD Consolidation',
  4709. 'tab.other': 'Other',
  4710. 'tab.counters': 'Refine Counters',
  4711. 'tab.visits': 'SCA & Visits',
  4712. 'tab.workers': 'Workers',
  4713. 'tab.tools': 'Tools',
  4714. 'tab.resources': 'Resource Tracker',
  4715. 'tab.levels': 'Prof levels',
  4716. 'tab.slots': 'Slots',
  4717. 'static.settings': 'Settings',
  4718. 'button.save&apply': 'Save and Apply',
  4719. 'button.close': 'Close',
  4720. 'button.cycle': 'Cycle SCA',
  4721. //'settings.main.paused': 'Pause Script',
  4722. //'settings.main.paused.tooltip': 'Disable All Automation',
  4723. 'settings.main.debug': 'Enable Debug',
  4724. 'settings.main.debug.tooltip': 'Enable all debug output to console',
  4725. 'settings.main.autoreload': 'Auto Reload',
  4726. 'settings.main.autoreload.tooltip': 'Enabling this will reload the gateway periodically. (Ensure Auto Login is enabled)',
  4727. 'settings.main.incdelay': 'Increase script delays by',
  4728. 'settings.main.incdelay.tooltip': 'Increase the delays the script waits before attempting the actions.',
  4729. 'settings.main.language': 'Script language',
  4730. 'settings.main.language.tooltip': 'Set GUI language of this script (change requires reloading the page)',
  4731. 'settings.main.autologin': 'Attempt to login automatically',
  4732. 'settings.main.autologin.tooltip': 'Automatically attempt to login to the neverwinter gateway site',
  4733. 'settings.main.nw_username': 'Neverwinter Username',
  4734. 'settings.main.nw_username.tooltip': '',
  4735. 'settings.main.nw_password': 'Neverwinter Password',
  4736. 'settings.main.nw_password.tooltip': '',
  4737. 'settings.main.savenexttime': 'Save next process times',
  4738. 'settings.main.savenexttime.tooltip': 'Save the next proffesion times persistently',
  4739. //'settings.main.charcount': 'Enter number of characters to use (Save and Apply to update settings form)',
  4740. //'settings.main.charcount.tooltip': 'Enter number of characters to use (Save and Apply to update settings form)',
  4741. 'settings.account.openrewards': 'Open Reward Chests',
  4742. 'settings.account.openrewards.tooltip': 'Enable opening of leadership chests on character switch',
  4743. 'settings.account.refinead': 'Refine AD',
  4744. 'settings.account.refinead.tooltip': 'Enable refining of AD on character switch',
  4745. 'settings.account.runSCA': 'Run SCA',
  4746. 'settings.account.runSCA.tooltip': 'Running SCA adventures reward after professions',
  4747. },
  4748. 'pl': {
  4749. 'translation.needed': 'wymagane tłumaczenie',
  4750. 'tab.general': 'Ogólne',
  4751. 'tab.professions': 'Profesje',
  4752. 'tab.vendor': 'Kupiec',
  4753. 'tab.consolidation': 'Konsolidacja AD',
  4754. 'tab.other': 'Pozostałe',
  4755. 'tab.counters': 'Liczniki szlifowania',
  4756. 'tab.visits': 'Nast.zadanie i SCA',
  4757. 'tab.workers': 'Pracownicy',
  4758. 'tab.tools': 'Narzędzia',
  4759. 'tab.resources': 'Surowce',
  4760. 'tab.levels': 'Poziomy prof.',
  4761. 'tab.slots': 'Sloty',
  4762. 'static.settings': 'Ustawienia',
  4763. 'button.save&apply': 'Zapisz i zastosuj',
  4764. 'button.close': 'Zamknij',
  4765. 'button.cycle': 'Runda SCA',
  4766. //'settings.main.paused': 'Zatrzymaj skrypt',
  4767. //'settings.main.paused.tooltip': 'Wyłącz wszelką automatyzację',
  4768. 'settings.main.debug': 'Włącz debugowanie',
  4769. 'settings.main.debug.tooltip': 'Wyświetl wszystkie komunikaty na konsoli (Ctrl+Shift+i w Chrome/Chromium)',
  4770. 'settings.main.autoreload': 'Automatyczne przeładowanie',
  4771. 'settings.main.autoreload.tooltip': 'Włączenie tej opcji powoduje okresowe przeładowanie strony (Upewnij się, że Automatyczne logowanie jest włączone)',
  4772. 'settings.main.incdelay': 'Zwiększ opóżnienia skryptu o...',
  4773. 'settings.main.incdelay.tooltip': 'Zwiększenie opóźnień, gdy skrypt czeka przed próbą działania (pomocne przy wolnych połączeniach).',
  4774. 'settings.main.language': 'Język skryptu',
  4775. 'settings.main.language.tooltip': 'Język interfejsu tego skryptu (zmiana wymaga przeładowania strony)',
  4776. 'settings.main.autologin': 'Próbuj logować automatycznie',
  4777. 'settings.main.autologin.tooltip': 'Próbuj logować automatycznie do strony gateway',
  4778. 'settings.main.nw_username': 'Nazwa użytkownika Neverwinter',
  4779. 'settings.main.nw_username.tooltip': '',
  4780. 'settings.main.nw_password': 'Hasło do Neverwinter',
  4781. 'settings.main.nw_password.tooltip': '',
  4782. 'settings.main.savenexttime': 'Zapisuj czas następnego zadania',
  4783. 'settings.main.savenexttime.tooltip': 'Zapisuj czas następnego zadania w danych międzysesyjnych',
  4784. //'settings.main.charcount': 'Wprowadź liczbę postaci (naciśnij "Zapisz i zastosuj" aby odświerzyć formularz)',
  4785. //'settings.main.charcount.tooltip': 'Wprowadź liczbę postaci (naciśnij "Save and Apply" aby odświerzyć formularz)',
  4786. 'settings.account.openrewards': 'Otwieraj skrzynki',
  4787. 'settings.account.openrewards.tooltip': 'Otwieraj skrzynki z zadań Przywództwa przy zmianie postaci',
  4788. 'settings.account.refinead': 'Szlifuj diamenty',
  4789. 'settings.account.refinead.tooltip': 'Przy zmianie postaci szlifuj diamenty astralne jeśli to możliwe',
  4790. 'settings.account.runSCA': 'Uruchom Wybrzeże Mieczy',
  4791. 'settings.account.runSCA.tooltip': 'Uruchom Wybrzeże Mieczy po wybraniu zadań profesji',
  4792. },
  4793. 'fr': {
  4794. 'translation.needed': 'traduction nécessaire',
  4795. }
  4796. };
  4797. }
  4798.  
  4799. function tr(key) {
  4800. var lang = translation['currLang'];
  4801. if (translation['en'][key] === undefined) {
  4802. console.log("translation: unknown key " + key);
  4803. return "unknown key: " + key;
  4804. }
  4805. if (translation[lang][key] === undefined) {
  4806. console.log('translation needed: lang: ' + lang + ", key: " + key);
  4807. return '/-/ ' + translation['en'][key] + ' /-/';
  4808. }
  4809. return translation[lang][key];
  4810. }
  4811.  
  4812. /** Start, Helpers added by users.
  4813. * Adds fetures, options to base script and can be easily removed if needed
  4814. * Add description so anyone can see if they can use Function somewhere
  4815. * Use "brackets" around function start and end //yourname
  4816. */
  4817. //RottenMind, returns inventory space, use Inventory_bagspace(); gives current free bags slots, from MAC-NW function
  4818.  
  4819. function Inventory_bagspace() {
  4820. var _pbags = client.dataModel.model.ent.main.inventory.playerbags;
  4821. var _bagUnused = 0;
  4822. $.each(_pbags, function(bi, bag) {
  4823. bag.slots.forEach(function(slot) {
  4824. if (slot === null || !slot || slot === undefined) {
  4825. _bagUnused++;
  4826. }
  4827. });
  4828. });
  4829. return _bagUnused;
  4830. }
  4831. //RottenMind
  4832. /** End, Helpers added by users.*/
  4833.  
  4834. // Add the settings button and start a process timer
  4835. addSettings();
  4836. timerHandle = window.setTimeout(function() {
  4837. process();
  4838. }, delay.SHORT);
  4839. })();
  4840.  
  4841.  
  4842.  
  4843.  
  4844. function workerDefinition() {
  4845. return {
  4846. // purple, blue, green, t3, t2, t1
  4847. "Leadership": ["Crafting_Asset_Craftsman_Leadership_T3_Epic", "Crafting_Asset_Craftsman_Leadership_T3_Rare", "Crafting_Asset_Craftsman_Leadership_T3_Uncommon",
  4848. "Crafting_Asset_Craftsman_Leadership_T3_Common", "Crafting_Asset_Craftsman_Leadership_T2_Common", "Crafting_Asset_Craftsman_Leadership_T1_Common_1"
  4849. ],
  4850. "Alchemy": ["Asset_Craftsman_Alchemy_T3_Epic", "Asset_Craftsman_Alchemy_T3_Rare", "Asset_Craftsman_Alchemy_T3_Uncommon",
  4851. "Asset_Craftsman_Alchemy_T3_Common", "Asset_Craftsman_Alchemy_T2_Common", "Asset_Craftsman_Alchemy_T1_Common"
  4852. ],
  4853. "Jewelcrafting": ["Crafting_Asset_Craftsman_Jewelcrafter_T3_Epic", "Crafting_Asset_Craftsman_Jewelcrafter_T3_Rare", "Crafting_Asset_Craftsman_Jewelcrafter_T3_Uncommon",
  4854. "Crafting_Asset_Craftsman_Jewelcrafter_T3_Common", "Crafting_Asset_Craftsman_Jewelcrafter_T2_Common", "Crafting_Asset_Craftsman_Jewelcrafter_T1_Common"
  4855. ],
  4856. "Weaponsmithing": ["Crafting_Asset_Craftsman_Weaponsmith_T3_Epic", "Crafting_Asset_Craftsman_Weaponsmith_T3_Rare", "Crafting_Asset_Craftsman_Weaponsmith_T3_Uncommon",
  4857. "Crafting_Asset_Craftsman_Weaponsmith_T3_Common", "Crafting_Asset_Craftsman_Weaponsmith_T2_Common", "Crafting_Asset_Craftsman_Weaponsmith_T1_Common"
  4858. ],
  4859. "Artificing": ["Crafting_Asset_Craftsman_Artificing_T3_Epic", "Crafting_Asset_Craftsman_Artificing_T3_Rare", "Crafting_Asset_Craftsman_Artificing_T3_Uncommon",
  4860. "Crafting_Asset_Craftsman_Artificing_T3_Common", "Crafting_Asset_Craftsman_Artificing_T2_Common", "Crafting_Asset_Craftsman_Artificing_T1_Common"
  4861. ],
  4862. "Mailsmithing": ["Crafting_Asset_Craftsman_Armorsmithing_Med_T3_Epic", "Crafting_Asset_Craftsman_Armorsmithing_Med_T3_Rare", "Crafting_Asset_Craftsman_Armorsmithing_Med_T3_Uncommon",
  4863. "Crafting_Asset_Craftsman_Armorsmithing_Med_T3_Common", "Crafting_Asset_Craftsman_Armorsmithing_Med_T2_Common", "Crafting_Asset_Craftsman_Armorsmithing_Med_T1_Common"
  4864. ],
  4865. "Platesmithing": ["Crafting_Asset_Craftsman_Armorsmithing_Hvy_T3_Epic", "Crafting_Asset_Craftsman_Armorsmithing_Hvy_T3_Rare", "Crafting_Asset_Craftsman_Armorsmithing_Hvy_T3_Uncommon",
  4866. "Crafting_Asset_Craftsman_Armorsmithing_Hvy_T3_Common", "Crafting_Asset_Craftsman_Armorsmithing_Hvy_T2_Common", "Crafting_Asset_Craftsman_Armorsmithing_Hvy_T1_Common"
  4867. ],
  4868. "Leatherworking": ["Crafting_Asset_Craftsman_Leatherworking_T3_Epic", "Crafting_Asset_Craftsman_Leatherworking_T3_Rare", "Crafting_Asset_Craftsman_Leatherworking_T3_Uncommon",
  4869. "Crafting_Asset_Craftsman_Leatherworking_T3_Common", "Crafting_Asset_Craftsman_Leatherworking_T2_Common", "Crafting_Asset_Craftsman_Leatherworking_T1_Common"
  4870. ],
  4871. "Tailoring": ["Crafting_Asset_Craftsman_Tailoring_T3_Epic", "Crafting_Asset_Craftsman_Tailoring_T3_Rare", "Crafting_Asset_Craftsman_Tailoring_T3_Uncommon",
  4872. "Crafting_Asset_Craftsman_Tailoring_T3_Common", "Crafting_Asset_Craftsman_Tailoring_T2_Common", "Crafting_Asset_Craftsman_Tailoring_T1_Common"
  4873. ],
  4874. "Black Ice Shaping": ["Crafting_Asset_Craftsman_Blackice_T3_Epic", "Crafting_Asset_Craftsman_Blackice_T3_Rare", "Crafting_Asset_Craftsman_Blackice_T3_Uncommon",
  4875. "Crafting_Asset_Craftsman_Blackice_T3_Common"
  4876. ],
  4877. /*
  4878. "Winter Event": ["Crafting_Asset_Craftsman_Winter_Event_T1_Common"],
  4879. "Siege Event": [],
  4880. */
  4881. }
  4882. }
  4883.  
  4884. function toolListDefinition() {
  4885. return {
  4886. "Awl": ["Crafting_Asset_Tool_Awl_Epic", "Crafting_Asset_Tool_Awl_Rare", "Crafting_Asset_Tool_Awl_Uncommon", "Crafting_Asset_Tool_Awl_Common"],
  4887. "Shears": ["Crafting_Asset_Tool_Shears_Epic", "Crafting_Asset_Tool_Shears_Rare", "Crafting_Asset_Tool_Shears_Uncommon", "Crafting_Asset_Tool_Shears_Common"],
  4888. "Hammer": ["Crafting_Asset_Tool_Hammer_Epic", "Crafting_Asset_Tool_Hammer_Rare", "Crafting_Asset_Tool_Shears_Uncommon", "Crafting_Asset_Tool_Hammer_Common", ],
  4889. "Needle": ["Crafting_Asset_Tool_Needle_Epic", "Crafting_Asset_Tool_Needle_Rare", "Crafting_Asset_Tool_Needle_Uncommon", "Crafting_Asset_Tool_Needle_Common", ],
  4890. "Bellows": ["Crafting_Asset_Tool_Bellows_Epic", "Crafting_Asset_Tool_Bellows_Rare", "Crafting_Asset_Tool_Bellows_Uncommon", "Crafting_Asset_Tool_Bellows_Common"],
  4891. "Bezelpusher": ["Crafting_Asset_Tool_Bezelpusher_Epic", "Crafting_Asset_Tool_Bezelpusher_Rare", "Crafting_Asset_Tool_Bezelpusher_Uncommon", "Crafting_Asset_Tool_Bezelpusher_Common"],
  4892. "Mortar": ["Asset_Tool_Mortar_Epic", "Asset_Tool_Mortar_Rare", "Asset_Tool_Mortar_Uncommon", "Asset_Tool_Mortar_Common"],
  4893. "Anvil": ["Crafting_Asset_Tool_Anvil_Epic", "Crafting_Asset_Tool_Anvil_Rare", "Crafting_Asset_Tool_Anvil_Uncommon", "Crafting_Asset_Tool_Anvil_Common", ],
  4894. "Grindstone": ["Crafting_Asset_Tool_Grindstone_Epic", "Crafting_Asset_Tool_Grindstone_Rare", "Crafting_Asset_Tool_Grindstone_Uncommon", "Crafting_Asset_Tool_Grindstone_Common", ],
  4895. "Philosophersstone": ["Asset_Tool_Philosophersstone_Epic", "Asset_Tool_Philosophersstone_Rare", "Asset_Tool_Philosophersstone_Uncommon", "Asset_Tool_Philosophersstone_Common"],
  4896. "Loupe": ["Crafting_Asset_Tool_Loupe_Epic", "Crafting_Asset_Tool_Loupe_Rare", "Crafting_Asset_Tool_Loupe_Uncommon", "Crafting_Asset_Tool_Loupe_Common", ],
  4897. "Graver": ["Crafting_Asset_Tool_Graver_Epic", "Crafting_Asset_Tool_Graver_Rare", "Crafting_Asset_Tool_Graver_Uncommon", "Crafting_Asset_Tool_Graver_Common", ],
  4898. "Crucible": ["Asset_Tool_Crucible_Epic", "Asset_Tool_Crucible_Rare", "Asset_Tool_Crucible_Uncommon", "Asset_Tool_Crucible_Common", ],
  4899. "Tongs": ["Crafting_Asset_Tool_Tongs_Epic", "Crafting_Asset_Tool_Tongs_Rare", "Crafting_Asset_Tool_Tongs_Uncommon", "Crafting_Asset_Tool_Tongs_Common", ],
  4900. /*
  4901. "Crafting_Asset_Tool_Leatherworking_T1_Epic",
  4902. "Crafting_Asset_Tool_Gauntlets_Common"
  4903. "Crafting_Asset_Tool_Leadership_T3_Common","Crafting_Asset_Tool_Leadership_T2_Common"
  4904. */
  4905. }
  4906. }
  4907.