-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathWQAchievements.lua
2034 lines (1861 loc) · 54.3 KB
/
WQAchievements.lua
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
---@class WQAchievements
local WQA = WQAchievements
local LibQTip = LibStub("LibQTip-1.0")
-- Blizzard
local IsActive = C_TaskQuest.IsActive
local GetQuestTagInfo = C_QuestLog.GetQuestTagInfo
local GetBountiesForMapID = C_QuestLog.GetBountiesForMapID
local GetTitleForQuestID = C_QuestLog.GetTitleForQuestID
local GetCurrencyLink = C_CurrencyInfo.GetCurrencyLink
local IsQuestFlaggedCompleted = C_QuestLog.IsQuestFlaggedCompleted
local L = WQA.L
local newOrder
do
local current = 0
function newOrder()
current = current + 1
return current
end
end
WQA.data.custom = { wqID = "", rewardID = "", rewardType = "none", questType = "WORLD_QUEST" }
WQA.data.custom.mission = { missionID = "", rewardID = "", rewardType = "none" }
--WQA.data.customReward = 0
local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local dataobj =
ldb:NewDataObject(
"WQAchievements",
{
type = "data source",
text = "WQA",
icon = "Interface\\Icons\\INV_Misc_Map06"
}
)
local icon = LibStub("LibDBIcon-1.0")
function WQA:OnInitialize()
-- Remove data for the other faction
local faction = UnitFactionGroup("player")
for k, v in pairs(self.data) do
for kk, vv in pairs(v) do
if type(vv) == "table" then
for kkk, vvv in pairs(vv) do
if vvv.faction and not (vvv.faction == faction) then
self.data[k][kk][kkk] = nil
end
end
end
end
end
self.faction = faction
-- Defaults
local defaults = {
char = {
["*"] = {
["profession"] = {
["*"] = {
isMaxLevel = true
}
}
}
},
profile = {
options = {
["*"] = true,
chat = true,
PopUp = false,
popupRememberPosition = false,
popupX = 600,
popupY = 800,
zone = { ["*"] = true },
reward = {
gear = {
["*"] = true,
itemLevelUpgradeMin = 1,
PercentUpgradeMin = 1,
unknownSource = false,
azeriteTraits = "",
conduit = false
},
general = {
gold = false,
goldMin = 0,
worldQuestType = {
["*"] = true
}
},
reputation = { ["*"] = false },
currency = {},
craftingreagent = { ["*"] = false },
["*"] = {
["*"] = true,
profession = {
["*"] = {
skillup = true
}
}
}
},
emissary = { ["*"] = false },
missionTable = {
reward = {
gold = false,
goldMin = 0,
["*"] = {
["*"] = false
}
}
},
delay = 5,
LibDBIcon = { hide = false }
},
["achievements"] = { exclusive = {}, ["*"] = "default" },
["mounts"] = { exclusive = {}, ["*"] = "default" },
["pets"] = { exclusive = {}, ["*"] = "default" },
["toys"] = { exclusive = {}, ["*"] = "default" },
custom = {
["*"] = { ["*"] = true }
},
["*"] = { ["*"] = true }
},
global = {
completed = { ["*"] = false },
custom = {
["*"] = { ["*"] = false }
}
}
}
self.db = LibStub("AceDB-3.0"):New("WQADB", defaults, true)
-- copy old data
if type(self.db.global.custom) == "table" then
for k, v in pairs(self.db.global.custom) do
if type(k) == "number" then
self.db.global.custom.worldQuest[k] = v
self.db.global.custom[k] = nil
end
end
end
if type(self.db.global.customReward) == "table" then
for k, v in pairs(self.db.global.customReward) do
self.db.global.custom.worldQuestReward[k] = true
end
self.db.global.customReward = nil
end
-- Minimap Icon
icon:Register("WQAchievements", dataobj, self.db.profile.options.LibDBIcon)
end
function WQA:OnEnable()
local name, server = UnitFullName("player")
self.playerName = name .. "-" .. server
------------------
-- Options
------------------
LibStub("AceConfig-3.0"):RegisterOptionsTable(
"WQAchievements",
function()
return self:GetOptions()
end
)
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("WQAchievements", "WQAchievements")
local profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
LibStub("AceConfig-3.0"):RegisterOptionsTable("WQAProfiles", profiles)
self.optionsFrame.Profiles =
LibStub("AceConfigDialog-3.0"):AddToBlizOptions("WQAProfiles", "Profiles", "WQAchievements")
self.event = CreateFrame("Frame")
self.event:RegisterEvent("PLAYER_ENTERING_WORLD")
self.event:RegisterEvent("GARRISON_MISSION_LIST_UPDATE")
self.event:SetScript(
"OnEvent",
function(...)
local _, name, id = ...
if name == "PLAYER_ENTERING_WORLD" then
self:ScheduleTimer(
function()
for i = 1, #self.ZoneIDList do
for _, mapID in pairs(self.ZoneIDList[i]) do
if self.db.profile.options.zone[mapID] == true then
local quests = C_TaskQuest.GetQuestsOnMap(mapID)
if quests then
for j = 1, #quests do
local questID = quests[j].questID
local numQuestRewards = GetNumQuestLogRewards(questID)
if numQuestRewards > 0 then
GetQuestLogRewardInfo(1, questID)
end
end
end
end
end
end
end,
self.db.profile.options.delay
)
self.event:UnregisterEvent("PLAYER_ENTERING_WORLD")
self:ScheduleTimer("Show", self.db.profile.options.delay + 1, nil, true)
self:ScheduleTimer(
function()
self:Show("new", true)
self:ScheduleRepeatingTimer("Show", 30 * 60, "new", true)
end,
(32 - (date("%M") % 30)) * 60
)
elseif name == "QUEST_LOG_UPDATE" or name == "GET_ITEM_INFO_RECEIVED" then
self.event:UnregisterEvent("QUEST_LOG_UPDATE")
self.event:UnregisterEvent("GET_ITEM_INFO_RECEIVED")
self:CancelTimer(self.timer)
if GetTime() - self.start > 1 then
self:Reward()
else
self:ScheduleTimer("Reward", 1)
end
elseif name == "PLAYER_REGEN_ENABLED" then
self.event:UnregisterEvent("PLAYER_REGEN_ENABLED")
self:Show("new", true)
elseif name == "QUEST_TURNED_IN" then
self.db.global.completed[id] = true
elseif name == "GARRISON_MISSION_LIST_UPDATE" then
self:CheckMissions()
end
end
)
C_AddOns.LoadAddOn("Blizzard_GarrisonUI")
end
WQA:RegisterChatCommand("wqa", "slash")
function WQA:slash(input)
local arg1 = string.lower(input)
if arg1 == "" then
--self:CheckWQ()
self:Show()
elseif arg1 == "new" then
self:Show("new")
elseif arg1 == "popup" then
self:Show("popup")
end
end
function WQA:CreateQuestList()
self:Debug("CreateQuestList")
self.questList = {}
self.questPinList = {}
self.questPinMapList = {}
self.missionList = {}
self.questFlagList = {}
self.Criterias.AreaPoi.list = {}
for expansionID = 7, 11 do
local data = self.data[expansionID]
if (data.achievements) then
for _, v in pairs(data.achievements) do
self.Achievements:Register(v)
end
end
if (data.mounts) then
self:AddMounts(data.mounts)
end
if (data.pets) then
self:AddPets(data.pets)
end
if (data.toys) then
self:AddToys(data.toys)
end
if (data.miscellaneous) then
-- self:AddMiscellaneous(data.miscellaneous)
end
end
self:AddCustom()
self:Special()
self:Reward()
self:EmissaryReward()
end
function WQA:AddMounts(mounts)
for i, id in pairs(C_MountJournal.GetMountIDs()) do
local n, spellID, _, _, _, _, _, _, _, _, isCollected = C_MountJournal.GetMountInfoByID(id)
local forced = false
if
not (self.db.profile.mounts[spellID] == "disabled" or
(self.db.profile.mounts[spellID] == "exclusive" and self.db.profile.mounts.exclusive[spellID] ~= self.playerName))
then
if self.db.profile.mounts[spellID] == "always" then
forced = true
end
if not isCollected or forced then
for _, mount in pairs(mounts) do
if spellID == mount.spellID then
for _, v in pairs(mount.quest) do
if not IsQuestFlaggedCompleted(v.trackingID or 0) then
self:AddRewardToQuest(v.wqID, "CHANCE", mount.itemID)
end
end
end
end
end
end
end
end
function WQA:AddPets(pets)
local total = C_PetJournal.GetNumPets()
for i = 1, total do
local petID, _, owned, _, _, _, _, _, _, _, companionID = C_PetJournal.GetPetInfoByIndex(i)
local forced = false
if
not (self.db.profile.pets[companionID] == "disabled" or
(self.db.profile.pets[companionID] == "exclusive" and self.db.profile.pets.exclusive[companionID] ~= self.playerName))
then
if self.db.profile.pets[companionID] == "always" then
forced = true
end
if not owned or forced then
for _, pet in pairs(pets) do
if companionID == pet.creatureID then
if pet.emissary == true then
self:AddEmissaryReward(pet.questID, "CHANCE", pet.itemID)
end
if pet.source and pet.source.type == "ITEM" then
self.itemList[pet.source.itemID] = true
end
if pet.questID then
self:AddRewardToQuest(pet.questID, "CHANCE", pet.itemID)
end
if pet.quest then
for _, v in pairs(pet.quest) do
if not IsQuestFlaggedCompleted(v.trackingID) then
self:AddRewardToQuest(v.wqID, "CHANCE", pet.itemID)
end
end
end
break
end
end
end
end
end
end
function WQA:AddToys(toys)
for _, toy in pairs(toys) do
local itemID = toy.itemID
local forced = false
if
not (self.db.profile.toys[itemID] == "disabled" or
(self.db.profile.toys[itemID] == "exclusive" and self.db.profile.toys.exclusive[itemID] ~= self.playerName))
then
if self.db.profile.toys[itemID] == "always" then
forced = true
end
if not PlayerHasToy(toy.itemID) or forced then
if toy.source and toy.source.type == "ITEM" then
self.itemList[toy.source.itemID] = true
else
if toy.questID then
self:AddRewardToQuest(toy.questID, "CHANCE", toy.itemID)
else
for _, v in pairs(toy.quest) do
if not IsQuestFlaggedCompleted(v.trackingID) then
self:AddRewardToQuest(v.wqID, "CHANCE", toy.itemID)
end
end
end
end
end
end
end
end
function WQA:AddCustom()
-- Custom World Quests
if type(self.db.global.custom.worldQuest) == "table" then
for questID, v in pairs(self.db.global.custom.worldQuest) do
if self.db.profile.custom.worldQuest[questID] == true then
self:AddRewardToQuest(questID, "CUSTOM")
if v.questType == "QUEST_FLAG" then
self.questFlagList[questID] = true
elseif v.questType == "QUEST_PIN" and v.mapID then
C_QuestLine.RequestQuestLinesForMap(v.mapID)
self.questPinMapList[v.mapID] = true
self.questPinList[questID] = true
end
end
end
end
-- Custom Missions
if type(self.db.global.custom.mission) == "table" then
for k, v in pairs(self.db.global.custom.mission) do
if self.db.profile.custom.mission[k] == true then
self:AddRewardToMission(k, "CUSTOM")
end
end
end
end
function WQA:AddRewardToMission(missionID, rewardType, reward)
if not self.missionList[missionID] then
self.missionList[missionID] = {}
end
local l = self.missionList[missionID]
self:AddReward(l, rewardType, reward)
end
function WQA:AddRewardToQuest(questID, rewardType, reward, emissary)
if not self.questList[questID] then
self.questList[questID] = {}
end
local l = self.questList[questID]
self:AddReward(l, rewardType, reward, emissary)
end
function WQA:AddEmissaryReward(questID, rewardType, reward)
self:AddRewardToQuest(questID, rewardType, reward, true)
end
WQA.first = false
function WQA:Show(mode, auto)
if auto and self.db.profile.options.delayCombat == true and UnitAffectingCombat("player") then
self.event:RegisterEvent("PLAYER_REGEN_ENABLED")
return
end
self:Debug("Show", mode)
self:CreateQuestList()
self:CheckWQ(mode)
self.first = true
end
function WQA:CheckWQ(mode)
self:Debug("CheckWQ")
if self.rewards ~= true or self.emissaryRewards ~= true then
self:Debug("NoRewards")
self:ScheduleTimer("CheckWQ", .4, mode)
return
end
local activeQuests = {}
local newQuests = {}
local retry = false
for questID, _ in pairs(self.questList) do
if
IsActive(questID) or self:EmissaryIsActive(questID) or self:isQuestPinActive(questID) or
self:IsQuestFlaggedCompleted(questID)
then
local questLink = self:GetTaskLink({ id = questID, type = "WORLD_QUEST" })
local link
for k, v in pairs(self.questList[questID].reward) do
if k == "custom" or k == "professionSkillup" or k == "gold" then
link = true
else
link = self:GetRewardLinkByID(questID, k, v, 1)
end
if not link then
self:Debug(questID, k, v, 1)
retry = true
else
self:SetRewardLinkByID(questID, k, v, 1, link)
end
if k == "achievement" or k == "chance" or k == "azeriteTraits" then
for i = 2, #v do
link = self:GetRewardLinkByID(questID, k, v, i)
if not link then
self:Debug(questID, k, v, i)
retry = true
else
self:SetRewardLinkByID(questID, k, v, i, link)
end
end
end
end
if (not questLink or not link) then
self:Debug(questID, questLink, link)
retry = true
else
activeQuests[questID] = true
if not self.watched[questID] then
newQuests[questID] = true
end
end
end
end
local activeMissions = self:CheckMissions()
local newMissions = {}
if type(activeMissions) == "table" then
for missionID, _ in pairs(activeMissions) do
local link = false
for k, v in pairs(self.missionList[missionID].reward) do
if k == "custom" or k == "professionSkillup" or k == "gold" then
link = true
else
link = self:GetRewardLinkByMissionID(missionID, k, v, 1)
end
if not link then
retry = true
else
self:SetRewardLinkByMissionID(missionID, k, v, 1, link)
end
end
if not link then
retry = true
else
if not self.watchedMissions[missionID] then
newMissions[missionID] = true
end
end
end
else
retry = true
end
local pois = self.Criterias.AreaPoi:Check()
if pois.retry then
retry = true
end
if retry == true then
self:Debug("NoLink")
self:ScheduleTimer("CheckWQ", 1, mode)
return
end
self.activeTasks = {}
for id in pairs(activeQuests) do
table.insert(self.activeTasks, { id = id, type = "WORLD_QUEST" })
end
for id in pairs(activeMissions) do
table.insert(self.activeTasks, { id = id, type = "MISSION" })
end
for poiId, mapIds in pairs(pois.active) do
for mapId in pairs(mapIds) do
table.insert(self.activeTasks, { id = poiId, mapId = mapId, type = "AREA_POI" })
end
end
self.activeTasks = self:SortQuestList(self.activeTasks)
self.newTasks = {}
for id in pairs(newQuests) do
self.watched[id] = true
table.insert(self.newTasks, { id = id, type = "WORLD_QUEST" })
end
for id in pairs(newMissions) do
self.watchedMissions[id] = true
table.insert(self.newTasks, { id = id, type = "MISSION" })
end
for poiId, mapIds in pairs(pois.new) do
for mapId in pairs(mapIds) do
if not self.Criterias.AreaPoi.watched[poiId] then
self.Criterias.AreaPoi.watched[poiId] = {}
end
self.Criterias.AreaPoi.watched[poiId][mapId] = true
table.insert(self.newTasks, { id = poiId, mapId = mapId, type = "AREA_POI" })
end
end
if mode == "new" then
self:AnnounceChat(self.newTasks, self.first)
if self.db.profile.options.PopUp == true then
self:AnnouncePopUp(self.newTasks, self.first)
end
elseif mode == "popup" then
self:AnnouncePopUp(self.activeTasks)
elseif mode == "LDB" then
self:AnnounceLDB(self.activeTasks)
else
self:AnnounceChat(self.activeTasks)
if self.db.profile.options.PopUp == true then
self:AnnouncePopUp(self.activeTasks)
end
end
self:UpdateLDBText(next(self.activeTasks), next(self.newTasks))
end
function WQA:link(x)
if not x then
return ""
end
local t = string.upper(x.type)
if t == "ACHIEVEMENT" then
return GetAchievementLink(x.id)
elseif t == "ITEM" then
return select(2, GetItemInfo(x.id))
else
return ""
end
end
function WQA:GetRewardForID(questID, key, type)
local l
if type == "MISSION" then
l = self.missionList[questID].reward
else
l = self.questList[questID].reward
end
local r = ""
if l then
if l.item then
if l.item then
if l.item.transmog then
r = r .. l.item.transmog
end
if l.item.itemLevelUpgrade then
if r ~= "" then
r = r .. " "
end
r = r .. "|cFF00FF00+" .. l.item.itemLevelUpgrade .. " iLvl|r"
end
if l.item.itemPercentUpgrade then
if r ~= "" then
r = r .. ", "
end
r = r .. "|cFF00FF00+" .. l.item.itemPercentUpgrade .. "%|r"
end
if l.item.AzeriteArmorCache then
for i = 1, 5, 2 do
local upgrade = l.item.AzeriteArmorCache[i]
if upgrade > 0 then
r = r .. "|cFF00FF00+" .. upgrade .. " iLvl|r"
elseif upgrade < 0 then
r = r .. "|cFFFF0000" .. upgrade .. " iLvl|r"
else
r = r .. "±" .. upgrade
end
if i ~= 5 then
r = r .. " / "
end
end
end
if l.item.cache then
local cache = l.item.cache
local upgradeChance = cache.upgradeNum / cache.n
upgradeChance = 1 / 2 * upgradeChance + .5
upgradeChance = string.format("%X", (1 - upgradeChance) * 255)
if string.len(upgradeChance) == 1 then
upgradeChance = "0" .. upgradeChance
end
r =
r ..
"|cFF" ..
upgradeChance ..
"FF" ..
upgradeChance .. cache.upgradeNum .. "/" .. cache.n .. " max +" .. cache.upgradeMax .. "|r"
local item = {
itemLink = itemLink,
cache = { upgradeNum = upgradeNum, n = n, upgradeMax = upgradeMax }
}
end
end
r = l.item.itemLink .. " " .. r
end
if l.currency and key ~= "item" then
r = r .. l.currency.amount .. " " .. l.currency.name
end
end
return r
end
function WQA:AnnounceChat(tasks, silent)
if self.db.profile.options.chat == false then
return
end
if next(tasks) == nil then
if silent ~= true then
print(L["NO_QUESTS"])
end
return
end
local output = L["WQChat"]
print(output)
local expansion, zoneID
for _, task in ipairs(tasks) do
local text, i = "", 0
if self.db.profile.options.chatShowExpansion == true then
if self:GetExpansion(task) ~= expansion then
expansion = self:GetExpansion(task)
print(self:GetExpansionName(expansion))
end
end
if self.db.profile.options.chatShowZone == true then
if self:GetTaskZoneID(task) ~= zoneID then
zoneID = self:GetTaskZoneID(task)
print(self:GetTaskZoneName(task))
end
end
local l
if task.type == "WORLD_QUEST" then
l = self.questList[task.id]
elseif task.type == "MISSION" then
l = self.missionList[task.id]
elseif task.type == "AREA_POI" then
l = self.Criterias.AreaPoi.list[task.id][task.mapId]
end
local rewards = l.reward
local more
for k, v in pairs(rewards) do
local rewardText = self:GetRewardTextByID(task.id, k, v, 1, task.type)
if k == "achievement" or k == "chance" or k == "azeriteTraits" then
for j = 2, 3 do
local t = self:GetRewardTextByID(task.id, k, v, j, task.type)
if t then
rewardText = rewardText .. " & " .. t
end
end
if self:GetRewardTextByID(task.id, k, v, 4, task.type) then
more = true
end
end
i = i + 1
if i > 1 then
text = text .. " & " .. rewardText
else
text = rewardText
end
end
if more == true then
text = text .. " & ..."
end
if self.db.profile.options.chatShowTime then
output = " " ..
string.format(L["WQforAchTime"], self:GetTaskLink(task), self:formatTime(self:GetTaskTime(task)), text)
else
output = " " .. string.format(L["WQforAch"], self:GetTaskLink(task), text)
end
print(output)
end
end
local inspectScantip = CreateFrame("GameTooltip", "WorldQuestListInspectScanningTooltip", nil, "GameTooltipTemplate")
inspectScantip:SetOwner(UIParent, "ANCHOR_NONE")
local EquipLocToSlot1 = {
INVTYPE_HEAD = 1,
INVTYPE_NECK = 2,
INVTYPE_SHOULDER = 3,
INVTYPE_BODY = 4,
INVTYPE_CHEST = 5,
INVTYPE_ROBE = 5,
INVTYPE_WAIST = 6,
INVTYPE_LEGS = 7,
INVTYPE_FEET = 8,
INVTYPE_WRIST = 9,
INVTYPE_HAND = 10,
INVTYPE_FINGER = 11,
INVTYPE_TRINKET = 13,
INVTYPE_CLOAK = 15,
INVTYPE_WEAPON = 16,
INVTYPE_SHIELD = 17,
INVTYPE_2HWEAPON = 16,
INVTYPE_WEAPONMAINHAND = 16,
INVTYPE_RANGED = 16,
INVTYPE_RANGEDRIGHT = 16,
INVTYPE_WEAPONOFFHAND = 17,
INVTYPE_HOLDABLE = 17,
INVTYPE_TABARD = 19
}
local EquipLocToSlot2 = {
INVTYPE_FINGER = 12,
INVTYPE_TRINKET = 14,
INVTYPE_WEAPON = 17
}
local ReputationItemList = {
-- Army of the Light Insignia
[152957] = 2165,
[152955] = 2165,
[152956] = 2165,
[152958] = 2165,
[152960] = 2170,
-- Argussian Reach Insignia
[152954] = 2170,
[152959] = 2170,
[152961] = 2170,
[141342] = 1894,
-- The Wardens
[139025] = 1894,
[141991] = 1894,
[147415] = 1894,
[150929] = 1894,
[146945] = 1894,
[146939] = 1894,
[141340] = 1900,
-- Court of Farondis
[139023] = 1900,
[147410] = 1900,
[141989] = 1900,
[150927] = 1900,
[146937] = 1900,
[146943] = 1900,
[139021] = 1883,
-- Dreamweavers
[141988] = 1883,
[147411] = 1883,
[141339] = 1883,
[150926] = 1883,
[146942] = 1883,
[146936] = 1883,
-- Highmountain Tribe
[141341] = 1828,
[139024] = 1828,
[141990] = 1828,
[147412] = 1828,
[150928] = 1828,
[146944] = 1828,
[146938] = 1828,
-- Valarjar
[139020] = 1948,
[141338] = 1948,
[141987] = 1948,
[147414] = 1948,
[146935] = 1948,
[146941] = 1948,
[150925] = 1948,
-- The Nightfallen
[141343] = 1859,
[141992] = 1859,
[139026] = 1859,
[147413] = 1859,
[150930] = 1859,
[146940] = 1859,
[146946] = 1859
}
local ReputationCurrencyList = {
[1579] = 2164, -- Champions of Azeroth
[1598] = 2163, -- Tortollan Seekers
[1593] = 2160, -- Proudmoore Admiralty
[1592] = 2161, -- Order of Embers
[1594] = 2162, -- Storm's Wake
[1599] = 2159, -- 7th Legion
[1597] = 2103, -- Zandalari Empire
[1595] = 2156, -- Talanji's Expedition
[1596] = 2158, -- Voldunai
[1600] = 2157, -- The Honorbound
[1742] = 2391, -- Rustbolt Resistance
[1739] = 2400, -- Waveblade Ankoan
[1757] = 2417, -- Uldum Accord
[1758] = 2415, -- Rajani
[1738] = 2373, -- The Unshackled
[1807] = 2413, -- Court of Harvesters
[1907] = 2470, -- Death's Advance
[1804] = 2407, -- The Ascended
[1982] = 2478, -- The Enlightened
[1805] = 2410, -- The Undying Army
[1806] = 2465, -- The Wild Hunt
[1880] = 2432, -- Ve'nari
[2819] = 2615, -- Azerothian Archives
[2031] = 2507, -- Dragonscale Expedition
[2652] = 2574, -- Dream Wardens
[2109] = 2511, -- Iskaara Tuskarr
[2420] = 2564, -- Loamm Niffen
[2108] = 2503, -- Maruuk Centaur
[2106] = 2510, -- Valdrakken Accord
[2902] = 2594, -- The Assembly of the Deeps
[2899] = 2570, -- Hallowfall Arathi
[2903] = 2600, -- The Severed Threads
[2897] = 2590 -- Council of Dornogal
}
function WQA:Reward()
self:Debug("Reward")
self.event:UnregisterEvent("QUEST_LOG_UPDATE")
self.event:UnregisterEvent("GET_ITEM_INFO_RECEIVED")
self.rewards = false
local retry = false
-- Azerite Traits
if self.db.profile.options.reward.gear.azeriteTraits ~= "" then
self.azeriteTraitsList = {}
for spellID in string.gmatch(self.db.profile.options.reward.gear.azeriteTraits, "(%d+)") do
self.azeriteTraitsList[tonumber(spellID)] = true
end
end
for i in pairs(self.ZoneIDList) do
for _, mapID in pairs(self.ZoneIDList[i]) do
if self.db.profile.options.zone[mapID] == true then
local quests = C_TaskQuest.GetQuestsOnMap(mapID)
if quests then
for i = 1, #quests do
local questID = quests[i].questID
local questTagInfo = GetQuestTagInfo(questID)
local worldQuestType = 0
if questTagInfo then
worldQuestType = questTagInfo.worldQuestType
end
if self.questList[questID] and not self.db.profile.options.reward.general.worldQuestType[worldQuestType] then
self.questList[questID] = nil
end
if
self.db.profile.options.zone[C_TaskQuest.GetQuestZoneID(questID)] == true and
self.db.profile.options.reward.general.worldQuestType[worldQuestType]
then
-- 100 different World Quests achievements
if QuestUtils_IsQuestWorldQuest(questID) and not self.db.global.completed[questID] then
local zoneID = C_TaskQuest.GetQuestZoneID(questID)
local exp = 0
for expansion, zones in pairs(WQA.ZoneIDList) do
for _, v in pairs(zones) do
if zoneID == v then
exp = expansion
end
end
end
if
self.db.profile.achievements[11189] ~= "disabled" and not select(4, GetAchievementInfo(11189)) and exp == 7 and
mapID ~= 830 and
mapID ~= 885 and
mapID ~= 882
then
self:AddRewardToQuest(questID, "ACHIEVEMENT", 11189)
elseif
self.db.profile.achievements[13144] ~= "disabled" and not select(4, GetAchievementInfo(13144)) and exp == 8
then
self:AddRewardToQuest(questID, "ACHIEVEMENT", 13144)
elseif
self.db.profile.achievements[14758] ~= "disabled" and not select(4, GetAchievementInfo(14758)) and exp == 9
then
self:AddRewardToQuest(questID, "ACHIEVEMENT", 14758)
end
end
if HaveQuestData(questID) and not HaveQuestRewardData(questID) then
C_TaskQuest.RequestPreloadRewardData(questID)
retry = true
end
retry = self:CheckItems(questID) or retry
self:CheckCurrencies(questID)
-- Profession
local tradeskillLineID
if questTagInfo then
tradeskillLineID = GetQuestTagInfo(questID).tradeskillLineID
end
if tradeskillLineID then
local professionName = C_TradeSkillUI.GetTradeSkillDisplayName(tradeskillLineID)
local zoneID = C_TaskQuest.GetQuestZoneID(questID)
local exp = 0
for expansion, zones in pairs(WQA.ZoneIDList) do
for _, v in pairs(zones) do
if zoneID == v then
exp = expansion
end
end
end
if
not self.db.char[exp].profession[tradeskillLineID].isMaxLevel and
self.db.profile.options.reward[exp].profession[tradeskillLineID].skillup
then
self:AddRewardToQuest(questID, "PROFESSION_SKILLUP", professionName)