comparison QuestPOI.lua @ 40:589c444d4837

WowAce/Curseforge migration push
author Nenue
date Sun, 25 Dec 2016 13:04:57 -0500
parents 78cf1f19856a
children 79e5e96e5f18
comparison
equal deleted inserted replaced
39:89ddef0594bc 40:589c444d4837
1 -- WorldPlan 1 -- WorldPlan
2 -- QuestPOI.lua 2 -- QuestPOI.lua
3 -- Created: 10/1/2016 7:21 PM 3 -- Created: 10/1/2016 7:21 PM
4 -- %file-revision% 4 -- %file-revision%
5 -- 5 --
6 local _, db = ...
6 7
7 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID 8 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID
8 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation 9 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
9 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes 10 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
10 local TQ_IsActive = C_TaskQuest.IsActive 11 local TQ_IsActive = C_TaskQuest.IsActive
11 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData 12 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData
12 local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame 13 local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame
13 local WorldMap_DoesWorldQuestInfoPassFilters = WorldMap_DoesWorldQuestInfoPassFilters 14 local WorldMap_DoesWorldQuestInfoPassFilters = WorldMap_DoesWorldQuestInfoPassFilters
14 local QuestMapFrame_IsQuestWorldQuest = QuestMapFrame_IsQuestWorldQuest 15 local QuestMapFrame_IsQuestWorldQuest = QuestMapFrame_IsQuestWorldQuest
16 local GetAchievementNumCriteria, GetAchievementCriteriaInfo, GetAchievementInfo = GetAchievementNumCriteria, GetAchievementCriteriaInfo, GetAchievementInfo
17 local pairs, ipairs, tinsert, unpack, select = pairs, ipairs, tinsert, unpack, select
18 local floor, mod, tostring, tonumber, GetSuperTrackedQuestID = floor, mod, tostring, tonumber, GetSuperTrackedQuestID
15 local GameTooltip = GameTooltip 19 local GameTooltip = GameTooltip
16 local GetItemIcon = GetItemIcon 20 local GetItemIcon = GetItemIcon
17 21
18 local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end 22 local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
19 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end 23 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
20 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end 24 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
21 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end 25 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
22 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end 26 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
27 local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or function() end
23 local QuestPOI = WorldPlanPOIMixin 28 local QuestPOI = WorldPlanPOIMixin
24 29
30
31 local PIN_REFRESH_DELAY = .5
32 local PIN_REQUEST_DELAY = .2
25 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" 33 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
26 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" 34 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
27 35
28 local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background" 36 local WORLD_QUEST_BORDER = "Interface\\UNITPOWERBARALT\\Generic1Target_Circular_Frame"
29 local POI_BORDER_FILL = "Interface\\BUTTONS\\YELLOWORANGE64" 37 local PENDING_BORDER
30 local POI_BORDER_BLUE = "Interface\\BUTTONS\\GRADBLUE" 38 local PENDING_ICON = "Interface\\BUTTONS\\YELLOWORANGE64"
31 local POI_BORDER_RED = "Interface\\BUTTONS\\RedGrad64"
32 local POI_BORDER_YELLOW = "Interface\\BUTTONS\\YELLOWORANGE64"
33 local POI_BORDER_GREEN = "Interface\\BUTTONS\\GREENGRAD64"
34 39
35 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD 40 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD
36 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER 41 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER
37 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT 42 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT
38 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES 43 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES
39 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS 44 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS
40 45
41
42 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP 46 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
43 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE 47 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
44 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON 48 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
45 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION 49 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
46 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL 50 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
49 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE 53 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
50 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON 54 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
51 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION 55 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
52 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL 56 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
53 57
54 local subStyles = { 58 local STYLE_TYPE_PENDING = 768
55 continent = { 59
56 iconWidth = 14, 60
57 borderWidth = 2, 61 -- Pin color/display variables
58 highlightWidth = 1, 62 db.TooltipExtras = db.TooltipExtras or {} -- idiot-proofing
59 TagSize = 6, 63
60 maxAlertLevel = 0, 64
61 showNumber = false, 65 local familiars = {
62 numberFontObject = 'WorldPlanFont' 66 [42159] = 'Nightwatcher Merayl',
63 }, 67 [40277] = 'Tiffany Nelson',
64 zone = { 68 [40298] = 'Sir Galveston',
65 iconWidth = 22, 69 [40282] = 'Grixis Tinypop',
66 borderWidth = 3, 70 [40278] = 'Robert Craig',
67 highlightWidth = 2, 71 [48195] = 'Aulier',
68 TagSize = 12, 72 [41990] = 'Varenne',
69 maxAlertLevel = 3, 73 [41860] = 'Xorvasc',
70 showNumber = true, 74 [40299] = 'Bodhi Sunwayver',
71 numberFontObject = 'WorldPlanNumberFontThin' 75 [42442] = 'Amalia',
72 }, 76 [40280] = 'Bredda Tenderhide',
73 minimized = { 77 [41687] = 'Odrogg',
74 iconWidth = 4, 78 [41944] = 'Trapper Jarrun',
75 borderWidth = 0, 79 [40337] = 'Master Tamer Flummox',
76 highlightWidth = 1, 80 [40279] = 'Durian Strongfruit'
77 NoIcon = true,
78 maxAlertLevel = 1,
79 showNumber = false,
80 }
81 } 81 }
82 82 local falcosaurs = {
83 -- Pin color/display variables 83 [44895] = {44881, 'Sharptalon Hatchling', 115786},
84 84 [44894] = {44882, 'Bloodgazer Hatchling', 115787},
85 local familiars = { 85 [44893] = {44880, 'Direbeak Hatchling', 115785},
86 [42159] = {npc = 106552, name = 'Nightwatcher Merayl'}, 86 [44892] = {44879, 'Snowfeather Hatchling', 115784},
87 [40277] = {npc = 97804, name = 'Tiffany Nelson'},
88 [40298] = {npc = 99182, name = 'Sir Galveston'},
89 [40282] = {npc= 99150, name = 'Grixis Tinypop'},
90 [40278] = {npc = 98270, name = 'Robert Craig'},
91 [48195] = {npc = 105250, name = 'Aulier'},
92 [41990] = {npc = 105674, name = 'Varenne'},
93 [41860] = {npc = 104970, name = 'Xorvasc'},
94 [40299] = {npc = 99210, name = 'Bodhi Sunwayver'},
95 [42442] = {npc = 107489, name = 'Amalia'},
96 [40280] = {npc = 99077, name = 'Bredda Tenderhide'},
97 [41687] = {npc = 104553, name = 'Odrogg'},
98 [41944] = {npc = 105455, name = 'Trapper Jarrun'},
99 [40337] = {npc = 97709, name = 'Master Tamer Flummox'},
100 [40279] = {npc = 99035, name = 'Durian Strongfruit'}
101 } 87 }
102 local familiars_id = 9696 88 local familiars_id = 9696
103 89 for questID, name in pairs(familiars) do
104 90 db.TooltipExtras[questID] = {{
105 -- update a masked texture without messing up its blending mask 91 achievementID = familiars_id,
106 92 name = name
107 93 }}
108 -- update a masked texture without messing up its blending mask 94 end
109 local SetMaskedTexture = function(region, file, mask) 95 for questID, info in pairs(falcosaurs) do
110 mask = mask or "Interface\\Minimap\\UI-Minimap-Background" 96 local trackingQuestID, petName, petID = unpack(info)
111 region:SetMask(nil) 97
112 region:SetTexture(file) 98 db.TooltipExtras[questID] = {{
113 region:SetMask(mask) 99 questID = trackingQuestID,
114 end 100 pet = petName,
115 101 petID = petID
116 102 }}
117 -- use tooltip object to extract item details 103 end
118 local ParseItemReward = function(questID) 104
119 local name, icon, quantity, quality, _, itemID = GetQuestLogRewardInfo(1, questID) 105 local GetAchievementTooltipExtras = function(info)
120 local scanner = _G.WorldPlanTooltip 106
121 if not itemID then 107 local hasInfo
122 return 108 local achievementID = info.achievementID
123 end 109 local _, name, _, completed, _, _, _, _, _, icon = GetAchievementInfo(achievementID)
124
125 scanner:SetOwner(WorldPlan, "ANCHOR_NONE")
126 scanner:SetItemByID(itemID)
127 scanner:Show()
128 local ttl1 = _G['WorldPlanTooltipTextLeft1']
129 local ttl2 = _G['WorldPlanTooltipTextLeft2']
130 local ttl3 = _G['WorldPlanTooltipTextLeft3']
131 local ttl4 = _G['WorldPlanTooltipTextLeft4']
132 if ttl2 then
133 local text = ttl2:GetText()
134 -- Artifact Power
135 if text then
136 if text:match("|cFFE6CC80") then
137 --print('AP token!', text)
138 local power
139 if ttl4 then
140 local text = ttl4:GetText()
141 --print('tip line 4', text)
142 if text then
143 power = text:gsub("%p", ""):match("%d+")
144 power = tonumber(power)
145 end
146
147 end
148 return REWARD_ARTIFACT_POWER, "Interface\\ICONS\\inv_7xp_inscription_talenttome01", power, name, itemID, quality
149 elseif text:match("Item Level") then
150 --print('equipment!', text)
151 quantity = text:match("Item Level ([%d\+]+)")
152 return REWARD_GEAR, icon, quantity, name, itemID, quality
153 elseif text:match("Crafting Reagent") then
154 --print('|cFFFF4400it is a reagent', text)
155 return REWARD_REAGENT, icon, quantity, name, itemID, quality
156 end
157 end
158
159 elseif ttl3 then
160 local text = ttl3:GetText()
161 if text:match("Crafting Reagent") then
162 --print('|cFFFF4400it is a reagent', text)
163 return REWARD_REAGENT, icon, quantity, name, itemID, quality
164 end
165 end
166 return 128, icon, quantity, name, itemID, quality
167 end
168
169 function WorldPlanPOIMixin:OnEnter()
170 if WorldMapFrame:IsVisible() then
171 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT')
172 else
173 WorldMap_HijackTooltip(self.owningFrame)
174 end
175
176 local completed = select(4,GetAchievementInfo(familiars_id))
177 if not completed then 110 if not completed then
178 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then 111
179 112 WorldMapTooltip:AddLine(" ")
180 WorldMapTooltip:AddLine(self.title, 1, 1, 1) 113 WorldMapTooltip:AddLine("Achievements:")
181 if self.quality then 114 WorldMapTooltip:AddLine(' |T'..icon..':20:20|t '..name)
182 local c = ITEM_QUALITY_COLORS[self.quality] 115
183 WorldMapTooltip:AddLine(" ") 116 local numItems = GetAchievementNumCriteria(achievementID)
184 WorldMapTooltip:AddLine('Rewards') 117 local numNeeded = 0
185 WorldMapTooltip:AddLine(self.itemName .. (self.quantity and (' x'..self.quantity) or ''), c.r, c.g, c.b) 118 local tooltipLines = {}
186 WorldMapTooltip:AddTexture(self.itemTexture) 119 for i =1, numItems do
187 120 local criteriaName, criteriaType, completed, _, _, _, _, subAchievementID = GetAchievementCriteriaInfo(achievementID, i)
188 local cLine = WorldMapTooltip:NumLines() 121 print(GetAchievementCriteriaInfo(achievementID, i))
189 local line = _G['WorldMapTooltipTextLeft'..cLine] 122
190 local pline = _G['WorldMapTooltipTextLeft'..(cLine-1)] 123 if not completed then
191 local icon = _G['WorldMapTooltipTexture'..(cLine-3)] 124 print('::', criteriaName, completed, subAchievementID)
192 icon:SetSize(24,24) 125 if criteriaType == 8 then
193 icon:ClearAllPoints() 126 local _, _, _, completed, _, _, _, _, _, subIcon = GetAchievementInfo(subAchievementID)
194 icon:SetPoint('TOPLEFT', pline, 'BOTTOMLEFT', 0, -2) 127 print(' -', criteriaName, completed, subIcon)
195 line:ClearAllPoints() 128 if not completed then
196 line:SetPoint('TOPLEFT', icon, 'TOPRIGHT', 7, 0) 129 local numCompleted = 0
197 130 local numSubItems = GetAchievementNumCriteria(subAchievementID)
198 --- voodoo workaround for IDs getting coerced to string 131 local subCriteriaLine
199 if type(self.itemTexture) == 'number' then 132 for j = 1, numSubItems do
200 icon:Show() 133 local subName, _, completed = GetAchievementCriteriaInfo(subAchievementID, j)
201 icon:SetTexture(self.itemTexture) 134
202 end 135 print(' -',subName, completed)
203 end 136 if completed then
204 137 numCompleted = numCompleted + 1
205 138 else
206 WorldMapTooltip:AddLine(" ") -- causes crash for some reason 139 numNeeded = numNeeded + 1
207 WorldMapTooltip:AddLine('Family Familiars') 140 if subName:match(info.name) then
208 local trainer = familiars[self.questID].name 141 hasInfo = true
209 local numCheevs = GetAchievementNumCriteria(familiars_id) 142 subCriteriaLine = ' |T'..subIcon..':16:16|t ' .. criteriaName
210 for index = 1, numCheevs do 143 end
211 local cheevName, cType, cCompleted, quantity, requiredQuantity, charName, flags, cheevID, quantityString, criteriaID = GetAchievementCriteriaInfo(familiars_id, index) 144 end
212 local numTrainers = GetAchievementNumCriteria(cheevID) 145
213 for subIndex = 1, numTrainers do 146 end
214 local desc, cType, partCompleted = GetAchievementCriteriaInfo(cheevID, subIndex) 147 if subCriteriaLine then
215 if desc == trainer then 148 tinsert(tooltipLines, subCriteriaLine .. ' ('..numCompleted..'/'..numSubItems..')')
216 if not partCompleted then
217 local iconPath = select(10, GetAchievementInfo(cheevID))
218 WorldMapTooltip:AddLine(cheevName)
219 WorldMapTooltip:AddTexture(iconPath)
220 end 149 end
221 end 150 end
151 elseif criteriaName:match(info.name) and (not completed) then
152 numNeeded = numNeeded + 1
153 tinsert(tooltipLines, criteriaName)
222 end 154 end
223 end 155 end
224 WorldMapTooltip:Show() 156 end
157 if numNeeded >= 1 then
158 for i, line in ipairs(tooltipLines) do
159 WorldMapTooltip:AddLine(line)
160 end
161 else
162 WorldMapTooltip:AddLine('Criteria completed!', 0, 1, 0)
163 end
164
165 end
166 return hasInfo
167 end
168
169 local GetQuestTooltipExtras = function(info)
170 local questID = info.questID
171 local hasInfo
172
173 if info.pet then
174 local index, guid = C_PetJournal.FindPetIDByName(info.pet)
175 if not index then
176 hasInfo = true
177 WorldMapTooltip:AddLine('Pets:')
178 WorldMapTooltip:AddLine(' - ' .. info.petName)
179
180 if not IsQuestFlaggedCompleted(questID) then
181 WorldMapTooltip:AddLine(' Required Quest Flags', 1, 1, 0)
182 else
183 WorldMapTooltip:AddLine(' Quest Flags Complete!', 0, 1, 0)
184 end
185
186 end
187 end
188
189 end
190
191 local GetFactionInfoByID, GetQuestObjectiveInfo = GetFactionInfoByID, GetQuestObjectiveInfo
192
193 function QuestPOI:OnEnter()
194 if not WorldMapFrame:IsVisible() then
195 WorldMap_HijackTooltip(self.owningFrame)
196 else
197 if self.filtered then
225 return 198 return
226 end 199 end
227 end 200 end
228 TaskPOI_OnEnter(self) 201 WorldMapTooltip:SetOwner(self, "ANCHOR_RIGHT");
229 end 202 print('doing tooltip stuff')
230 function WorldPlanPOIMixin:OnLeave() 203
204 -- Can't add stuff after, so most of the blizzard tooltip hook is simply copied over
205 local questID = self.questID
206 local color = WORLD_QUEST_QUALITY_COLORS[self.rarity] or NORMAL_FONT_COLOR;
207
208
209 WorldMapTooltip:SetText(self.title, color.r, color.g, color.b);
210 QuestUtils_AddQuestTypeToTooltip(WorldMapTooltip, questID, NORMAL_FONT_COLOR);
211
212 if ( self.factionID ) then
213 local factionName = GetFactionInfoByID(self.factionID);
214 if ( factionName ) then
215 if (self.capped) then
216 WorldMapTooltip:AddLine(factionName, GRAY_FONT_COLOR:GetRGB());
217 else
218 WorldMapTooltip:AddLine(factionName);
219 end
220 end
221 end
222
223 if self.worldQuest then
224 WorldMap_AddQuestTimeToTooltip(questID);
225 end
226
227
228 for objectiveIndex = 1, self.numObjectives do
229 local objectiveText, objectiveType, finished = GetQuestObjectiveInfo(questID, objectiveIndex, false);
230 if ( objectiveText and #objectiveText > 0 ) then
231 local color = finished and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR;
232 WorldMapTooltip:AddLine(QUEST_DASH .. objectiveText, color.r, color.g, color.b, true);
233 end
234 end
235
236 local percent = C_TaskQuest.GetQuestProgressBarInfo(self.questID);
237 if ( percent ) then
238 GameTooltip_InsertFrame(WorldMapTooltip, WorldMapTaskTooltipStatusBar);
239 WorldMapTaskTooltipStatusBar.Bar:SetValue(percent);
240 WorldMapTaskTooltipStatusBar.Bar.Label:SetFormattedText(PERCENTAGE_STRING, percent);
241 end
242
243 if db.TooltipExtras[self.questID] then
244 for index, info in pairs(db.TooltipExtras[questID]) do
245 if info.achievementID then
246 GetAchievementTooltipExtras(info)
247 end
248 if info.questID then
249 GetQuestTooltipExtras(info)
250 end
251 end
252 end
253 WorldMap_AddQuestRewardsToTooltip(questID)
254
255 self.MouseGlow:Show()
256 WorldMapTooltip:Show()
257 --WorldMapTooltip.recalculatePadding = true;
258 --print(WorldMapTooltip:GetParent())
259 --print(WorldMapTooltip:IsVisible())
260 end
261 function QuestPOI:OnLeave()
231 WorldMap_RestoreTooltip() 262 WorldMap_RestoreTooltip()
232 TaskPOI_OnLeave(self) 263 self.MouseGlow:Hide()
233 end 264 WorldMapTooltip:Hide();
234 function WorldPlanPOIMixin:OnMouseDown() 265 end
266 function QuestPOI:OnMouseDown()
235 TaskPOI_OnClick(self) 267 TaskPOI_OnClick(self)
236 end 268 end
237 269
238 270 -- attempt to pull pin data
239 271 local GetQuestTagInfo, GetProfessionInfo = GetQuestTagInfo, GetProfessionInfo
240 -- create or update the pin using the given questID and C_TaskQuest results 272 function QuestPOI:GetData ()
241 function WorldPlanPOIMixin:RefreshData (info) 273 qprint('|cFF00FF88'..self:GetName()..':GetWorldQuestInfo()|r')
242 274 local questID = self.questID
243 qprint('|cFF00FF88'..self:GetName()..':RefreshData()|r') 275 if not questID then
244 276 rprint('|cFFFF4400bad pin|r', self:GetName())
245 if info then 277 return nil
246 self.inProgress = info.inProgress 278 end
247 self.floor = info.floor 279
248 self.numObjectives = info.numObjectives or 0 280 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
249 if info.x and info.y then 281 -- if the title is nil, then wait and try later
250 self.x = info.x or self.x 282 if not questTitle then
251 self.y = info.y or self.y 283 self.isPending = true
252 --qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y) 284 rprint('|cFFBB8844nodata|r|cFF00FFFF', self.questId)
253 end 285 else
254 286 self.title, self.factionID, self.capped = questTitle, factionID, capped
255 end 287 rprint('|cFFBB8844 data|r|cFF00FFFF', (self.isPending and 'late|r' or 'jit|r'), self.title, '|r', self.factionID)
256 288 -- set tag details
257 289 local worldQuestType
258 local questID = self:GetID() 290 self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.tradeskillLineIndex = GetQuestTagInfo(questID);
259 local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _ 291 local tagAtlas
260 local hasUpdate, isPending = (self.isStale or self.isNew), self.isPending 292 if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then
261 293 tagAtlas = "worldquest-icon-petbattle"
262 294 elseif worldQuestType == LE_QUEST_TAG_TYPE_PVP then
295 tagAtlas = "worldquest-icon-pvp-ffa"
296 elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then
297 self.isKnownProfession = nil
298 local id = self.tradeskillLineIndex and select(7, GetProfessionInfo(self.tradeskillLineIndex))
299 if id then
300 self.isKnownProfession = true
301 qprint('profession' , self.title, id)
302 tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
303 end
304 elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
305 tagAtlas = "worldquest-icon-dungeon"
306 end
307 self.worldQuestType = worldQuestType
308
309 self.tagAtlas = tagAtlas
310
311
312 self:SetRewardInfo()
313
314 -- force throttle on success
315 --qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending, 'isShown', self:IsShown())
316 --qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
317 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
318
319 if self.itemTexture and self.itemName and self.title then
320 self.isPending = nil
321 self.throttle = 1
322 self.updateRate = PIN_REFRESH_DELAY
323 end
324 end
325
326 self.isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(questID)
327
328 return self.isStale, self.isPending
329 end
330
331 local GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData = GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData
332 local GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString = GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString
333 function QuestPOI:SetRewardInfo()
334 local questID = self.questID
263 if not HaveQuestData(questID) then 335 if not HaveQuestData(questID) then
264 TQ_RequestPreloadRewardData(questID) 336 self.isPending = true
265 isPending = true
266 else 337 else
267 338
339 local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality
268 -- set reward category 340 -- set reward category
269 local numRewards = GetNumQuestLogRewards(questID) 341 local numRewards = GetNumQuestLogRewards(questID)
270 local numCurrency = GetNumQuestLogRewardCurrencies(questID) 342 local numCurrency = GetNumQuestLogRewardCurrencies(questID)
271 local money = GetQuestLogRewardMoney(questID) 343 local money = GetQuestLogRewardMoney(questID)
272 if numRewards >= 1 then 344 if numRewards >= 1 then
273 rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = ParseItemReward(questID) 345 rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = WorldPlanQuests:GetRewardHeader(questID)
274 elseif numCurrency >= 1 then 346 elseif numCurrency >= 1 then
275 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID) 347 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
276 rewardType = REWARD_CURRENCY 348 rewardType = REWARD_CURRENCY
277 elseif money >= 1 then 349 elseif money >= 1 then
278 rewardIcon = ICON_MONEY 350 rewardIcon = ICON_MONEY
279 rewardName = GetMoneyString(money) 351 rewardName = GetMoneyString(money)
280 rewardType = REWARD_CASH 352 rewardType = REWARD_CASH
281 end 353 end
282 rewardStyle = self:GetTypeInfo(rewardType) 354
283 355 print(' '..self.questID..':|cFFFFFF00SetRewardInfo():', rewardType)
284 self.itemNumber = rewardCount or self.itemNumber 356 self.itemNumber = tonumber(rewardCount or self.itemNumber)
285 self.rewardType = rewardType or REWARD_ITEM 357 self.rewardType = rewardType or REWARD_GEAR
286 self.style = rewardStyle
287 self.quality = quality 358 self.quality = quality
288 359
289 -- title, faction, capped state 360 self.itemTexture = rewardIcon or self.itemTexture
290 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID) 361 self.itemName = rewardName or self.itemName
291 self.factionID = factionID
292 self.capped = capped
293
294 -- set tag details
295 local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = GetQuestTagInfo(questID);
296 local tagAtlas
297 if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then
298 tagAtlas = "worldquest-icon-petbattle"
299 elseif worldQuestType == LE_QUEST_TAG_TYPE_PVP then
300 tagAtlas = "worldquest-icon-pvp-ffa"
301 elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then
302 local id = tradeskillLineIndex and select(7, GetProfessionInfo(tradeskillLineIndex))
303 if id then
304 tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
305 end
306 elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
307 tagAtlas = "worldquest-icon-dungeon"
308 end
309
310 self.tagID = tagID
311 self.tagName = tagName
312 self.worldQuestType = worldQuestType
313 self.isElite = isElite
314 self.tradeskillLineIndex = tradeskillLineIndex
315 self.rarity = rarity
316 self.tagAtlas = tagAtlas
317 362
318 -- flag unresolved info 363 -- flag unresolved info
319 if not (rewardIcon and rewardName) then 364 if not (rewardIcon and rewardName) then
320 isPending = true 365 self.isPending = true
321 qprint('because not have icon') 366 return true, nil
322 TQ_RequestPreloadRewardData (questID)
323 --WorldPlan:print('|cFFFFFF00'..tostring(self.title)..'|r waiting on texture info') 367 --WorldPlan:print('|cFFFFFF00'..tostring(self.title)..'|r waiting on texture info')
324 else 368 else
325 if (rewardIcon and rewardName) and isPending then 369 if (rewardIcon and rewardName) and self.isPending then
326 --WorldPlan:print('|cFF00FF00'..tostring(self.title)..'|r has info', rewardIcon, rewardName) 370 --WorldPlan:print('|cFF00FF00'..tostring(self.title)..'|r has info', rewardIcon, rewardName)
327 hasUpdate = true 371 self.isStale = true
328 end 372 end
329 isPending = false 373 self.isPending = nil
330 end 374 end
331 375
332 self.title = questTitle or "|cFFFF0000Retrieving..." 376 end
333 self.itemTexture = rewardIcon or self.itemTexture 377 return self.isStale, self.isPending
334 self.itemName = rewardName or self.itemName 378
335 self.isStale = hasUpdate
336 self.isPending = isPending
337
338
339 --qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending, 'isShown', self:IsShown())
340 --qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
341 --qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
342 end
343 self.cheevos = familiars[self.questID]
344
345 return hasUpdate, isPending
346 end
347
348
349 function WorldPlanPOIMixin:SetAchievementProgressTooltip()
350 print('cheevos')
351 end 379 end
352 380
353 -- run from OnShow if .isNew is set 381 -- run from OnShow if .isNew is set
354 function WorldPlanPOIMixin:OnNew() 382 function QuestPOI:OnNew()
355 383
356 if not self.isAnimating then 384 if not self.isAnimating then
357 --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.') 385 --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.')
358 self:SetAlpha(0) 386 self:SetAlpha(0)
359 if WorldPlan.db.FadeWhileGrouped then 387 if db.Config.FadeWhileGrouped then
360 self.FadeIn.FadeIn:SetToAlpha(0.15) 388 self.FadeIn.FadeIn:SetToAlpha(0.15)
361 self.PendingFade.FadeIn:SetToAlpha(0.15) 389 self.PendingFade.FadeIn:SetToAlpha(0.15)
362 self.PendingFade.FadeOut:SetFromAlpha(0.15) 390 self.PendingFade.FadeOut:SetFromAlpha(0.15)
363 else 391 else
364 self.FadeIn.FadeIn:SetToAlpha(1) 392 self.FadeIn.FadeIn:SetToAlpha(1)
365 self.PendingFade.FadeIn:SetToAlpha(1) 393 self.PendingFade.FadeIn:SetToAlpha(1)
366 self.PendingFade.FadeOut:SetFromAlpha(1) 394 self.PendingFade.FadeOut:SetFromAlpha(1)
367 end 395 end
368 self.isAnimating = true 396 self.isAnimating = true
369 self.isNew = nil 397 self.isNew = nil
398 self.isStale = true
370 self.FadeIn:Play() 399 self.FadeIn:Play()
371 end 400 end
372 end 401 end
373 402
374 function WorldPlanPOIMixin:OnShow () 403 function QuestPOI:OnShow ()
375 -- pop this on principle 404 -- pop this on principle
376 405
377 if self.isNew or self.isStale then 406 if self.isNew or self.isStale then
378 self:Refresh() 407 self:Refresh()
379 end 408 end
390 419
391 self.Overlay:SetShown(true) 420 self.Overlay:SetShown(true)
392 --WorldPlan:print(self:GetAlpha()) 421 --WorldPlan:print(self:GetAlpha())
393 422
394 end 423 end
395 function WorldPlanPOIMixin:OnHide() 424 function QuestPOI:OnHide()
396 --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') 425 --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
397 if not self:IsShown() then 426 if not self:IsShown() then
398 self.isAnimating = nil 427 self.isAnimating = nil
399 self:SetAlpha(1) 428 self:SetAlpha(1)
400 end 429 end
401 430
402 self.Overlay:SetShown(false) 431 self.Overlay:SetShown(false)
403 end 432 end
404 433
405 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight) 434 function QuestPOI:SetAnchor(frame, mapID, mapWidth, mapHeight)
406 --qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID, mapWidth) 435 qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID)
407 self:ClearAllPoints() 436 self:ClearAllPoints()
408 local dX, dY = TQ_GetQuestLocation(self.questID) 437 local dX, dY = TQ_GetQuestLocation(self.questID)
409 if not dX or dX == 0 then 438 if not dX or dX == 0 then
410 local _, x, y = QuestPOIGetIconInfo(self.questID) 439 local _, x, y = QuestPOIGetIconInfo(self.questID)
411 if x and floor(x) ~= 0 then 440 if x and floor(x) ~= 0 then
412 dX, dY = x, y 441 dX, dY = x, y
413 else 442 else
414 dX, dY = self.x, self.y 443 dX, dY = self.x, self.y
415 end 444 end
416 end 445 end
446 local oX, oY = self.x, self.y
417 self.x = dX 447 self.x = dX
418 self.y = dY 448 self.y = dY
419 449
420 --qprint(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY))
421 450
422 local pX = (dX * mapWidth) 451 local pX = (dX * mapWidth)
423 local pY = (-dY * mapHeight) 452 local pY = (-dY * mapHeight)
424 453
454 if oX ~= dX then
455 wqprint(' |cFF00FF00'..self.questID..':|r', oX, dX, format("%0.2f %0.2f", pX, pY))
456 end
457
425 self:SetParent(WorldMapPOIFrame) 458 self:SetParent(WorldMapPOIFrame)
426 self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY) 459 self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY)
427 end 460 end
428 461
429 462 function QuestPOI:OnLoad()
430 function WorldPlanPOIMixin:OnLoad() 463 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
431 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db)
432 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') 464 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
433 465
466 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
467 self.isPending = true
434 self.count = self.Overlay.count 468 self.count = self.Overlay.count
435 self.timeLabel = self.Overlay.timeLabel 469 self.timeLabel = self.Overlay.timeLabel
436 end 470 self.updateRate = PIN_REQUEST_DELAY
437 471 self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
438 function WorldPlanPOIMixin:OnEvent(event, ...) 472 end
473
474 function QuestPOI:OnEvent(event, ...)
439 if event == 'SUPER_TRACKED_QUEST_CHANGED' then 475 if event == 'SUPER_TRACKED_QUEST_CHANGED' then
440 self.isStale = true 476 self.isStale = true
441 end 477 end
442 end 478 end
443 479
444 480 function QuestPOI:OnUpdate (sinceLast)
445 local PIN_UPDATE_DELAY = .016 481 -- control update check intervals
446 local TOP_PIN_ID 482 self.throttle = (self.throttle or self.updateRate) + sinceLast
447 function WorldPlanPOIMixin:OnUpdate (sinceLast) 483 if self.throttle >= self.updateRate then
484 -- factor overtime into the throttle timer
485 self.throttle = self.throttle - self.updateRate
486 else
487 return
488 end
448 if self.isNew then 489 if self.isNew then
449 print('|cFFFFFF00push new poi stuff') 490 print('|cFFFFFF00push new poi stuff')
450 self:OnNew() 491 self:OnNew()
451 end 492 elseif (self.isStale or (not self.title)) and not self.isAnimating then
452 -- control update check intervals
453 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
454 if self.throttle <= 0 then
455 -- factor overtime into the throttle timer
456 self.throttle = PIN_UPDATE_DELAY - self.throttle
457 else
458 return
459 end
460 if self.isStale and not self.isAnimating then
461 wprint('|cFFFFFF00push poi update') 493 wprint('|cFFFFFF00push poi update')
462 self:Refresh() 494 self:Refresh()
463 return 495 return
464 end 496 end
465 497
466 -- query for reward data if it wasn't found in the original scan 498 -- query for reward data if it wasn't found in the original scan
467 local questID = self.questID 499 local questID = self.questID
468 if self.isPending then 500 if self.isPending then
469 self:RefreshData() 501 self:GetData()
470 if not (self.PendingFade:IsPlaying() or self.isAnimating) then 502 if not (self.PendingFade:IsPlaying() or self.isAnimating) then
471 self.PendingFade:Play() 503 self.PendingFade:Play()
472 end 504 end
473 return 505 return
474 else 506 else
477 end 509 end
478 end 510 end
479 511
480 512
481 -- update time elements 513 -- update time elements
482 local tl = self.alertLevel 514 if TQ_IsActive(self.questID) then
483 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID) 515
484 if timeLeft > 0 then 516 local tl = self.alertLevel
485 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel) 517 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID)
486 if tl ~= timeState then 518 if timeLeft > 0 then
487 tl = timeState 519
488 self.timeLabel:SetText(text) 520 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel)
489 end 521 if tl ~= timeState then
490 else 522 tl = timeState
491 -- remove self in a timely manner 523 self.timeLabel:SetText(text)
492 if not TQ_IsActive(self.questID) then 524 end
493 print('|cFFFF4400'..self:GetName()..' pin hard timeout') 525 else
494 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then 526 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
495 self:Hide() 527 self:SetShown(false)
496 end 528 end
497 end 529 end
498 end 530 self.alertLevel = tl
499 self.alertLevel = tl 531 end
500 532 self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1))
501 if self:IsMouseOver() then 533 end
502 self.MouseGlow:Show() 534
503 else 535
504 self.MouseGlow:Hide() 536
505 end 537 function QuestPOI:Refresh ()
506 end
507
508
509
510 function WorldPlanPOIMixin:Refresh ()
511 local db = WorldPlan.db
512 print('|cFF00FF88'..self:GetName()..'|r:Refresh()') 538 print('|cFF00FF88'..self:GetName()..'|r:Refresh()')
513 539
514 540 local styleType = (self.isPending and STYLE_TYPE_PENDING) or self.rewardType
541 local style,subStyle = self:GetTypeInfo(self.rewardType)
542 if self.filtered then
543 subStyle = style.minimized
544 end
545 self.style = style
546 self.subStyle = subStyle
547 --print(style, subStyle)
548 self.currentWidth = subStyle.iconWidth
549 self.borderWidth = subStyle.borderWidth
550 self.highlightWidth = subStyle.highlightWidth
551 self.tagSize = subStyle.TagSize
552 self.maxAlertLevel = subStyle.maxAlertLevel
553 self.NoIcon = subStyle.NoIcon
515 554
516 local questID = self:GetID() 555 local questID = self:GetID()
517 local iconBorder = self.RewardBorder 556 local iconBorder = self.RewardBorder
518 local trackingBorder = self.HighlightBorder 557 local trackingBorder = self.HighlightBorder
519 local icon = self.icon 558 local icon = self.icon
520 local count = self.count 559 local count = self.count
521
522
523
524
525 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName)) 560 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
526
527
528 561
529 if self.itemName then 562 if self.itemName then
530 --wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber) 563 --wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber)
531 564 if self.itemNumber and self.itemNumber >= 1000 then
532 self.count:SetText(self.itemNumber) 565 local numeral = floor(self.itemNumber/1000)
533 end 566 local decimal = mod(self.itemNumber, 1000)
567 local numberString = numeral
568 if decimal > 100 then
569 numberString = numberString .. '.' .. tostring(floor(decimal/100))
570 end
571 numberString = numberString .. 'k'
572 self.count:SetText(numberString)
573 else
574 self.count:SetText(self.itemNumber)
575 end
576
577
578 end
579 icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
534 if self.itemTexture then 580 if self.itemTexture then
535 icon:SetTexture(self.itemTexture) 581 iconBorder:SetTexture(WORLD_QUEST_BORDER)
536 icon:SetMask("Interface\\Minimap\\UI-Minimap-Background") 582
537 end 583 if self.NoIcon then
538 584 icon:SetTexture(PENDING_ICON)
539 local border = self:GetTypeInfo(self.rewardType) 585 icon:SetDesaturated(true)
540 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a) 586 icon:SetVertexColor(style.r, style.g, style.b, style.a)
587 else
588
589 icon:SetTexture(self.itemTexture)
590 icon:SetDesaturated(false)
591 icon:SetVertexColor(1, 1, 1)
592 end
593 else
594 iconBorder:SetTexture(PENDING_BORDER)
595 icon:SetTexture(PENDING_ICON)
596 icon:SetDesaturated(true)
597 icon:SetVertexColor(style.r, style.g, style.b, style.a)
598 end
599
600 local borderStyle = style
601 if self.rarity and WORLD_QUEST_QUALITY_COLORS[self.rarity] then
602 borderStyle = WORLD_QUEST_QUALITY_COLORS[self.rarity]
603 end
604
605 iconBorder:SetVertexColor(borderStyle.r, borderStyle.g, borderStyle.b, 1)
541 iconBorder:SetDesaturated(true) 606 iconBorder:SetDesaturated(true)
542 607 iconBorder:SetAlpha(subStyle.alpha or 1)
543 608
544 if questID == GetSuperTrackedQuestID() then 609 if questID == GetSuperTrackedQuestID() then
545 trackingBorder:SetVertexColor(0,0,0,1) 610 trackingBorder:SetVertexColor(0,0,0,1)
546 else 611 else
547 trackingBorder:SetVertexColor(0,0,0,0.5) 612 trackingBorder:SetVertexColor(0,0,0,0.5)
548 end 613 end
549 614
615 self.tagIcon:SetShown(self.tagSize and true or false)
550 self.tagIcon:SetAtlas(self.tagAtlas) 616 self.tagIcon:SetAtlas(self.tagAtlas)
551 self.tagIcon:SetTexCoord(0,1,0,1) 617 self.tagIcon:SetAlpha(subStyle.alpha or 1)
552 self.EliteBorder:SetShown(self.isElite and not self.filtered) 618 self.EliteBorder:SetShown(self.isElite and not self.filtered)
553 --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
554 --print(' - subStyle:', (self.filtered == true), self.subStyle)
555
556 self.Overlay:SetShown(self:IsShown()) 619 self.Overlay:SetShown(self:IsShown())
557 self.Overlay:SetParent(self:GetParent()) 620 self.Overlay:SetParent(self:GetParent())
558 self.Overlay:SetFrameLevel(self:GetFrameLevel()+200) 621 self.Overlay:SetFrameLevel(self:GetFrameLevel()+200)
559 self.Overlay:SetAllPoints(self) 622 self.Overlay:SetAllPoints(self)
560 623
561 624
562 self:UpdateSize() 625 self:UpdateSize()
563
564 self.isStale = nil 626 self.isStale = nil
565
566 end 627 end
567 628
568 local cvar_check = { 629 local cvar_check = {
569 [REWARD_CASH] = 'worldQuestFilterGold', 630 [REWARD_CASH] = 'worldQuestFilterGold',
570 [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower', 631 [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower',
572 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', 633 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials',
573 [REWARD_GEAR] = 'worldQuestFilterEquipment', 634 [REWARD_GEAR] = 'worldQuestFilterEquipment',
574 } 635 }
575 636
576 637
638 function QuestPOI:IsFiltered ()
639 for filterKey, value in pairs(db.UsedFilters) do
640 print('|cFFFF4400', filterKey, self[filterKey])
641 if self[filterKey] ~= value then
642 return true
643 end
644 end
645 if self.rewardType and cvar_check[self.rewardType] then
646 if self.rewardType == REWARD_CASH then
647 print('##', cvar_check[self.rewardType], GetCVarBool(cvar_check[self.rewardType]))
648 end
649 if not GetCVarBool(cvar_check[self.rewardType]) then
650 return true
651 end
652 end
653 print(' '..self.questID..':|cFFFFFF00IsFiltered()|r')
654 end
655
577 function QuestPOI:IsShowable () 656 function QuestPOI:IsShowable ()
578 local print = qprint 657 local print = qprint
579 local db = WorldPlan.db
580 local qType = self.worldQuestType 658 local qType = self.worldQuestType
581 local rType = self.rewardType 659
582 self.filtered = nil 660 if not self.worldQuest then
583 self.used = true 661 print('ignoring showable check')
584 662 return self.used, self.filtered
585 for filterKey, value in pairs(WorldPlan.UsedFilters) do 663 end
586 print('|cFFFF4400', filterKey, self[filterKey]) 664 self.used = TQ_IsActive(self.questID)
587 if self[filterKey] ~= value then 665
588 self.filtered = true 666 if qType == LE_QUEST_TAG_TYPE_PROFESSION then
589 end 667 qprint('hide flags:', (not self.isKnownProfession), (db.Config.ShowAllProfessionQuests == false))
590 end 668 if (not self.isKnownProfession) and (db.Config.ShowAllProfessionQuests == false) then
591 669 qprint(self.used)
592 self.questId = self:GetID()
593 if self.rewardType then
594 if cvar_check[self.rewardType] then
595 if self.rewardType == REWARD_CASH then
596 print('##', cvar_check[self.rewardType], GetCVarBool(cvar_check[self.rewardType]))
597 end
598 if not GetCVarBool(cvar_check[self.rewardType]) then
599 self.filtered = true
600
601 end
602
603 end
604 end
605
606 if not TQ_IsActive(self.questID) then
607 self.used = nil
608 elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then
609 if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then
610 self.used = nil 670 self.used = nil
611 end 671 qprint(self.used)
612 end 672 end
613 print(' |cFF'.. (((self.rewardType == REWARD_CASH) and 'FFFF00') or '0088FF') ..'IsShowable()|r ', cvar_check[self.rewardType], 'used:', self.used, 'filtered:', self.filtered, self.title) 673 end
614 return self.used, self.filtered 674 print(' '..self.questID..':|cFFFFFF00IsShowable()|r ', self.used, self.title)
675 return self.used
615 end 676 end
616 677
617 function QuestPOI:UpdateTimer (timeLeft, timeType) 678 function QuestPOI:UpdateTimer (timeLeft, timeType)
618 print('|cFF0088FFUpdatePinTimer()|r') 679 print('|cFF0088FFUpdatePinTimer()|r')
619 end 680 end
620 681
621 --- Fixes icons upon size update 682 --- Fixes icons upon size update
622 function QuestPOI:UpdateSize () 683 function QuestPOI:UpdateSize ()
623 684
624 local style,subStyle = self:GetTypeInfo(self.rewardType) 685 qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', self.style, self.subStyle)
625 if self.filtered then 686
626 subStyle = style.minimized 687 local style = self.style
627 end 688 local subStyle = self.subStyle
628 --qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', style, subStyle)
629
630 local icon = self.icon 689 local icon = self.icon
631 local iconBorder = self.RewardBorder 690 local iconBorder = self.RewardBorder
632 local trackingBorder = self.HighlightBorder 691 local trackingBorder = self.HighlightBorder
633 local tag = self.tagIcon 692 local tag = self.tagIcon
634 693
636 local borderWidth = iconWidth + (subStyle.borderWidth * 2) 695 local borderWidth = iconWidth + (subStyle.borderWidth * 2)
637 local highlightWidth = borderWidth + (subStyle.highlightWidth * 2) 696 local highlightWidth = borderWidth + (subStyle.highlightWidth * 2)
638 697
639 local iconTexture = self.itemTexture 698 local iconTexture = self.itemTexture
640 699
700 self.tagIcon:SetSize(self.tagSize, self.tagSize)
641 self:SetSize(iconWidth, iconWidth) 701 self:SetSize(iconWidth, iconWidth)
642 icon:SetSize(iconWidth, iconWidth) 702 icon:SetSize(iconWidth, iconWidth)
643 iconBorder:SetSize(borderWidth, borderWidth) 703 iconBorder:SetSize(borderWidth, borderWidth)
644 trackingBorder:SetSize(highlightWidth, highlightWidth) 704 trackingBorder:SetSize(highlightWidth, highlightWidth)
645 705
656 end 716 end
657 end 717 end
658 718
659 self.count:SetShown((subStyle.showNumber and self.itemNumber) and style.hasNumeric) 719 self.count:SetShown((subStyle.showNumber and self.itemNumber) and style.hasNumeric)
660 720
661 --[[ 721
662 if self.tagSize then 722 end
663 tag:Show()
664 tag:ClearAllPoints()
665 tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth)
666 else
667 tag:Hide()
668 end
669
670 if self.NoIcon then
671 self.icon:Hide()
672 else
673 self.icon:Show()
674 if style.rewardMask then
675 icon:SetMask(rewardMask)
676 else
677 icon:SetMask(iconTexture)
678 end
679 if style.pinMask then
680 iconBorder:Show()
681 trackingBorder:Show()
682 iconBorder:SetMask(pinMask)
683 trackingBorder:SetMask(pinMask)
684 else
685 iconBorder:Hide()
686 trackingBorder:Hide()
687 end
688 end
689
690
691 icon:SetTexture(iconTexture)
692 iconBorder:SetTexture(iconBorder:GetTexture())
693 trackingBorder:SetTexture(trackingBorder:GetTexture())
694 --]]
695 self.currentWidth = subStyle.iconWidth
696 self.borderWidth = subStyle.borderWidth
697 self.highlightWidth = subStyle.highlightWidth
698 self.tagSize = subStyle.TagSize
699 self.maxAlertLevel = subStyle.maxAlertLevel
700 self.NoIcon = subStyle.NoIcon
701 self.style = style
702 self.subStyle = subStyle
703 if self.rewardType == REWARD_CASH then
704 qprint('using mask:', pinMask or iconTexture, rewardMask or iconTexture, self.used, self.filtered)
705 end
706
707 end