comparison QuestPOI.lua @ 31:d0114b51cdea

WorldPlan: - Reworking filters to utilize newly added CVars - Fleshed out POI tooltip for WQ's associated with Family Familiars - Filter button tooltip includes reward icons - Respond to tracking menu clicks when they change filter options
author Nenue
date Fri, 28 Oct 2016 19:54:00 -0400
parents 8cb750e79952
children be4db60219ca
comparison
equal deleted inserted replaced
30:8cb750e79952 31:d0114b51cdea
43 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP 43 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
44 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE 44 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
45 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON 45 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
46 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION 46 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
47 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL 47 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
48
49 local subStyles = {
50 continent = {
51 PinSize = 14,
52 Border = 2,
53 TrackingBorder = 1,
54 TagSize = 6,
55 TimeleftStage = 0,
56 showNumber = false,
57 numberFontObject = 'WorldPlanFont'
58 },
59 zone = {
60 PinSize = 22,
61 Border = 3,
62 TrackingBorder = 2,
63 TagSize = 12,
64 TimeleftStage = 3,
65 showNumber = true,
66 numberFontObject = 'WorldPlanNumberFontThin'
67 },
68 minimized = {
69 PinSize = 4,
70 Border = 0,
71 TrackingBorder = 1,
72 NoIcon = true,
73 TimeleftStage = 1,
74 showNumber = false,
75 }
76 }
48 77
49 -- Pin color/display variables 78 -- Pin color/display variables
50 79
51 local familiars = { 80 local familiars = {
52 [42159] = {npc = 106552, name = 'Nightwatcher Merayl'}, 81 [42159] = {npc = 106552, name = 'Nightwatcher Merayl'},
106 power = text:gsub("%p", ""):match("%d+") 135 power = text:gsub("%p", ""):match("%d+")
107 power = tonumber(power) 136 power = tonumber(power)
108 end 137 end
109 138
110 end 139 end
111 return REWARD_ARTIFACT_POWER, "Interface\\ICONS\\inv_7xp_inscription_talenttome01", power, name, itemID 140 return REWARD_ARTIFACT_POWER, "Interface\\ICONS\\inv_7xp_inscription_talenttome01", power, name, itemID, quality
112 elseif text:match("Item Level") then 141 elseif text:match("Item Level") then
113 --print('equipment!', text) 142 --print('equipment!', text)
114 quantity = text:match("Item Level ([%d\+]+)") 143 quantity = text:match("Item Level ([%d\+]+)")
115 return REWARD_GEAR, icon, quantity, name, itemID 144 return REWARD_GEAR, icon, quantity, name, itemID, quality
116 elseif text:match("Crafting Reagent") then 145 elseif text:match("Crafting Reagent") then
117 --print('|cFFFF4400it is a reagent', text) 146 --print('|cFFFF4400it is a reagent', text)
118 return REWARD_REAGENT, icon, quantity, name, itemID 147 return REWARD_REAGENT, icon, quantity, name, itemID, quality
119 end 148 end
120 end 149 end
121 150
122 elseif ttl3 then 151 elseif ttl3 then
123 local text = ttl3:GetText() 152 local text = ttl3:GetText()
124 if text:match("Crafting Reagent") then 153 if text:match("Crafting Reagent") then
125 --print('|cFFFF4400it is a reagent', text) 154 --print('|cFFFF4400it is a reagent', text)
126 return REWARD_REAGENT, icon, quantity, name, itemID 155 return REWARD_REAGENT, icon, quantity, name, itemID, quality
127 end 156 end
128 end 157 end
129 return 128, icon, quantity, name, itemID 158 return 128, icon, quantity, name, itemID, quality
130 end 159 end
131 160
132 function WorldPlanPOIMixin:OnEnter() 161 function WorldPlanPOIMixin:OnEnter()
133 local completed = select(4,GetAchievementInfo(familiars_id)) 162 local completed = select(4,GetAchievementInfo(familiars_id))
134 if not completed then 163 if not completed then
135 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then 164 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then
136 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT') 165 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT')
166 WorldMapTooltip:AddLine(self.title, 1, 1, 1)
167 if self.quality then
168 local c = ITEM_QUALITY_COLORS[self.quality]
169 WorldMapTooltip:AddLine(" ")
170 WorldMapTooltip:AddLine('Rewards')
171 WorldMapTooltip:AddLine(self.itemName .. (self.quantity and (' x'..self.quantity) or ''), c.r, c.g, c.b)
172 WorldMapTooltip:AddTexture(self.itemTexture)
173
174 local cLine = WorldMapTooltip:NumLines()
175 local line = _G['WorldMapTooltipTextLeft'..cLine]
176 local pline = _G['WorldMapTooltipTextLeft'..(cLine-1)]
177 local icon = _G['WorldMapTooltipTexture'..(cLine-3)]
178 icon:SetSize(24,24)
179 icon:ClearAllPoints()
180 icon:SetPoint('TOPLEFT', pline, 'BOTTOMLEFT', 0, -2)
181 line:ClearAllPoints()
182 line:SetPoint('TOPLEFT', icon, 'TOPRIGHT', 7, 0)
183
184 --- voodoo workaround for IDs getting coerced to string
185 if type(self.itemTexture) == 'number' then
186 icon:Show()
187 icon:SetTexture(self.itemTexture)
188 end
189 end
190
191
192 WorldMapTooltip:AddLine(" ") -- causes crash for some reason
137 WorldMapTooltip:AddLine('Family Familiars') 193 WorldMapTooltip:AddLine('Family Familiars')
138 local trainer = familiars[self.questID].name 194 local trainer = familiars[self.questID].name
139 local numCheevs = GetAchievementNumCriteria(familiars_id) 195 local numCheevs = GetAchievementNumCriteria(familiars_id)
140 for index = 1, numCheevs do 196 for index = 1, numCheevs do
141 local cheevName, cType, cCompleted, quantity, requiredQuantity, charName, flags, cheevID, quantityString, criteriaID = GetAchievementCriteriaInfo(familiars_id, index) 197 local cheevName, cType, cCompleted, quantity, requiredQuantity, charName, flags, cheevID, quantityString, criteriaID = GetAchievementCriteriaInfo(familiars_id, index)
179 self.x = info.x or self.x 235 self.x = info.x or self.x
180 self.y = info.y or self.y 236 self.y = info.y or self.y
181 qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y) 237 qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y)
182 end 238 end
183 239
184 self.passesBlizzFilters = WorldMap_DoesWorldQuestInfoPassFilters(info)
185 end 240 end
186 241
187 242
188 local questID = self:GetID() 243 local questID = self:GetID()
189 local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _ 244 local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _
190 local hasUpdate, isPending = self.hasUpdate, self.isPending 245 local hasUpdate, isPending = (self.hasUpdate or self.isNew), self.isPending
191 246
192 247
193 if not HaveQuestData(questID) then 248 if not HaveQuestData(questID) then
194 TQ_RequestPreloadRewardData(questID) 249 TQ_RequestPreloadRewardData(questID)
195 isPending = true 250 isPending = true
196 qprint('because not have data')
197 else 251 else
198 252
199 -- set reward category 253 -- set reward category
200 local numRewards = GetNumQuestLogRewards(questID) 254 local numRewards = GetNumQuestLogRewards(questID)
201 local numCurrency = GetNumQuestLogRewardCurrencies(questID) 255 local numCurrency = GetNumQuestLogRewardCurrencies(questID)
202 local money = GetQuestLogRewardMoney(questID) 256 local money = GetQuestLogRewardMoney(questID)
203 if numRewards >= 1 then 257 if numRewards >= 1 then
204 rewardType, rewardIcon, rewardCount, rewardName, itemID = ParseItemReward(questID) 258 rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = ParseItemReward(questID)
205 elseif numCurrency >= 1 then 259 elseif numCurrency >= 1 then
206 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID) 260 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
207 rewardType = REWARD_CURRENCY 261 rewardType = REWARD_CURRENCY
208 elseif money >= 1 then 262 elseif money >= 1 then
209 rewardIcon = ICON_MONEY 263 rewardIcon = ICON_MONEY
213 rewardStyle = self:GetTypeInfo(rewardType) 267 rewardStyle = self:GetTypeInfo(rewardType)
214 268
215 self.itemNumber = rewardCount or self.itemNumber 269 self.itemNumber = rewardCount or self.itemNumber
216 self.rewardType = rewardType or REWARD_ITEM 270 self.rewardType = rewardType or REWARD_ITEM
217 self.style = rewardStyle 271 self.style = rewardStyle
272 self.quality = quality
218 273
219 -- title, faction, capped state 274 -- title, faction, capped state
220 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID) 275 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
221 self.factionID = factionID 276 self.factionID = factionID
222 self.capped = capped 277 self.capped = capped
268 323
269 qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending) 324 qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending)
270 qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID) 325 qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
271 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) 326 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
272 end 327 end
328 self.cheevos = familiars[self.questID]
329
273 return hasUpdate, isPending 330 return hasUpdate, isPending
274 end 331 end
275 332
276 333
277 function WorldPlanPOIMixin:SetAchievementProgressTooltip() 334 function WorldPlanPOIMixin:SetAchievementProgressTooltip()
409 local style,subStyle = self:GetTypeInfo(self.rewardType) 466 local style,subStyle = self:GetTypeInfo(self.rewardType)
410 if self.filtered then 467 if self.filtered then
411 subStyle = style.minimized 468 subStyle = style.minimized
412 end 469 end
413 self.style = style 470 self.style = style
471 self.subStyle = subStyle
414 472
415 473
416 local borderMask = style.mask 474 local borderMask = style.mask
417 local borderFill = style.texture 475 local borderFill = style.texture
418 local iconBorder = self.iconBorder 476 local iconBorder = self.iconBorder
419 local icon = self.icon 477 local icon = self.icon
420 local count = self.count 478 local count = self.count
421 479
422 self.subStyle = subStyle
423 self.hasNumeric = style.hasNumeric 480 self.hasNumeric = style.hasNumeric
424 self.numberRGB = style.numberRGB 481 self.numberRGB = style.numberRGB
425 self.showNumber = subStyle.showNumber 482 self.showNumber = subStyle.showNumber
426 483
427 484
436 if self.hasNumeric then 493 if self.hasNumeric then
437 if subStyle.numberFontObject then 494 if subStyle.numberFontObject then
438 wqprint('change font', _G[subStyle.numberFontObject]:GetName()) 495 wqprint('change font', _G[subStyle.numberFontObject]:GetName())
439 self.count:SetFontObject(_G[subStyle.numberFontObject]) 496 self.count:SetFontObject(_G[subStyle.numberFontObject])
440 end 497 end
441 498 wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber)
442 self.count:SetShown(true) 499
500 self.count:SetShown(self.showNumber)
443 self.count:SetText(self.itemNumber) 501 self.count:SetText(self.itemNumber)
444 self.count:SetTextColor(unpack(self.numberRGB)) 502 self.count:SetTextColor(unpack(self.numberRGB))
445 else 503 else
446 self.count:SetShown(false) 504 self.count:SetShown(false)
447 self.count:SetText(nil) 505 self.count:SetText(nil)