view QuestPOI.lua @ 35:26dfa661daa7

WorldPlan: - Quest pins will appear in the flight map. They follow the filter settings applied from the world map. - Reward filter toggle changed to clear out other reward filters. The assumption being that one is most often looking only for that particular type of quest when they go to use it. - Fixed filter bar info falling out of sync after player-triggered world map updates. - Code stuff: -- Quest pin shown-state management makes better use of OnShow OnHide handlers, SetShown is toggled and it all goes from there -- WorldQuests module re-factored outside of the top level frame script. ClassPlan: - Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
author Nenue
date Thu, 03 Nov 2016 17:29:15 -0400
parents 0100d923d8c3
children 21bcff08b0f4
line wrap: on
line source
-- WorldPlan
-- QuestPOI.lua
-- Created: 10/1/2016 7:21 PM
-- %file-revision%
--

local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID
local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
local TQ_IsActive = C_TaskQuest.IsActive
local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData
local QuestPOIGetIconInfo, WorldMapPOIFrame =  QuestPOIGetIconInfo, WorldMapPOIFrame
local WorldMap_DoesWorldQuestInfoPassFilters = WorldMap_DoesWorldQuestInfoPassFilters
local QuestMapFrame_IsQuestWorldQuest = QuestMapFrame_IsQuestWorldQuest
local GameTooltip = GameTooltip
local GetItemIcon = GetItemIcon

local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
local QuestPOI = WorldPlanPOIMixin

local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"

local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background"
local POI_BORDER_FILL = "Interface\\BUTTONS\\YELLOWORANGE64"
local POI_BORDER_BLUE = "Interface\\BUTTONS\\GRADBLUE"
local POI_BORDER_RED = "Interface\\BUTTONS\\RedGrad64"
local POI_BORDER_YELLOW = "Interface\\BUTTONS\\YELLOWORANGE64"
local POI_BORDER_GREEN = "Interface\\BUTTONS\\GREENGRAD64"

local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD
local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER
local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT
local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES
local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS


local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL

local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL

local subStyles = {
  continent = {
    PinSize = 14,
    Border = 2,
    TrackingBorder = 1,
    TagSize = 6,
    TimeleftStage = 0,
    showNumber = false,
    numberFontObject = 'WorldPlanFont'
  },
  zone = {
    PinSize = 22,
    Border = 3,
    TrackingBorder = 2,
    TagSize = 12,
    TimeleftStage = 3,
    showNumber = true,
    numberFontObject = 'WorldPlanNumberFontThin'
  },
  minimized = {
    PinSize = 4,
    Border = 0,
    TrackingBorder = 1,
    NoIcon = true,
    TimeleftStage = 1,
    showNumber = false,
  }
}

-- Pin color/display variables

local familiars = {
    [42159] = {npc = 106552, name = 'Nightwatcher Merayl'},
    [40277] = {npc = 97804, name = 'Tiffany Nelson'},
    [40298] = {npc = 99182, name = 'Sir Galveston'},
    [40282] = {npc=  99150, name = 'Grixis Tinypop'},
    [40278] = {npc = 98270, name = 'Robert Craig'},
    [48195] = {npc = 105250, name = 'Aulier'},
    [41990] = {npc = 105674, name = 'Varenne'},
    [41860] = {npc = 104970, name = 'Xorvasc'},
    [40299] = {npc = 99210, name = 'Bodhi Sunwayver'},
    [42442] = {npc = 107489, name = 'Amalia'},
    [40280] = {npc = 99077, name = 'Bredda Tenderhide'},
    [41687] = {npc = 104553, name = 'Odrogg'},
    [41944] = {npc = 105455, name = 'Trapper Jarrun'},
    [40337] = {npc = 97709, name = 'Master Tamer Flummox'},
    [40279] = {npc = 99035, name = 'Durian Strongfruit'}
}
local familiars_id = 9696


-- update a masked texture without messing up its blending mask


-- update a masked texture without messing up its blending mask
local SetMaskedTexture = function(region, file, mask)
  mask = mask or "Interface\\Minimap\\UI-Minimap-Background"
  region:SetMask(nil)
  region:SetTexture(file)
  region:SetMask(mask)
end


