Neverwinter Gateway - Professions Robot

Automatically selects professions for empty slots

当前为 2014-05-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Neverwinter Gateway - Professions Robot
  3. // @description Automatically selects professions for empty slots
  4. // @namespace http://userscripts.org/scripts/show/171738
  5. // @include https://gateway.playneverwinter.com
  6. // @include https://gateway.playneverwinter.com/*
  7. // @include https://gatewaysitedown.playneverwinter.com
  8. // @include https://gatewaysitedown.playneverwinter.com/*
  9. // @include http://gateway.playneverwinter.com
  10. // @include http://gateway.playneverwinter.com/*
  11. // @include http://gatewaysitedown.playneverwinter.com
  12. // @include http://gatewaysitedown.playneverwinter.com/*
  13. // @originalAuthor Mustex
  14. // @modifiedBy Bunta
  15. // @version 1.0.0.3
  16. // @license http://creativecommons.org/licenses/by-nc-sa/3.0/us/
  17. // @grant GM_getValue
  18. // @grant GM_setValue
  19. // @grant GM_listValues
  20. // @grant GM_deleteValue
  21. // ==/UserScript==
  22. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  23. <html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
  24. <head>
  25. <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
  26. <title>Source for &quot;Neverwinter Gateway - Professions Robot Mod&quot; - Userscripts.org</title>
  27. <link href='/images/script_icon.png' rel='shortcut icon' type='image/x-icon' />
  28. <link href="/stylesheets/compiled/screen.css?1397513844" media="screen, projection" rel="stylesheet" type="text/css" />
  29. <link href="/stylesheets/compiled/print.css?1397513844" media="print" rel="stylesheet" type="text/css" />
  30. <script src="/javascripts/all.js?1397513839" type="text/javascript"></script>
  31. <link href="/stylesheets/sh_style.css?1397513839" media="screen" rel="stylesheet" type="text/css" />
  32. <script src="/javascripts/sh_main.min.js?1397513839" type="text/javascript"></script>
  33. <script src="/javascripts/sh_javascript.min.js?1397513839" type="text/javascript"></script>
  34.  
  35. <!--[if IE]>
  36. <link href="/stylesheets/compiled/ie.css?1397513844" media="screen, projection" rel="stylesheet" type="text/css" />
  37. <![endif]-->
  38. </head>
  39. <body class='scripts anon wide' id='scripts-review'>
  40. <div id='root'>
  41. <div id='top'>
  42. <div class='container'>
  43. <ul class='login_status'>
  44. <li><a href="/signup" rel="nofollow">Signup</a></li>
  45. <li><a href="/login?redirect=%2Fscripts%2Freview%2F171738" rel="nofollow">Login</a></li>
  46. </ul>
  47.  
  48. </div>
  49. </div>
  50. <div id='header'>
  51. <div class='container'>
  52. <h1><a href="/">Userscripts.org</a></h1>
  53. <ul id='mainmenu'>
  54. <li class='active'><a href="/scripts">Scripts</a></li>
  55. <li><a href="/tags">Tags</a></li>
  56. <li><a href="/forums">Forums</a></li>
  57. <li><a href="/users">People</a></li>
  58. </ul>
  59.  
  60. </div>
  61. </div>
  62. <div id='section'>
  63. <div class='container'>
  64. <div id='heading'>
  65. <a href="/users/133248" id="avatar" rel="nofollow" title="Bunta"><img alt="" class="photo" height="92" src="http://www.gravatar.com/avatar.php?gravatar_id=24801550d08da0f58a138d4f66744f93&amp;r=PG&amp;s=92&amp;default=identicon" width="92" /></a>
  66. <div id='details'>
  67. <h2 class='title'><a href="/scripts/show/171738">Neverwinter Gateway - Professions Robot Mod</a></h2>
  68. <span class='author'>By <a href="/users/133248" gravatar="http://www.gravatar.com/avatar.php?gravatar_id=24801550d08da0f58a138d4f66744f93&amp;r=PG&amp;s=80&amp;default=identicon" rel="nofollow" user_id="133248">Bunta</a></span>
  69. &mdash;
  70. <span class='date'>
  71. Last update
  72. Mar 29, 2014
  73. </span>
  74. &mdash;
  75. Installed
  76. 856 times.
  77.  
  78. </div>
  79. </div>
  80. <ul id='script-nav'>
  81.  
  82. <li class='menu'><a href="/scripts/show/171738">About</a></li>
  83. <li class='menu current'>Source Code</li>
  84. <li class='menu'><a href="/scripts/reviews/171738">Reviews <span>3</span></a></li>
  85. <li class='menu'><a href="/scripts/discuss/171738">Discussions <span>688</span></a></li>
  86. <li class='menu'><a href="/scripts/fans/171738">Fans <span>32</span></a></li>
  87. <li class='menu'><a href="/scripts/issues/171738" rel="nofollow">Issues</a></li>
  88. <li><a href="http://www.addtoany.com/share_save?linkname=Neverwinter+Gateway+-+Professions+Robot+Mod&amp;linkurl=http%3A%2F%2Fuserscripts.org%3A8080%2Fscripts%2Fshow%2F171738" class="a2a_dd" rel="nofollow">Share</a></li>
  89. </ul>
  90. </div>
  91. </div>
  92.  
  93. <div class='container'>
  94.  
  95. <div id='content'>
  96.  
  97.  
  98.  
  99. <p class='notice'>
  100. There are
  101. <a href="/scripts/versions/171738">59 previous versions</a>
  102. of this script.
  103. </p>
  104. <h3><a href="#" onclick="sh_highlightDocument(); this.parentNode.innerHTML=''; return false">Add Syntax Highlighting</a> <em>(this will take a few seconds, probably freezing your browser while it works)</em></h3></h3>
  105. <pre class='sh_javascript' id='source'>
  106.  
  107. /* RELEASE NOTES
  108. 1.0.0.3
  109. - Fix some gem trading tasks not being filtered correctly
  110. - Add check for gateway disconnected
  111. 1.0.0.2
  112. - Fix leadership tasks not creating assets correctly
  113. - Add option to save task lists per character (experimental)
  114. 1.0.0.1
  115. - Rewrite script using client.dataModel methods to massively improve reliability and performance (thanks Msc)
  116. - AD refining will now only attempt to refine if you are able to collect diamonds
  117. - Change task lists to use exact task names so no ambiguity exists (no longer requires excluderare option)
  118. - Asset resources are now trained as needed (only for required slots)
  119. 0.3.0.5
  120. - Fix resources not buying correctly in all cases
  121. - Fix pause button state saving correctly in firefox
  122. 0.3.0.4
  123. - Add page timeout reloading functions outside of main function (thanks Kreese and Frabtik)
  124. - Add check to ensure tasks are being started for the correct character
  125. - Alter next run resolve function to use delay parameter to allow for unique delay timers to be used in certain cases
  126. 0.3.0.3
  127. - Fix ingredient task selection to correctly iterate through all ingredient tasks
  128. - Alter character selection to pick only exact character name matches
  129. - Update leadership tasks
  130. 0.3.0.2
  131. - Exclude alchemy from rare task exclusions due to Aqua Regia (thanks Eversor)
  132. - Reduce GM_setValue calls to avoid tampermonkey failing to save settings (thanks miah)
  133. 0.3.0.1
  134. - Altered mutichar selector to be faster (thanks miah)
  135. - Updated rare tasks selector (thanks Traktor)
  136. - Add option to refine AD during character switching (thanks Eversor)
  137. - Added some level 20 gather tasks
  138. - Increased supply buying to 100 units
  139. 0.3.0.0
  140. - Added Multi-Character support
  141. - Added function to clear all saved settings for script
  142. - Remove disable sound functionality (now configurable in gateway)
  143. 0.2.0.1.8
  144. - Added pause button to allow easy on/off switching
  145. 0.2.0.1.7
  146. - Added option to enable/disable filling optional asset slots
  147. - Added batch potions tasks to be skipped in ingredient selection
  148. - Added timer to reload page if stuck loading for too long
  149. - Added option to disable page sounds
  150. - Updated license to by-nc-sa
  151. 0.2.0.1.6
  152. - Add configurable option for excluding rare tasks
  153. 0.2.0.1.5
  154. - Add ability to specify specific level for tasks and configure same named artificing resource tasks to request correct level of task
  155. - Remove purchase notification that never times out
  156. 0.2.0.1.4
  157. - Added functionality to purchase required resources from gateway shop
  158. 0.2.0.1.3
  159. - Add Artificing and Weaponsmithing to Robot
  160. (Artificing will not work properly yet as all three tiers of gather and craft tasks have the same task name)
  161. 0.2.0.1.2
  162. - Update reload process
  163. - Fix optional asset selector with gateway update
  164. 0.2.0.1.1
  165. - Simplify asset selection after they fixed bug in previous gateway update
  166. - Update level 20 leadership tasks
  167. - Update with changes in Mustex&#39;s script (version 15)
  168. * Added a secondary timer that will reload the gateway every few hours. This should help with disconnects from the server
  169. * Implemented tooltips for settings panel
  170. 0.1.9.1.15
  171. - Repeat task reordering for +2 armor
  172. 0.1.9.1.14
  173. - Fix selection of assets after gateway update
  174. - Skip intensive gather tasks added after gateway update
  175. 0.1.9.1.13
  176. - Change ordering of tasks and ingredient checks
  177. The purpose of this is to allow crafting of +4 armors if you have +2 ingredients in your inv but to not create them if you don&#39;t.
  178. Creating the ingredients for them is less efficient than crafting ingredients for pants but is more efficient if you already have the ingredients from earlier tasks.
  179. 0.1.9.1.12
  180. - Optimise crafting tasks for highest exp/min gains due to ingredient requirements
  181. 0.1.9.1.11
  182. - Add extra craft tasks for when residuum runs out
  183. 0.1.9.1.10
  184. - Only allow rare tasks to be selected for Leadership
  185. This avoids craft loops where higher quality rare crafts require ingredients with the same name
  186. 0.1.9.1.9
  187. - Alter craft tasks to favour armor to optimise inventory space
  188. 0.1.9.1.8
  189. - Fix script restart bug when no tasks found
  190. 0.1.9.1.7
  191. - Update search string for Potions (After the task names for elxiirs have been changed)
  192. - Remove logon error skips to avoid logons sometimes failing on first load (ensure logon details are correct!)
  193. 0.1.9.1.6
  194. - Update tasks for all professions
  195. - Update ingredient search lists for all professions
  196. 0.1.9.1.5
  197. - Fix regular expression used in potion ingredient search
  198. 0.1.9.1.4
  199. - Alter default timeouts (makes script a lot more stable and less prone to errors)
  200. - Remove unused variable
  201. - Add extra logging for task ingredient searches
  202. 0.1.9.1.3
  203. - Fix bug with required resource checks getting stuck on non craftable resources
  204. 0.1.9.1.2
  205. - Added method to check for required task ingredients and choose tasks to create them
  206. Method is currently hard coded to specify certain search strings for ingredient types
  207. Currently working for all Alchemy tasks
  208. There is a current problem that if you have the required potion ingredient but it is in your belt slots
  209. the task is uncraftable but the ingredients show as available and it will not craft a new one
  210. 0.1.9.1
  211. - Update with changes in Mustex&#39;s script (version 12)
  212. * Added tasks for Platesmithing, Leatherworking, Tailoring
  213. * Added detection for the gateway being down
  214. 0.1.8.3.8
  215. - Update asset selection to avoid using coloured assets in junk slots for leadership
  216. 0.1.8.3.7
  217. - Update leadership tasks table due to task reward/duration alterations
  218. 0.1.8.3.6
  219. - Add option to enable/disable automation process
  220. - Update alchemy tasks some more
  221. 0.1.8.3.5
  222. - Add ability to select from multiple tasks with same name (eg Alchemical Research)
  223. - Add craft options for alchemy potions (need to be manually switched since they use the same ingredients)
  224. 0.1.8.3.4
  225. - Add alchemy tasks up to level 20
  226. 0.1.8.3.3
  227. - Change task slot selection to be user configurable options in settings window
  228. - Add level 1 alchemical research
  229. 0.1.8.3.2
  230. - Added ability to specify how many tasks of each profession to train multiple professions at once
  231. - Updated mailsmithing level 0 tasks
  232. 0.1.8.3.1
  233. - Changed asset selection to only update Junk assets
  234. - Leadership asset selection for bronze tier picks lowest asset first
  235. - Modified Leadership tasks
  236. 0.1.8.3
  237. - Tweaked Leadership tasks grid
  238. - Added task grid for Alchemy (Partial)
  239. 0.1.8.2
  240. - onsave handlers for settings are now called before the settings values are saved
  241. - Added onsave handler for console to enable/disable using the window console
  242. 0.1.8.1
  243. - Added checking for errors (using the window title) and will navigate back to the main login page if autologin is enabled
  244. 0.1.8
  245. - Added popup for altering settings
  246. - Settings are saved to script cache
  247. - Added mailsmithing tasks to task grid
  248. 0.1.7
  249. - Added lower level leadership tasks to grid
  250. - Added hiring tasks to leadership task
  251. - Uses saved values to determine which profession type to level (Defaults to Leadership, currently no way to change it)
  252.  
  253. 0.1.5
  254. - Is now able to recover from missing assets
  255. - Uses a configurable grid to determine what the next task is to complete
  256.  
  257. 0.1.0
  258. - Is now able to select some hard coded leadership tasks
  259. - Can now collect from any completed slot
  260. */
  261.  
  262. // Make sure it&#39;s running on the main page, no frames
  263. if (window.self !== window.top) {
  264. throw &quot;&quot;;
  265. }
  266.  
  267. // Set global console variables
  268. var fouxConsole = {log:function(){},info:function(){},error:function(){},warn:function(){}};
  269. var console = unsafeWindow.console || fouxConsole;
  270.  
  271. // Page Reloading function
  272. // Every second the page is idle or loading is tracked
  273. var loading_reset = false; // Enables a periodic reload if this is toggled on by the Auto Reload check box on the settings panel
  274. var s_paused = false; // extend the paused setting to the Page Reloading function
  275.  
  276. (function() {
  277. var $ = unsafeWindow.$;
  278. var state_loading = 0; // If &quot;Page Loading&quot; takes longer than 30 seconds, reload page (maybe a javascript error)
  279. var state_loading_time = 30; // default of 30 seconds
  280.  
  281. var state_idle = 0; // If the page is idle for longer than 60 seconds, reload page (maybe a javascript error)
  282. var state_idle_time = 120; // default of 120 seconds
  283. 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
  284. var last_location = &quot;&quot;; // variable to track reference to page URL
  285. var reload_timer = setInterval(function() {
  286. if (!s_paused) {
  287. if (loading_reset) {
  288. var loading_date = new Date();
  289. var loading_sec = Number(loading_date.getSeconds());
  290. var loading_min = Number(loading_date.getMinutes());
  291. var loading_hour = Number(loading_date.getHours());
  292. if (reload_hours.indexOf(loading_hour) &gt;= 0 &amp;&amp; loading_min == 29 &amp;&amp; loading_sec &lt; 2) {
  293. console.log(&quot;Auto Reload&quot;);
  294. unsafeWindow.location.href = &quot;http://gateway.playneverwinter.com&quot;;
  295. return;
  296. }
  297. }
  298. // check for errors
  299. if ($(&quot;title&quot;).text().match(/Error/) || $(&quot;div.modal-content h3&quot;).text().match(/Disconnected/)) {
  300. console.log(&quot;Error detected - relogging&quot;);
  301. unsafeWindow.location.href = &quot;http://gateway.playneverwinter.com&quot;;
  302. return;
  303. }
  304.  
  305. if ($(&quot;div.loading-image:visible&quot;).length) {
  306. last_location = location.href;
  307. state_idle = 0;
  308. if (state_loading &gt;= state_loading_time) {
  309. console.log(&quot;Page Loading too long&quot;);
  310. state_loading = 0;
  311. location.reload();
  312. }
  313. else {
  314. state_loading++;
  315. console.log(&quot;Page Loading ...&quot;, state_loading + &quot;s&quot;);
  316. }
  317. }
  318. // TODO: Add check for Gateway disconnected
  319. //&lt;div class=&quot;modal-content&quot; id=&quot;modal_content&quot;&gt;&lt;h3&gt;Disconnected from Gateway&lt;/h3&gt;&lt;p&gt;You have been disconnected.&lt;/p&gt;&lt;button type=&quot;button&quot; class=&quot;modal-button&quot; onclick=&quot;window.location.reload(true);&quot;&gt;Close&lt;/button&gt;
  320.  
  321. /* Can&#39;t use idle check with dataModel methods
  322. else if (location.href == last_location) {
  323. state_loading = 0;
  324. if (state_idle &gt;= state_idle_time) {
  325. console.log(&quot;Page Idle too long&quot;);
  326. state_idle = 0;
  327. unsafeWindow.location.href = &quot;http://gateway.playneverwinter.com&quot;;
  328. }
  329. else {
  330. state_idle++;
  331. // comment out to avoid console spam
  332. //console.log(&quot;Page Idle ...&quot;, state_idle + &quot;s&quot;);
  333. }
  334. }
  335. */
  336. else {
  337. last_location = location.href;
  338. state_loading = 0;
  339. state_idle = 0;
  340. }
  341. }
  342. },1000);
  343. })();
  344.  
  345. (function() {
  346.  
  347. /**
  348. * Add a string of CSS to the main page
  349. *
  350. * @param {String} cssString The CSS to add to the main page
  351. */
  352. function AddCss(cssString) {
  353. var head = document.getElementsByTagName(&#39;head&#39;)[0];
  354. if (!head)
  355. return;
  356. var newCss = document.createElement(&#39;style&#39;);
  357. newCss.type = &quot;text/css&quot;;
  358. newCss.innerHTML = cssString;
  359. head.appendChild(newCss);
  360. }
  361. function countLeadingSpaces(str) {
  362. return str.match(/^(\s*)/)[1].length;
  363. }
  364.  
  365. var image_pause = &quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAY&quot; +
  366. &quot;AAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2&quot; +
  367. &quot;ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG&quot; +
  368. &quot;8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNR&quot; +
  369. &quot;NYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMBy&quot; +
  370. &quot;H/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAI&quot; +
  371. &quot;Cd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOE&quot; +
  372. &quot;AuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dX&quot; +
  373. &quot;Lh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJ&quot; +
  374. &quot;iYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PE&quot; +
  375. &quot;WhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJh&quot; +
  376. &quot;GLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+&quot; +
  377. &quot;AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlT&quot; +
  378. &quot;Ksz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKm&quot; +
  379. &quot;Av1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIB&quot; +
  380. &quot;BKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3&quot; +
  381. &quot;GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7E&quot; +
  382. &quot;irAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJy&quot; +
  383. &quot;KTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksq&quot; +
  384. &quot;Zs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZl&quot; +
  385. &quot;mDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5&quot; +
  386. &quot;Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVV&quot; +
  387. &quot;gqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU&quot; +
  388. &quot;2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2&quot; +
  389. &quot;KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVx&quot; +
  390. &quot;rqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri&quot; +
  391. &quot;6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxb&quot; +
  392. &quot;zwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppS&quot; +
  393. &quot;TbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo&quot; +
  394. &quot;5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8&quot; +
  395. &quot;Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLK&quot; +
  396. &quot;cRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p&quot; +
  397. &quot;7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc&quot; +
  398. &quot;+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+H&quot; +
  399. &quot;p8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw&quot; +
  400. &quot;34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8Yu&quot; +
  401. &quot;ZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIh&quot; +
  402. &quot;OOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hC&quot; +
  403. &quot;epkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa&quot; +
  404. &quot;7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZL&quot; +
  405. &quot;Vy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wt&quot; +
  406. &quot;VCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZt&quot; +
  407. &quot;Jm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkV&quot; +
  408. &quot;PRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvtt&quot; +
  409. &quot;Xa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fc&quot; +
  410. &quot;J3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5Sv&quot; +
  411. &quot;NUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2&quot; +
  412. &quot;+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3d&quot; +
  413. &quot;vfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/c&quot; +
  414. &quot;GhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0Z&quot; +
  415. &quot;jRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0&quot; +
  416. &quot;Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgA&quot; +
  417. &quot;ABdvkl/FRgAAAZ9JREFUeNqU0z+LE2EQBvDfvsuZ3IkoFzSJiuCfeAkWFmJnkz5wjVjlK4i&quot; +
  418. &quot;tnR9BrP0E4uewE/bQwKko2CjR88+BuSMhycbm3RjjNk41z7szz8w8O5Motzqu4iwW+Ir3+L&quot; +
  419. &quot;YemKzh07iLGziJPL4HjPAKz3FcRnAJD3AKXzBb+b7ABhr4jscYQhoDzuBhrDQsIU9iNz9j7&quot; +
  420. &quot;G28wLQg6OMyhrVaLd3Z2dFoNBwdHdna2tJut9XrdZPJJIzH4xHOo4rXAU3cjJXTfr8vyzJZ&quot; +
  421. &quot;lul2u3q9nizL7O3t2d3dLbr+jFvYDuiggjlMp9Nl3/P53Gw2W+IVfxZFbgecw7SYOc/zZUK&quot; +
  422. &quot;e5//gNU22QxRu4f9tgSTE5ThRkIQQ/kifJJIk+QuvJKc4DHizOsLm5uYyoVKpqFarS7zipx&quot; +
  423. &quot;jjXUF5P4o5bDabodVqgcFgIE1TnU4H7O/vOzg4yHEBL/G0IGjgUVzXX1GXMsvjIm3E+B/FI&quot; +
  424. &quot;o3wEXfi7zkuRFoVLBYKeIJPZcd0EfdwLc5ZaLMR/bd4Fm+l9BoLu44rsd0FDuM5f1gP/D0A&quot; +
  425. &quot;BNp57TyT3+MAAAAASUVORK5CYII=&quot;;
  426. var image_play = &quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYA&quot; +
  427. &quot;AAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2Z&quot; +
  428. &quot;pbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8&quot; +
  429. &quot;igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRN&quot; +
  430. &quot;YAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH&quot; +
  431. &quot;/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAIC&quot; +
  432. &quot;d+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEA&quot; +
  433. &quot;uyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXL&quot; +
  434. &quot;h4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJi&quot; +
  435. &quot;YuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEW&quot; +
  436. &quot;hkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhG&quot; +
  437. &quot;Lc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+A&quot; +
  438. &quot;XuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTK&quot; +
  439. &quot;sz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmA&quot; +
  440. &quot;v1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBB&quot; +
  441. &quot;KLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3G&quot; +
  442. &quot;oRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7Ei&quot; +
  443. &quot;rAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyK&quot; +
  444. &quot;TqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZ&quot; +
  445. &quot;s0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlm&quot; +
  446. &quot;DJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5O&quot; +
  447. &quot;l9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVg&quot; +
  448. &quot;qtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2&quot; +
  449. &quot;epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2K&quot; +
  450. &quot;ruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxr&quot; +
  451. &quot;qpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6&quot; +
  452. &quot;qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbz&quot; +
  453. &quot;wdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppST&quot; +
  454. &quot;bmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5&quot; +
  455. &quot;WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8W&quot; +
  456. &quot;uw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKc&quot; +
  457. &quot;RpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7&quot; +
  458. &quot;ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+&quot; +
  459. &quot;9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp&quot; +
  460. &quot;8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw3&quot; +
  461. &quot;4MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZ&quot; +
  462. &quot;lnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhO&quot; +
  463. &quot;OJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCe&quot; +
  464. &quot;pkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7&quot; +
  465. &quot;OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLV&quot; +
  466. &quot;y0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtV&quot; +
  467. &quot;CuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJ&quot; +
  468. &quot;m6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVP&quot; +
  469. &quot;RU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttX&quot; +
  470. &quot;a1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ&quot; +
  471. &quot;3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvN&quot; +
  472. &quot;UyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+&quot; +
  473. &quot;UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dv&quot; +
  474. &quot;fN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cG&quot; +
  475. &quot;hYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0Zj&quot; +
  476. &quot;RoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0K&quot; +
  477. &quot;f7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAA&quot; +
  478. &quot;Bdvkl/FRgAAAYZJREFUeNqk08+KklEYBvDf9+lIEYZDZQ0OIrQZahEuBoLuQqiWIl5BG2k5&quot; +
  479. &quot;W5dzA15AF9EFJOiiRRNkSIw4lTAfCQNmzrToOIkc2nRW5z3n/fe8z/Mm4mcfD3EfCb5hhC/&quot; +
  480. &quot;bjsmWXcJLPMJNLMP7DhY4wRt8jyWo4hVu4Qyrjf8rpKGjJY7xCXLB4TZeB/ssBCaRTn+ggG&quot; +
  481. &quot;d4h4s0fDRQxAy5arWq0+nEZpMiQx7P1w938SRUzkGWZbrdrsFgoFarxZJ8xWPspzgIuH+tP&quot; +
  482. &quot;ZbLpfl8rl6vG41GWq3WdpLLAOUgxb0QfI05Sf7CT9NUr9fT7/dVKpXNmSxRSv3nSQOn+UDV&quot; +
  483. &quot;H86urq9Wq5V2u+3w8NBkMrFB6w7O80EcFyHJCgqFgmKxaDgcajQaxuNxrPBPnORC8IOgvgx&quot; +
  484. &quot;puVw2nU41m01ZlsUGuIf3eJtsCOko0DjbEFgsuBQYOMJs7bjABzzFndDVZUTKe8E+xmlsmX&quot; +
  485. &quot;bxIsC5sZ5J6GiBj/9aptg67wafc3yOrfPvAQDwi2sWVdJBsgAAAABJRU5ErkJggg==&quot;;
  486. var image_prefs = &quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQC&quot; +
  487. &quot;AMAAAAoLQ9TAAAAllBMVEUAGQASEhIfHx8fJy8pKSk2NjZBQUFJR0ZQUE9RUVFSUlJNX3No&quot; +
  488. &quot;aGhsaWdramlycG1meY98fHx+fn5wgpV0iqKKh4R4jaR9jJx8kad9kad/mbONmaWEnrmEnrq&quot; +
  489. &quot;koZy3t7fIx8bKyMHT0c3S0dDU09DV1NPP1t3W1dXY2Njb2tfe29bf3tzj4uHr6+js6+r39/&quot; +
  490. &quot;f5+PgAAABrL3yvAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTA&quot; +
  491. &quot;QCanBgAAAAHdElNRQfWBRoFKh31UQ8DAAAAgUlEQVQY022OxxLCMAwFRSc4BEIPJZQQ08v+&quot; +
  492. &quot;/8+RsTExDDpIe3ijfSJ/hx9g62Dt4GaAI+8YT0t27+BxxvvE/no5pYT10lGFrE34Ja40W3g&quot; +
  493. &quot;1oMGmW7YZ6hnCYexKTPVkXivuvWe1Cz1aKqPNI3N0slI2TNYZiARJX30qERc7wBPKC4WRDz&quot; +
  494. &quot;WdWHfmAAAAAElFTkSuQmCC&quot;;
  495. var image_close = &quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQC&quot; +
  496. &quot;AQAAAC1+jfqAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfW&quot; +
  497. &quot;BRkTNhxuPxLkAAAAHXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBUaGUgR0lNUO9kJW4AAAE&quot; +
  498. &quot;KSURBVCjPhdGxSgNBFAXQMzpgYWwsLEQUDBJBQgqFIChZEPR7/DA/QCGQTgQtJE1ENoWohY&quot; +
  499. &quot;UgbGKQyFjErNv52nObe19wqGWg7z0l5YVgVdOu+wUt507tqIVQ4Zodp861ooELe15M5KFI6&quot; +
  500. &quot;Zfr9u25MIj6Jl4cmSIPBWrq2o5cufO4aOJDYSozNTa2pK4t03PtwUdMKRRykAmW0dTRcyNX&quot; +
  501. &quot;pBQpI8GJDTR050zkNzK0bMMZLvUNZ8yCfy6Wvbc1NVyi4dloXjqWvds6uvp41pFmpVOKJWd&quot; +
  502. &quot;6bgwxkmTMIotWKpwrfBkZl7uMonUHf5wSlV2+fUZrjnXdzrmyy7djD8GWTW9e51z557o1Tz&quot; +
  503. &quot;85FH/WkOkaHQAAAABJRU5ErkJggg==&quot;;
  504.  
  505.  
  506. // Setup global closure variables
  507. var $ = unsafeWindow.jQuery;
  508. var timerHandle = 0;
  509. var dfdNextRun = $.Deferred();
  510. var charcurrent = 0; // current character counter
  511. var settingwipe = false; // Use to wipe stored settings
  512. var delay = {
  513. SHORT : 1000,
  514. MEDIUM : 5000,
  515. LONG : 30000,
  516. MINS : 300000,
  517. DEFAULT : 10000, // default delay
  518. TIMEOUT : 60000, // delay for cycle processing timeout
  519. };
  520.  
  521. /*
  522. * Tasklist can be modified to configure the training you want to perform.
  523. * The configurable options window sets how many profession slots you want to use for each profession.
  524. * The level array below for each professions specifies the tasks you want to learn at each crafting level.
  525. * Each craft slot will pick the first task that meets requirements.
  526. * See http://pastebin.com/VaGntEha for Task Name Map.
  527. * Some names above do not match, use below code to check:
  528. * var tasks = client.dataModel.model.craftinglist[&#39;craft_&#39; + profname].entries.filter(function(entry) { return entry.def &amp;&amp; entry.def.displayname == taskname; }); tasks[0].def.name;
  529. */
  530. var tasklist;
  531. var defaultTasklist = [
  532. {
  533. taskName:&quot;Leadership&quot;,
  534. level: {
  535. 0:[&quot;Leadership_Tier0_Intro_1&quot;],
  536. 1:[&quot;Leadership_Tier0_Intro_5&quot;, &quot;Leadership_Tier0_Intro_4&quot;,&quot;Leadership_Tier0_Intro_3&quot;, &quot;Leadership_Tier0_Intro_2&quot;],
  537. 2:[&quot;Leadership_Tier1_2_Guardduty&quot;],
  538. 3:[&quot;Leadership_Tier1_2_Guardduty&quot;],
  539. 4:[&quot;Leadership_Tier1_4_Protect&quot;],
  540. 5:[&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier1_5_Explore&quot;],
  541. 6:[&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier1_5_Explore&quot;],
  542. 7:[&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier1_5_Explore&quot;],
  543. 8:[&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier1_5_Explore&quot;],
  544. 9:[&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier1_5_Explore&quot;],
  545. 10:[&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  546. 11:[&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  547. 12:[&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  548. // Current model
  549. 13:[&quot;Leadership_Tier3_13_Patrol&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  550. 14:[&quot;Leadership_Tier3_13_Patrol&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  551. 15:[&quot;Leadership_Tier3_13_Patrol&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier1_4_Protect&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  552. 16:[&quot;Leadership_Tier3_13_Patrol&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier3_16_Fight&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  553. 17:[&quot;Leadership_Tier3_13_Patrol&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier3_17_Deliver&quot;,&quot;Leadership_Tier3_16_Fight&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_12_Taxes&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  554. 18:[&quot;Leadership_Tier3_13_Patrol&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier3_17_Deliver&quot;,&quot;Leadership_Tier3_16_Fight&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_12_Taxes&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  555. 19:[&quot;Leadership_Tier3_13_Patrol&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier3_17_Deliver&quot;,&quot;Leadership_Tier3_16_Fight&quot;,&quot;Leadership_Tier1_5_Explore&quot;,&quot;Leadership_Tier2_12_Taxes&quot;,&quot;Leadership_Tier2_10_Battle&quot;],
  556. 20:[&quot;Leadership_Tier3_20r_Master2&quot;,&quot;Leadership_Tier3_20r_Master1&quot;,&quot;Leadership_Tier3_20r_Master3&quot;,&quot;Leadership_Tier3_20_Destroy&quot;,&quot;Leadership_Tier3_17_Deliver&quot;,&quot;Leadership_Tier3_13r_Protectdiamonds&quot;,&quot;Leadership_Tier2_12_Taxes&quot;,&quot;Leadership_Tier3_16_Fight&quot;,&quot;Leadership_Tier3_13_Patrol&quot;,&quot;Leadership_Tier2_9_Chart&quot;,&quot;Leadership_Tier1_5_Explore&quot;],
  557. //19:[&quot;Patrol the Mines&quot;,&quot;Chart Region&quot;,&quot;Deliver Metals&quot;,&quot;Fight Off Spellplagued&quot;,&quot;Explore Local Area&quot;,&quot;Collect Taxes&quot;,&quot;Train a Guard&quot;,&quot;Battle Undead&quot;,&quot;Hire a Mercenary&quot;],
  558. //20:[&quot;Assault Enemy Stronghold&quot;,&quot;Follow Map to an Unknown Location&quot;,&quot;Recover Large Mineral Claim&quot;,&quot;Destroy Enemy Camp&quot;,&quot;Deliver Metals&quot;,&quot;Protect Diamond Shipment&quot;,&quot;Collect Taxes&quot;,&quot;Fight Off Spellplagued&quot;,&quot;Patrol the Mines&quot;,&quot;Chart Region&quot;,&quot;Explore Local Area&quot;],
  559. // Training Mode
  560. /*
  561. 13:[&quot;Leadership_Tier3_13_Recruit&quot;,&quot;Leadership_Tier2_7_Recruit&quot;,&quot;Leadership_Tier1_2_Recruit&quot;],
  562. 14:[&quot;Leadership_Tier3_13_Recruit&quot;,&quot;Leadership_Tier2_7_Recruit&quot;,&quot;Leadership_Tier1_2_Recruit&quot;],
  563. 15:[&quot;Leadership_Tier3_13_Recruit&quot;,&quot;Leadership_Tier2_7_Recruit&quot;,&quot;Leadership_Tier1_2_Recruit&quot;],
  564. 16:[&quot;Leadership_Tier3_13_Recruit&quot;,&quot;Leadership_Tier2_7_Recruit&quot;,&quot;Leadership_Tier1_2_Recruit&quot;],
  565. 17:[&quot;Leadership_Tier3_13_Recruit&quot;,&quot;Leadership_Tier2_7_Recruit&quot;,&quot;Leadership_Tier1_2_Recruit&quot;],
  566. */
  567. },
  568. },
  569. {
  570. // Mailsmithing
  571. taskName:&quot;Armorsmithing_Med&quot;,
  572. level: {
  573. 0:[&quot;Med_Armorsmithing_Tier0_Intro&quot;],
  574. 1:[&quot;Med_Armorsmithing_Tier1_Chain_Boots_1&quot;,&quot;Med_Armorsmithing_Tier1_Chain_Shirt_1&quot;],
  575. 2:[&quot;Med_Armorsmithing_Tier1_Chain_Armor_1&quot;,&quot;Med_Armorsmithing_Tier1_Chain_Pants_1&quot;],
  576. 3:[&quot;Med_Armorsmithing_Tier1_Chain_Armor_1&quot;,&quot;Med_Armorsmithing_Tier1_Chain_Boots_Set_1&quot;],
  577. 4:[&quot;Med_Armorsmithing_Tier1_Chain_Armor_1&quot;,&quot;Med_Armorsmithing_Tier1_Chain_Boots_Set_1&quot;],
  578. 5:[&quot;Med_Armorsmithing_Tier1_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier1_Chain_Boots_Set_1&quot;],
  579. 6:[&quot;Med_Armorsmithing_Tier1_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier1_Chain_Boots_Set_1&quot;],
  580. 7:[&quot;Med_Armorsmithing_Tier1_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Boots_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Shirt&quot;],
  581. 8:[&quot;Med_Armorsmithing_Tier2_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Boots_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Shirt&quot;],
  582. 9:[&quot;Med_Armorsmithing_Tier2_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Boots_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Shirt&quot;],
  583. 10:[&quot;Med_Armorsmithing_Tier2_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Boots_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Shirt_2&quot;],
  584. 11:[&quot;Med_Armorsmithing_Tier2_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_2&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Boots_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Shirt_2&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_1&quot;],
  585. 12:[&quot;Med_Armorsmithing_Tier2_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_2&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Boots_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Shirt_2&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_1&quot;],
  586. 13:[&quot;Med_Armorsmithing_Tier2_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_2&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Boots_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Shirt_2&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_1&quot;],
  587. 14:[&quot;Med_Armorsmithing_Tier2_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier2_Chain_Pants_2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Shirt&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Boots_Set_1&quot;],
  588. 15:[&quot;Med_Armorsmithing_Tier3_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Shirt2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Boots_Set_1&quot;],
  589. 16:[&quot;Med_Armorsmithing_Tier3_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Shirt2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Helm_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants&quot;],
  590. 17:[&quot;Med_Armorsmithing_Tier3_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Shirt2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Helm_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants&quot;],
  591. 18:[&quot;Med_Armorsmithing_Tier3_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Shirt2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Helm_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants&quot;],
  592. 19:[&quot;Med_Armorsmithing_Tier3_Chain_Armor_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Shirt2&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Helm_Set_1&quot;,&quot;Med_Armorsmithing_Tier3_Chain_Pants&quot;],
  593. 20:[&quot;Med_Armorsmithing_Tier2_Refine_Basic&quot;],
  594. //19:[&quot;Chain Armor +4&quot;,&quot;Fancy Chain Pants&quot;,&quot;Fancy Chain Shirt&quot;,&quot;Chain Helm +4&quot;,&quot;Ornate Chain Pants&quot;,&quot;Upgrade Blacksmith&quot;,&quot;Upgrade Prospector&quot;,&quot;Hire an additional Prospector&quot;],
  595. //20:[&quot;Forge Steel Rings and Scales&quot;],
  596. },
  597. },
  598. {
  599. // Platesmithing
  600. taskName:&quot;Armorsmithing_Heavy&quot;,
  601. level: {
  602. 0:[&quot;Hvy_Armorsmithing_Tier0_Intro&quot;],
  603. 1:[&quot;Hvy_Armorsmithing_Tier1_Plate_Boots_1&quot;,&quot;Hvy_Armorsmithing_Tier1_Plate_Shirt_1&quot;,&quot;Hvy_Armorsmithing_Tier1_Shield_1&quot;],
  604. 2:[&quot;Hvy_Armorsmithing_Tier1_Plate_Armor_1&quot;,&quot;Hvy_Armorsmithing_Tier1_Plate_Pants_1&quot;],
  605. 3:[&quot;Hvy_Armorsmithing_Tier1_Plate_Armor_1&quot;,&quot;Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1&quot;],
  606. 4:[&quot;Hvy_Armorsmithing_Tier1_Plate_Armor_1&quot;,&quot;Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1&quot;],
  607. 5:[&quot;Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1&quot;],
  608. 6:[&quot;Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1&quot;],
  609. 7:[&quot;Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Shirt&quot;,&quot;Hvy_Armorsmithing_Tier2_Shield_Set_1&quot;],
  610. 8:[&quot;Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Shirt&quot;],
  611. 9:[&quot;Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Shirt&quot;],
  612. 10:[&quot;Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Shirt_2&quot;],
  613. 11:[&quot;Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_2&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Shirt_2&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_1&quot;],
  614. 12:[&quot;Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_2&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Shirt_2&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_1&quot;],
  615. 13:[&quot;Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_2&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Shirt_2&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_1&quot;],
  616. 14:[&quot;Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier2_Plate_Pants_2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Shirt&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Boots_Set_1&quot;],
  617. 15:[&quot;Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Shirt2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Boots_Set_1&quot;],
  618. 16:[&quot;Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Shirt2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants&quot;],
  619. 17:[&quot;Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Shirt2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants&quot;],
  620. 18:[&quot;Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Shirt2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants&quot;],
  621. 19:[&quot;Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Shirt2&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1&quot;,&quot;Hvy_Armorsmithing_Tier3_Plate_Pants&quot;],
  622. 20:[&quot;Hvy_Armorsmithing_Tier2_Refine_Basic&quot;],
  623. //19:[&quot;Plate Armor +4&quot;,&quot;Fancy Plate Pants&quot;,&quot;Fancy Plate Shirt&quot;,&quot;Plate Helm +4&quot;,&quot;Ornate Plate Pants&quot;,&quot;Upgrade Armorer&quot;,&quot;Upgrade Miner&quot;,&quot;Hire an additional Miner&quot;],
  624. //20:[&quot;Forge Steel Plates&quot;],
  625. },
  626. },
  627. {
  628. taskName:&quot;Leatherworking&quot;,
  629. level: {
  630. 0:[&quot;Leatherworking_Tier0_Intro_1&quot;],
  631. 1:[&quot;Leatherworking_Tier1_Leather_Boots_1&quot;,&quot;Leatherworking_Tier1_Leather_Shirt_1&quot;],
  632. 2:[&quot;Leatherworking_Tier1_Leather_Armor_1&quot;,&quot;Leatherworking_Tier1_Leather_Pants_1&quot;],
  633. 3:[&quot;Leatherworking_Tier1_Leather_Armor_1&quot;,&quot;Leatherworking_Tier1_Leather_Boots_Set_1&quot;],
  634. 4:[&quot;Leatherworking_Tier1_Leather_Armor_1&quot;,&quot;Leatherworking_Tier1_Leather_Boots_Set_1&quot;],
  635. 5:[&quot;Leatherworking_Tier1_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier1_Leather_Boots_Set_1&quot;],
  636. 6:[&quot;Leatherworking_Tier1_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier1_Leather_Boots_Set_1&quot;],
  637. 7:[&quot;Leatherworking_Tier1_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Boots_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Shirt&quot;],
  638. 8:[&quot;Leatherworking_Tier2_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Pants_1&quot;,&quot;Leatherworking_Tier2_Leather_Boots_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Shirt&quot;],
  639. 9:[&quot;Leatherworking_Tier2_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Pants_1&quot;,&quot;Leatherworking_Tier2_Leather_Boots_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Shirt&quot;],
  640. 10:[&quot;Leatherworking_Tier2_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Pants_1&quot;,&quot;Leatherworking_Tier2_Leather_Boots_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Shirt_2&quot;],
  641. 11:[&quot;Leatherworking_Tier2_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Pants_2&quot;,&quot;Leatherworking_Tier2_Leather_Boots_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Shirt_2&quot;,&quot;Leatherworking_Tier2_Leather_Pants_1&quot;],
  642. 12:[&quot;Leatherworking_Tier2_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Pants_2&quot;,&quot;Leatherworking_Tier2_Leather_Boots_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Shirt_2&quot;,&quot;Leatherworking_Tier2_Leather_Pants_1&quot;],
  643. 13:[&quot;Leatherworking_Tier2_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Pants_2&quot;,&quot;Leatherworking_Tier2_Leather_Boots_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Shirt_2&quot;,&quot;Leatherworking_Tier2_Leather_Pants_1&quot;],
  644. 14:[&quot;Leatherworking_Tier2_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier2_Leather_Pants_2&quot;,&quot;Ornate Leatherworking_Tier1_Leather_Shirt_1&quot;,&quot;Leatherworking_Tier3_Leather_Boots_Set_1&quot;],
  645. 15:[&quot;Leatherworking_Tier3_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants&quot;,&quot;Leatherworking_Tier3_Leather_Shirt2&quot;,&quot;Leatherworking_Tier3_Leather_Boots_Set_1&quot;],
  646. 16:[&quot;Leatherworking_Tier3_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants2&quot;,&quot;Leatherworking_Tier3_Leather_Shirt2&quot;,&quot;Leatherworking_Tier3_Leather_Helm_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants&quot;],
  647. 17:[&quot;Leatherworking_Tier3_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants2&quot;,&quot;Leatherworking_Tier3_Leather_Shirt2&quot;,&quot;Leatherworking_Tier3_Leather_Helm_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants&quot;],
  648. 18:[&quot;Leatherworking_Tier3_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants2&quot;,&quot;Leatherworking_Tier3_Leather_Shirt2&quot;,&quot;Leatherworking_Tier3_Leather_Helm_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants&quot;],
  649. 19:[&quot;Leatherworking_Tier3_Leather_Armor_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants2&quot;,&quot;Leatherworking_Tier3_Leather_Shirt2&quot;,&quot;Leatherworking_Tier3_Leather_Helm_Set_1&quot;,&quot;Leatherworking_Tier3_Leather_Pants&quot;],
  650. 20:[&quot;Leatherworking_Tier2_Refine_Basic&quot;],
  651. //19:[&quot;Leather Armor +4&quot;,&quot;Fancy Leather Pants&quot;,&quot;Fancy Leather Shirt&quot;,&quot;Leather Helm +4&quot;,&quot;Ornate Leather Pants&quot;,&quot;Upgrade Tanner&quot;,&quot;Upgrade Skinner&quot;,&quot;Hire an additional Skinner&quot;],
  652. //20:[&quot;Cure Tough Pelts&quot;],
  653. },
  654. },
  655. {
  656. taskName:&quot;Tailoring&quot;,
  657. level: {
  658. 0:[&quot;Tailoring_Tier0_Intro&quot;],
  659. 1:[&quot;Tailoring_Tier1_Cloth_Boots_1&quot;,&quot;Tailoring_Tier1_Cloth_Shirt_1&quot;],
  660. 2:[&quot;Tailoring_Tier1_Cloth_Armor_1&quot;,&quot;Tailoring_Tier1_Cloth_Pants_1&quot;],
  661. 3:[&quot;Tailoring_Tier1_Cloth_Armor_1&quot;,&quot;Tailoring_Tier1_Cloth_Boots_Set_1&quot;],
  662. 4:[&quot;Tailoring_Tier1_Cloth_Armor_1&quot;,&quot;Tailoring_Tier1_Cloth_Boots_Set_1&quot;],
  663. 5:[&quot;Tailoring_Tier1_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier1_Cloth_Boots_Set_1&quot;],
  664. 6:[&quot;Tailoring_Tier1_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier1_Cloth_Boots_Set_1&quot;],
  665. 7:[&quot;Tailoring_Tier1_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Boots_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Shirt&quot;],
  666. 8:[&quot;Tailoring_Tier2_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Pants_1&quot;,&quot;Tailoring_Tier2_Cloth_Boots_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Shirt&quot;],
  667. 9:[&quot;Tailoring_Tier2_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Pants_1&quot;,&quot;Tailoring_Tier2_Cloth_Boots_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Shirt&quot;],
  668. 10:[&quot;Tailoring_Tier2_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Pants_1&quot;,&quot;Tailoring_Tier2_Cloth_Boots_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Shirt_2&quot;],
  669. 11:[&quot;Tailoring_Tier2_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Pants_2&quot;,&quot;Tailoring_Tier2_Cloth_Boots_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Shirt_2&quot;,&quot;Tailoring_Tier2_Cloth_Pants_1&quot;],
  670. 12:[&quot;Tailoring_Tier2_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Pants_2&quot;,&quot;Tailoring_Tier2_Cloth_Boots_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Shirt_2&quot;,&quot;Tailoring_Tier2_Cloth_Pants_1&quot;],
  671. 13:[&quot;Tailoring_Tier2_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Pants_2&quot;,&quot;Tailoring_Tier2_Cloth_Boots_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Shirt_2&quot;,&quot;Tailoring_Tier2_Cloth_Pants_1&quot;],
  672. 14:[&quot;Tailoring_Tier2_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier2_Cloth_Pants_2&quot;, &quot;Tailoring_Tier3_Cloth_Shirt&quot;,&quot;Tailoring_Tier3_Cloth_Boots_Set_1&quot;],
  673. 15:[&quot;Tailoring_Tier3_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants&quot;,&quot;Tailoring_Tier3_Cloth_Shirt2&quot;,&quot;Tailoring_Tier3_Cloth_Boots_Set_1&quot;],
  674. 16:[&quot;Tailoring_Tier3_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants2&quot;,&quot;Tailoring_Tier3_Cloth_Shirt2&quot;,&quot;Tailoring_Tier3_Cloth_Helm_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants&quot;],
  675. 17:[&quot;Tailoring_Tier3_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants2&quot;,&quot;Tailoring_Tier3_Cloth_Shirt2&quot;,&quot;Tailoring_Tier3_Cloth_Helm_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants&quot;],
  676. 18:[&quot;Tailoring_Tier3_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants2&quot;,&quot;Tailoring_Tier3_Cloth_Shirt2&quot;,&quot;Tailoring_Tier3_Cloth_Helm_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants&quot;],
  677. 19:[&quot;Tailoring_Tier3_Cloth_Armor_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants2&quot;,&quot;Tailoring_Tier3_Cloth_Shirt2&quot;,&quot;Tailoring_Tier3_Cloth_Helm_Set_1&quot;,&quot;Tailoring_Tier3_Cloth_Pants&quot;],
  678. 20:[&quot;Tailoring_Tier2_Refine_Basic&quot;],
  679. //19:[&quot;Cloth Robes +4&quot;,&quot;Fancy Cloth Pants&quot;,&quot;Fancy Cloth Shirt&quot;,&quot;Cloth Cap +4&quot;,&quot;Ornate Cloth Pants&quot;,&quot;Upgrade Outfitter&quot;,&quot;Upgrade Weaver&quot;,&quot;Hire an additional Weaver&quot;],
  680. //20:[&quot;Weave Cotton Cloth&quot;],
  681. },
  682. },
  683. {
  684. taskName:&quot;Artificing&quot;,
  685. level: {
  686. 0:[&quot;Artificing_Tier0_Intro_1&quot;],
  687. 1:[&quot;Artificing_Tier1_Symbol_Virtuous_1&quot;],
  688. 2:[&quot;Artificing_Tier1_Icon_Virtuous_1&quot;],
  689. 3:[&quot;Artificing_Tier1_Icon_Virtuous_1&quot;],
  690. 4:[&quot;Artificing_Tier1_Icon_Virtuous_2&quot;],
  691. 5:[&quot;Artificing_Tier1_Icon_Virtuous_2&quot;],
  692. 6:[&quot;Artificing_Tier1_Icon_Virtuous_2&quot;],
  693. 7:[&quot;Artificing_Tier1_Icon_Virtuous_2&quot;],
  694. 8:[&quot;Artificing_Tier2_Icon_Virtuous_3&quot;],
  695. 9:[&quot;Artificing_Tier2_Icon_Virtuous_3&quot;],
  696. 10:[&quot;Artificing_Tier2_Icon_Virtuous_3&quot;],
  697. 11:[&quot;Artificing_Tier2_Icon_Virtuous_3&quot;],
  698. 12:[&quot;Artificing_Tier2_Icon_Virtuous_3&quot;],
  699. 13:[&quot;Artificing_Tier2_Icon_Virtuous_3&quot;],
  700. 14:[&quot;Artificing_Tier3_Icon_Virtuous_4&quot;],
  701. 15:[&quot;Artificing_Tier3_Icon_Virtuous_4&quot;],
  702. 16:[&quot;Artificing_Tier3_Icon_Virtuous_4&quot;],
  703. 17:[&quot;Artificing_Tier3_Icon_Virtuous_5&quot;],
  704. 18:[&quot;Artificing_Tier3_Icon_Virtuous_5&quot;],
  705. 19:[&quot;Artificing_Tier3_Icon_Virtuous_5&quot;],
  706. 20:[&quot;Artificing_Tier2_Refine_Basic&quot;],
  707. //19:[&quot;Virtuous Icon +5&quot;,&quot;Upgrade Engraver&quot;,&quot;Upgrade Carver&quot;,&quot;Hire an additional Carver&quot;],
  708. //20:[&quot;7:Craft Ornamental metal and Carved Wood&quot;],
  709. },
  710. },
  711. {
  712. taskName:&quot;Weaponsmithing&quot;,
  713. level: {
  714. 0:[&quot;Weaponsmithing_Tier0_Intro&quot;],
  715. 1:[&quot;Weaponsmithing_Tier1_Dagger_1&quot;],
  716. 2:[&quot;Weaponsmithing_Tier1_Dagger_1&quot;],
  717. 3:[&quot;Weaponsmithing_Tier1_Dagger_1&quot;],
  718. 4:[&quot;Weaponsmithing_Tier1_Dagger_2&quot;],
  719. 5:[&quot;Weaponsmithing_Tier1_Dagger_2&quot;],
  720. 6:[&quot;Weaponsmithing_Tier1_Dagger_2&quot;],
  721. 7:[&quot;Weaponsmithing_Tier2_Dagger_3&quot;],
  722. 8:[&quot;Weaponsmithing_Tier2_Dagger_3&quot;],
  723. 9:[&quot;Weaponsmithing_Tier2_Dagger_3&quot;],
  724. 10:[&quot;Weaponsmithing_Tier2_Dagger_3&quot;],
  725. 11:[&quot;Weaponsmithing_Tier2_Dagger_3&quot;],
  726. 12:[&quot;Weaponsmithing_Tier2_Dagger_3&quot;],
  727. 13:[&quot;Weaponsmithing_Tier2_Dagger_3&quot;],
  728. 14:[&quot;Weaponsmithing_Tier3_Dagger_4&quot;],
  729. 15:[&quot;Weaponsmithing_Tier3_Dagger_4&quot;],
  730. 16:[&quot;Weaponsmithing_Tier3_Dagger_4&quot;],
  731. 17:[&quot;Weaponsmithing_Tier3_Dagger_4&quot;],
  732. 18:[&quot;Weaponsmithing_Tier3_Dagger_4&quot;],
  733. 19:[&quot;Weaponsmithing_Tier3_Dagger_4&quot;],
  734. 20:[&quot;Weaponsmithing_Tier2_Refine_Basic&quot;],
  735. //19:[&quot;Dagger+4&quot;,&quot;Upgrade Grinder&quot;,&quot;Upgrade Smelter&quot;,&quot;Hire an additional Smelter&quot;],
  736. //20:[&quot;Craft Steel Blades and Barausk Hafts&quot;],
  737. },
  738. },
  739. {
  740. taskName:&quot;Alchemy&quot;,
  741. level: {
  742. 0:[&quot;Alchemy_Tier0_Intro_1&quot;],
  743. 1:[&quot;Alchemy_Tier1_Experiment_Rank2&quot;,&quot;Alchemy_Tier1_Experimentation_Rank1&quot;,],
  744. 2:[&quot;Alchemy_Tier1_Experiment_Rank3&quot;,&quot;Alchemy_Tier1_Experimentation_Rank2&quot;],
  745. 3:[&quot;Alchemy_Tier1_Experiment_Rank4&quot;,&quot;Alchemy_Tier1_Experimentation_Rank3&quot;],
  746. 4:[&quot;Alchemy_Tier1_Experiment_Rank5&quot;,&quot;Alchemy_Tier1_Experimentation_Rank4&quot;],
  747. 5:[&quot;Alchemy_Tier1_Experiment_Rank6&quot;,&quot;Alchemy_Tier1_Experimentation_Rank5&quot;],
  748. 6:[&quot;Alchemy_Tier1_Experiment_Rank7&quot;,&quot;Alchemy_Tier1_Experimentation_Rank6&quot;],
  749. 7:[&quot;Alchemy_Tier2_Experiment_Rank08&quot;,&quot;Alchemy_Tier2_Experimentation_Rank07&quot;],
  750. 8:[&quot;Alchemy_Tier2_Experiment_Rank09&quot;,&quot;Alchemy_Tier2_Experimentation_Rank08&quot;],
  751. 9:[&quot;Alchemy_Tier2_Experiment_Rank10&quot;,&quot;Alchemy_Tier2_Experimentation_Rank09&quot;],
  752. 10:[&quot;Alchemy_Tier2_Experiment_Rank11&quot;,&quot;Alchemy_Tier2_Experimentation_Rank10&quot;],
  753. 11:[&quot;Alchemy_Tier2_Experiment_Rank12&quot;,&quot;Alchemy_Tier2_Experimentation_Rank11&quot;],
  754. 12:[&quot;Alchemy_Tier2_Experiment_Rank13&quot;,&quot;Alchemy_Tier2_Experimentation_Rank12&quot;],
  755. 13:[&quot;Alchemy_Tier2_Experiment_Rank14&quot;,&quot;Alchemy_Tier2_Experimentation_Rank13&quot;],
  756. 14:[&quot;Alchemy_Tier3_Experiment_Rank15&quot;,&quot;Alchemy_Tier3_Experimentation_Rank14&quot;],
  757. 15:[&quot;Alchemy_Tier3_Experiment_Rank16&quot;,&quot;Alchemy_Tier3_Experimentation_Rank15&quot;],
  758. 16:[&quot;Alchemy_Tier3_Experiment_Rank17&quot;,&quot;Alchemy_Tier3_Experimentation_Rank16&quot;],
  759. 17:[&quot;Alchemy_Tier3_Experiment_Rank18&quot;,&quot;Alchemy_Tier3_Experimentation_Rank17&quot;],
  760. 18:[&quot;Alchemy_Tier3_Experiment_Rank19&quot;,&quot;Alchemy_Tier3_Experimentation_Rank18&quot;],
  761. 19:[&quot;Alchemy_Tier3_Experiment_Rank20&quot;,&quot;Alchemy_Tier3_Experimentation_Rank19&quot;],
  762. 20:[&quot;Alchemy_Tier3_Experimentation_Rank20&quot;],
  763. //19:[&quot;Alchemical Research&quot;,&quot;Rank 20 Experimentation&quot;,&quot;Upgrade Mixologist&quot;,&quot;Upgrade Apothecary&quot;,&quot;Hire an additional Apothecary&quot;],
  764. //20:[&quot;Rank 20 Experimentation&quot;],
  765. },
  766. },
  767. ];
  768. // Load Settings
  769. var settingnames = [
  770. {name: &#39;paused&#39;, title: &#39;Pause Script&#39;, def: false, type:&#39;checkbox&#39;, tooltip:&#39;Disable All Automation&#39;},
  771. {name: &#39;debug&#39;, title: &#39;Enable Debug&#39;, def: false, type:&#39;checkbox&#39;, tooltip:&#39;Enable all debug output to console&#39;, onsave: function(newValue, oldValue) {console=newValue?unsafeWindow.console||fouxConsole:fouxConsole;}},
  772. {name: &#39;optionals&#39;, title: &#39;Fill Optional Assets&#39;, def: true, type:&#39;checkbox&#39;, tooltip:&#39;Enable to include selecting the optional assets of tasks&#39;},
  773. {name: &#39;autopurchase&#39;, title: &#39;Auto Purchase Resources&#39;, def: true, type:&#39;checkbox&#39;, tooltip:&#39;Automatically purchase required resources from gateway shop (100 at a time)&#39;},
  774. {name: &#39;trainassets&#39;, title: &#39;Train Assets&#39;, def: true, type:&#39;checkbox&#39;, tooltip:&#39;Enable training/upgrading of asset worker resources&#39;},
  775. {name: &#39;refinead&#39;, title: &#39;Refine AD&#39;, def: true, type:&#39;checkbox&#39;, tooltip:&#39;Enable refining of AD on character switch&#39;},
  776. {name: &#39;autoreload&#39;, title: &#39;Auto Reload&#39;, def: false, type:&#39;checkbox&#39;, tooltip:&#39;Enabling this will reload the gateway periodically. (Ensure Auto Login is enabled)&#39;},
  777. {name: &#39;autologin&#39;, title: &#39;Attempt to login automatically&#39;, def: false, type:&#39;checkbox&#39;, tooltip:&#39;Automatically attempt to login to the neverwinter gateway site&#39;},
  778. {name: &#39;nw_username&#39;, title: &#39; Neverwinter Username&#39;, def: &#39;&#39;, type:&#39;text&#39;, tooltip:&#39;&#39;},
  779. {name: &#39;nw_password&#39;, title: &#39; Neverwinter Password&#39;, def: &#39;&#39;, type:&#39;password&#39;, tooltip:&#39;&#39;},
  780. {name: &#39;charcount&#39;, title: &#39; Number of Characters&#39;, def: &#39;2&#39;, type:&#39;text&#39;, tooltip:&#39;Enter number of characters to use (reload page to update settings form)&#39;},
  781. ];
  782. // Load local settings cache (unsecured)
  783. var settings = {};
  784. for (var i = 0; i &lt; settingnames.length; i++) {
  785. // Ignore label types
  786. if (settingnames[i].type === &#39;label&#39;) {
  787. continue;
  788. }
  789. settings[settingnames[i].name] = GM_getValue(settingnames[i].name, settingnames[i].def);
  790. // call the onsave for the setting if it exists
  791. if (typeof(settingnames[i].onsave) === &quot;function&quot;) {
  792. console.log(&quot;Calling &#39;onsave&#39; for&quot;, settingnames[i].name);
  793. settingnames[i].onsave(settings[settingnames[i].name], settings[settingnames[i].name]);
  794. }
  795. }
  796. if (settings[&quot;charcount&quot;]&lt;1) { settings[&quot;charcount&quot;] = 1; }
  797. if (settings[&quot;charcount&quot;]&gt;99) { settings[&quot;charcount&quot;] = 99; }
  798.  
  799. var charSettings = [];
  800. for (var i = 0; i &lt; settings[&quot;charcount&quot;]; i++) {
  801. charSettings.push({name: &#39;nw_charname&#39;+i, title: &#39;Character&#39;, def: &#39;Character &#39;+(i+1), type:&#39;text&#39;, tooltip:&#39;Characters Name&#39;});
  802. charSettings.push({name: &#39;Leadership&#39;+i, title: &#39;Leadership&#39;, def: &#39;9&#39;, type:&#39;text&#39;, tooltip:&#39;Number of slots to assign to Leadership&#39;});
  803. charSettings.push({name: &#39;Armorsmithing_Med&#39;+i, title: &#39;Mailsmithing&#39;, def: &#39;0&#39;, type:&#39;text&#39;, tooltip:&#39;Number of slots to assign to Mailsmithing&#39;});
  804. charSettings.push({name: &#39;Armorsmithing_Heavy&#39;+i, title: &#39;Platesmithing&#39;, def: &#39;0&#39;, type:&#39;text&#39;, tooltip:&#39;Number of slots to assign to Platesmithing&#39;});
  805. charSettings.push({name: &#39;Leatherworking&#39;+i, title: &#39;Leatherworking&#39;, def: &#39;0&#39;, type:&#39;text&#39;, tooltip:&#39;Number of slots to assign to Leatherworking&#39;});
  806. charSettings.push({name: &#39;Tailoring&#39;+i, title: &#39;Tailoring&#39;, def: &#39;0&#39;, type:&#39;text&#39;, tooltip:&#39;Number of slots to assign to Tailoring&#39;});
  807. charSettings.push({name: &#39;Artificing&#39;+i, title: &#39;Artificing&#39;, def: &#39;0&#39;, type:&#39;text&#39;, tooltip:&#39;Number of slots to assign to Artificing&#39;});
  808. charSettings.push({name: &#39;Weaponsmithing&#39;+i, title: &#39;Weaponsmithing&#39;, def: &#39;0&#39;, type:&#39;text&#39;, tooltip:&#39;Number of slots to assign to Weaponsmithing&#39;});
  809. charSettings.push({name: &#39;Alchemy&#39;+i, title: &#39;Alchemy&#39;, def: &#39;0&#39;, type:&#39;text&#39;, tooltip:&#39;Number of slots to assign to Alchemy&#39;});
  810.  
  811. // task settings are slightly different
  812. charSettings.push({name: &#39;tasklist&#39;+i, title: &#39;Task List&#39;, def: &#39;&#39;, type:&#39;void&#39;, tooltip:&#39;&#39;});
  813. }
  814. for (var i = 0; i &lt; charSettings.length; i++) {
  815. settings[charSettings[i].name] = GM_getValue(charSettings[i].name, charSettings[i].def);
  816. }
  817. // Page Settings
  818. var PAGES = Object.freeze({
  819. LOGIN : { name: &quot;Login&quot;, path: &quot;div#login&quot;},
  820. GUARD : { name: &quot;Account Guard&quot;, path: &quot;div#page-accountguard&quot;},
  821. });
  822.  
  823. /**
  824. * Uses the page settings to determine which page is currently displayed
  825. */
  826. function GetCurrentPage() {
  827. for each(var page in PAGES) {
  828. if ($(page[&quot;path&quot;]).filter(&quot;:visible&quot;).length) {
  829. return page;
  830. }
  831. }
  832. }
  833. /**
  834. * Logs in to gateway
  835. * No client.dataModel exists at this stage
  836. */
  837. function page_LOGIN() {
  838. //if (!$(&quot;form &gt; p.error:visible&quot;).length &amp;&amp; settings[&quot;autologin&quot;]) {
  839. // No previous log in error - attempt to log in
  840. console.log(&quot;Setting username&quot;);
  841. $(&quot;input#user&quot;).val(settings[&quot;nw_username&quot;]);
  842. console.log(&quot;Setting password&quot;);
  843. $(&quot;input#pass&quot;).val(settings[&quot;nw_password&quot;]);
  844. console.log(&quot;Clicking Login Button&quot;);
  845. $(&quot;div#login &gt; input&quot;).click();
  846. //}
  847. dfdNextRun.resolve(delay.LONG);
  848. }
  849. /**
  850. * Action to perform on account guard page
  851. */
  852. function page_GUARD() {
  853. // Do nothing on the guard screen
  854. dfdNextRun.resolve(delay.LONG);
  855. }
  856.  
  857. /**
  858. * Collects rewards for tasks or starts new tasks
  859. * Function is called once per new task and returns true if an action is created
  860. * If no action is started function returns false to switch characters
  861. */
  862. function processCharacter() {
  863. // Switch to professions page to show task progression
  864. unsafeWindow.location.hash=&quot;#char(&quot;+encodeURI(unsafeWindow.client.getCurrentCharAtName())+&quot;)/professions&quot;;
  865. // Collect rewards for completed tasks and restart
  866. if (unsafeWindow.client.dataModel.model.ent.main.itemassignments.complete) {
  867. unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.forEach(function(entry) {
  868. if (entry.hascompletedetails) { unsafeWindow.client.professionTaskCollectRewards(entry.uassignmentid); }
  869. });
  870. dfdNextRun.resolve();
  871. return true;
  872. }
  873. // Check for available slots and start new task
  874. if (unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.filter(function(entry) { return (!entry.islockedslot &amp;&amp; !entry.uassignmentid); }).length) {
  875. // Go through the professions to assign tasks until specified slots filled
  876. for (var i = 0; i &lt; tasklist.length; i++) {
  877. var currentTasks = unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.filter(function(entry) { return entry.category == tasklist[i].taskName; });
  878. if (currentTasks.length &lt; settings[tasklist[i].taskName]) {
  879. unsafeWindow.client.professionFetchTaskList(&#39;craft_&#39; + tasklist[i].taskName);
  880. unsafeWindow.client.dataModel.fetchVendor(&#39;Nw_Gateway_Professions_Merchant&#39;);
  881. window.setTimeout(function() { createNextTask(tasklist[i], 0); }, delay.SHORT);
  882. return true;
  883. }
  884. }
  885. console.log(&quot;All task counts assigned&quot;);
  886. }
  887. else {
  888. console.log(&quot;No available task slots&quot;);
  889. }
  890. // TODO: Add code to get next task finish time
  891. return false;
  892. }
  893.  
  894. /**
  895. * Iterative approach to finding the next task to assign to an open slot.
  896. *
  897. * @param {Array} prof The tasklist for the profession being used
  898. * @param {int} i The current task number being attempted
  899. */
  900. function createNextTask(prof, i) {
  901. // TODO: Use callback function
  902. if (!unsafeWindow.client.dataModel.model.craftinglist || unsafeWindow.client.dataModel.model.craftinglist === null || !unsafeWindow.client.dataModel.model.craftinglist[&#39;craft_&#39; + prof.taskName] || unsafeWindow.client.dataModel.model.craftinglist[&#39;craft_&#39; + prof.taskName] === null) {
  903. console.log(&#39;Task list not loaded for:&#39;, prof.taskName);
  904. window.setTimeout(function() { createNextTask(prof, i); }, delay.SHORT);
  905. return false;
  906. }
  907.  
  908. // Check level
  909. var level = unsafeWindow.client.dataModel.model.ent.main.itemassignmentcategories.categories.filter(function(entry) { return entry.name == prof.taskName; })[0].currentrank;
  910. var list = prof.level[level];
  911. if (list.length &lt;=i) {
  912. console.log(&quot;Nothing Found&quot;);
  913. switchChar();
  914. return false;
  915. }
  916. console.log(prof.taskName, &quot;is level&quot;, level);
  917. console.log(&quot;createNextTask&quot;, list.length, i);
  918.  
  919. var taskName = list[i];
  920. console.log(&quot;Searching for task:&quot;, taskName);
  921. // Search for task to start
  922. var task = searchForTask(taskName, prof.taskName);
  923.  
  924. /** TODO: Use this code once below can be replaced properly
  925. if (task === null) {
  926. console.log(&quot;Skipping task selection to purchase resources&quot;);
  927. dfdNextRun.resolve();
  928. }
  929. else if (task) {
  930. startTask(task);
  931. dfdNextRun.resolve();
  932. }
  933. else {
  934. console.log(&#39;Finding next task&#39;);
  935. createNextTask(prof, i+1);
  936. }
  937. **/
  938.  
  939.  
  940. // Finish createNextTask function
  941. if (task === null) {
  942. console.log(&quot;Skipping task selection to purchase resources&quot;);
  943. dfdNextRun.resolve();
  944. return true;
  945. }
  946. if (task) {
  947. task = &#39;/professions-tasks/&#39; + prof.taskName + &#39;/&#39; + task.def.name;
  948. console.log(&#39;Task Found&#39;);
  949. unsafeWindow.location.hash = unsafeWindow.location.hash.replace(/\)\/.+/,&#39;)&#39; + task);
  950. WaitForState(&quot;div.page-professions-taskdetails&quot;).done(function() {
  951. // Click all buttons and select an item to use in the slot
  952. var def = $.Deferred();
  953. var buttonList = $(&quot;h3:contains(&#39;Optional Assets:&#39;)&quot;).closest(&quot;div&quot;).find(&quot;button&quot;);
  954. if (buttonList.length &amp;&amp; settings[&quot;optionals&quot;]) {
  955. SelectItemFor(buttonList, 0, def, prof);
  956. }
  957. else {
  958. def.resolve();
  959. }
  960. def.done(function() {
  961. // All items are populated
  962. console.log(&quot;Items Populated&quot;);
  963. // Click the Start Task Button
  964. //Get the start task button if it is enabled
  965. var enabledButton = $(&quot;div.footer-body &gt; div.input-field.button:not(&#39;.disabled&#39;) &gt; button:contains(&#39;Start Task&#39;)&quot;);
  966. if (enabledButton.length) {
  967. console.log(&quot;Clicking Start Task Button&quot;);
  968. enabledButton.click();
  969. WaitForState(&quot;&quot;).done(function() {
  970. // Done
  971. dfdNextRun.resolve(delay.SHORT);
  972. });
  973. return true;
  974. }
  975. else { // Button not enabled, something required was probably missing
  976. // Go back
  977. $(&quot;div.footer-body &gt; div.input-field.button &gt; button:contains(&#39;Back&#39;)&quot;).click();
  978. WaitForState(&quot;&quot;).done(function() {
  979. // continue with the next one
  980. console.log(&#39;Finding next task&#39;);
  981. createNextTask(prof, i+1);
  982. });
  983. }
  984. });
  985. });
  986. }
  987. else {
  988. console.log(&#39;Finding next task&#39;);
  989. createNextTask(prof, i+1);
  990. }
  991. }
  992. /**
  993. * Checks task being started for requirements and initiates beginning task if found
  994. *
  995. * @param {string} taskname The name of the task being started
  996. * @param {string} profname The name of the profession being used
  997. * @param {Deferred} dfd Deferred object to process on return
  998. */
  999. function searchForTask(taskname, profname) {
  1000. // Return first object that matches exact craft name
  1001. var thisTask = unsafeWindow.client.dataModel.model.craftinglist[&#39;craft_&#39; + profname].entries.filter(function(entry) {
  1002. return entry.def &amp;&amp; entry.def.name == taskname;
  1003. })[0];
  1004. // If no task is returned we either have three of this task already, the task is a rare that doesn&#39;t exist currently, or we have the name wrong in tasklist
  1005. if (!thisTask) {
  1006. console.log(&#39;Could not find task for:&#39;, taskname);
  1007. return false;
  1008. }
  1009. // start task if requirements are met
  1010. if (!thisTask.failedrequirementsreasons.length) {
  1011. return thisTask;
  1012. }
  1013. // Too high level
  1014. if (thisTask.failslevelrequirements) {
  1015. console.log(&quot;Task level is too high:&quot;, taskname);
  1016. return false;
  1017. }
  1018. var searchItem = null;
  1019. var searchAsset = false;
  1020. // Missing assets or ingredients
  1021. if (thisTask.failsresourcesrequirements) {
  1022. var failedAssets = thisTask.required.filter(function(entry) { return !entry.fillsrequirements; });
  1023. // Missing required assets
  1024. if (failedAssets.length) {
  1025. var failedCrafter = failedAssets.filter(function(entry) { return entry.categories.indexOf(&quot;Person&quot;) &gt;= 0; });
  1026. if (failedCrafter.length &amp;&amp; settings[&quot;trainassets&quot;]) {
  1027. console.log(&quot;Found required asset:&quot;, failedCrafter[0].icon);
  1028. searchItem = failedCrafter[0].icon;
  1029. searchAsset = true;
  1030. }
  1031. else {
  1032. // TODO: Automatically purchase item assets from shop
  1033. console.log(&quot;Not enough assets for task:&quot;, taskname);
  1034. return false;
  1035. }
  1036. }
  1037.  
  1038. // Check for craftable or buyable ingredients
  1039. else {
  1040. var failedResources = thisTask.consumables.filter(function(entry) { return entry.required &amp;&amp; !entry.fillsrequirements; });
  1041. // Check first required ingredient only
  1042. // If it fails to buy or craft task cannot be completed anyway
  1043. // If it succeeds script will search for tasks anew
  1044. var itemName = failedResources[0].hdef.match(/\[(\w+)\]/)[1];
  1045. // purchase buyable resources
  1046. if (itemName.match(/^Crafting_Resource_(Charcoal|Rocksalt|Spool_Thread|Porridge|Solvent|Brimstone|Coal|Moonseasalt|Quicksilver|Spool_Threadsilk)$/)) {
  1047. if (settings[&quot;autopurchase&quot;]) {
  1048. buyResource(itemName);
  1049. return null;
  1050. }
  1051. else {
  1052. console.log(&quot;Buyable resource required for:&quot;, taskname);
  1053. return false;
  1054. }
  1055. }
  1056. // craft ingredient items
  1057. else {
  1058. console.log(&quot;Found required ingredient:&quot;, itemName);
  1059. searchItem = itemName;
  1060. }
  1061. }
  1062. }
  1063. // either no craftable items/assets found or other task requirements are not met
  1064. // Skip crafting ingredient tasks for Leadership
  1065. if (searchItem === null || !searchItem.length || (profname == &#39;Leadership&#39; &amp;&amp; !searchAsset &amp;&amp; !searchItem.match(/Crafting_Asset_Craftsman/))) {
  1066. console.log(&quot;Failed to resolve item requirements for task:&quot;, taskname);
  1067. return false;
  1068. }
  1069.  
  1070. // Generate list of available tasks to search ingredients/assets from
  1071. console.log(&quot;Searching ingredient tasks for:&quot;, profname);
  1072. var taskList = unsafeWindow.client.dataModel.model.craftinglist[&#39;craft_&#39; + profname].entries.filter(function(entry) {
  1073. // remove header lines first to avoid null def
  1074. if (entry.isheader) { return false; }
  1075. // Too high level
  1076. if (entry.failslevelrequirements) { return false; }
  1077. // Rewards do not contain item we want to make
  1078. if (searchAsset) {
  1079. if (entry.def.icon != searchItem || !entry.def.name.match(/Recruit/) || entry.def.requiredrank &gt; 14) { return false; }
  1080. }
  1081. else {
  1082. if (!(entry.rewards.some(function (itm) { try { return itm.hdef.match(/\[(\w+)\]/)[1] == searchItem; } catch(e) {} }))) { return false; }
  1083. }
  1084. // Skip mass production tasks
  1085. if (entry.def.displayname.match(/^(Batch|Mass|Deep|Intensive) /)) { return false; }
  1086. // Skip trading tasks
  1087. if (entry.def.displayname.match(/rading$/)) { return false; }
  1088. // Skip looping Transmute tasks
  1089. if (entry.def.displayname.match(/^(Transmute|Create) /)) { return false; }
  1090. return true;
  1091. });
  1092. if (!taskList.length) {
  1093. console.log(&quot;No ingredient tasks found for:&quot;, taskname, searchItem);
  1094. return false;
  1095. }
  1096. // Use more efficient Empowered task for Aqua Vitae if available.
  1097. if (searchItem == &quot;Crafting_Resource_Aquavitae&quot; &amp;&amp; taskList.length &gt; 1) { taskList.shift(); }
  1098. // Should really only be one result now but lets iterate through anyway.
  1099. for (var i = 0; i &lt; taskList.length; i++) {
  1100. console.log(&quot;Attempting search for ingredient task:&quot;, taskList[i].def.name);
  1101. var task = searchForTask(taskList[i].def.name, profname);
  1102. if (task === null || task) {
  1103. return task;
  1104. }
  1105. }
  1106. return false;
  1107. }
  1108. /**
  1109. * Fills resource slots and begins a profession task
  1110. *
  1111. * @param {string} taskDetail The craftindetail object for the task to be started
  1112. */
  1113. function startTask(taskDetail) {
  1114. return;
  1115. unsafeWindow.client.professionFetchTaskDetail(taskDetail.def.name);
  1116. //client.dataModel.addDefaultResources();
  1117. client.professionStartAssignment(taskDetail.def.name);
  1118. }
  1119.  
  1120. /**
  1121. * Selects the highest level asset for the i&#39;th button in the list. Uses an iterative approach
  1122. * in order to apply a sufficient delay after the asset is assigned
  1123. *
  1124. * @param {Array} The list of buttons to use to click and assign assets for
  1125. * @param {int} i The current iteration number. Will select assets for the i&#39;th button
  1126. * @param {Deferred} jQuery Deferred object to resolve when all of the assets have been assigned
  1127. */
  1128. function SelectItemFor(buttonListIn, i, def, prof) {
  1129. buttonListIn[i].click();
  1130. WaitForState(&quot;&quot;).done(function() {
  1131. var specialItems = $(&quot;div.modal-item-list a.Special&quot;);
  1132. var goldItems = $(&quot;div.modal-item-list a.Gold&quot;);
  1133. var silverItems = $(&quot;div.modal-item-list a.Silver&quot;);
  1134. var bronzeItems = $(&quot;div.modal-item-list a.Bronze&quot;);
  1135. var clicked = false;
  1136.  
  1137. // Try to avoid using up higher rank assets needlessly
  1138. if (prof.taskName === &quot;Leadership&quot;) {
  1139. var mercenarys = $(&quot;div.modal-item-list a.Bronze:contains(&#39;Mercenary&#39;)&quot;);
  1140. var guards = $(&quot;div.modal-item-list a.Bronze:contains(&#39;Guard&#39;)&quot;);
  1141. var footmen = $(&quot;div.modal-item-list a.Bronze:contains(&#39;Footman&#39;)&quot;);
  1142.  
  1143. if (mercenarys.length) { clicked = true; mercenarys[0].click(); }
  1144. else if (guards.length) { clicked = true; guards[0].click(); }
  1145. else if (footmen.length) { clicked = true; footmen[0].click(); }
  1146. }
  1147. // TODO: add remaining professions in the same way for bronze tier assets.
  1148.  
  1149. if (!clicked) {
  1150. // Click the highest slot
  1151. if (specialItems.length) { specialItems[0].click(); }
  1152. else if (goldItems.length) { goldItems[0].click(); }
  1153. else if (silverItems.length) { silverItems[0].click(); }
  1154. else if (bronzeItems.length) { bronzeItems[0].click(); }
  1155. else { $(&quot;button.close-button&quot;).click(); }
  1156. }
  1157.  
  1158. console.log(&quot;Clicked item&quot;);
  1159. WaitForState(&quot;&quot;).done(function() {
  1160. // Get the new set of select buttons created since the other ones are removed when the asset loads
  1161. var buttonList = $(&quot;h3:contains(&#39;Optional Assets:&#39;)&quot;).closest(&quot;div&quot;).find(&quot;button&quot;);
  1162. if (i &lt; buttonList.length - 1) {
  1163. SelectItemFor(buttonList, i+1, def, prof);
  1164. }
  1165. else {
  1166. // Let main loop continue
  1167. def.resolve();
  1168. }
  1169. });
  1170. });
  1171. }
  1172. /**
  1173. * Will buy a given purchasable resource
  1174. *
  1175. * @param {String} item The data-tt-item id of the Resource to purchase
  1176. */
  1177. function buyResource(item) {
  1178. console.log(&quot;Purchasing resources:&quot;, item);
  1179. var resourceID = {
  1180. Crafting_Resource_Charcoal : 0,
  1181. Crafting_Resource_Rocksalt : 1,
  1182. Crafting_Resource_Spool_Thread : 2,
  1183. Crafting_Resource_Porridge : 3,
  1184. Crafting_Resource_Solvent : 4,
  1185. Crafting_Resource_Brimstone : 5,
  1186. Crafting_Resource_Coal : 6,
  1187. Crafting_Resource_Moonseasalt : 7,
  1188. Crafting_Resource_Quicksilver : 8,
  1189. Crafting_Resource_Spool_Threadsilk : 9,
  1190. };
  1191. // Make purchase
  1192. unsafeWindow.client.sendCommand(&quot;GatewayVendor_PurchaseVendorItem&quot;,{vendor:&#39;Nw_Gateway_Professions_Merchant&#39;,store:&#39;Store_Crafting_Resources&#39;,idx:resourceID[item],count:100});
  1193. WaitForState(&quot;button.closeNotification&quot;).done(function() {
  1194. $(&quot;button.closeNotification&quot;).click();
  1195. });
  1196. }
  1197. function switchChar() {
  1198. if (settings[&quot;refinead&quot;]) {
  1199. var _currencies = unsafeWindow.client.dataModel.model.ent.main.currencies;
  1200. if (_currencies.diamondsconvertleft &amp;&amp; _currencies.roughdiamonds) {
  1201. console.log(&quot;Refining AD&quot;);
  1202. unsafeWindow.client.sendCommand(&#39;Gateway_ConvertNumeric&#39;, &#39;Astral_Diamonds&#39;);
  1203. }
  1204. }
  1205.  
  1206. console.log(&quot;Switching Characters&quot;);
  1207. if (++charcurrent &gt;= settings[&quot;charcount&quot;]) { charcurrent = 0; }
  1208. GM_setValue(&quot;charcurrent&quot;, charcurrent);
  1209. dfdNextRun.resolve(delay.SHORT);
  1210. }
  1211. /**
  1212. * Waits for the loading symbol to be hidden.
  1213. *
  1214. * @return {Deferred} A jQuery defferred object that will be resolved when loading is complete
  1215. */
  1216. function WaitForLoad() {
  1217. return WaitForState(&quot;&quot;);
  1218. }
  1219. /**
  1220. * Creates a deferred object that will be resolved when the state is reached
  1221. *
  1222. * @param {string} query The query for the state to wait for
  1223. * @return {Deferred} A jQuery defferred object that will be resolved when the state is reached
  1224. */
  1225. function WaitForState(query) {
  1226. var dfd = $.Deferred();
  1227. window.setTimeout(function() {AttemptResolve(query, dfd);}, delay.SHORT); // Doesn&#39;t work without a short delay
  1228. return dfd;
  1229. }
  1230. /**
  1231. * Will continually test for the given query state and resolve the given deferred object when the state is reached
  1232. * and the loading symbol is not visible
  1233. *
  1234. * @param {string} query The query for the state to wait for
  1235. * @param {Deferred} dfd The jQuery defferred object that will be resolved when the state is reached
  1236. */
  1237. function AttemptResolve(query, dfd) {
  1238. if ((query === &quot;&quot; || $(query).length) &amp;&amp; $(&quot;div.loading-image:visible&quot;).length === 0) {
  1239. dfd.resolve();
  1240. }
  1241. else {
  1242. window.setTimeout(function() {AttemptResolve(query, dfd);}, delay.SHORT); // Try again in a little bit
  1243. }
  1244. }
  1245.  
  1246. /**
  1247. * The main process loop:
  1248. * - Determine which page we are on and call the page specific logic
  1249. * - When processing is complete, process again later
  1250. * - Use a short timer when something changed last time through
  1251. * - Use a longer timer when waiting for tasks to complete
  1252. */
  1253. function process() {
  1254. // Make sure the settings button exists
  1255. addSettings();
  1256.  
  1257. // Enable/Disable the unconditional page reload depending on settings
  1258. loading_reset = settings[&quot;autoreload&quot;];
  1259.  
  1260. // Check if timer is paused
  1261. s_paused = settings[&quot;paused&quot;]; // let the Page Reloading function know the pause state
  1262. if (settings[&quot;paused&quot;]) {
  1263. // Just continue later - the deferred object is still set and nothing will resolve it until we get past this point
  1264. var timerHandle = window.setTimeout(function() {process();}, delay.DEFAULT);
  1265. return;
  1266. }
  1267.  
  1268. // Check for Gateway down
  1269. if (window.location.href.indexOf(&quot;gatewaysitedown&quot;) &gt; -1) {
  1270. // Do a long delay and then retry the site
  1271. console.log(&quot;Gateway down detected - relogging in &quot; + (delay.MINS/1000) + &quot; seconds&quot;);
  1272. window.setTimeout(function() {unsafeWindow.location.href = &quot;http://gateway.playneverwinter.com&quot;;}, delay.MINS);
  1273. return;
  1274. }
  1275.  
  1276. // Check for login or account guard and process accordingly
  1277. var currentPage = GetCurrentPage();
  1278. if (currentPage == PAGES.LOGIN) { page_LOGIN(); return; }
  1279. else if (currentPage == PAGES.GUARD) { page_GUARD(); return; }
  1280. window.setTimeout(function() {loginProcess();}, delay.SHORT);
  1281. // Continue again later
  1282. dfdNextRun.done(function(delayTimer) {
  1283. dfdNextRun = $.Deferred();
  1284. timerHandle = window.setTimeout(function() {process();}, typeof delayTimer!== &#39;undefined&#39; ? delayTimer:delay.DEFAULT);
  1285. });
  1286. }
  1287. function loginProcess() {
  1288. // Get logged on account details
  1289. var accountName;
  1290. try {
  1291. accountName = unsafeWindow.client.dataModel.model.loginInfo.publicaccountname;
  1292. }
  1293. catch (e) {
  1294. // TODO: Use callback function
  1295. window.setTimeout(function() {loginProcess();}, delay.SHORT);
  1296. return;
  1297. }
  1298. // Check if timer is paused again to avoid starting new task between timers
  1299. s_paused = settings[&quot;paused&quot;]; // let the Page Reloading function know the pause state
  1300. if (settings[&quot;paused&quot;]) {
  1301. // Just continue later - the deferred object is still set and nothing will resolve it until we get past this point
  1302. var timerHandle = window.setTimeout(function() {process();}, delay.DEFAULT);
  1303. return;
  1304. }
  1305.  
  1306. if (accountName) {
  1307. // load current character position and values
  1308. charcurrent = GM_getValue(&quot;charcurrent&quot;, 0);
  1309. for (var i = 0; i &lt; (charSettings.length/settings[&quot;charcount&quot;]); i++) {
  1310. j = i + (charcurrent*charSettings.length/settings[&quot;charcount&quot;]);
  1311. settings[charSettings[j].name.replace(new RegExp(charcurrent+&quot;$&quot;),&#39;&#39;)] = settings[charSettings[j].name];
  1312. }
  1313. // Load task list from settings if saved
  1314. if (settings[&quot;tasklist&quot;].length) {
  1315. tasklist = JSON.parse(settings[&quot;tasklist&quot;]);
  1316. }
  1317. else {
  1318. tasklist = defaultTasklist;
  1319. }
  1320.  
  1321. var charName = settings[&quot;nw_charname&quot;];
  1322. var fullCharName = charName + &#39;@&#39; + accountName;
  1323.  
  1324. if (unsafeWindow.client.getCurrentCharAtName() != fullCharName) {
  1325. loadCharacter(fullCharName);
  1326. return;
  1327. }
  1328.  
  1329. // Try to start tasks
  1330. if (processCharacter()) { return; }
  1331.  
  1332. // Switch characters as necessary
  1333. switchChar();
  1334. }
  1335. }
  1336.  
  1337. function loadCharacter(charname) {
  1338. // Load character and restart next load loop
  1339. console.log(&quot;Loading gateway script for&quot;, charname);
  1340. unsafeWindow.client.dataModel.loadEntityByName(charname);
  1341. dfdNextRun.resolve();
  1342. }
  1343. function addSettings() {
  1344. if ($(&quot;#settingsButton&quot;).length)
  1345. return;
  1346. // Add the required CSS
  1347. AddCss(&quot;\
  1348. #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;}\
  1349. #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;}\
  1350. #settingsPanel{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); color: rgb(0, 0, 0); position: fixed; overflow: auto; right: 0px; top: 0px; width: 350px;max-height:750px;font: 12px sans-serif; text-align: left; display: block; z-index: 1000;}\
  1351. #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;}\
  1352. #settingsPanelButtonContainer {background: none repeat scroll 0% 0% rgb(204, 204, 204); border-top: 1px solid rgb(102, 102, 102);padding: 3px;text-align:center} \
  1353. #settingsPanel label.purple {font-weight:bold;color:#7C37F6}\
  1354. #settingsPanel label.blue {font-weight:bold;color:#007EFF}\
  1355. #settingsPanel label.green {font-weight:bold;color:#8AFF00}\
  1356. #settingsPanel label.white {font-weight:bold;color:#FFFFFF}\
  1357. #charPanel {width:340px;max-height:400px;overflow:auto;display:block;padding:3px;}\
  1358. &quot;);
  1359.  
  1360. // Add settings panel to page body
  1361. $(&quot;body&quot;).append(
  1362. &#39;&lt;div id=&quot;settingsPanel&quot;&gt;\
  1363. &lt;div id=&quot;settings_title&quot;&gt;\
  1364. &lt;img src=&#39;+image_prefs+&#39; style=&quot;float: left; vertical-align: text-bottom;&quot;\&gt;\
  1365. &lt;img id=&quot;settings_close&quot; src=&#39;+image_close+&#39; title=&quot;Click to hide preferences&quot; style=&quot;float: right; vertical-align: text-bottom; cursor: pointer; display: block;&quot;\&gt;\
  1366. &lt;span style=&quot;margin:3px&quot;&gt;Settings&lt;/span&gt;\
  1367. &lt;/div&gt;\
  1368. &lt;form style=&quot;margin: 0px; padding: 0px&quot;&gt;\
  1369. &lt;ul style=&quot;list-style: none outside none; max-height: 500px; overflow: auto; margin: 3px; padding: 0px;&quot;&gt;\
  1370. &lt;/ul&gt;\
  1371. &lt;/form&gt;\
  1372. &lt;/div&gt;&#39;
  1373. );
  1374.  
  1375. // Add each setting input
  1376. var settingsList = $(&quot;#settingsPanel form ul&quot;);
  1377. for (var i = 0; i &lt; settingnames.length; i++) {
  1378. var id = &#39;settings_&#39; + settingnames[i].name;
  1379. var indent = countLeadingSpaces(settingnames[i].title) * 2;
  1380. switch(settingnames[i].type) {
  1381. case &quot;checkbox&quot;:
  1382. settingsList.append(&#39;&lt;li title=&quot;&#39;+settingnames[i].tooltip+&#39;&quot; style=&quot;margin-left:&#39;+indent+&#39;em&quot;&gt;&lt;input style=&quot;margin:4px&quot; name=&quot;&#39;+id+&#39;&quot; id=&quot;&#39;+id+&#39;&quot; type=&quot;checkbox&quot; /&gt;&lt;label class=&quot;&#39;+settingnames[i].class+&#39;&quot; for=&quot;&#39;+id+&#39;&quot;&gt;&#39;+settingnames[i].title+&#39;&lt;/label&gt;&lt;/li&gt;&#39;)
  1383. $(&#39;#&#39;+id).prop(&#39;checked&#39;, settings[settingnames[i].name]);
  1384. break;
  1385. case &quot;text&quot;:
  1386. settingsList.append(&#39;&lt;li title=&quot;&#39;+settingnames[i].tooltip+&#39;&quot; style=&quot;margin-left:&#39;+indent+&#39;em&quot;&gt;&lt;label class=&quot;&#39;+settingnames[i].class+&#39;&quot; for=&quot;&#39;+id+&#39;&quot;&gt;&#39;+settingnames[i].title+&#39;&lt;/label&gt;&lt;input style=&quot;margin:4px&quot; name=&quot;&#39;+id+&#39;&quot; id=&quot;&#39;+id+&#39;&quot; type=&quot;text&quot; /&gt;&lt;/li&gt;&#39;)
  1387. $(&#39;#&#39;+id).val(settings[settingnames[i].name]);
  1388. break;
  1389. case &quot;password&quot;:
  1390. settingsList.append(&#39;&lt;li title=&quot;&#39;+settingnames[i].tooltip+&#39;&quot; style=&quot;margin-left:&#39;+indent+&#39;em&quot;&gt;&lt;label class=&quot;&#39;+settingnames[i].class+&#39;&quot; for=&quot;&#39;+id+&#39;&quot;&gt;&#39;+settingnames[i].title+&#39;&lt;/label&gt;&lt;input style=&quot;margin:4px&quot; name=&quot;&#39;+id+&#39;&quot; id=&quot;&#39;+id+&#39;&quot; type=&quot;password&quot; /&gt;&lt;/li&gt;&#39;)
  1391. $(&#39;#&#39;+id).val(settings[settingnames[i].name]);
  1392. break;
  1393. case &quot;select&quot;:
  1394. settingsList.append(&#39;&lt;li title=&quot;&#39;+settingnames[i].tooltip+&#39;&quot; style=&quot;margin-left:&#39;+indent+&#39;em&quot;&gt;&lt;label class=&quot;&#39;+settingnames[i].class+&#39;&quot; style=&quot;padding-left:4px&quot; for=&quot;&#39;+id+&#39;&quot;&gt;&#39;+settingnames[i].title+&#39;&lt;/label&gt;&lt;select style=&quot;margin:4px&quot; name=&quot;&#39;+id+&#39;&quot; id=&quot;&#39;+id+&#39;&quot; /&gt;&lt;/li&gt;&#39;)
  1395. var options = settingnames[i].opts;
  1396. var select = $(&#39;#&#39;+id);
  1397. for (var j = 0; j &lt; options.length; j++) {
  1398. if (settings[settingnames[i].name] == options[j].path)
  1399. select.append(&#39;&lt;option value=&quot;&#39;+options[j].path+&#39;&quot; selected=&quot;selected&quot;&gt;&#39;+options[j].name+&#39;&lt;/option&gt;&#39;);
  1400. else
  1401. select.append(&#39;&lt;option value=&quot;&#39;+options[j].path+&#39;&quot;&gt;&#39;+options[j].name+&#39;&lt;/option&gt;&#39;);
  1402. }
  1403. break;
  1404. case &quot;label&quot;:
  1405. settingsList.append(&#39;&lt;li title=&quot;&#39;+settingnames[i].tooltip+&#39;&quot; style=&quot;margin-left:&#39;+indent+&#39;em;&gt;&lt;label class=&quot;&#39;+settingnames[i].class+&#39;&quot;&gt;&#39;+settingnames[i].title+&#39;&lt;/label&gt;&lt;/li&gt;&#39;)
  1406. break;
  1407. }
  1408. }
  1409. // Add character settings for each char
  1410. var addText = &#39;\
  1411. &lt;script type=&quot;text/javascript&quot;&gt;\
  1412. &lt;!--\
  1413. function click_position(obj)\
  1414. {\
  1415. change_position(obj.value)\
  1416. }\
  1417. \
  1418. function change_position(val)\
  1419. {\
  1420. for (var i = 0; i &lt; &#39;+settings[&quot;charcount&quot;]+&#39;; i++)\
  1421. {\
  1422. document.getElementById(&quot;charContainer&quot;+i).style.display=&quot;none&quot;;\
  1423. }\
  1424. document.getElementById(&quot;charContainer&quot;+val).style.display=&quot;block&quot;;\
  1425. }\
  1426. //--&gt;\
  1427. &lt;/script&gt;\
  1428. &lt;div id=&quot;charPanel&quot;&gt;\
  1429. &lt;div style=&quot;width:150px;float:left;max-height:400px;overflow:auto;&quot;&gt;\
  1430. &#39;;
  1431. for (var i = 0; i &lt; settings[&quot;charcount&quot;]; i++) {
  1432. addText += &#39;\
  1433. &lt;div&gt;&lt;input autocomplete=&quot;off&quot; type=&quot;radio&quot; name=&quot;radio_position&quot; onclick=&quot;click_position(this)&quot; id=&quot;value_&#39;+i+&#39;&quot; value=&quot;&#39;+i+&#39;&quot; /&gt;&lt;label for=&quot;value_&#39;+i+&#39;&quot;&gt;&#39;+settings[&quot;nw_charname&quot;+i]+&#39;&lt;/label&gt;&lt;/div&gt;\
  1434. &#39;;
  1435. }
  1436. addText += &#39;\
  1437. &lt;/div&gt;\
  1438. &lt;div style=&quot;width:170px;float:right;&quot;&gt;\
  1439. &#39;;
  1440. for (var i = 0; i &lt; settings[&quot;charcount&quot;]; i++) {
  1441. addText += &#39;\
  1442. &lt;div id=&quot;charContainer&#39;+i+&#39;&quot; style=&quot;display:none&quot;&gt;\
  1443. &lt;ul style=&quot;list-style: none outside none; max-height: 500px; overflow: auto;&quot;&gt;\
  1444. &#39;;
  1445. var k = 0 + (i*charSettings.length/settings[&quot;charcount&quot;]);
  1446. var id = &#39;settings_&#39; + charSettings[k].name;
  1447. addText += &#39;&lt;li title=&quot;&#39;+charSettings[k].tooltip+&#39;&quot;&gt;&lt;input style=&quot;margin:4px&quot; name=&quot;&#39;+id+&#39;&quot; id=&quot;&#39;+id+&#39;&quot; type=&quot;text&quot; /&gt;&lt;/li&gt;&#39;;
  1448. for (var j = 1; j &lt; (charSettings.length/settings[&quot;charcount&quot;]); j++) {
  1449. k = j + (i*charSettings.length/settings[&quot;charcount&quot;]);
  1450. if (charSettings[k].type == &#39;void&#39;) { continue; }
  1451. id = &#39;settings_&#39; + charSettings[k].name;
  1452. addText += &#39;&lt;li title=&quot;&#39;+charSettings[k].tooltip+&#39;&quot;&gt;&lt;input maxlength=&quot;2&quot; size=&quot;1&quot; style=&quot;margin:4px&quot; name=&quot;&#39;+id+&#39;&quot; id=&quot;&#39;+id+&#39;&quot; type=&quot;text&quot; /&gt;&lt;label class=&quot;&#39;+charSettings[k].class+&#39;&quot; for=&quot;&#39;+id+&#39;&quot;&gt;&#39;+charSettings[k].title+&#39;&lt;/label&gt;&lt;/li&gt;&#39;;
  1453. }
  1454. addText += &#39;&lt;/ul&gt;&#39;
  1455.  
  1456. // Add task list save buttons
  1457. addText += &#39;\
  1458. &lt;input id=&quot;save_tasklist&#39;+i+&#39;&quot; type=&quot;button&quot; value=&quot;Save Tasks&quot; title=&quot;Saves current task list in script to this character&quot;&gt;\
  1459. &lt;input id=&quot;clear_tasklist&#39;+i+&#39;&quot; type=&quot;button&quot; value=&quot;Clear Tasks&quot; title=&quot;Clears the saved task list for this character to use defaults&quot;&gt;\
  1460. &lt;/div&gt;&#39;;
  1461. }
  1462. addText += &#39;\
  1463. &lt;/div&gt;\
  1464. &lt;/div&gt;\
  1465. &#39;;
  1466. $(&quot;#settingsPanel form&quot;).append(addText);
  1467.  
  1468. // Add values to character input fields
  1469. for (var i = 0; i &lt; charSettings.length; i++) {
  1470. id = &#39;settings_&#39; + charSettings[i].name;
  1471. $(&#39;#&#39;+id).val(settings[charSettings[i].name]);
  1472. }
  1473. // Add code to tasklist buttons
  1474. for (var i = 0; i &lt; settings[&quot;charcount&quot;]; i++) {
  1475. $(&quot;#save_tasklist&quot;+i).click(function() {
  1476. var num = this.id.replace(&quot;save_tasklist&quot;, &quot;&quot;);
  1477. charSettings[&quot;tasklist&quot;+num] = tasklist;
  1478. setTimeout(function() { GM_setValue(&quot;tasklist&quot;+num, JSON.stringify(defaultTasklist)); }, 0);
  1479. });
  1480. $(&quot;#clear_tasklist&quot;+i).click(function() {
  1481. var num = this.id.replace(&quot;clear_tasklist&quot;, &quot;&quot;);
  1482. charSettings[&quot;tasklist&quot;+num] = &quot;&quot;;
  1483. setTimeout(function() { GM_setValue(&quot;tasklist&quot;+num, &quot;&quot;); }, 0);
  1484. });
  1485. }
  1486.  
  1487. // Add save/cancel buttons to panel
  1488. $(&quot;#settingsPanel form&quot;).append(&#39;\
  1489. &lt;div id=&quot;settingsPanelButtonContainer&quot;&gt;\
  1490. &lt;input id=&quot;settings_save&quot; type=&quot;button&quot; value=&quot;Save and Apply&quot;&gt;\
  1491. &lt;input id=&quot;settings_close&quot; type=&quot;button&quot; value=&quot;Close&quot;&gt;\
  1492. &lt;/div&gt;&#39;);
  1493.  
  1494. // Add open settings button to page
  1495. $(&quot;body&quot;).append(&#39;&lt;div id=&quot;settingsButton&quot;&gt;&lt;img src=&quot;&#39;+image_prefs+&#39;&quot; title=&quot;Click to show preferences&quot; style=&quot;cursor: pointer; display: block;&quot;&gt;&lt;/div&gt;&#39;);
  1496.  
  1497. // Add pause button to page
  1498. $(&quot;body&quot;).append(&#39;&lt;div id=&quot;pauseButton&quot;&gt;&lt;img src=&quot;&#39;+(settings[&quot;paused&quot;]?image_play:image_pause)+&#39;&quot; title=&quot;Click to &#39;+(settings[&quot;paused&quot;]?&quot;resume&quot;:&quot;pause&quot;)+&#39; task script&quot; style=&quot;cursor: pointer; display: block;&quot;&gt;&lt;/div&gt;&#39;);
  1499.  
  1500. // Add the javascript
  1501. $(&quot;#settingsPanel&quot;).hide();
  1502. $(&quot;#settingsButton&quot;).click(function() {
  1503. $(&quot;#settingsButton&quot;).hide();
  1504. $(&quot;#pauseButton&quot;).hide();
  1505. $(&quot;#settingsPanel&quot;).show();
  1506. });
  1507. $(&quot;#settings_close,settings_cancel&quot;).click(function() {
  1508. $(&quot;#settingsButton&quot;).show();
  1509. $(&quot;#pauseButton&quot;).show();
  1510. $(&quot;#settingsPanel&quot;).hide();
  1511. });
  1512. $(&quot;#pauseButton&quot;).click(function() {
  1513. settings[&quot;paused&quot;] = !settings[&quot;paused&quot;]
  1514. setTimeout(function() { GM_setValue(&quot;paused&quot;, settings[&quot;paused&quot;]); }, 0);
  1515. $(&quot;#settings_paused&quot;).prop(&quot;checked&quot;, settings[&quot;paused&quot;]);
  1516. $(&quot;#pauseButton img&quot;).attr(&quot;src&quot;,(settings[&quot;paused&quot;]?image_play:image_pause));
  1517. $(&quot;#pauseButton img&quot;).attr(&quot;title&quot;,&quot;Click to &quot;+(settings[&quot;paused&quot;]?&quot;resume&quot;:&quot;pause&quot;)+&quot; task script&quot;);
  1518. });
  1519.  
  1520. // Use setTimeout to workaround permission issues when calling GM functions from main window
  1521. $(&quot;#settings_save&quot;).click(function() { setTimeout(function() { SaveSettings();}, 0)});
  1522. }
  1523.  
  1524. function SaveSettings() {
  1525. var charcount = settings[&quot;charcount&quot;];
  1526.  
  1527. // Get each value from the UI
  1528. for (var i = 0; i &lt; settingnames.length; i++) {
  1529. var name = settingnames[i].name;
  1530. var el = $(&#39;#settings_&#39; + name);
  1531. var value = false;
  1532. switch(settingnames[i].type) {
  1533. case &quot;checkbox&quot;:
  1534. value = el.prop(&quot;checked&quot;);
  1535. break;
  1536. case &quot;text&quot;:
  1537. value = el.val();
  1538. break;
  1539. case &quot;password&quot;:
  1540. value = el.val();
  1541. break;
  1542. case &quot;select&quot;:
  1543. value = el.val();
  1544. break;
  1545. case &quot;label&quot;: // Labels don&#39;t have values
  1546. continue;
  1547. }
  1548. if (typeof(settingnames[i].onsave) === &quot;function&quot;) {
  1549. console.log(&quot;Calling &#39;onsave&#39; for&quot;, name);
  1550. settingnames[i].onsave(value, settings[name]);
  1551. }
  1552. if (settings[name] !== value) { settings[name] = value; } // Save to local cache
  1553. if (GM_getValue(name) !== value) { GM_setValue(name, value); } // Save to GM cache
  1554. }
  1555.  
  1556. // Get character settings from UI
  1557. for (var i = 0; i &lt; charSettings.length; i++) {
  1558. if (charSettings[i].type == &#39;void&#39;) { continue; }
  1559. var name = charSettings[i].name;
  1560. var el = $(&#39;#settings_&#39; + name);
  1561. var value = el.val();
  1562. if (settings[name] !== value) { settings[name] = value; } // Save to local cache
  1563. if (GM_getValue(name) !== value) { GM_setValue(name, value); } // Save to GM cache
  1564. }
  1565. // If character numbers have changed reload page
  1566. if (charcount != settings[&quot;charcount&quot;]) {
  1567. console.log(&quot;Reloading Gateway to update character count&quot;);
  1568. unsafeWindow.location.href = &quot;http://gateway.playneverwinter.com&quot;;
  1569. return;
  1570. }
  1571.  
  1572. // Delete all saved settings
  1573. if (settingwipe) {
  1574. var keys = GM_listValues();
  1575. for (var i = 0, key = null; key = keys[i]; i++) {
  1576. GM_deleteValue(key);
  1577. }
  1578. }
  1579. // Close the panel
  1580. $(&quot;#settingsButton&quot;).show();
  1581. $(&quot;#pauseButton img&quot;).attr(&quot;src&quot;,(settings[&quot;paused&quot;]?image_play:image_pause));
  1582. $(&quot;#pauseButton img&quot;).attr(&quot;title&quot;,&quot;Click to &quot;+(settings[&quot;paused&quot;]?&quot;resume&quot;:&quot;pause&quot;)+&quot; task script&quot;);
  1583. $(&quot;#pauseButton&quot;).show();
  1584. $(&quot;#settingsPanel&quot;).hide();
  1585. }
  1586.  
  1587. // Add the settings button and start a process timer
  1588. addSettings();
  1589. timerHandle = window.setTimeout(function() {process();}, delay.SHORT);
  1590. })();</pre>
  1591.  
  1592. </div>
  1593. <div class='clear'></div>
  1594. <div id='root_footer'></div>
  1595. </div>
  1596. </div>
  1597. <div id='footer'>
  1598. <div id='footer-content'>
  1599. <div class='col la'>
  1600. <p>
  1601. <strong class='disclaim'>
  1602. Because it's your web
  1603. </strong>
  1604. </p>
  1605. </div>
  1606. <div class='col ra'>
  1607. <p class='credit'>
  1608. Powered by
  1609. <em>monkeys and unicorns</em>
  1610. with the help of many
  1611. <a href="/users/contributers" rel="nofollow">friends</a>
  1612. </p>
  1613. <p id='policies'>
  1614. Policy &amp; Guidelines:
  1615. <a href="/about/dmca" rel="nofollow">DMCA</a>
  1616. <a href="/about/privacy" rel="nofollow">Privacy Policy</a>
  1617. </p>
  1618. </div>
  1619. </div>
  1620. </div>
  1621. <script src="/javascripts/bottom.js?1397513839" type="text/javascript"></script>
  1622. <script type="text/javascript">
  1623. var _gaq = _gaq || [];
  1624. _gaq.push(['_setAccount', 'UA-50927-4']);
  1625. _gaq.push(['_trackPageview']);
  1626. (function() {
  1627. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  1628. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  1629. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  1630. })();
  1631. </script>
  1632. <!-- Quantcast Tag -->
  1633. <script type="text/javascript">
  1634. var _qevents = _qevents || [];
  1635. (function() {
  1636. var elem = document.createElement('script');
  1637. elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
  1638. elem.async = true;
  1639. elem.type = "text/javascript";
  1640. var scpt = document.getElementsByTagName('script')[0];
  1641. scpt.parentNode.insertBefore(elem, scpt);
  1642. })();
  1643. _qevents.push( { qacct:"p-6eWjYgYdo7Su6"} );
  1644. </script>
  1645. <noscript><div style="display: none;"><img src="//pixel.quantserve.com/pixel/p-6eWjYgYdo7Su6.gif" height="1" width="1" alt="Quantcast"/></div></noscript>
  1646. <script type="text/javascript">
  1647. var a2a_onclick = 1;
  1648. var a2a_linkname = "Neverwinter Gateway - Professions Robot Mod";
  1649. var a2a_linkurl = "http://userscripts.org/scripts/show/171738";
  1650. </script>
  1651. <script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
  1652.  
  1653.  
  1654. </body>
  1655. </html>