-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.txt
1560 lines (1448 loc) · 89.4 KB
/
script.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ==UserScript==
// @name Neverwinter Gateway - Professions Robot
// @description Automatically selects professions for empty slots
// @namespace
// @include https://gateway.playneverwinter.com
// @include https://gateway.playneverwinter.com/*
// @include https://gatewaysitedown.playneverwinter.com
// @include https://gatewaysitedown.playneverwinter.com/*
// @include http://gateway.playneverwinter.com
// @include http://gateway.playneverwinter.com/*
// @include http://gatewaysitedown.playneverwinter.com
// @include http://gatewaysitedown.playneverwinter.com/*
// @updateURL
// @downloadURL
// @originalAuthor Mustex
// @modifiedBy Bunta
// @version 1.0.0.3
// @license http://creativecommons.org/licenses/by-nc-sa/3.0/us/
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_listValues
// @grant GM_deleteValue
// ==/UserScript==
/* RELEASE NOTES
1.0.0.3
- Fix some gem trading tasks not being filtered correctly
- Add check for gateway disconnected
1.0.0.2
- Fix leadership tasks not creating assets correctly
- Add option to save task lists per character (experimental)
1.0.0.1
- Rewrite script using client.dataModel methods to massively improve reliability and performance (thanks Msc)
- AD refining will now only attempt to refine if you are able to collect diamonds
- Change task lists to use exact task names so no ambiguity exists (no longer requires excluderare option)
- Asset resources are now trained as needed (only for required slots)
0.3.0.5
- Fix resources not buying correctly in all cases
- Fix pause button state saving correctly in firefox
0.3.0.4
- Add page timeout reloading functions outside of main function (thanks Kreese and Frabtik)
- Add check to ensure tasks are being started for the correct character
- Alter next run resolve function to use delay parameter to allow for unique delay timers to be used in certain cases
0.3.0.3
- Fix ingredient task selection to correctly iterate through all ingredient tasks
- Alter character selection to pick only exact character name matches
- Update leadership tasks
0.3.0.2
- Exclude alchemy from rare task exclusions due to Aqua Regia (thanks Eversor)
- Reduce GM_setValue calls to avoid tampermonkey failing to save settings (thanks miah)
0.3.0.1
- Altered mutichar selector to be faster (thanks miah)
- Updated rare tasks selector (thanks Traktor)
- Add option to refine AD during character switching (thanks Eversor)
- Added some level 20 gather tasks
- Increased supply buying to 100 units
0.3.0.0
- Added Multi-Character support
- Added function to clear all saved settings for script
- Remove disable sound functionality (now configurable in gateway)
0.2.0.1.8
- Added pause button to allow easy on/off switching
0.2.0.1.7
- Added option to enable/disable filling optional asset slots
- Added batch potions tasks to be skipped in ingredient selection
- Added timer to reload page if stuck loading for too long
- Added option to disable page sounds
- Updated license to by-nc-sa
0.2.0.1.6
- Add configurable option for excluding rare tasks
0.2.0.1.5
- Add ability to specify specific level for tasks and configure same named artificing resource tasks to request correct level of task
- Remove purchase notification that never times out
0.2.0.1.4
- Added functionality to purchase required resources from gateway shop
0.2.0.1.3
- Add Artificing and Weaponsmithing to Robot
(Artificing will not work properly yet as all three tiers of gather and craft tasks have the same task name)
0.2.0.1.2
- Update reload process
- Fix optional asset selector with gateway update
0.2.0.1.1
- Simplify asset selection after they fixed bug in previous gateway update
- Update level 20 leadership tasks
- Update with changes in Mustex's script (version 15)
* Added a secondary timer that will reload the gateway every few hours. This should help with disconnects from the server
* Implemented tooltips for settings panel
0.1.9.1.15
- Repeat task reordering for +2 armor
0.1.9.1.14
- Fix selection of assets after gateway update
- Skip intensive gather tasks added after gateway update
0.1.9.1.13
- Change ordering of tasks and ingredient checks
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't.
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.
0.1.9.1.12
- Optimise crafting tasks for highest exp/min gains due to ingredient requirements
0.1.9.1.11
- Add extra craft tasks for when residuum runs out
0.1.9.1.10
- Only allow rare tasks to be selected for Leadership
This avoids craft loops where higher quality rare crafts require ingredients with the same name
0.1.9.1.9
- Alter craft tasks to favour armor to optimise inventory space
0.1.9.1.8
- Fix script restart bug when no tasks found
0.1.9.1.7
- Update search string for Potions (After the task names for elxiirs have been changed)
- Remove logon error skips to avoid logons sometimes failing on first load (ensure logon details are correct!)
0.1.9.1.6
- Update tasks for all professions
- Update ingredient search lists for all professions
0.1.9.1.5
- Fix regular expression used in potion ingredient search
0.1.9.1.4
- Alter default timeouts (makes script a lot more stable and less prone to errors)
- Remove unused variable
- Add extra logging for task ingredient searches
0.1.9.1.3
- Fix bug with required resource checks getting stuck on non craftable resources
0.1.9.1.2
- Added method to check for required task ingredients and choose tasks to create them
Method is currently hard coded to specify certain search strings for ingredient types
Currently working for all Alchemy tasks
There is a current problem that if you have the required potion ingredient but it is in your belt slots
the task is uncraftable but the ingredients show as available and it will not craft a new one
0.1.9.1
- Update with changes in Mustex's script (version 12)
* Added tasks for Platesmithing, Leatherworking, Tailoring
* Added detection for the gateway being down
0.1.8.3.8
- Update asset selection to avoid using coloured assets in junk slots for leadership
0.1.8.3.7
- Update leadership tasks table due to task reward/duration alterations
0.1.8.3.6
- Add option to enable/disable automation process
- Update alchemy tasks some more
0.1.8.3.5
- Add ability to select from multiple tasks with same name (eg Alchemical Research)
- Add craft options for alchemy potions (need to be manually switched since they use the same ingredients)
0.1.8.3.4
- Add alchemy tasks up to level 20
0.1.8.3.3
- Change task slot selection to be user configurable options in settings window
- Add level 1 alchemical research
0.1.8.3.2
- Added ability to specify how many tasks of each profession to train multiple professions at once
- Updated mailsmithing level 0 tasks
0.1.8.3.1
- Changed asset selection to only update Junk assets
- Leadership asset selection for bronze tier picks lowest asset first
- Modified Leadership tasks
0.1.8.3
- Tweaked Leadership tasks grid
- Added task grid for Alchemy (Partial)
0.1.8.2
- onsave handlers for settings are now called before the settings values are saved
- Added onsave handler for console to enable/disable using the window console
0.1.8.1
- Added checking for errors (using the window title) and will navigate back to the main login page if autologin is enabled
0.1.8
- Added popup for altering settings
- Settings are saved to script cache
- Added mailsmithing tasks to task grid
0.1.7
- Added lower level leadership tasks to grid
- Added hiring tasks to leadership task
- Uses saved values to determine which profession type to level (Defaults to Leadership, currently no way to change it)
0.1.5
- Is now able to recover from missing assets
- Uses a configurable grid to determine what the next task is to complete
0.1.0
- Is now able to select some hard coded leadership tasks
- Can now collect from any completed slot
*/
// Make sure it's running on the main page, no frames
if (window.self !== window.top) {
throw "";
}
// Set global console variables
var fouxConsole = {log:function(){},info:function(){},error:function(){},warn:function(){}};
var console = unsafeWindow.console || fouxConsole;
// Page Reloading function
// Every second the page is idle or loading is tracked
var loading_reset = false; // Enables a periodic reload if this is toggled on by the Auto Reload check box on the settings panel
var s_paused = false; // extend the paused setting to the Page Reloading function
(function() {
var $ = unsafeWindow.$;
var state_loading = 0; // If "Page Loading" takes longer than 30 seconds, reload page (maybe a javascript error)
var state_loading_time = 30; // default of 30 seconds
var state_idle = 0; // If the page is idle for longer than 60 seconds, reload page (maybe a javascript error)
var state_idle_time = 120; // default of 120 seconds
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
var last_location = ""; // variable to track reference to page URL
var reload_timer = setInterval(function() {
if (!s_paused) {
if (loading_reset) {
var loading_date = new Date();
var loading_sec = Number(loading_date.getSeconds());
var loading_min = Number(loading_date.getMinutes());
var loading_hour = Number(loading_date.getHours());
if (reload_hours.indexOf(loading_hour) >= 0 && loading_min == 29 && loading_sec < 2) {
console.log("Auto Reload");
unsafeWindow.location.href = "http://gateway.playneverwinter.com";
return;
}
}
// check for errors
if ($("title").text().match(/Error/) || $("div.modal-content h3").text().match(/Disconnected/)) {
console.log("Error detected - relogging");
unsafeWindow.location.href = "http://gateway.playneverwinter.com";
return;
}
if ($("div.loading-image:visible").length) {
last_location = location.href;
state_idle = 0;
if (state_loading >= state_loading_time) {
console.log("Page Loading too long");
state_loading = 0;
location.reload();
}
else {
state_loading++;
console.log("Page Loading ...", state_loading + "s");
}
}
// TODO: Add check for Gateway disconnected
//<div class="modal-content" id="modal_content"><h3>Disconnected from Gateway</h3><p>You have been disconnected.</p><button type="button" class="modal-button" onclick="window.location.reload(true);">Close</button>
/* Can't use idle check with dataModel methods
else if (location.href == last_location) {
state_loading = 0;
if (state_idle >= state_idle_time) {
console.log("Page Idle too long");
state_idle = 0;
unsafeWindow.location.href = "http://gateway.playneverwinter.com";
}
else {
state_idle++;
// comment out to avoid console spam
//console.log("Page Idle ...", state_idle + "s");
}
}
*/
else {
last_location = location.href;
state_loading = 0;
state_idle = 0;
}
}
},1000);
})();
(function() {
/**
* Add a string of CSS to the main page
*
* @param {String} cssString The CSS to add to the main page
*/
function AddCss(cssString) {
var head = document.getElementsByTagName('head')[0];
if (!head)
return;
var newCss = document.createElement('style');
newCss.type = "text/css";
newCss.innerHTML = cssString;
head.appendChild(newCss);
}
function countLeadingSpaces(str) {
return str.match(/^(\s*)/)[1].length;
}
var image_pause = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAY" +
"AAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2" +
"ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG" +
"8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNR" +
"NYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMBy" +
"H/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAI" +
"Cd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOE" +
"AuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dX" +
"Lh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJ" +
"iYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PE" +
"WhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0T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ElNRQfWBRoFKh31UQ8DAAAAgUlEQVQY022OxxLCMAwFRSc4BEIPJZQQ08v+" +
"/8+RsTExDDpIe3ijfSJ/hx9g62Dt4GaAI+8YT0t27+BxxvvE/no5pYT10lGFrE34Ja40W3g" +
"1oMGmW7YZ6hnCYexKTPVkXivuvWe1Cz1aKqPNI3N0slI2TNYZiARJX30qERc7wBPKC4WRDz" +
"WdWHfmAAAAAElFTkSuQmCC";
var image_close = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQC" +
"AQAAAC1+jfqAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfW" +
"BRkTNhxuPxLkAAAAHXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBUaGUgR0lNUO9kJW4AAAE" +
"KSURBVCjPhdGxSgNBFAXQMzpgYWwsLEQUDBJBQgqFIChZEPR7/DA/QCGQTgQtJE1ENoWohY" +
"UgbGKQyFjErNv52nObe19wqGWg7z0l5YVgVdOu+wUt507tqIVQ4Zodp861ooELe15M5KFI6" +
"Zfr9u25MIj6Jl4cmSIPBWrq2o5cufO4aOJDYSozNTa2pK4t03PtwUdMKRRykAmW0dTRcyNX" +
"pBQpI8GJDTR050zkNzK0bMMZLvUNZ8yCfy6Wvbc1NVyi4dloXjqWvds6uvp41pFmpVOKJWd" +
"6bgwxkmTMIotWKpwrfBkZl7uMonUHf5wSlV2+fUZrjnXdzrmyy7djD8GWTW9e51z557o1Tz" +
"85FH/WkOkaHQAAAABJRU5ErkJggg==";
// Setup global closure variables
var $ = unsafeWindow.jQuery;
var timerHandle = 0;
var dfdNextRun = $.Deferred();
var charcurrent = 0; // current character counter
var settingwipe = false; // Use to wipe stored settings
var delay = {
SHORT : 1000,
MEDIUM : 5000,
LONG : 30000,
MINS : 300000,
DEFAULT : 10000, // default delay
TIMEOUT : 60000, // delay for cycle processing timeout
};
/*
* Tasklist can be modified to configure the training you want to perform.
* The configurable options window sets how many profession slots you want to use for each profession.
* The level array below for each professions specifies the tasks you want to learn at each crafting level.
* Each craft slot will pick the first task that meets requirements.
* See http://pastebin.com/VaGntEha for Task Name Map.
* Some names above do not match, use below code to check:
* var tasks = client.dataModel.model.craftinglist['craft_' + profname].entries.filter(function(entry) { return entry.def && entry.def.displayname == taskname; }); tasks[0].def.name;
*/
var tasklist;
var defaultTasklist = [
{
taskName:"Leadership",
level: {
0:["Leadership_Tier0_Intro_1"],
1:["Leadership_Tier0_Intro_5", "Leadership_Tier0_Intro_4","Leadership_Tier0_Intro_3", "Leadership_Tier0_Intro_2"],
2:["Leadership_Tier1_2_Guardduty","Leadership_Tier1_2_Training"],
3:["Leadership_Tier1_2_Guardduty","Leadership_Tier1_2_Training"],
4:["Leadership_Tier1_2_Guardduty","Leadership_Tier1_2_Training"],
5:["Leadership_Tier1_2_Guardduty","Leadership_Tier1_5_Explore"],
6:["Leadership_Tier1_2_Guardduty","Leadership_Tier1_5_Explore"],
7:["Leadership_Tier1_2_Guardduty","Leadership_Tier1_5_Explore"],
8:["Leadership_Tier1_2_Guardduty","Leadership_Tier1_5_Explore"],
9:["Leadership_Tier2_9_Chart","Leadership_Tier1_2_Guardduty","Leadership_Tier1_5_Explore"],
10:["Leadership_Tier2_9_Chart","Leadership_Tier1_2_Guardduty","Leadership_Tier1_5_Explore"],
// Current model
11:["Leadership_Tier2_9_Chart","Leadership_Tier1_2_Guardduty","Leadership_Tier1_5_Explore"],
12:["Leadership_Tier2_9_Chart","Leadership_Tier1_2_Guardduty","Leadership_Tier1_5_Explore"],
// Current model
13:["Leadership_Tier2_9_Chart","Leadership_Tier3_13_Patrol","Leadership_Tier1_2_Guardduty"],
14:["Leadership_Tier2_9_Chart","Leadership_Tier3_14_Assemble","Leadership_Tier3_13_Patrol","Leadership_Tier1_2_Guardduty"],
15:["Leadership_Tier2_9_Chart","Leadership_Tier3_14_Assemble","Leadership_Tier3_13_Patrol","Leadership_Tier1_2_Guardduty"],
16:["Leadership_Tier2_9_Chart","Leadership_Tier3_14_Assemble","Leadership_Tier3_13_Patrol","Leadership_Tier3_16_Fight","Leadership_Tier2_10_Battle","Leadership_Tier1_2_Guardduty"],
17:["Leadership_Tier3_17_Deliver","Leadership_Tier3_13_Patrol","Leadership_Tier3_16_Fight","Leadership_Tier2_10_Battle","Leadership_Tier1_2_Guardduty"],
18:["Leadership_Tier3_17_Deliver","Leadership_Tier3_13_Patrol","Leadership_Tier3_16_Fight","Leadership_Tier2_10_Battle","Leadership_Tier1_2_Guardduty"],
19:["Leadership_Tier3_17_Deliver","Leadership_Tier3_13_Patrol","Leadership_Tier3_16_Fight","Leadership_Tier2_10_Battle","Leadership_Tier1_2_Guardduty"],
20:["Leadership_Tier3_13r_Protectdiamonds","Leadership_Tier3_20_Destroy","Leadership_Tier3_16_Fight","Leadership_Tier2_10_Battle"],
// Training Mode
/*
13:["Leadership_Tier3_13_Recruit","Leadership_Tier2_7_Recruit","Leadership_Tier1_2_Recruit"],
14:["Leadership_Tier3_13_Recruit","Leadership_Tier2_7_Recruit","Leadership_Tier1_2_Recruit"],
15:["Leadership_Tier3_13_Recruit","Leadership_Tier2_7_Recruit","Leadership_Tier1_2_Recruit"],
16:["Leadership_Tier3_13_Recruit","Leadership_Tier2_7_Recruit","Leadership_Tier1_2_Recruit"],
17:["Leadership_Tier3_13_Recruit","Leadership_Tier2_7_Recruit","Leadership_Tier1_2_Recruit"],
*/
},
},
{
// Mailsmithing
taskName:"Armorsmithing_Med",
level: {
0:["Med_Armorsmithing_Tier0_Intro"],
1:["Med_Armorsmithing_Tier1_Chain_Boots_1","Med_Armorsmithing_Tier1_Chain_Shirt_1"],
2:["Med_Armorsmithing_Tier1_Chain_Armor_1","Med_Armorsmithing_Tier1_Chain_Pants_1"],
3:["Med_Armorsmithing_Tier1_Chain_Armor_1","Med_Armorsmithing_Tier1_Chain_Boots_Set_1"],
4:["Med_Armorsmithing_Tier1_Chain_Armor_1","Med_Armorsmithing_Tier1_Chain_Boots_Set_1"],
5:["Med_Armorsmithing_Tier1_Chain_Armor_Set_1","Med_Armorsmithing_Tier1_Chain_Boots_Set_1"],
6:["Med_Armorsmithing_Tier1_Chain_Armor_Set_1","Med_Armorsmithing_Tier1_Chain_Boots_Set_1"],
7:["Med_Armorsmithing_Tier1_Chain_Armor_Set_1","Med_Armorsmithing_Tier2_Chain_Boots_Set_1","Med_Armorsmithing_Tier2_Chain_Shirt"],
8:["Med_Armorsmithing_Tier2_Chain_Armor_Set_1","Med_Armorsmithing_Tier2_Chain_Pants_1","Med_Armorsmithing_Tier2_Chain_Boots_Set_1","Med_Armorsmithing_Tier2_Chain_Shirt"],
9:["Med_Armorsmithing_Tier2_Chain_Armor_Set_1","Med_Armorsmithing_Tier2_Chain_Pants_1","Med_Armorsmithing_Tier2_Chain_Boots_Set_1","Med_Armorsmithing_Tier2_Chain_Shirt"],
10:["Med_Armorsmithing_Tier2_Chain_Armor_Set_1","Med_Armorsmithing_Tier2_Chain_Pants_1","Med_Armorsmithing_Tier2_Chain_Boots_Set_1","Med_Armorsmithing_Tier2_Chain_Shirt_2"],
11:["Med_Armorsmithing_Tier2_Chain_Armor_Set_1","Med_Armorsmithing_Tier2_Chain_Pants_2","Med_Armorsmithing_Tier2_Chain_Boots_Set_1","Med_Armorsmithing_Tier2_Chain_Shirt_2","Med_Armorsmithing_Tier2_Chain_Pants_1"],
12:["Med_Armorsmithing_Tier2_Chain_Armor_Set_1","Med_Armorsmithing_Tier2_Chain_Pants_2","Med_Armorsmithing_Tier2_Chain_Boots_Set_1","Med_Armorsmithing_Tier2_Chain_Shirt_2","Med_Armorsmithing_Tier2_Chain_Pants_1"],
13:["Med_Armorsmithing_Tier2_Chain_Armor_Set_1","Med_Armorsmithing_Tier2_Chain_Pants_2","Med_Armorsmithing_Tier2_Chain_Boots_Set_1","Med_Armorsmithing_Tier2_Chain_Shirt_2","Med_Armorsmithing_Tier2_Chain_Pants_1"],
14:["Med_Armorsmithing_Tier2_Chain_Armor_Set_1","Med_Armorsmithing_Tier2_Chain_Pants_2","Med_Armorsmithing_Tier3_Chain_Shirt","Med_Armorsmithing_Tier3_Chain_Boots_Set_1"],
15:["Med_Armorsmithing_Tier3_Chain_Armor_Set_1","Med_Armorsmithing_Tier3_Chain_Pants","Med_Armorsmithing_Tier3_Chain_Shirt2","Med_Armorsmithing_Tier3_Chain_Boots_Set_1"],
16:["Med_Armorsmithing_Tier3_Chain_Armor_Set_1","Med_Armorsmithing_Tier3_Chain_Pants2","Med_Armorsmithing_Tier3_Chain_Shirt2","Med_Armorsmithing_Tier3_Chain_Helm_Set_1","Med_Armorsmithing_Tier3_Chain_Pants"],
17:["Med_Armorsmithing_Tier3_Chain_Armor_Set_1","Med_Armorsmithing_Tier3_Chain_Pants2","Med_Armorsmithing_Tier3_Chain_Shirt2","Med_Armorsmithing_Tier3_Chain_Helm_Set_1","Med_Armorsmithing_Tier3_Chain_Pants"],
18:["Med_Armorsmithing_Tier3_Chain_Armor_Set_1","Med_Armorsmithing_Tier3_Chain_Pants2","Med_Armorsmithing_Tier3_Chain_Shirt2","Med_Armorsmithing_Tier3_Chain_Helm_Set_1","Med_Armorsmithing_Tier3_Chain_Pants"],
19:["Med_Armorsmithing_Tier3_Chain_Armor_Set_1","Med_Armorsmithing_Tier3_Chain_Pants2","Med_Armorsmithing_Tier3_Chain_Shirt2","Med_Armorsmithing_Tier3_Chain_Helm_Set_1","Med_Armorsmithing_Tier3_Chain_Pants"],
20:["Med_Armorsmithing_Tier2_Refine_Basic"],
//19:["Chain Armor +4","Fancy Chain Pants","Fancy Chain Shirt","Chain Helm +4","Ornate Chain Pants","Upgrade Blacksmith","Upgrade Prospector","Hire an additional Prospector"],
//20:["Forge Steel Rings and Scales"],
},
},
{
// Platesmithing
taskName:"Armorsmithing_Heavy",
level: {
0:["Hvy_Armorsmithing_Tier0_Intro"],
1:["Hvy_Armorsmithing_Tier1_Plate_Boots_1","Hvy_Armorsmithing_Tier1_Plate_Shirt_1","Hvy_Armorsmithing_Tier1_Shield_1"],
2:["Hvy_Armorsmithing_Tier1_Plate_Armor_1","Hvy_Armorsmithing_Tier1_Plate_Pants_1"],
3:["Hvy_Armorsmithing_Tier1_Plate_Armor_1","Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1"],
4:["Hvy_Armorsmithing_Tier1_Plate_Armor_1","Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1"],
5:["Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1"],
6:["Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier1_Plate_Boots_Set_1"],
7:["Hvy_Armorsmithing_Tier1_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1","Hvy_Armorsmithing_Tier2_Plate_Shirt","Hvy_Armorsmithing_Tier2_Shield_Set_1"],
8:["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier2_Plate_Pants_1","Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1","Hvy_Armorsmithing_Tier2_Plate_Shirt"],
9:["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier2_Plate_Pants_1","Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1","Hvy_Armorsmithing_Tier2_Plate_Shirt"],
10:["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier2_Plate_Pants_1","Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1","Hvy_Armorsmithing_Tier2_Plate_Shirt_2"],
11:["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier2_Plate_Pants_2","Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1","Hvy_Armorsmithing_Tier2_Plate_Shirt_2","Hvy_Armorsmithing_Tier2_Plate_Pants_1"],
12:["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier2_Plate_Pants_2","Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1","Hvy_Armorsmithing_Tier2_Plate_Shirt_2","Hvy_Armorsmithing_Tier2_Plate_Pants_1"],
13:["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier2_Plate_Pants_2","Hvy_Armorsmithing_Tier2_Plate_Boots_Set_1","Hvy_Armorsmithing_Tier2_Plate_Shirt_2","Hvy_Armorsmithing_Tier2_Plate_Pants_1"],
14:["Hvy_Armorsmithing_Tier2_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier2_Plate_Pants_2","Hvy_Armorsmithing_Tier3_Plate_Shirt","Hvy_Armorsmithing_Tier3_Plate_Boots_Set_1"],
15:["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants","Hvy_Armorsmithing_Tier3_Plate_Shirt2","Hvy_Armorsmithing_Tier3_Plate_Boots_Set_1"],
16:["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants2","Hvy_Armorsmithing_Tier3_Plate_Shirt2","Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants"],
17:["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants2","Hvy_Armorsmithing_Tier3_Plate_Shirt2","Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants"],
18:["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants2","Hvy_Armorsmithing_Tier3_Plate_Shirt2","Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants"],
19:["Hvy_Armorsmithing_Tier3_Plate_Armor_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants2","Hvy_Armorsmithing_Tier3_Plate_Shirt2","Hvy_Armorsmithing_Tier3_Plate_Helm_Set_1","Hvy_Armorsmithing_Tier3_Plate_Pants"],
20:["Hvy_Armorsmithing_Tier2_Refine_Basic"],
//19:["Plate Armor +4","Fancy Plate Pants","Fancy Plate Shirt","Plate Helm +4","Ornate Plate Pants","Upgrade Armorer","Upgrade Miner","Hire an additional Miner"],
//20:["Forge Steel Plates"],
},
},
{
taskName:"Leatherworking",
level: {
0:["Leatherworking_Tier0_Intro_1"],
1:["Leatherworking_Tier1_Leather_Boots_1","Leatherworking_Tier1_Leather_Shirt_1"],
2:["Leatherworking_Tier1_Leather_Armor_1","Leatherworking_Tier1_Leather_Pants_1"],
3:["Leatherworking_Tier1_Leather_Armor_1","Leatherworking_Tier1_Leather_Boots_Set_1"],
4:["Leatherworking_Tier1_Leather_Armor_1","Leatherworking_Tier1_Leather_Boots_Set_1"],
5:["Leatherworking_Tier1_Leather_Armor_Set_1","Leatherworking_Tier1_Leather_Boots_Set_1"],
6:["Leatherworking_Tier1_Leather_Armor_Set_1","Leatherworking_Tier1_Leather_Boots_Set_1"],
7:["Leatherworking_Tier1_Leather_Armor_Set_1","Leatherworking_Tier2_Leather_Boots_Set_1","Leatherworking_Tier2_Leather_Shirt"],
8:["Leatherworking_Tier2_Leather_Armor_Set_1","Leatherworking_Tier2_Leather_Pants_1","Leatherworking_Tier2_Leather_Boots_Set_1","Leatherworking_Tier2_Leather_Shirt"],
9:["Leatherworking_Tier2_Leather_Armor_Set_1","Leatherworking_Tier2_Leather_Pants_1","Leatherworking_Tier2_Leather_Boots_Set_1","Leatherworking_Tier2_Leather_Shirt"],
10:["Leatherworking_Tier2_Leather_Armor_Set_1","Leatherworking_Tier2_Leather_Pants_1","Leatherworking_Tier2_Leather_Boots_Set_1","Leatherworking_Tier2_Leather_Shirt_2"],
11:["Leatherworking_Tier2_Leather_Armor_Set_1","Leatherworking_Tier2_Leather_Pants_2","Leatherworking_Tier2_Leather_Boots_Set_1","Leatherworking_Tier2_Leather_Shirt_2","Leatherworking_Tier2_Leather_Pants_1"],
12:["Leatherworking_Tier2_Leather_Armor_Set_1","Leatherworking_Tier2_Leather_Pants_2","Leatherworking_Tier2_Leather_Boots_Set_1","Leatherworking_Tier2_Leather_Shirt_2","Leatherworking_Tier2_Leather_Pants_1"],
13:["Leatherworking_Tier2_Leather_Armor_Set_1","Leatherworking_Tier2_Leather_Pants_2","Leatherworking_Tier2_Leather_Boots_Set_1","Leatherworking_Tier2_Leather_Shirt_2","Leatherworking_Tier2_Leather_Pants_1"],
14:["Leatherworking_Tier2_Leather_Armor_Set_1","Leatherworking_Tier2_Leather_Pants_2","Ornate Leatherworking_Tier1_Leather_Shirt_1","Leatherworking_Tier3_Leather_Boots_Set_1"],
15:["Leatherworking_Tier3_Leather_Armor_Set_1","Leatherworking_Tier3_Leather_Pants","Leatherworking_Tier3_Leather_Shirt2","Leatherworking_Tier3_Leather_Boots_Set_1"],
16:["Leatherworking_Tier3_Leather_Armor_Set_1","Leatherworking_Tier3_Leather_Pants2","Leatherworking_Tier3_Leather_Shirt2","Leatherworking_Tier3_Leather_Helm_Set_1","Leatherworking_Tier3_Leather_Pants"],
17:["Leatherworking_Tier3_Leather_Armor_Set_1","Leatherworking_Tier3_Leather_Pants2","Leatherworking_Tier3_Leather_Shirt2","Leatherworking_Tier3_Leather_Helm_Set_1","Leatherworking_Tier3_Leather_Pants"],
18:["Leatherworking_Tier3_Leather_Armor_Set_1","Leatherworking_Tier3_Leather_Pants2","Leatherworking_Tier3_Leather_Shirt2","Leatherworking_Tier3_Leather_Helm_Set_1","Leatherworking_Tier3_Leather_Pants"],
19:["Leatherworking_Tier3_Leather_Armor_Set_1","Leatherworking_Tier3_Leather_Pants2","Leatherworking_Tier3_Leather_Shirt2","Leatherworking_Tier3_Leather_Helm_Set_1","Leatherworking_Tier3_Leather_Pants"],
20:["Leatherworking_Tier2_Refine_Basic"],
//19:["Leather Armor +4","Fancy Leather Pants","Fancy Leather Shirt","Leather Helm +4","Ornate Leather Pants","Upgrade Tanner","Upgrade Skinner","Hire an additional Skinner"],
//20:["Cure Tough Pelts"],
},
},
{
taskName:"Tailoring",
level: {
0:["Tailoring_Tier0_Intro"],
1:["Tailoring_Tier1_Cloth_Boots_1","Tailoring_Tier1_Cloth_Shirt_1"],
2:["Tailoring_Tier1_Cloth_Armor_1","Tailoring_Tier1_Cloth_Pants_1"],
3:["Tailoring_Tier1_Cloth_Armor_1","Tailoring_Tier1_Cloth_Boots_Set_1"],
4:["Tailoring_Tier1_Cloth_Armor_1","Tailoring_Tier1_Cloth_Boots_Set_1"],
5:["Tailoring_Tier1_Cloth_Armor_Set_1","Tailoring_Tier1_Cloth_Boots_Set_1"],
6:["Tailoring_Tier1_Cloth_Armor_Set_1","Tailoring_Tier1_Cloth_Boots_Set_1"],
7:["Tailoring_Tier1_Cloth_Armor_Set_1","Tailoring_Tier2_Cloth_Boots_Set_1","Tailoring_Tier2_Cloth_Shirt"],
8:["Tailoring_Tier2_Cloth_Armor_Set_1","Tailoring_Tier2_Cloth_Pants_1","Tailoring_Tier2_Cloth_Boots_Set_1","Tailoring_Tier2_Cloth_Shirt"],
9:["Tailoring_Tier2_Cloth_Armor_Set_1","Tailoring_Tier2_Cloth_Pants_1","Tailoring_Tier2_Cloth_Boots_Set_1","Tailoring_Tier2_Cloth_Shirt"],
10:["Tailoring_Tier2_Cloth_Armor_Set_1","Tailoring_Tier2_Cloth_Pants_1","Tailoring_Tier2_Cloth_Boots_Set_1","Tailoring_Tier2_Cloth_Shirt_2"],
11:["Tailoring_Tier2_Cloth_Armor_Set_1","Tailoring_Tier2_Cloth_Pants_2","Tailoring_Tier2_Cloth_Boots_Set_1","Tailoring_Tier2_Cloth_Shirt_2","Tailoring_Tier2_Cloth_Pants_1"],
12:["Tailoring_Tier2_Cloth_Armor_Set_1","Tailoring_Tier2_Cloth_Pants_2","Tailoring_Tier2_Cloth_Boots_Set_1","Tailoring_Tier2_Cloth_Shirt_2","Tailoring_Tier2_Cloth_Pants_1"],
13:["Tailoring_Tier2_Cloth_Armor_Set_1","Tailoring_Tier2_Cloth_Pants_2","Tailoring_Tier2_Cloth_Boots_Set_1","Tailoring_Tier2_Cloth_Shirt_2","Tailoring_Tier2_Cloth_Pants_1"],
14:["Tailoring_Tier2_Cloth_Armor_Set_1","Tailoring_Tier2_Cloth_Pants_2", "Tailoring_Tier3_Cloth_Shirt","Tailoring_Tier3_Cloth_Boots_Set_1"],
15:["Tailoring_Tier3_Cloth_Armor_Set_1","Tailoring_Tier3_Cloth_Pants","Tailoring_Tier3_Cloth_Shirt2","Tailoring_Tier3_Cloth_Boots_Set_1"],
16:["Tailoring_Tier3_Cloth_Armor_Set_1","Tailoring_Tier3_Cloth_Pants2","Tailoring_Tier3_Cloth_Shirt2","Tailoring_Tier3_Cloth_Helm_Set_1","Tailoring_Tier3_Cloth_Pants"],
17:["Tailoring_Tier3_Cloth_Armor_Set_1","Tailoring_Tier3_Cloth_Pants2","Tailoring_Tier3_Cloth_Shirt2","Tailoring_Tier3_Cloth_Helm_Set_1","Tailoring_Tier3_Cloth_Pants"],
18:["Tailoring_Tier3_Cloth_Armor_Set_1","Tailoring_Tier3_Cloth_Pants2","Tailoring_Tier3_Cloth_Shirt2","Tailoring_Tier3_Cloth_Helm_Set_1","Tailoring_Tier3_Cloth_Pants"],
19:["Tailoring_Tier3_Cloth_Armor_Set_1","Tailoring_Tier3_Cloth_Pants2","Tailoring_Tier3_Cloth_Shirt2","Tailoring_Tier3_Cloth_Helm_Set_1","Tailoring_Tier3_Cloth_Pants"],
20:["Tailoring_Tier2_Refine_Basic"],
//19:["Cloth Robes +4","Fancy Cloth Pants","Fancy Cloth Shirt","Cloth Cap +4","Ornate Cloth Pants","Upgrade Outfitter","Upgrade Weaver","Hire an additional Weaver"],
//20:["Weave Cotton Cloth"],
},
},
{
taskName:"Artificing",
level: {
0:["Artificing_Tier0_Intro_1"],
1:["Artificing_Tier1_Symbol_Virtuous_1"],
2:["Artificing_Tier1_Icon_Virtuous_1"],
3:["Artificing_Tier1_Icon_Virtuous_1"],
4:["Artificing_Tier1_Icon_Virtuous_2"],
5:["Artificing_Tier1_Icon_Virtuous_2"],
6:["Artificing_Tier1_Icon_Virtuous_2"],
7:["Artificing_Tier1_Icon_Virtuous_2"],
8:["Artificing_Tier2_Icon_Virtuous_3"],
9:["Artificing_Tier2_Icon_Virtuous_3"],
10:["Artificing_Tier2_Icon_Virtuous_3"],
11:["Artificing_Tier2_Icon_Virtuous_3"],
12:["Artificing_Tier2_Icon_Virtuous_3"],
13:["Artificing_Tier2_Icon_Virtuous_3"],
14:["Artificing_Tier3_Icon_Virtuous_4"],
15:["Artificing_Tier3_Icon_Virtuous_4"],
16:["Artificing_Tier3_Icon_Virtuous_4"],
17:["Artificing_Tier3_Icon_Virtuous_5"],
18:["Artificing_Tier3_Icon_Virtuous_5"],
19:["Artificing_Tier3_Icon_Virtuous_5"],
20:["Artificing_Tier2_Refine_Basic"],
//19:["Virtuous Icon +5","Upgrade Engraver","Upgrade Carver","Hire an additional Carver"],
//20:["7:Craft Ornamental metal and Carved Wood"],
},
},
{
taskName:"Weaponsmithing",
level: {
0:["Weaponsmithing_Tier0_Intro"],
1:["Weaponsmithing_Tier1_Dagger_1"],
2:["Weaponsmithing_Tier1_Dagger_1"],
3:["Weaponsmithing_Tier1_Dagger_1"],
4:["Weaponsmithing_Tier1_Dagger_2"],
5:["Weaponsmithing_Tier1_Dagger_2"],
6:["Weaponsmithing_Tier1_Dagger_2"],
7:["Weaponsmithing_Tier2_Dagger_3"],
8:["Weaponsmithing_Tier2_Dagger_3"],
9:["Weaponsmithing_Tier2_Dagger_3"],
10:["Weaponsmithing_Tier2_Dagger_3"],
11:["Weaponsmithing_Tier2_Dagger_3"],
12:["Weaponsmithing_Tier2_Dagger_3"],
13:["Weaponsmithing_Tier2_Dagger_3"],
14:["Weaponsmithing_Tier3_Dagger_4"],
15:["Weaponsmithing_Tier3_Dagger_4"],
16:["Weaponsmithing_Tier3_Dagger_4"],
17:["Weaponsmithing_Tier3_Dagger_4"],
18:["Weaponsmithing_Tier3_Dagger_4"],
19:["Weaponsmithing_Tier3_Dagger_4"],
20:["Weaponsmithing_Tier2_Refine_Basic"],
//19:["Dagger+4","Upgrade Grinder","Upgrade Smelter","Hire an additional Smelter"],
//20:["Craft Steel Blades and Barausk Hafts"],
},
},
{
taskName:"Alchemy",
level: {
0:["Alchemy_Tier0_Intro_1"],
1:["Alchemy_Tier1_Experiment_Rank2","Alchemy_Tier1_Experimentation_Rank1",],
2:["Alchemy_Tier1_Experiment_Rank3","Alchemy_Tier1_Experimentation_Rank2"],
3:["Alchemy_Tier1_Accuracy_Potion_Minor_Mass","Alchemy_Tier1_Reflexes_Potion_Minor_Mass","Alchemy_Tier1_Force_Potion_Minor_Mass","Alchemy_Tier1_Fortification_Potion_Minor_Mass","Alchemy_Tier1_Healing_Potion_Minor_Mass","Alchemy_Tier1_Rejuvenation_Potion_Minor_Mass","Alchemy_Tier1_Tidespan_Potion_Minor_Mass","Alchemy_Tier1_Force_Potion_Lesser_Mass","Alchemy_Tier1_Fortification_Potion_Lesser_Mass","Alchemy_Tier1_Rejuvenation_Potion_Lesser_Mass","Alchemy_Tier1_,ealing_Potion_Lesser_Mass","Alchemy_Tier1_Tidespan_Potion_Lesser_Mass","Alchemy_Tier1_Accuracy_Potion_Lesser_Mass","Alchemy_Tier1_Reflexes_Potion_Lesser_Mass","Alchemy_Tier1_Gather_Components"],
4:["Alchemy_Tier1_Gather_Components"],
5:["Alchemy_Tier1_Gather_Components"],
6:["Alchemy_Tier1_Gather_Components"],
7:["Alchemy_Tier1_Gather_Components"],
8:["Alchemy_Tier1_Gather_Components"],
9:["Alchemy_Tier1_Gather_Components"],
10:["Alchemy_Tier1_Gather_Components"],
11:["Alchemy_Tier1_Gather_Components"],
12:["Alchemy_Tier1_Gather_Components"],
13:["Alchemy_Tier1_Gather_Components"],
14:["Alchemy_Tier1_Gather_Components"],
15:["Alchemy_Tier1_Gather_Components"],
16:["Alchemy_Tier1_Gather_Components"],
17:["Alchemy_Tier1_Gather_Components"],
18:["Alchemy_Tier1_Gather_Components"],
19:["Alchemy_Tier1_Gather_Components"],
20:["Alchemy_Tier1_Gather_Components"],
//19:["Alchemical Research","Rank 20 Experimentation","Upgrade Mixologist","Upgrade Apothecary","Hire an additional Apothecary"],
//20:["Rank 20 Experimentation"],
},
},
];
// Load Settings
var settingnames = [
{name: 'paused', title: 'Pause Script', def: false, type:'checkbox', tooltip:'Disable All Automation'},
{name: 'debug', title: 'Enable Debug', def: false, type:'checkbox', tooltip:'Enable all debug output to console', onsave: function(newValue, oldValue) {console=newValue?unsafeWindow.console||fouxConsole:fouxConsole;}},
{name: 'optionals', title: 'Fill Optional Assets', def: true, type:'checkbox', tooltip:'Enable to include selecting the optional assets of tasks'},
{name: 'autopurchase', title: 'Auto Purchase Resources', def: true, type:'checkbox', tooltip:'Automatically purchase required resources from gateway shop (100 at a time)'},
{name: 'trainassets', title: 'Train Assets', def: true, type:'checkbox', tooltip:'Enable training/upgrading of asset worker resources'},
{name: 'refinead', title: 'Refine AD', def: true, type:'checkbox', tooltip:'Enable refining of AD on character switch'},
{name: 'autoreload', title: 'Auto Reload', def: false, type:'checkbox', tooltip:'Enabling this will reload the gateway periodically. (Ensure Auto Login is enabled)'},
{name: 'autologin', title: 'Attempt to login automatically', def: false, type:'checkbox', tooltip:'Automatically attempt to login to the neverwinter gateway site'},
{name: 'nw_username', title: ' Neverwinter Username', def: '', type:'text', tooltip:''},
{name: 'nw_password', title: ' Neverwinter Password', def: '', type:'password', tooltip:''},
{name: 'charcount', title: ' Number of Characters', def: '2', type:'text', tooltip:'Enter number of characters to use (reload page to update settings form)'},
];
// Load local settings cache (unsecured)
var settings = {};
for (var i = 0; i < settingnames.length; i++) {
// Ignore label types
if (settingnames[i].type === 'label') {
continue;
}
settings[settingnames[i].name] = GM_getValue(settingnames[i].name, settingnames[i].def);
// call the onsave for the setting if it exists
if (typeof(settingnames[i].onsave) === "function") {
console.log("Calling 'onsave' for", settingnames[i].name);
settingnames[i].onsave(settings[settingnames[i].name], settings[settingnames[i].name]);
}
}
if (settings["charcount"]<1) { settings["charcount"] = 1; }
if (settings["charcount"]>99) { settings["charcount"] = 99; }
var charSettings = [];
for (var i = 0; i < settings["charcount"]; i++) {
charSettings.push({name: 'nw_charname'+i, title: 'Character', def: 'Character '+(i+1), type:'text', tooltip:'Characters Name'});
charSettings.push({name: 'Leadership'+i, title: 'Leadership', def: '9', type:'text', tooltip:'Number of slots to assign to Leadership'});
charSettings.push({name: 'Armorsmithing_Med'+i, title: 'Mailsmithing', def: '0', type:'text', tooltip:'Number of slots to assign to Mailsmithing'});
charSettings.push({name: 'Armorsmithing_Heavy'+i, title: 'Platesmithing', def: '0', type:'text', tooltip:'Number of slots to assign to Platesmithing'});
charSettings.push({name: 'Leatherworking'+i, title: 'Leatherworking', def: '0', type:'text', tooltip:'Number of slots to assign to Leatherworking'});
charSettings.push({name: 'Tailoring'+i, title: 'Tailoring', def: '0', type:'text', tooltip:'Number of slots to assign to Tailoring'});
charSettings.push({name: 'Artificing'+i, title: 'Artificing', def: '0', type:'text', tooltip:'Number of slots to assign to Artificing'});
charSettings.push({name: 'Weaponsmithing'+i, title: 'Weaponsmithing', def: '0', type:'text', tooltip:'Number of slots to assign to Weaponsmithing'});
charSettings.push({name: 'Alchemy'+i, title: 'Alchemy', def: '0', type:'text', tooltip:'Number of slots to assign to Alchemy'});
// task settings are slightly different
charSettings.push({name: 'tasklist'+i, title: 'Task List', def: '', type:'void', tooltip:''});
}
for (var i = 0; i < charSettings.length; i++) {
settings[charSettings[i].name] = GM_getValue(charSettings[i].name, charSettings[i].def);
}
// Page Settings
var PAGES = Object.freeze({
LOGIN : { name: "Login", path: "div#login"},
GUARD : { name: "Account Guard", path: "div#page-accountguard"},
});
/**
* Uses the page settings to determine which page is currently displayed
*/
function GetCurrentPage() {
for each(var page in PAGES) {
if ($(page["path"]).filter(":visible").length) {
return page;
}
}
}
/**
* Logs in to gateway
* No client.dataModel exists at this stage
*/
function page_LOGIN() {
//if (!$("form > p.error:visible").length && settings["autologin"]) {
// No previous log in error - attempt to log in
console.log("Setting username");
$("input#user").val(settings["nw_username"]);
console.log("Setting password");
$("input#pass").val(settings["nw_password"]);
console.log("Clicking Login Button");
$("div#login > input").click();
//}
dfdNextRun.resolve(delay.LONG);
}
/**
* Action to perform on account guard page
*/
function page_GUARD() {
// Do nothing on the guard screen
dfdNextRun.resolve(delay.LONG);
}
/**
* Collects rewards for tasks or starts new tasks
* Function is called once per new task and returns true if an action is created
* If no action is started function returns false to switch characters
*/
function processCharacter() {
// Switch to professions page to show task progression
unsafeWindow.location.hash="#char("+encodeURI(unsafeWindow.client.getCurrentCharAtName())+")/professions";
// Collect rewards for completed tasks and restart
if (unsafeWindow.client.dataModel.model.ent.main.itemassignments.complete) {
unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.forEach(function(entry) {
if (entry.hascompletedetails) { unsafeWindow.client.professionTaskCollectRewards(entry.uassignmentid); }
});
dfdNextRun.resolve();
return true;
}
// Check for available slots and start new task
if (unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.filter(function(entry) { return (!entry.islockedslot && !entry.uassignmentid); }).length) {
// Go through the professions to assign tasks until specified slots filled
for (var i = 0; i < tasklist.length; i++) {
var currentTasks = unsafeWindow.client.dataModel.model.ent.main.itemassignments.assignments.filter(function(entry) { return entry.category == tasklist[i].taskName; });
if (currentTasks.length < settings[tasklist[i].taskName]) {
unsafeWindow.client.professionFetchTaskList('craft_' + tasklist[i].taskName);
unsafeWindow.client.dataModel.fetchVendor('Nw_Gateway_Professions_Merchant');
window.setTimeout(function() { createNextTask(tasklist[i], 0); }, delay.SHORT);
return true;
}
}
console.log("All task counts assigned");
}
else {
console.log("No available task slots");
}
// TODO: Add code to get next task finish time
return false;
}
/**
* Iterative approach to finding the next task to assign to an open slot.
*
* @param {Array} prof The tasklist for the profession being used
* @param {int} i The current task number being attempted
*/
function createNextTask(prof, i) {
// TODO: Use callback function
if (!unsafeWindow.client.dataModel.model.craftinglist || unsafeWindow.client.dataModel.model.craftinglist === null || !unsafeWindow.client.dataModel.model.craftinglist['craft_' + prof.taskName] || unsafeWindow.client.dataModel.model.craftinglist['craft_' + prof.taskName] === null) {
console.log('Task list not loaded for:', prof.taskName);
window.setTimeout(function() { createNextTask(prof, i); }, delay.SHORT);
return false;
}
// Check level
var level = unsafeWindow.client.dataModel.model.ent.main.itemassignmentcategories.categories.filter(function(entry) { return entry.name == prof.taskName; })[0].currentrank;
var list = prof.level[level];
if (list.length <=i) {
console.log("Nothing Found");
switchChar();
return false;
}
console.log(prof.taskName, "is level", level);
console.log("createNextTask", list.length, i);
var taskName = list[i];
console.log("Searching for task:", taskName);
// Search for task to start
var task = searchForTask(taskName, prof.taskName);
/** TODO: Use this code once below can be replaced properly
if (task === null) {
console.log("Skipping task selection to purchase resources");
dfdNextRun.resolve();
}
else if (task) {
startTask(task);
dfdNextRun.resolve();
}
else {
console.log('Finding next task');
createNextTask(prof, i+1);
}
**/
// Finish createNextTask function
if (task === null) {
console.log("Skipping task selection to purchase resources");
dfdNextRun.resolve();
return true;
}
if (task) {
task = '/professions-tasks/' + prof.taskName + '/' + task.def.name;
console.log('Task Found');
unsafeWindow.location.hash = unsafeWindow.location.hash.replace(/\)\/.+/,')' + task);
WaitForState("div.page-professions-taskdetails").done(function() {
// Click all buttons and select an item to use in the slot
var def = $.Deferred();
var buttonList = $("h3:contains('Optional Assets:')").closest("div").find("button");
if (buttonList.length && settings["optionals"]) {
SelectItemFor(buttonList, 0, def, prof);
}
else {
def.resolve();
}
def.done(function() {
// All items are populated
console.log("Items Populated");
// Click the Start Task Button
//Get the start task button if it is enabled
var enabledButton = $("div.footer-body > div.input-field.button:not('.disabled') > button:contains('Start Task')");
if (enabledButton.length) {
console.log("Clicking Start Task Button");
enabledButton.click();
WaitForState("").done(function() {
// Done
dfdNextRun.resolve(delay.SHORT);
});
return true;
}
else { // Button not enabled, something required was probably missing
// Go back
$("div.footer-body > div.input-field.button > button:contains('Back')").click();
WaitForState("").done(function() {
// continue with the next one
console.log('Finding next task');
createNextTask(prof, i+1);
});
}
});
});
}
else {
console.log('Finding next task');
createNextTask(prof, i+1);
}
}
/**
* Checks task being started for requirements and initiates beginning task if found
*
* @param {string} taskname The name of the task being started
* @param {string} profname The name of the profession being used
* @param {Deferred} dfd Deferred object to process on return
*/
function searchForTask(taskname, profname) {
// Return first object that matches exact craft name
var thisTask = unsafeWindow.client.dataModel.model.craftinglist['craft_' + profname].entries.filter(function(entry) {
return entry.def && entry.def.name == taskname;
})[0];
// If no task is returned we either have three of this task already, the task is a rare that doesn't exist currently, or we have the name wrong in tasklist
if (!thisTask) {
console.log('Could not find task for:', taskname);
return false;
}
// start task if requirements are met
if (!thisTask.failedrequirementsreasons.length) {
return thisTask;
}
// Too high level
if (thisTask.failslevelrequirements) {
console.log("Task level is too high:", taskname);
return false;
}
var searchItem = null;
var searchAsset = false;
// Missing assets or ingredients
if (thisTask.failsresourcesrequirements) {
var failedAssets = thisTask.required.filter(function(entry) { return !entry.fillsrequirements; });
// Missing required assets
if (failedAssets.length) {
var failedCrafter = failedAssets.filter(function(entry) { return entry.categories.indexOf("Person") >= 0; });
if (failedCrafter.length && settings["trainassets"]) {
console.log("Found required asset:", failedCrafter[0].icon);
searchItem = failedCrafter[0].icon;
searchAsset = true;
}
else {
// TODO: Automatically purchase item assets from shop
console.log("Not enough assets for task:", taskname);
return false;
}
}
// Check for craftable or buyable ingredients
else {
var failedResources = thisTask.consumables.filter(function(entry) { return entry.required && !entry.fillsrequirements; });
// Check first required ingredient only
// If it fails to buy or craft task cannot be completed anyway
// If it succeeds script will search for tasks anew
var itemName = failedResources[0].hdef.match(/\[(\w+)\]/)[1];
// purchase buyable resources
if (itemName.match(/^Crafting_Resource_(Charcoal|Rocksalt|Spool_Thread|Porridge|Solvent|Brimstone|Coal|Moonseasalt|Quicksilver|Spool_Threadsilk)$/)) {
if (settings["autopurchase"]) {
buyResource(itemName);
return null;
}
else {
console.log("Buyable resource required for:", taskname);
return false;
}
}
// craft ingredient items
else {
console.log("Found required ingredient:", itemName);
searchItem = itemName;