-- use tooltip object to extract item details
local ParseItemReward = function(questID)
  local name, icon, quantity, quality, _, itemID = GetQuestLogRewardInfo(1, questID)
  local scanner = _G.WorldPlanTooltip
  if not itemID then
    return
  end

  scanner:SetOwner(WorldPlan, "ANCHOR_NONE")
  scanner:SetItemByID(itemID)
  scanner:Show()
  local ttl1 = _G['WorldPlanTooltipTextLeft1']
  local ttl2 = _G['WorldPlanTooltipTextLeft2']
  local ttl3 = _G['WorldPlanTooltipTextLeft3']
  local ttl4 = _G['WorldPlanTooltipTextLeft4']
  if ttl2 then
    local text = ttl2:GetText()
    -- Artifact Power
    if text then
      if text:match("|cFFE6CC80") then
        --print('AP token!', text)
        local power
        if ttl4 then
          local text = ttl4:GetText()
          --print('tip line 4', text)
          if text then
            power = text:gsub("%p", ""):match("%d+")
            power = tonumber(power)
          end

        end
        return REWARD_ARTIFACT_POWER, "Interface\\ICONS\\inv_7xp_inscription_talenttome01", power, name, itemID, quality
      elseif text:match("Item Level") then
        --print('equipment!', text)
        quantity = text:match("Item Level ([%d\+]+)")
        return REWARD_GEAR, icon, quantity, name, itemID, quality
      elseif  text:match("Crafting Reagent") then
        --print('|cFFFF4400it is a reagent', text)
        return REWARD_REAGENT, icon, quantity, name, itemID, quality
      end
    end

  elseif ttl3 then
    local text = ttl3:GetText()
    if  text:match("Crafting Reagent") then
      --print('|cFFFF4400it is a reagent', text)
      return REWARD_REAGENT, icon, quantity, name, itemID, quality
    end
  end
  return 128, icon, quantity, name, itemID, quality
end

function WorldPlanPOIMixin:OnEnter()
  WorldMap_HijackTooltip(self)
  local completed = select(4,GetAchievementInfo(familiars_id))
  if not completed then
    if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then
      WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT')
      WorldMapTooltip:AddLine(self.title, 1, 1, 1)
      if self.quality then
        local c = ITEM_QUALITY_COLORS[self.quality]
        WorldMapTooltip:AddLine(" ")
        WorldMapTooltip:AddLine('Rewards')
        WorldMapTooltip:AddLine(self.itemName .. (self.quantity and (' x'..self.quantity) or ''), c.r, c.g, c.b)
        WorldMapTooltip:AddTexture(self.itemTexture)

        local cLine = WorldMapTooltip:NumLines()
        local line = _G['WorldMapTooltipTextLeft'..cLine]
        local pline = _G['WorldMapTooltipTextLeft'..(cLine-1)]
        local icon = _G['WorldMapTooltipTexture'..(cLine-3)]
        icon:SetSize(24,24)
        icon:ClearAllPoints()
        icon:SetPoint('TOPLEFT', pline, 'BOTTOMLEFT', 0, -2)
        line:ClearAllPoints()
        line:SetPoint('TOPLEFT', icon, 'TOPRIGHT', 7, 0)

        --- voodoo workaround for IDs getting coerced to string
        if type(self.itemTexture) == 'number' then
          icon:Show()
          icon:SetTexture(self.itemTexture)
        end
      end


      WorldMapTooltip:AddLine(" ") -- causes crash for some reason
      WorldMapTooltip:AddLine('Family Familiars')
      local trainer = familiars[self.questID].name
      local numCheevs = GetAchievementNumCriteria(familiars_id)
      for index = 1, numCheevs do
        local cheevName, cType, cCompleted, quantity, requiredQuantity, charName, flags, cheevID, quantityString, criteriaID = GetAchievementCriteriaInfo(familiars_id, index)
        local numTrainers = GetAchievementNumCriteria(cheevID)
        for subIndex = 1, numTrainers do
          local desc, cType, partCompleted = GetAchievementCriteriaInfo(cheevID, subIndex)
          if desc == trainer then
            if not partCompleted then
              local iconPath = select(10, GetAchievementInfo(cheevID))
              WorldMapTooltip:AddLine(cheevName)
              WorldMapTooltip:AddTexture(iconPath)
            end
          end
        end
      end
      WorldMapTooltip:Show()
      return
    end
  end
  TaskPOI_OnEnter(self)
end
function WorldPlanPOIMixin:OnLeave()
  WorldMap_RestoreTooltip()
  TaskPOI_OnLeave(self)
end
function WorldPlanPOIMixin:OnMouseDown()
  TaskPOI_OnClick(self)
