view QuestPOI.lua @ 37:78cf1f19856a

WorldPlan: - Quest pins are now placed on the flight map. Their visibility rules will mirror the filter options from the world map. - Filter controls polish: - First click negates other reward type filters. Subsequent clicks will then toggle individual reward types until the filters are reset via Right-click. - Adheres to the Blizzard CVars added in patch 7.1 - Numerous optimizations to how data and visual updates are handled; should see an even better load time, and snappier world map interaction. ClassPlan: - The 'Available Missions' list is now recorded. It can be reviewed by clicking on the mission list heading. - Information filtering by character and realm.
author Nenue
date Fri, 04 Nov 2016 02:47:17 -0400
parents 21bcff08b0f4
children 589c444d4837
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 = {
    iconWidth = 14,
    borderWidth = 2,
    highlightWidth = 1,
    TagSize = 6,
    maxAlertLevel = 0,
    showNumber = false,
    numberFontObject = 'WorldPlanFont'
  },
  zone = {
    iconWidth = 22,
    borderWidth = 3,
    highlightWidth = 2,
    TagSize = 12,
    maxAlertLevel = 3,
    showNumber = true,
    numberFontObject = 'WorldPlanNumberFontThin'
  },
  minimized = {
    iconWidth = 4,
    borderWidth = 0,
    highlightWidth = 1,
    NoIcon = true,
    maxAlertLevel = 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()
  if WorldMapFrame:IsVisible() then
    WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT')
  else
    WorldMap_HijackTooltip(self.owningFrame)
  end

  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: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 ()
  -- pop this on principle

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


  -- is it a new quest?
  if self.isNew then
    qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
    --qprint('|cFFFFFF00popping new pin handler')
    self:OnNew()
  elseif not self.isAnimating then
    self:SetAlpha(1)
  end

  self.Overlay:SetShown(true)
  --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

  self.Overlay:SetShown(false)
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.count = self.Overlay.count
  self.timeLabel = self.Overlay.timeLabel
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
    wprint('|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.alertLevel
  local timeLeft = TQ_GetQuestTimeLeftMinutes(questID)
  if timeLeft > 0 then
    local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel)
    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.alertLevel = 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 iconBorder = self.RewardBorder
  local trackingBorder = self.HighlightBorder
  local icon = self.icon
  local count = self.count




  --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))



  if self.itemName then
      --wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber)

      self.count:SetText(self.itemNumber)
  end
  if self.itemTexture then
    icon:SetTexture(self.itemTexture)
    icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
  end

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


  if questID == GetSuperTrackedQuestID() then
    trackingBorder:SetVertexColor(0,0,0,1)
  else
    trackingBorder:SetVertexColor(0,0,0,0.5)
  end

  self.tagIcon:SetAtlas(self.tagAtlas)
  self.tagIcon:SetTexCoord(0,1,0,1)
  self.EliteBorder:SetShown(self.isElite and not self.filtered)
  --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
  --print('  - subStyle:', (self.filtered == true), self.subStyle)

  self.Overlay:SetShown(self:IsShown())
  self.Overlay:SetParent(self:GetParent())
  self.Overlay:SetFrameLevel(self:GetFrameLevel()+200)
  self.Overlay:SetAllPoints(self)


  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 = qprint
  local db = WorldPlan.db
  local qType = self.worldQuestType
  local rType = self.rewardType
  self.filtered = nil
  self.used = true

  for filterKey, value in pairs(WorldPlan.UsedFilters) do
    print('|cFFFF4400', filterKey, self[filterKey])
    if self[filterKey] ~= value then
      self.filtered = true
    end
  end

  self.questId  = self:GetID()
  if self.rewardType then
    if cvar_check[self.rewardType] then
      if self.rewardType == REWARD_CASH then
        print('##', cvar_check[self.rewardType], GetCVarBool(cvar_check[self.rewardType]))
      end
      if not GetCVarBool(cvar_check[self.rewardType]) 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('  |cFF'.. (((self.rewardType == REWARD_CASH) and 'FFFF00') or '0088FF') ..'IsShowable()|r ', cvar_check[self.rewardType], 'used:', self.used, 'filtered:', 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 ()

  local style,subStyle =  self:GetTypeInfo(self.rewardType)
  if self.filtered then
    subStyle = style.minimized
  end
  --qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', style, subStyle)

  local icon = self.icon
  local iconBorder = self.RewardBorder
  local trackingBorder = self.HighlightBorder
  local tag = self.tagIcon

  local iconWidth = subStyle.iconWidth
  local borderWidth = iconWidth + (subStyle.borderWidth * 2)
  local highlightWidth = borderWidth + (subStyle.highlightWidth * 2)

  local iconTexture = self.itemTexture

  self:SetSize(iconWidth, iconWidth)
  icon:SetSize(iconWidth, iconWidth)
  iconBorder:SetSize(borderWidth, borderWidth)
  trackingBorder:SetSize(highlightWidth, highlightWidth)


  iconBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
  trackingBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))


  if style.hasNumeric then
    self.count:SetTextColor(unpack(style.numberRGB))
    if subStyle.numberFontObject then
      --wqprint('change font', _G[subStyle.numberFontObject]:GetName())
      self.count:SetFontObject(_G[subStyle.numberFontObject])
    end
  end

  self.count:SetShown((subStyle.showNumber and self.itemNumber) and style.hasNumeric)

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

  if self.NoIcon then
    self.icon:Hide()
  else
    self.icon:Show()
    if style.rewardMask then
      icon:SetMask(rewardMask)
    else
      icon:SetMask(iconTexture)
    end
    if style.pinMask then
      iconBorder:Show()
      trackingBorder:Show()
      iconBorder:SetMask(pinMask)
      trackingBorder:SetMask(pinMask)
    else
      iconBorder:Hide()
      trackingBorder:Hide()
    end
  end


  icon:SetTexture(iconTexture)
  iconBorder:SetTexture(iconBorder:GetTexture())
  trackingBorder:SetTexture(trackingBorder:GetTexture())
  --]]
  self.currentWidth = subStyle.iconWidth
  self.borderWidth = subStyle.borderWidth
  self.highlightWidth = subStyle.highlightWidth
  self.tagSize = subStyle.TagSize
  self.maxAlertLevel = subStyle.maxAlertLevel
  self.NoIcon = subStyle.NoIcon
  self.style = style
  self.subStyle = subStyle
  if self.rewardType == REWARD_CASH then
  qprint('using mask:', pinMask or iconTexture, rewardMask or iconTexture, self.used, self.filtered)
  end

end