Nenue@7: -- WorldPlan Nenue@7: -- QuestPOI.lua Nenue@7: -- Created: 10/1/2016 7:21 PM Nenue@7: -- %file-revision% Nenue@7: -- Nenue@29: Nenue@29: local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID Nenue@7: local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation Nenue@7: local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes Nenue@9: local TQ_IsActive = C_TaskQuest.IsActive Nenue@29: local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData Nenue@7: local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame Nenue@33: local WorldMap_DoesWorldQuestInfoPassFilters = WorldMap_DoesWorldQuestInfoPassFilters Nenue@33: local QuestMapFrame_IsQuestWorldQuest = QuestMapFrame_IsQuestWorldQuest Nenue@33: local GameTooltip = GameTooltip Nenue@33: local GetItemIcon = GetItemIcon Nenue@7: Nenue@33: local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end Nenue@7: local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end Nenue@33: local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end Nenue@30: local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end Nenue@7: local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end Nenue@7: local QuestPOI = WorldPlanPOIMixin Nenue@7: Nenue@9: local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" Nenue@9: local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" Nenue@9: Nenue@9: local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background" Nenue@9: local POI_BORDER_FILL = "Interface\\BUTTONS\\YELLOWORANGE64" Nenue@9: local POI_BORDER_BLUE = "Interface\\BUTTONS\\GRADBLUE" Nenue@9: local POI_BORDER_RED = "Interface\\BUTTONS\\RedGrad64" Nenue@9: local POI_BORDER_YELLOW = "Interface\\BUTTONS\\YELLOWORANGE64" Nenue@9: local POI_BORDER_GREEN = "Interface\\BUTTONS\\GREENGRAD64" Nenue@9: Nenue@29: local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD Nenue@29: local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER Nenue@29: local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT Nenue@29: local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES Nenue@29: local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS Nenue@29: Nenue@29: Nenue@29: local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP Nenue@29: local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE Nenue@29: local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON Nenue@29: local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION Nenue@29: local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL Nenue@29: Nenue@29: local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP Nenue@29: local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE Nenue@29: local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON Nenue@29: local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION Nenue@29: local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL Nenue@29: Nenue@31: local subStyles = { Nenue@31: continent = { Nenue@31: PinSize = 14, Nenue@31: Border = 2, Nenue@31: TrackingBorder = 1, Nenue@31: TagSize = 6, Nenue@31: TimeleftStage = 0, Nenue@31: showNumber = false, Nenue@31: numberFontObject = 'WorldPlanFont' Nenue@31: }, Nenue@31: zone = { Nenue@31: PinSize = 22, Nenue@31: Border = 3, Nenue@31: TrackingBorder = 2, Nenue@31: TagSize = 12, Nenue@31: TimeleftStage = 3, Nenue@31: showNumber = true, Nenue@31: numberFontObject = 'WorldPlanNumberFontThin' Nenue@31: }, Nenue@31: minimized = { Nenue@31: PinSize = 4, Nenue@31: Border = 0, Nenue@31: TrackingBorder = 1, Nenue@31: NoIcon = true, Nenue@31: TimeleftStage = 1, Nenue@31: showNumber = false, Nenue@31: } Nenue@31: } Nenue@31: Nenue@29: -- Pin color/display variables Nenue@29: Nenue@33: local familiars = { Nenue@33: [42159] = {npc = 106552, name = 'Nightwatcher Merayl'}, Nenue@33: [40277] = {npc = 97804, name = 'Tiffany Nelson'}, Nenue@33: [40298] = {npc = 99182, name = 'Sir Galveston'}, Nenue@33: [40282] = {npc= 99150, name = 'Grixis Tinypop'}, Nenue@33: [40278] = {npc = 98270, name = 'Robert Craig'}, Nenue@33: [48195] = {npc = 105250, name = 'Aulier'}, Nenue@33: [41990] = {npc = 105674, name = 'Varenne'}, Nenue@33: [41860] = {npc = 104970, name = 'Xorvasc'}, Nenue@33: [40299] = {npc = 99210, name = 'Bodhi Sunwayver'}, Nenue@33: [42442] = {npc = 107489, name = 'Amalia'}, Nenue@33: [40280] = {npc = 99077, name = 'Bredda Tenderhide'}, Nenue@33: [41687] = {npc = 104553, name = 'Odrogg'}, Nenue@33: [41944] = {npc = 105455, name = 'Trapper Jarrun'}, Nenue@33: [40337] = {npc = 97709, name = 'Master Tamer Flummox'}, Nenue@33: [40279] = {npc = 99035, name = 'Durian Strongfruit'} Nenue@33: } Nenue@33: local familiars_id = 9696 Nenue@33: Nenue@33: Nenue@33: -- update a masked texture without messing up its blending mask Nenue@7: Nenue@7: Nenue@9: -- update a masked texture without messing up its blending mask Nenue@9: local SetMaskedTexture = function(region, file, mask) Nenue@33: mask = mask or "Interface\\Minimap\\UI-Minimap-Background" Nenue@9: region:SetMask(nil) Nenue@9: region:SetTexture(file) Nenue@9: region:SetMask(mask) Nenue@9: end Nenue@7: Nenue@29: Nenue@29: -- use tooltip object to extract item details Nenue@29: local ParseItemReward = function(questID) Nenue@29: local name, icon, quantity, quality, _, itemID = GetQuestLogRewardInfo(1, questID) Nenue@29: local scanner = _G.WorldPlanTooltip Nenue@29: if not itemID then Nenue@29: return Nenue@29: end Nenue@29: Nenue@29: scanner:SetOwner(WorldPlan, "ANCHOR_NONE") Nenue@29: scanner:SetItemByID(itemID) Nenue@29: scanner:Show() Nenue@29: local ttl1 = _G['WorldPlanTooltipTextLeft1'] Nenue@29: local ttl2 = _G['WorldPlanTooltipTextLeft2'] Nenue@29: local ttl3 = _G['WorldPlanTooltipTextLeft3'] Nenue@29: local ttl4 = _G['WorldPlanTooltipTextLeft4'] Nenue@29: if ttl2 then Nenue@29: local text = ttl2:GetText() Nenue@29: -- Artifact Power Nenue@29: if text then Nenue@29: if text:match("|cFFE6CC80") then Nenue@29: --print('AP token!', text) Nenue@29: local power Nenue@29: if ttl4 then Nenue@29: local text = ttl4:GetText() Nenue@29: --print('tip line 4', text) Nenue@29: if text then Nenue@29: power = text:gsub("%p", ""):match("%d+") Nenue@29: power = tonumber(power) Nenue@29: end Nenue@29: Nenue@29: end Nenue@31: return REWARD_ARTIFACT_POWER, "Interface\\ICONS\\inv_7xp_inscription_talenttome01", power, name, itemID, quality Nenue@29: elseif text:match("Item Level") then Nenue@29: --print('equipment!', text) Nenue@29: quantity = text:match("Item Level ([%d\+]+)") Nenue@31: return REWARD_GEAR, icon, quantity, name, itemID, quality Nenue@29: elseif text:match("Crafting Reagent") then Nenue@29: --print('|cFFFF4400it is a reagent', text) Nenue@31: return REWARD_REAGENT, icon, quantity, name, itemID, quality Nenue@29: end Nenue@29: end Nenue@29: Nenue@29: elseif ttl3 then Nenue@29: local text = ttl3:GetText() Nenue@29: if text:match("Crafting Reagent") then Nenue@29: --print('|cFFFF4400it is a reagent', text) Nenue@31: return REWARD_REAGENT, icon, quantity, name, itemID, quality Nenue@29: end Nenue@29: end Nenue@31: return 128, icon, quantity, name, itemID, quality Nenue@29: end Nenue@29: Nenue@27: function WorldPlanPOIMixin:OnEnter() Nenue@35: WorldMap_HijackTooltip(self) Nenue@7: local completed = select(4,GetAchievementInfo(familiars_id)) Nenue@7: if not completed then Nenue@7: if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then Nenue@7: WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT') Nenue@31: WorldMapTooltip:AddLine(self.title, 1, 1, 1) Nenue@31: if self.quality then Nenue@31: local c = ITEM_QUALITY_COLORS[self.quality] Nenue@31: WorldMapTooltip:AddLine(" ") Nenue@31: WorldMapTooltip:AddLine('Rewards') Nenue@31: WorldMapTooltip:AddLine(self.itemName .. (self.quantity and (' x'..self.quantity) or ''), c.r, c.g, c.b) Nenue@31: WorldMapTooltip:AddTexture(self.itemTexture) Nenue@31: Nenue@31: local cLine = WorldMapTooltip:NumLines() Nenue@31: local line = _G['WorldMapTooltipTextLeft'..cLine] Nenue@31: local pline = _G['WorldMapTooltipTextLeft'..(cLine-1)] Nenue@31: local icon = _G['WorldMapTooltipTexture'..(cLine-3)] Nenue@31: icon:SetSize(24,24) Nenue@31: icon:ClearAllPoints() Nenue@31: icon:SetPoint('TOPLEFT', pline, 'BOTTOMLEFT', 0, -2) Nenue@31: line:ClearAllPoints() Nenue@31: line:SetPoint('TOPLEFT', icon, 'TOPRIGHT', 7, 0) Nenue@31: Nenue@31: --- voodoo workaround for IDs getting coerced to string Nenue@31: if type(self.itemTexture) == 'number' then Nenue@31: icon:Show() Nenue@31: icon:SetTexture(self.itemTexture) Nenue@31: end Nenue@31: end Nenue@31: Nenue@31: Nenue@31: WorldMapTooltip:AddLine(" ") -- causes crash for some reason Nenue@7: WorldMapTooltip:AddLine('Family Familiars') Nenue@7: local trainer = familiars[self.questID].name Nenue@7: local numCheevs = GetAchievementNumCriteria(familiars_id) Nenue@7: for index = 1, numCheevs do Nenue@7: local cheevName, cType, cCompleted, quantity, requiredQuantity, charName, flags, cheevID, quantityString, criteriaID = GetAchievementCriteriaInfo(familiars_id, index) Nenue@7: local numTrainers = GetAchievementNumCriteria(cheevID) Nenue@7: for subIndex = 1, numTrainers do Nenue@7: local desc, cType, partCompleted = GetAchievementCriteriaInfo(cheevID, subIndex) Nenue@7: if desc == trainer then Nenue@7: if not partCompleted then Nenue@7: local iconPath = select(10, GetAchievementInfo(cheevID)) Nenue@7: WorldMapTooltip:AddLine(cheevName) Nenue@7: WorldMapTooltip:AddTexture(iconPath) Nenue@7: end Nenue@7: end Nenue@7: end Nenue@7: end Nenue@7: WorldMapTooltip:Show() Nenue@7: return Nenue@7: end Nenue@7: end Nenue@7: TaskPOI_OnEnter(self) Nenue@7: end Nenue@27: function WorldPlanPOIMixin:OnLeave() Nenue@35: WorldMap_RestoreTooltip() Nenue@7: TaskPOI_OnLeave(self) Nenue@7: end Nenue@27: function WorldPlanPOIMixin:OnMouseDown() Nenue@7: TaskPOI_OnClick(self) Nenue@7: end Nenue@7: Nenue@7: Nenue@29: Nenue@29: -- create or update the pin using the given questID and C_TaskQuest results Nenue@29: function WorldPlanPOIMixin:RefreshData (info) Nenue@29: Nenue@29: qprint('|cFF00FF88'..self:GetName()..':RefreshData()|r') Nenue@29: Nenue@29: if info then Nenue@29: self.inProgress = info.inProgress Nenue@29: self.floor = info.floor Nenue@29: self.numObjectives = info.numObjectives or 0 Nenue@30: if info.x and info.y then Nenue@30: self.x = info.x or self.x Nenue@30: self.y = info.y or self.y Nenue@35: --qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y) Nenue@30: end Nenue@30: Nenue@29: end Nenue@29: Nenue@29: Nenue@29: local questID = self:GetID() Nenue@29: local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _ Nenue@33: local hasUpdate, isPending = (self.isStale or self.isNew), self.isPending Nenue@29: Nenue@29: Nenue@29: if not HaveQuestData(questID) then Nenue@29: TQ_RequestPreloadRewardData(questID) Nenue@29: isPending = true Nenue@29: else Nenue@29: Nenue@29: -- set reward category Nenue@29: local numRewards = GetNumQuestLogRewards(questID) Nenue@29: local numCurrency = GetNumQuestLogRewardCurrencies(questID) Nenue@29: local money = GetQuestLogRewardMoney(questID) Nenue@29: if numRewards >= 1 then Nenue@31: rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = ParseItemReward(questID) Nenue@29: elseif numCurrency >= 1 then Nenue@29: rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID) Nenue@29: rewardType = REWARD_CURRENCY Nenue@29: elseif money >= 1 then Nenue@29: rewardIcon = ICON_MONEY Nenue@29: rewardName = GetMoneyString(money) Nenue@29: rewardType = REWARD_CASH Nenue@29: end Nenue@30: rewardStyle = self:GetTypeInfo(rewardType) Nenue@29: Nenue@29: self.itemNumber = rewardCount or self.itemNumber Nenue@29: self.rewardType = rewardType or REWARD_ITEM Nenue@29: self.style = rewardStyle Nenue@31: self.quality = quality Nenue@29: Nenue@29: -- title, faction, capped state Nenue@29: local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID) Nenue@29: self.factionID = factionID Nenue@29: self.capped = capped Nenue@29: Nenue@29: -- set tag details Nenue@29: local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = GetQuestTagInfo(questID); Nenue@29: local tagAtlas Nenue@29: if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then Nenue@29: tagAtlas = "worldquest-icon-petbattle" Nenue@29: elseif worldQuestType == LE_QUEST_TAG_TYPE_PVP then Nenue@29: tagAtlas = "worldquest-icon-pvp-ffa" Nenue@29: elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then Nenue@29: local id = tradeskillLineIndex and select(7, GetProfessionInfo(tradeskillLineIndex)) Nenue@29: if id then Nenue@29: tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id] Nenue@29: end Nenue@29: elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then Nenue@29: tagAtlas = "worldquest-icon-dungeon" Nenue@29: end Nenue@29: Nenue@29: self.tagID = tagID Nenue@29: self.tagName = tagName Nenue@29: self.worldQuestType = worldQuestType Nenue@29: self.isElite = isElite Nenue@29: self.tradeskillLineIndex = tradeskillLineIndex Nenue@29: self.rarity = rarity Nenue@29: self.tagAtlas = tagAtlas Nenue@29: Nenue@29: -- flag unresolved info Nenue@29: if not (rewardIcon and rewardName) then Nenue@29: isPending = true Nenue@29: qprint('because not have icon') Nenue@29: TQ_RequestPreloadRewardData (questID) Nenue@29: --WorldPlan:print('|cFFFFFF00'..tostring(self.title)..'|r waiting on texture info') Nenue@29: else Nenue@29: if (rewardIcon and rewardName) and isPending then Nenue@29: --WorldPlan:print('|cFF00FF00'..tostring(self.title)..'|r has info', rewardIcon, rewardName) Nenue@29: hasUpdate = true Nenue@29: end Nenue@29: isPending = false Nenue@29: end Nenue@29: Nenue@29: self.title = questTitle or "|cFFFF0000Retrieving..." Nenue@29: self.itemTexture = rewardIcon or self.itemTexture Nenue@29: self.itemName = rewardName or self.itemName Nenue@33: self.isStale = hasUpdate Nenue@29: self.isPending = isPending Nenue@29: Nenue@29: Nenue@35: --qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending, 'isShown', self:IsShown()) Nenue@35: --qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID) Nenue@35: --qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) Nenue@29: end Nenue@31: self.cheevos = familiars[self.questID] Nenue@31: Nenue@29: return hasUpdate, isPending Nenue@29: end Nenue@29: Nenue@29: Nenue@7: function WorldPlanPOIMixin:SetAchievementProgressTooltip() Nenue@7: print('cheevos') Nenue@7: end Nenue@7: Nenue@34: -- run from OnShow if .isNew is set Nenue@34: function WorldPlanPOIMixin:OnNew() Nenue@34: Nenue@34: if not self.isAnimating then Nenue@35: --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.') Nenue@35: self:SetAlpha(0) Nenue@35: if WorldPlan.db.FadeWhileGrouped then Nenue@35: self.FadeIn.FadeIn:SetToAlpha(0.15) Nenue@35: self.PendingFade.FadeIn:SetToAlpha(0.15) Nenue@35: self.PendingFade.FadeOut:SetFromAlpha(0.15) Nenue@35: else Nenue@35: self.FadeIn.FadeIn:SetToAlpha(1) Nenue@35: self.PendingFade.FadeIn:SetToAlpha(1) Nenue@35: self.PendingFade.FadeOut:SetFromAlpha(1) Nenue@35: end Nenue@34: self.isAnimating = true Nenue@35: self.isNew = nil Nenue@35: self.FadeIn:Play() Nenue@34: end Nenue@7: end Nenue@7: Nenue@27: function WorldPlanPOIMixin:OnShow () Nenue@35: qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) Nenue@27: -- pop this on principle Nenue@34: Nenue@34: if self.isNew or self.isStale then Nenue@27: self:Refresh() Nenue@27: end Nenue@27: Nenue@34: Nenue@34: -- is it a new quest? Nenue@34: if self.isNew then Nenue@35: print('|cFFFFFF00popping new pin handler') Nenue@34: self:OnNew() Nenue@35: elseif not self.isAnimating then Nenue@35: self:SetAlpha(1) Nenue@34: end Nenue@34: Nenue@35: --WorldPlan:print(self:GetAlpha()) Nenue@34: Nenue@27: end Nenue@27: function WorldPlanPOIMixin:OnHide() Nenue@35: --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') Nenue@34: if not self:IsShown() then Nenue@34: self.isAnimating = nil Nenue@35: self:SetAlpha(1) Nenue@34: end Nenue@34: Nenue@27: end Nenue@27: Nenue@27: function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight) Nenue@33: --qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID, mapWidth) Nenue@7: self:ClearAllPoints() Nenue@29: local dX, dY = TQ_GetQuestLocation(self.questID) Nenue@7: if not dX or dX == 0 then Nenue@7: local _, x, y = QuestPOIGetIconInfo(self.questID) Nenue@7: if x and floor(x) ~= 0 then Nenue@7: dX, dY = x, y Nenue@7: else Nenue@7: dX, dY = self.x, self.y Nenue@7: end Nenue@7: end Nenue@7: self.x = dX Nenue@7: self.y = dY Nenue@7: Nenue@29: --qprint(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY)) Nenue@7: Nenue@7: local pX = (dX * mapWidth) Nenue@7: local pY = (-dY * mapHeight) Nenue@7: Nenue@7: self:SetParent(WorldMapPOIFrame) Nenue@7: self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY) Nenue@7: end Nenue@7: Nenue@7: Nenue@27: function WorldPlanPOIMixin:OnLoad() Nenue@27: qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db) Nenue@7: self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') Nenue@27: self.style = WorldPlan.db.defaultPinStyle Nenue@27: self.subStyle = WorldPlan.db.defaultPinStyle.continent Nenue@7: end Nenue@7: Nenue@27: function WorldPlanPOIMixin:OnEvent(event, ...) Nenue@7: if event == 'SUPER_TRACKED_QUEST_CHANGED' then Nenue@33: self.isStale = true Nenue@7: end Nenue@7: end Nenue@7: Nenue@7: Nenue@7: local PIN_UPDATE_DELAY = .016 Nenue@7: local TOP_PIN_ID Nenue@27: function WorldPlanPOIMixin:OnUpdate (sinceLast) Nenue@35: if self.isNew then Nenue@35: print('|cFFFFFF00push new poi stuff') Nenue@35: self:OnNew() Nenue@30: end Nenue@7: -- control update check intervals Nenue@7: self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast Nenue@7: if self.throttle <= 0 then Nenue@7: -- factor overtime into the throttle timer Nenue@7: self.throttle = PIN_UPDATE_DELAY - self.throttle Nenue@7: else Nenue@7: return Nenue@7: end Nenue@35: if self.isStale and not self.isAnimating then Nenue@35: print('|cFFFFFF00push poi update') Nenue@35: self:Refresh() Nenue@35: return Nenue@35: end Nenue@7: Nenue@7: -- query for reward data if it wasn't found in the original scan Nenue@7: local questID = self.questID Nenue@7: if self.isPending then Nenue@29: self:RefreshData() Nenue@7: if not (self.PendingFade:IsPlaying() or self.isAnimating) then Nenue@7: self.PendingFade:Play() Nenue@7: end Nenue@7: return Nenue@7: else Nenue@7: if self.PendingFade:IsPlaying() then Nenue@7: self.PendingFade:Stop() Nenue@7: end Nenue@7: end Nenue@7: Nenue@7: Nenue@7: -- update time elements Nenue@7: local tl = self.timeThreschold Nenue@7: local timeLeft = TQ_GetQuestTimeLeftMinutes(questID) Nenue@7: if timeLeft > 0 then Nenue@29: local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.TimeleftStage) Nenue@29: if tl ~= timeState then Nenue@29: tl = timeState Nenue@29: self.timeLabel:SetText(text) Nenue@7: end Nenue@7: else Nenue@7: -- remove self in a timely manner Nenue@9: if not TQ_IsActive(self.questID) then Nenue@9: print('|cFFFF4400'..self:GetName()..' pin hard timeout') Nenue@9: if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then Nenue@9: self:Hide() Nenue@9: end Nenue@7: end Nenue@7: end Nenue@7: self.timeThreschold = tl Nenue@7: Nenue@7: if self:IsMouseOver() then Nenue@7: self.MouseGlow:Show() Nenue@7: else Nenue@7: self.MouseGlow:Hide() Nenue@7: end Nenue@8: end Nenue@8: Nenue@8: Nenue@9: Nenue@27: function WorldPlanPOIMixin:Refresh () Nenue@9: local db = WorldPlan.db Nenue@30: print('|cFF00FF88'..self:GetName()..'|r:Refresh()') Nenue@9: Nenue@9: Nenue@9: Nenue@29: local questID = self:GetID() Nenue@35: local style,subStyle = WorldPlanQuests:GetTypeInfo(self.rewardType) Nenue@29: if self.filtered then Nenue@29: subStyle = style.minimized Nenue@29: end Nenue@30: self.style = style Nenue@31: self.subStyle = subStyle Nenue@30: Nenue@29: Nenue@9: local borderMask = style.mask Nenue@9: local borderFill = style.texture Nenue@9: local iconBorder = self.iconBorder Nenue@9: local icon = self.icon Nenue@9: local count = self.count Nenue@9: Nenue@27: self.hasNumeric = style.hasNumeric Nenue@27: self.numberRGB = style.numberRGB Nenue@27: self.showNumber = subStyle.showNumber Nenue@9: Nenue@27: Nenue@9: Nenue@9: --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName)) Nenue@9: SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask) Nenue@9: icon:SetAllPoints(self) Nenue@9: Nenue@9: if self.itemName then Nenue@27: Nenue@29: Nenue@27: if self.hasNumeric then Nenue@30: if subStyle.numberFontObject then Nenue@33: --wqprint('change font', _G[subStyle.numberFontObject]:GetName()) Nenue@30: self.count:SetFontObject(_G[subStyle.numberFontObject]) Nenue@30: end Nenue@33: --wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber) Nenue@30: Nenue@31: self.count:SetShown(self.showNumber) Nenue@29: self.count:SetText(self.itemNumber) Nenue@29: self.count:SetTextColor(unpack(self.numberRGB)) Nenue@9: else Nenue@29: self.count:SetShown(false) Nenue@29: self.count:SetText(nil) Nenue@9: end Nenue@27: Nenue@9: end Nenue@9: Nenue@9: SetMaskedTexture(iconBorder, borderFill, borderMask) Nenue@30: local border = self:GetTypeInfo(self.rewardType) Nenue@9: iconBorder:SetVertexColor(border.r, border.g, border.b, border.a) Nenue@9: iconBorder:SetDesaturated(true) Nenue@9: Nenue@9: local trackingBorder = self.supertrackBorder Nenue@9: Nenue@9: self.highlight:SetMask(nil) Nenue@9: if questID == GetSuperTrackedQuestID() then Nenue@9: trackingBorder:SetVertexColor(0,0,0,1) Nenue@9: else Nenue@9: trackingBorder:SetVertexColor(0,0,0,0.5) Nenue@9: end Nenue@9: self.highlight:SetAllPoints(trackingBorder) Nenue@9: Nenue@9: SetMaskedTexture(trackingBorder, borderFill, borderMask) Nenue@9: self.highlight:SetMask(borderMask) Nenue@9: Nenue@9: local qType = self.worldQuestType Nenue@9: self.tagIcon:SetAtlas(self.tagAtlas) Nenue@9: self.tagIcon:SetTexCoord(0,1,0,1) Nenue@9: Nenue@9: Nenue@9: if self.isElite then Nenue@29: self.EliteBorder:Show() Nenue@9: else Nenue@29: self.EliteBorder:Hide() Nenue@9: end Nenue@30: --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') Nenue@30: --print(' - subStyle:', (self.filtered == true), self.subStyle) Nenue@9: Nenue@9: Nenue@9: self:UpdateSize() Nenue@35: Nenue@33: self.isStale = nil Nenue@35: Nenue@9: end Nenue@9: Nenue@35: local cvar_check = { Nenue@35: [REWARD_CASH] = 'worldQuestFilterGold', Nenue@35: [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower', Nenue@35: [REWARD_CURRENCY] = 'worldQuestFilterOrderResources', Nenue@35: [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', Nenue@35: [REWARD_GEAR] = 'worldQuestFilterEquipment', Nenue@35: } Nenue@8: Nenue@33: Nenue@33: function QuestPOI:IsShowable () Nenue@33: local print = wqprint Nenue@33: local db = WorldPlan.db Nenue@33: local qType = self.worldQuestType Nenue@33: local rType = self.rewardType Nenue@33: self.filtered = nil Nenue@33: self.used = true Nenue@33: Nenue@33: Nenue@33: self.questId = self:GetID() Nenue@35: if self.rewardType then Nenue@35: if cvar_check[self.rewardType] and not GetCVarBool(cvar_check[self.rewardType]) then Nenue@33: self.filtered = true Nenue@8: end Nenue@35: else Nenue@35: for filterKey, value in pairs(WorldPlan.UsedFilters) do Nenue@35: if self[filterKey] ~= value then Nenue@35: self.filtered = true Nenue@35: end Nenue@35: end Nenue@8: end Nenue@33: Nenue@33: if not TQ_IsActive(self.questID) then Nenue@33: self.used = nil Nenue@33: elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then Nenue@33: if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then Nenue@33: self.used = nil Nenue@33: end Nenue@33: end Nenue@34: print(' |cFFFF4400IsShowable()|r', self.isNew, self.isAnimating, self.used, self.filtered, self.title) Nenue@33: return self.used, self.filtered Nenue@33: end Nenue@33: Nenue@33: function QuestPOI:UpdateTimer (timeLeft, timeType) Nenue@33: print('|cFF0088FFUpdatePinTimer()|r') Nenue@33: end Nenue@33: Nenue@33: --- Fixes icons upon size update Nenue@33: function QuestPOI:UpdateSize (style, subStyle) Nenue@33: style = style or self.style Nenue@33: subStyle = subStyle or self.subStyle Nenue@33: Nenue@33: --qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', style, subStyle) Nenue@33: Nenue@33: self.currentWidth = subStyle.PinSize Nenue@33: self.borderSize = subStyle.Border Nenue@33: self.trackingBorderSize = subStyle.TrackingBorder Nenue@33: self.tagSize = subStyle.TagSize Nenue@33: self.TimeleftStage = subStyle.TimeleftStage Nenue@33: self.NoIcon = subStyle.NoIcon Nenue@33: Nenue@33: Nenue@33: self:SetSize(self.currentWidth, self.currentWidth) Nenue@33: Nenue@33: local icon = self.icon Nenue@33: local iconBorder = self.iconBorder Nenue@33: local trackingBorder = self.supertrackBorder Nenue@33: local tag = self.tagIcon Nenue@33: local pinMask = style.pinMask Nenue@33: local rewardMask = style.rewardMask Nenue@33: Nenue@33: if self.NoIcon then Nenue@33: self.icon:Hide() Nenue@33: else Nenue@33: self.icon:Show() Nenue@33: icon:SetMask(nil) Nenue@33: icon:SetMask(rewardMask) Nenue@33: icon:SetTexture(self.icon:GetTexture()) Nenue@33: end Nenue@33: iconBorder:SetMask(nil) Nenue@33: trackingBorder:SetMask(nil) Nenue@33: Nenue@33: Nenue@33: local borderWidth = self.borderSize Nenue@33: local trackingWidth = self.trackingBorderSize Nenue@33: Nenue@33: iconBorder:ClearAllPoints() Nenue@33: iconBorder:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', -borderWidth + (style.x or 0), -borderWidth + (style.y or 0)) Nenue@33: iconBorder:SetPoint('TOPRIGHT', self, 'TOPRIGHT', borderWidth + (style.x or 0), borderWidth + (style.y or 0)) Nenue@33: Nenue@33: trackingBorder:ClearAllPoints() Nenue@33: trackingBorder:SetPoint('BOTTOMLEFT', iconBorder, 'BOTTOMLEFT', -trackingWidth, -trackingWidth) Nenue@33: trackingBorder:SetPoint('TOPRIGHT', iconBorder, 'TOPRIGHT', trackingWidth, trackingWidth) Nenue@33: Nenue@33: if self.tagSize then Nenue@33: tag:Show() Nenue@33: tag:ClearAllPoints() Nenue@33: tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth) Nenue@33: else Nenue@33: tag:Hide() Nenue@33: end Nenue@33: Nenue@35: qprint('using mask:', pinMask, self.name ) Nenue@33: iconBorder:SetMask(pinMask) Nenue@33: trackingBorder:SetMask(pinMask) Nenue@35: iconBorder:SetTexture(iconBorder:GetTexture()) Nenue@35: trackingBorder:SetTexture(trackingBorder:GetTexture()) Nenue@7: end