end



-- create or update the pin using the given questID and C_TaskQuest results
function WorldPlanPOIMixin:RefreshData (info)

  qprint('|cFF00FF88'..self:GetName()..':RefreshData()|r')

  if info then
    self.inProgress = info.inProgress
    self.floor = info.floor
    self.numObjectives = info.numObjectives or 0
    if info.x and info.y then
      self.x = info.x or self.x
      self.y = info.y or self.y
      --qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y)
    end

  end


  local questID = self:GetID()
  local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _
  local hasUpdate, isPending = (self.isStale or self.isNew), self.isPending


  if not HaveQuestData(questID) then
    TQ_RequestPreloadRewardData(questID)
    isPending = true
  else

    -- set reward category
    local numRewards = GetNumQuestLogRewards(questID)
    local numCurrency = GetNumQuestLogRewardCurrencies(questID)
    local money = GetQuestLogRewardMoney(questID)
    if numRewards >= 1 then
      rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = ParseItemReward(questID)
    elseif numCurrency >= 1 then
      rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
      rewardType = REWARD_CURRENCY
    elseif money >= 1 then
      rewardIcon = ICON_MONEY
      rewardName = GetMoneyString(money)
      rewardType = REWARD_CASH
    end
    rewardStyle = self:GetTypeInfo(rewardType)

    self.itemNumber = rewardCount or self.itemNumber
    self.rewardType = rewardType or REWARD_ITEM
    self.style = rewardStyle
    self.quality = quality

    -- title, faction, capped state
    local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
    self.factionID = factionID
    self.capped = capped

    -- set tag details
    local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = GetQuestTagInfo(questID);
    local tagAtlas
    if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then
      tagAtlas = "worldquest-icon-petbattle"
    elseif worldQuestType == LE_QUEST_TAG_TYPE_PVP then
      tagAtlas = "worldquest-icon-pvp-ffa"
    elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then
      local id = tradeskillLineIndex and select(7, GetProfessionInfo(tradeskillLineIndex))
      if id then
        tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
      end
    elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
      tagAtlas = "worldquest-icon-dungeon"
    end

    self.tagID = tagID
    self.tagName = tagName
    self.worldQuestType = worldQuestType
    self.isElite = isElite
    self.tradeskillLineIndex = tradeskillLineIndex
    self.rarity = rarity
    self.tagAtlas = tagAtlas

    -- flag unresolved info
    if not (rewardIcon and rewardName) then
      isPending = true
      qprint('because not have icon')
      TQ_RequestPreloadRewardData (questID)
      --WorldPlan:print('|cFFFFFF00'..tostring(self.title)..'|r waiting on texture info')
    else
      if (rewardIcon and rewardName) and isPending then
        --WorldPlan:print('|cFF00FF00'..tostring(self.title)..'|r has info', rewardIcon, rewardName)
        hasUpdate = true
      end
      isPending = false
    end

    self.title = questTitle or "|cFFFF0000Retrieving..."
    self.itemTexture = rewardIcon or self.itemTexture
    self.itemName = rewardName or self.itemName
    self.isStale = hasUpdate
    self.isPending = isPending


    --qprint('  |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending, 'isShown', self:IsShown())
    --qprint('  ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
    --qprint('  ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
  end
  self.cheevos = familiars[self.questID]

  return hasUpdate, isPending
end


function WorldPlanPOIMixin:SetAchievementProgressTooltip()
  print('cheevos')
end

-- run from OnShow if .isNew is set
function WorldPlanPOIMixin:OnNew()

  if not self.isAnimating then
    --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.')
    self:SetAlpha(0)
    if WorldPlan.db.FadeWhileGrouped then
      self.FadeIn.FadeIn:SetToAlpha(0.15)
      self.PendingFade.FadeIn:SetToAlpha(0.15)
      self.PendingFade.FadeOut:SetFromAlpha(0.15)
    else
      self.FadeIn.FadeIn:SetToAlpha(1)
      self.PendingFade.FadeIn:SetToAlpha(1)
      self.PendingFade.FadeOut:SetFromAlpha(1)
    end
    self.isAnimating = true
    self.isNew = nil
    self.FadeIn:Play()
  end
end

function WorldPlanPOIMixin:OnShow ()
  qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
  -- pop this on principle

  if self.isNew or self.isStale then
    self:Refresh()
  end


  -- is it a new quest?
  if self.isNew then
    print('|cFFFFFF00popping new pin handler')
    self:OnNew()
  elseif not self.isAnimating then
    self:SetAlpha(1)
  end

  --WorldPlan:print(self:GetAlpha())

end
function WorldPlanPOIMixin:OnHide()
  --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
  if not self:IsShown() then
    self.isAnimating = nil
    self:SetAlpha(1)
  end

end

function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight)
  --qprint('  |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID, mapWidth)
  self:ClearAllPoints()
  local dX, dY = TQ_GetQuestLocation(self.questID)
  if not dX or dX == 0 then
    local _, x, y = QuestPOIGetIconInfo(self.questID)
    if x and floor(x) ~= 0 then
      dX, dY = x, y
    else
      dX, dY = self.x, self.y
    end
  end
  self.x = dX
  self.y = dY

  --qprint('  |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY))

  local pX = (dX * mapWidth)
  local pY = (-dY * mapHeight)

  self:SetParent(WorldMapPOIFrame)
  self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY)
end


function WorldPlanPOIMixin:OnLoad()
  qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db)
  self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
  self.style = WorldPlan.db.defaultPinStyle
  self.subStyle = WorldPlan.db.defaultPinStyle.continent
end

function WorldPlanPOIMixin:OnEvent(event, ...)
  if event == 'SUPER_TRACKED_QUEST_CHANGED' then
    self.isStale = true
  end
end


local PIN_UPDATE_DELAY = .016
local TOP_PIN_ID
function WorldPlanPOIMixin:OnUpdate (sinceLast)
  if self.isNew then
    print('|cFFFFFF00push new poi stuff')
    self:OnNew()
  end
  -- control update check intervals
  self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
  if self.throttle <= 0 then
    -- factor overtime into the throttle timer
    self.throttle = PIN_UPDATE_DELAY - self.throttle
  else
    return
  end
  if self.isStale and not self.isAnimating then
    print('|cFFFFFF00push poi update')
    self:Refresh()
    return
  end

  -- query for reward data if it wasn't found in the original scan
  local questID = self.questID
  if self.isPending then
    self:RefreshData()
    if not (self.PendingFade:IsPlaying() or self.isAnimating) then
      self.PendingFade:Play()
    end
    return
  else
    if self.PendingFade:IsPlaying() then
      self.PendingFade:Stop()
    end
  end


  -- update time elements
  local tl = self.timeThreschold
  local timeLeft = TQ_GetQuestTimeLeftMinutes(questID)
  if timeLeft > 0 then
    local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.TimeleftStage)
    if tl ~= timeState then
      tl = timeState
      self.timeLabel:SetText(text)
    end
  else
    -- remove self in a timely manner
    if not TQ_IsActive(self.questID) then
      print('|cFFFF4400'..self:GetName()..' pin hard timeout')
      if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
        self:Hide()
      end
    end
  end
  self.timeThreschold = tl

  if self:IsMouseOver() then
    self.MouseGlow:Show()
  else
    self.MouseGlow:Hide()
  end
end



function WorldPlanPOIMixin:Refresh ()
  local db = WorldPlan.db
  print('|cFF00FF88'..self:GetName()..'|r:Refresh()')



  local questID = self:GetID()
  local style,subStyle =  WorldPlanQuests:GetTypeInfo(self.rewardType)
  if self.filtered then
    subStyle = style.minimized
  end
  self.style = style
  self.subStyle = subStyle


  local borderMask = style.mask
  local borderFill = style.texture
  local iconBorder = self.iconBorder
  local icon = self.icon
  local count = self.count

  self.hasNumeric = style.hasNumeric
  self.numberRGB = style.numberRGB
  self.showNumber = subStyle.showNumber



  --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
  SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
  icon:SetAllPoints(self)

  if self.itemName then


    if self.hasNumeric then
      if subStyle.numberFontObject then
        --wqprint('change font', _G[subStyle.numberFontObject]:GetName())
        self.count:SetFontObject(_G[subStyle.numberFontObject])
      end
      --wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber)

      self.count:SetShown(self.showNumber)
      self.count:SetText(self.itemNumber)
      self.count:SetTextColor(unpack(self.numberRGB))
    else
      self.count:SetShown(false)
      self.count:SetText(nil)
    end

  end

  SetMaskedTexture(iconBorder, borderFill, borderMask)
  local border = self:GetTypeInfo(self.rewardType)
  iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
  iconBorder:SetDesaturated(true)

  local trackingBorder = self.supertrackBorder

  self.highlight:SetMask(nil)
  if questID == GetSuperTrackedQuestID() then
    trackingBorder:SetVertexColor(0,0,0,1)
  else
    trackingBorder:SetVertexColor(0,0,0,0.5)
  end
  self.highlight:SetAllPoints(trackingBorder)

  SetMaskedTexture(trackingBorder, borderFill, borderMask)
  self.highlight:SetMask(borderMask)

  local qType = self.worldQuestType
  self.tagIcon:SetAtlas(self.tagAtlas)
  self.tagIcon:SetTexCoord(0,1,0,1)


  if self.isElite then
    self.EliteBorder:Show()
  else
    self.EliteBorder:Hide()
  end
  --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
  --print('  - subStyle:', (self.filtered == true), self.subStyle)


  self:UpdateSize()

  self.isStale = nil

