Mercurial > wow > worldplan
comparison Map.lua @ 121:1fcc4fe645dc tip
- Removed legionfall war supplies from the list of reward currencies to display
author | Nenue |
---|---|
date | Fri, 16 Feb 2018 14:27:59 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
120:c9b4e33d4d93 | 121:1fcc4fe645dc |
---|---|
1 | |
2 local _, db = ... | |
3 local print = DEVIAN_WORKSPACE and function(...) _G.print('Map', ...) end or function() end | |
4 | |
5 | |
6 WorldPlanMapMixin = {} | |
7 local Map = WorldPlanMapMixin | |
8 local wmf = WorldMapFrame | |
9 | |
10 local ArgusPins = {} | |
11 | |
12 function Map:OnLoad() | |
13 | |
14 tinsert(db.modules, self) | |
15 --hooksecurefunc("WorldMap_SetupWorldQuestButton", function(taskPOI, ...) | |
16 -- self:OnSetupWorldQuestButton(taskPOI, ...) | |
17 --end) | |
18 | |
19 --WorldMapFrame:UnregisterAllEvents() | |
20 | |
21 | |
22 hooksecurefunc("WorldMap_QuantizeWorldQuestPOIs", function(...) | |
23 self:OnWorldMap_QuantizeWorldQuestPOIs(...) | |
24 end) | |
25 | |
26 hooksecurefunc("WorldMapPOIFrame_AnchorPOI", function(taskPOI, ...) | |
27 self:OnWorldMapPOIFrame_AnchorPOI(taskPOI, ...) | |
28 end) | |
29 | |
30 hooksecurefunc("WorldMapFrame_Update", function() | |
31 self:OnWorldMapPOIFrame_Update() | |
32 end) | |
33 end | |
34 | |
35 function Map:OnWorldMapPOIFrame_Update() | |
36 | |
37 | |
38 | |
39 local map = GetCurrentMapAreaID() | |
40 _G.print('WQRefresh', '|cFF88FF00WorldMapFrame_Update()|r', map) | |
41 if map == 1007 then | |
42 _G.print('WQRefresh', 'is a continent map') | |
43 self:Update('WorldMapFrame_Update') | |
44 end | |
45 | |
46 end | |
47 | |
48 function Map:OnWorldMap_QuantizeWorldQuestPOIs(pois) | |
49 --_G.print('WQRefresh', '|cFF88FF00WorldMap_QuantizeWorldQuestPOIs()|r') | |
50 for k, worldQuestPOI in pairs(pois) do | |
51 --print(worldQuestPOI.questID, worldQuestPOI:GetPoint(1)) | |
52 WorldMapPOIFrame_AnchorPOI(worldQuestPOI, worldQuestPOI.quantizedX or worldQuestPOI.x, worldQuestPOI.quantizedY or worldQuestPOI.y, WORLD_MAP_POI_FRAME_LEVEL_OFFSETS.WORLD_QUEST); | |
53 end | |
54 end | |
55 function Map:OnWorldMapPOIFrame_AnchorPOI(taskPOI, x, y, level) | |
56 --_G.print('WQRefresh','|cFF88FF00OnWorldMapPOIFrame_AnchorPOI()|r', taskPOI:GetName()) | |
57 taskPOI.lastAnchor = time() | |
58 end | |
59 | |
60 function Map:OnSetupWorldQuestButton(taskPOI, ...) | |
61 | |
62 _G.print('WQRefresh','SetupWorldQuestButton()', taskPOI.questID) | |
63 end | |
64 | |
65 | |
66 local usedPOI = {} | |
67 function Map:Update(source) | |
68 local existingPOI = db.pins.id | |
69 print('|cFF00FFFF' .. (source or '?'), '->Refresh()', NUM_WORLDMAP_TASK_POIS) | |
70 wipe(usedPOI) | |
71 for index = 1, 100 do | |
72 | |
73 local poi = _G["WorldMapFrameTaskPOI"..index]; | |
74 if poi and poi.worldQuest and poi.questID then | |
75 print(index, 'used by #', poi.questID) | |
76 existingPOI[poi.questID] = poi | |
77 end | |
78 end | |
79 local poiIndex = NUM_WORLDMAP_TASK_POIS | |
80 local quests = db.pins.current | |
81 for questID, info in pairs(quests) do | |
82 | |
83 local msg = 'Q #' .. questID .. ' ' .. (existingPOI[questID] and '(!)' or '-') | |
84 --print(questID, info.x, info.y) | |
85 | |
86 --for k,v in pairs(info) do | |
87 -- print(questID .. '.' .. tostring(k), '=', v) | |
88 --end | |
89 | |
90 --local taskPOI = existingPOI[questID] | |
91 --if not taskPOI or ( taskPOI.questID ~= questID) then | |
92 | |
93 | |
94 local taskPOI | |
95 if existingPOI[questID] then | |
96 | |
97 taskPOI = existingPOI[questID] | |
98 msg = msg .. '\n there is a POI for this quest, re-using ' .. taskPOI:GetName() | |
99 else | |
100 msg = msg .. 'no poi found... create one' | |
101 poiIndex = poiIndex + 1 | |
102 taskPOI = WorldMap_GetOrCreateTaskPOI(poiIndex); | |
103 | |
104 local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, displayTimeLeft = GetQuestTagInfo(info.questId); | |
105 | |
106 taskPOI.name = tagName | |
107 | |
108 local selected = info.questId == GetSuperTrackedQuestID(); | |
109 | |
110 local isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(info.questId); | |
111 local isSpellTarget = SpellCanTargetQuest() and IsQuestIDValidSpellTarget(info.questId); | |
112 local isEffectivelyTracked = WorldMap_IsWorldQuestEffectivelyTracked(info.questId); | |
113 | |
114 taskPOI.worldQuest = true; | |
115 | |
116 taskPOI.questID = questID | |
117 taskPOI.Texture:SetDrawLayer("OVERLAY"); | |
118 | |
119 WorldMap_SetupWorldQuestButton(taskPOI, worldQuestType, rarity, isElite, tradeskillLineIndex, info.inProgress, selected, isCriteria, isSpellTarget, isEffectivelyTracked); | |
120 | |
121 C_TaskQuest.RequestPreloadRewardData(info.questId); | |
122 | |
123 end | |
124 | |
125 if taskPOI then | |
126 msg = msg .. "\n taskPOI established/" | |
127 end | |
128 | |
129 --[[ | |
130 taskPOI = WorldMap_TryCreatingWorldQuestPOI(info, poiIndex) | |
131 print(WorldMap_IsWorldQuestSuppressed(info.questId), not WorldMap_DoesWorldQuestInfoPassFilters(info)) | |
132 existingPOI[questID] = taskPOI | |
133 if not taskPOI then | |
134 print('|cFFFF4400unable to create for|r', questID) | |
135 else | |
136 --print(taskPOI, 'created',poiIndex) | |
137 end | |
138 --]] | |
139 | |
140 | |
141 | |
142 --else | |
143 | |
144 --print(taskPOI, 're-used') | |
145 --end | |
146 if taskPOI then | |
147 | |
148 | |
149 msg = msg .. '\n POS '..tostring(taskPOI:GetName())..' |cFF00FF00x/y:|r ' .. tostring(info.x) ..' '..tostring(info.y) | |
150 taskPOI.x = info.x; | |
151 taskPOI.y = info.y; | |
152 taskPOI.quantizedX = nil; | |
153 taskPOI.quantizedY = nil; | |
154 taskPOI.questID = info.questId; | |
155 taskPOI.numObjectives = info.numObjectives; | |
156 taskPOI:Show(); | |
157 | |
158 usedPOI[questID] = taskPOI | |
159 end | |
160 print(msg) | |
161 | |
162 end | |
163 | |
164 for questID, poi in pairs(existingPOI) do | |
165 if not usedPOI[questID] then | |
166 print('|cFFFF4400remove un-updated:', poi:GetName()) | |
167 poi:Hide() | |
168 end | |
169 | |
170 end | |
171 | |
172 | |
173 | |
174 WorldMapFrame.UIElementsFrame.ActionButton:SetHasWorldQuests(#usedPOI > 0); | |
175 WorldMap_QuantizeWorldQuestPOIs(usedPOI) | |
176 | |
177 _G.print('WQRefresh', time()) | |
178 end |