comparison WorldQuests.lua @ 71:d6c0bed32c51

fixed bounty highlighting and changed quests matching the selected bounty to have a yellow highlight, while quests matching any ongoing bounty are highlighted blue
author Nenue
date Wed, 05 Apr 2017 12:44:19 -0400
parents 31de7e9e7849
children 6db0b9696936
comparison
equal deleted inserted replaced
70:bb2baedae81f 71:d6c0bed32c51
78 db.QuestsByZone[mapID] = {} 78 db.QuestsByZone[mapID] = {}
79 end 79 end
80 for target, arg in pairs(callbacks) do 80 for target, arg in pairs(callbacks) do
81 print(type(target)) 81 print(type(target))
82 if type(target) == 'table' then 82 if type(target) == 'table' then
83 local callerName = target:GetName() 83 local callerName = target:GetName() or tostring(target)
84 for name, method in pairs(arg) do 84 for name, method in pairs(arg) do
85 print(callerName, arg) 85 print(callerName, arg)
86 hooksecurefunc(target, name, function(...) 86 hooksecurefunc(target, name, function(...)
87 self:OnSecureHook(callerName .. '.' .. arg, method, ...) 87 self:OnSecureHook(callerName .. '.' .. name, method, ...)
88 end) 88 end)
89 end 89 end
90 else 90 else
91 hooksecurefunc(target, function(...) 91 hooksecurefunc(target, function(...)
92 self:OnSecureHook(target, arg, ...) 92 self:OnSecureHook(target, arg, ...)
136 WorldQuests:RefreshIfChanged() 136 WorldQuests:RefreshIfChanged()
137 end 137 end
138 callbacks[WorldMapFrame.UIElementsFrame.BountyBoard] = { 138 callbacks[WorldMapFrame.UIElementsFrame.BountyBoard] = {
139 SetSelectedBountyIndex = function(WorldQuests) 139 SetSelectedBountyIndex = function(WorldQuests)
140 WorldQuests:UpdateBountyInfo() 140 WorldQuests:UpdateBountyInfo()
141 WorldQuests:Refresh(true)
141 end 142 end
142 } 143 }
143 callbacks[WorldMapFrame.UIElementsFrame.ActionButton] = { 144 callbacks[WorldMapFrame.UIElementsFrame.ActionButton] = {
144 UpdateCastingState = function(WorldQuests) 145 UpdateCastingState = function(WorldQuests)
145 WorldQuests:Refresh(true) 146 WorldQuests:Refresh(true)
147 } 148 }
148 149
149 150
150 local GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted = GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted 151 local GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted = GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted
151 function Module:UpdateBountyInfo() 152 function Module:UpdateBountyInfo()
153 print('|cFF00FF88BountyInfo()|r')
152 wipe(db.BountyInfo) 154 wipe(db.BountyInfo)
153 db.selectedBounty = nil 155 db.selectedBounty = nil
154 156
155 local selectedBounty = WorldMapFrame.UIElementsFrame.BountyBoard:GetSelectedBountyIndex() 157 local selectedBounty = WorldMapFrame.UIElementsFrame.BountyBoard:GetSelectedBountyIndex()
156 local bounties, numBounties = GetQuestBountyInfoForMapID(db.currentMapID) 158 local bounties, numBounties = GetQuestBountyInfoForMapID(db.currentMapID)
157 159
158 for index, data in ipairs(bounties) do 160 for index, data in ipairs(bounties) do
159 if data.factionID then 161 if data.factionID then
160 data.title = GetQuestLogTitle(GetQuestLogIndexByID(data.questID)) 162 data.title = GetQuestLogTitle(GetQuestLogIndexByID(data.questID))
161 data.complete = IsQuestFlaggedCompleted(data.questID) 163 data.complete = IsQuestFlaggedCompleted(data.questID)
162 db.BountyInfo[data.factionID] = data 164 if not data.complete then
163 if index == selectedBounty then 165 db.BountyInfo[data.factionID] = data
164 db.selectedBounty = data 166 print('bounty', data.factionID, data.title, data.complete)
165 end 167 if index == selectedBounty then
168 db.selectedBounty = data
169 end
170 end
171
166 end 172 end
167 end 173 end
168 174
169 for questID, pin in pairs(db.QuestsByID) do 175 for questID, pin in pairs(db.QuestsByID) do
170 local doUpdate 176 local doUpdate
171 if pin.factionID and db.BountyInfo[pin.factionID] then 177 if pin.factionID then
172 if not pin.isCriteria then 178 if db.BountyInfo[pin.factionID] then
179 print(pin.questID, pin.factionID, db.BountyInfo[pin.factionID], pin.isCriteria)
173 pin.isCriteria = true 180 pin.isCriteria = true
174 doUpdate = true 181 doUpdate = true
175 end 182 else
176 else
177 if pin.isCriteria then
178 doUpdate = true 183 doUpdate = true
179 pin.isCriteria = nil 184 pin.isCriteria = nil
180 end 185 end
181 end 186
187 end
188
189
182 if doUpdate then 190 if doUpdate then
183 if pin:IsVisible() then 191 if pin:IsVisible() then
184 pin:Refresh() 192 pin:Refresh()
185 else 193 else
186 pin.isStale = true 194 pin.isStale = true
517 while pin do 525 while pin do
518 pin:CheckFilterRules() 526 pin:CheckFilterRules()
519 527
520 local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1] 528 local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
521 print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor) 529 print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor)
522 pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor) 530 if pin.used then
523 531 pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor)
524 if pin.isNew then 532 if pin.isNew then
525 pin:OnShow() 533 pin:OnShow()
526 end 534 end
527 535 end
528 536
529 pin = tremove(db.UpdatedPins) 537 pin = tremove(db.UpdatedPins)
530 538
531 end 539 end
532 end 540 end
652 pin.hideReason = "Not used in map area " .. (db.currentMapID) 660 pin.hideReason = "Not used in map area " .. (db.currentMapID)
653 pin:HideFrames() 661 pin:HideFrames()
654 end 662 end
655 end 663 end
656 664
665
666 self:UpdateBountyInfo()
667
657 print(numShown, 'shown', numLoaded, 'loaded') 668 print(numShown, 'shown', numLoaded, 'loaded')
658 if numShown > numLoaded then 669 if numShown > numLoaded then
659 self.Status:Show() 670 self.Status:Show()
660 end 671 end
661 672