end

local cvar_check = {
  [REWARD_CASH] = 'worldQuestFilterGold',
  [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower',
  [REWARD_CURRENCY] = 'worldQuestFilterOrderResources',
  [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials',
  [REWARD_GEAR] = 'worldQuestFilterEquipment',
}


function QuestPOI:IsShowable ()
  local print = wqprint
  local db = WorldPlan.db
  local qType = self.worldQuestType
  local rType = self.rewardType
  self.filtered = nil
  self.used = true


  self.questId  = self:GetID()
  if self.rewardType then
    if cvar_check[self.rewardType] and not GetCVarBool(cvar_check[self.rewardType]) then
      self.filtered = true
    end
  else
    for filterKey, value in pairs(WorldPlan.UsedFilters) do
      if self[filterKey] ~= value then
        self.filtered = true
      end
    end
  end

  if not TQ_IsActive(self.questID) then
    self.used = nil
  elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then
    if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then
      self.used = nil
    end
  end
  print('  |cFFFF4400IsShowable()|r', self.isNew, self.isAnimating, self.used, self.filtered, self.title)
  return self.used, self.filtered
end

function QuestPOI:UpdateTimer (timeLeft, timeType)
  print('|cFF0088FFUpdatePinTimer()|r')
end

--- Fixes icons upon size update
function QuestPOI:UpdateSize (style, subStyle)
  style = style or self.style
  subStyle = subStyle or self.subStyle

  --qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', style, subStyle)

  self.currentWidth = subStyle.PinSize
  self.borderSize = subStyle.Border
  self.trackingBorderSize = subStyle.TrackingBorder
  self.tagSize = subStyle.TagSize
  self.TimeleftStage = subStyle.TimeleftStage
  self.NoIcon = subStyle.NoIcon


  self:SetSize(self.currentWidth, self.currentWidth)

  local icon = self.icon
  local iconBorder = self.iconBorder
  local trackingBorder = self.supertrackBorder
  local tag = self.tagIcon
  local pinMask = style.pinMask
  local rewardMask = style.rewardMask

  if self.NoIcon then
    self.icon:Hide()
  else
    self.icon:Show()
    icon:SetMask(nil)
    icon:SetMask(rewardMask)
    icon:SetTexture(self.icon:GetTexture())
  end
  iconBorder:SetMask(nil)
  trackingBorder:SetMask(nil)


  local borderWidth = self.borderSize
  local trackingWidth = self.trackingBorderSize

  iconBorder:ClearAllPoints()
  iconBorder:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', -borderWidth + (style.x or 0), -borderWidth + (style.y or 0))
  iconBorder:SetPoint('TOPRIGHT', self, 'TOPRIGHT', borderWidth + (style.x or 0), borderWidth + (style.y or 0))

  trackingBorder:ClearAllPoints()
  trackingBorder:SetPoint('BOTTOMLEFT', iconBorder, 'BOTTOMLEFT', -trackingWidth, -trackingWidth)
  trackingBorder:SetPoint('TOPRIGHT', iconBorder, 'TOPRIGHT', trackingWidth, trackingWidth)

  if self.tagSize then
    tag:Show()
    tag:ClearAllPoints()
    tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth)
  else
    tag:Hide()
  end

  qprint('using mask:', pinMask, self.name )
  iconBorder:SetMask(pinMask)
  trackingBorder:SetMask(pinMask)
  iconBorder:SetTexture(iconBorder:GetTexture())
  trackingBorder:SetTexture(trackingBorder:GetTexture())
end