diff QuestPOI.lua @ 40:589c444d4837

WowAce/Curseforge migration push
author Nenue
date Sun, 25 Dec 2016 13:04:57 -0500
parents 78cf1f19856a
children 79e5e96e5f18
line wrap: on
line diff
--- a/QuestPOI.lua	Fri Nov 04 02:54:32 2016 -0400
+++ b/QuestPOI.lua	Sun Dec 25 13:04:57 2016 -0500
@@ -3,6 +3,7 @@
 -- Created: 10/1/2016 7:21 PM
 -- %file-revision%
 --
+local _, db = ...
 
 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID
 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
@@ -12,6 +13,9 @@
 local QuestPOIGetIconInfo, WorldMapPOIFrame =  QuestPOIGetIconInfo, WorldMapPOIFrame
 local WorldMap_DoesWorldQuestInfoPassFilters = WorldMap_DoesWorldQuestInfoPassFilters
 local QuestMapFrame_IsQuestWorldQuest = QuestMapFrame_IsQuestWorldQuest
+local GetAchievementNumCriteria, GetAchievementCriteriaInfo, GetAchievementInfo = GetAchievementNumCriteria, GetAchievementCriteriaInfo, GetAchievementInfo
+local pairs, ipairs, tinsert, unpack, select = pairs, ipairs, tinsert, unpack, select
+local floor, mod, tostring, tonumber, GetSuperTrackedQuestID = floor, mod, tostring, tonumber, GetSuperTrackedQuestID
 local GameTooltip = GameTooltip
 local GetItemIcon = GetItemIcon
 
@@ -20,17 +24,18 @@
 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 rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or function() end
 local QuestPOI = WorldPlanPOIMixin
 
+
+local PIN_REFRESH_DELAY = .5
+local PIN_REQUEST_DELAY = .2
 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 WORLD_QUEST_BORDER = "Interface\\UNITPOWERBARALT\\Generic1Target_Circular_Frame"
+local PENDING_BORDER
+local PENDING_ICON = "Interface\\BUTTONS\\YELLOWORANGE64"
 
 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD
 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER
@@ -38,7 +43,6 @@
 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
@@ -51,226 +55,294 @@
 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,
-  }
-}
+local STYLE_TYPE_PENDING = 768
+
 
 -- Pin color/display variables
+db.TooltipExtras = db.TooltipExtras or {} -- idiot-proofing
+
 
 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'}
+    [42159] = 'Nightwatcher Merayl',
+    [40277] = 'Tiffany Nelson',
+    [40298] = 'Sir Galveston',
+    [40282] = 'Grixis Tinypop',
+    [40278] = 'Robert Craig',
+    [48195] = 'Aulier',
+    [41990] = 'Varenne',
+    [41860] = 'Xorvasc',
+    [40299] = 'Bodhi Sunwayver',
+    [42442] = 'Amalia',
+    [40280] = 'Bredda Tenderhide',
+    [41687] = 'Odrogg',
+    [41944] = 'Trapper Jarrun',
+    [40337] = 'Master Tamer Flummox',
+    [40279] = 'Durian Strongfruit'
+}
+local falcosaurs = {
+  [44895] = {44881, 'Sharptalon Hatchling', 115786},
+  [44894] = {44882, 'Bloodgazer Hatchling', 115787},
+  [44893] = {44880, 'Direbeak Hatchling', 115785},
+  [44892] = {44879, 'Snowfeather Hatchling', 115784},
 }
 local familiars_id = 9696
+for questID, name in pairs(familiars) do
+  db.TooltipExtras[questID] = {{
+    achievementID = familiars_id,
+    name = name
+  }}
+end
+for questID, info in pairs(falcosaurs) do
+  local trackingQuestID, petName, petID = unpack(info)
 
-
--- 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)
+  db.TooltipExtras[questID] = {{
+    questID = trackingQuestID,
+    pet = petName,
+    petID = petID
+  }}
 end
 
+local GetAchievementTooltipExtras = function(info)
 
--- 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
+  local hasInfo
+  local achievementID = info.achievementID
+  local _, name, _, completed, _, _, _, _, _, icon = GetAchievementInfo(achievementID)
+  if not completed then
+
+    WorldMapTooltip:AddLine(" ")
+    WorldMapTooltip:AddLine("Achievements:")
+    WorldMapTooltip:AddLine(' |T'..icon..':20:20|t '..name)
+
+    local numItems = GetAchievementNumCriteria(achievementID)
+    local numNeeded = 0
+    local tooltipLines = {}
+    for i =1, numItems do
+      local criteriaName, criteriaType, completed, _, _, _, _, subAchievementID = GetAchievementCriteriaInfo(achievementID, i)
+      print(GetAchievementCriteriaInfo(achievementID, i))
+
+      if not completed then
+        print('::', criteriaName, completed, subAchievementID)
+        if criteriaType == 8 then
+          local _, _, _, completed, _, _, _, _, _, subIcon = GetAchievementInfo(subAchievementID)
+          print(' -', criteriaName, completed, subIcon)
+          if not completed then
+            local numCompleted = 0
+            local numSubItems = GetAchievementNumCriteria(subAchievementID)
+            local subCriteriaLine
+            for j = 1, numSubItems do
+              local subName, _, completed = GetAchievementCriteriaInfo(subAchievementID, j)
+
+              print('   -',subName, completed)
+              if completed then
+                numCompleted = numCompleted + 1
+              else
+                numNeeded = numNeeded + 1
+                if subName:match(info.name) then
+                  hasInfo = true
+                  subCriteriaLine = '  |T'..subIcon..':16:16|t ' .. criteriaName
+                end
+              end
+
+            end
+            if subCriteriaLine then
+              tinsert(tooltipLines, subCriteriaLine .. ' ('..numCompleted..'/'..numSubItems..')')
+            end
+          end
+        elseif criteriaName:match(info.name) and (not completed) then
+          numNeeded = numNeeded + 1
+          tinsert(tooltipLines, criteriaName)
+        end
+      end
+    end
+    if numNeeded >= 1 then
+      for i, line in ipairs(tooltipLines) do
+        WorldMapTooltip:AddLine(line)
+      end
+    else
+      WorldMapTooltip:AddLine('Criteria completed!', 0, 1, 0)
+    end
+
+  end
+  return hasInfo
+end
+
+local GetQuestTooltipExtras = function(info)
+  local questID = info.questID
+  local hasInfo
+
+  if info.pet then
+    local index, guid = C_PetJournal.FindPetIDByName(info.pet)
+    if not index then
+      hasInfo = true
+      WorldMapTooltip:AddLine('Pets:')
+      WorldMapTooltip:AddLine(' - ' .. info.petName)
+
+      if not IsQuestFlaggedCompleted(questID) then
+        WorldMapTooltip:AddLine('  Required Quest Flags', 1, 1, 0)
+      else
+        WorldMapTooltip:AddLine('  Quest Flags Complete!', 0, 1, 0)
+      end
+
+    end
   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')
+local GetFactionInfoByID, GetQuestObjectiveInfo = GetFactionInfoByID, GetQuestObjectiveInfo
+
+function QuestPOI:OnEnter()
+  if not WorldMapFrame:IsVisible() then
+    WorldMap_HijackTooltip(self.owningFrame)
   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()
+    if self.filtered then
       return
     end
   end
-  TaskPOI_OnEnter(self)
+  WorldMapTooltip:SetOwner(self, "ANCHOR_RIGHT");
+  print('doing tooltip stuff')
+
+  -- Can't add stuff after, so most of the blizzard tooltip hook is simply copied over
+  local questID = self.questID
+  local color = WORLD_QUEST_QUALITY_COLORS[self.rarity] or NORMAL_FONT_COLOR;
+
+
+  WorldMapTooltip:SetText(self.title, color.r, color.g, color.b);
+  QuestUtils_AddQuestTypeToTooltip(WorldMapTooltip, questID, NORMAL_FONT_COLOR);
+
+  if ( self.factionID ) then
+    local factionName = GetFactionInfoByID(self.factionID);
+    if ( factionName ) then
+      if (self.capped) then
+        WorldMapTooltip:AddLine(factionName, GRAY_FONT_COLOR:GetRGB());
+      else
+        WorldMapTooltip:AddLine(factionName);
+      end
+    end
+  end
+
+  if self.worldQuest then
+    WorldMap_AddQuestTimeToTooltip(questID);
+  end
+
+
+  for objectiveIndex = 1, self.numObjectives do
+    local objectiveText, objectiveType, finished = GetQuestObjectiveInfo(questID, objectiveIndex, false);
+    if ( objectiveText and #objectiveText > 0 ) then
+      local color = finished and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR;
+      WorldMapTooltip:AddLine(QUEST_DASH .. objectiveText, color.r, color.g, color.b, true);
+    end
+  end
+
+  local percent = C_TaskQuest.GetQuestProgressBarInfo(self.questID);
+  if ( percent ) then
+    GameTooltip_InsertFrame(WorldMapTooltip, WorldMapTaskTooltipStatusBar);
+    WorldMapTaskTooltipStatusBar.Bar:SetValue(percent);
+    WorldMapTaskTooltipStatusBar.Bar.Label:SetFormattedText(PERCENTAGE_STRING, percent);
+  end
+
+  if db.TooltipExtras[self.questID] then
+    for index, info in pairs(db.TooltipExtras[questID]) do
+      if info.achievementID then
+        GetAchievementTooltipExtras(info)
+      end
+      if info.questID then
+        GetQuestTooltipExtras(info)
+      end
+    end
+  end
+  WorldMap_AddQuestRewardsToTooltip(questID)
+
+  self.MouseGlow:Show()
+  WorldMapTooltip:Show()
+  --WorldMapTooltip.recalculatePadding = true;
+  --print(WorldMapTooltip:GetParent())
+  --print(WorldMapTooltip:IsVisible())
 end
-function WorldPlanPOIMixin:OnLeave()
+function QuestPOI:OnLeave()
   WorldMap_RestoreTooltip()
-  TaskPOI_OnLeave(self)
+  self.MouseGlow:Hide()
+  WorldMapTooltip:Hide();
 end
-function WorldPlanPOIMixin:OnMouseDown()
+function QuestPOI: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
-
+-- attempt to pull pin data
+local GetQuestTagInfo, GetProfessionInfo = GetQuestTagInfo, GetProfessionInfo
+function QuestPOI:GetData ()
+  qprint('|cFF00FF88'..self:GetName()..':GetWorldQuestInfo()|r')
+  local questID = self.questID
+  if not questID then
+    rprint('|cFFFF4400bad pin|r', self:GetName())
+    return nil
   end
 
+  local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
+  -- if the title is nil, then wait and try later
+  if not questTitle then
+    self.isPending = true
+    rprint('|cFFBB8844nodata|r|cFF00FFFF', self.questId)
+  else
+    self.title, self.factionID, self.capped = questTitle, factionID, capped
+    rprint('|cFFBB8844  data|r|cFF00FFFF', (self.isPending and 'late|r' or 'jit|r'), self.title, '|r', self.factionID)
+    -- set tag details
+    local worldQuestType
+    self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.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
+      self.isKnownProfession = nil
+      local id = self.tradeskillLineIndex and select(7, GetProfessionInfo(self.tradeskillLineIndex))
+      if id then
+        self.isKnownProfession = true
+        qprint('profession' , self.title, id)
+        tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
+      end
+    elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
+      tagAtlas = "worldquest-icon-dungeon"
+    end
+    self.worldQuestType = worldQuestType
 
-  local questID = self:GetID()
-  local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _
-  local hasUpdate, isPending = (self.isStale or self.isNew), self.isPending
+    self.tagAtlas = tagAtlas
 
 
+    self:SetRewardInfo()
+
+    -- force throttle on success
+    --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))
+
+    if self.itemTexture and self.itemName and self.title then
+      self.isPending = nil
+      self.throttle = 1
+      self.updateRate = PIN_REFRESH_DELAY
+    end
+  end
+
+  self.isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(questID)
+
+  return self.isStale, self.isPending
+end
+
+local GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData = GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData
+local GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString = GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString
+function QuestPOI:SetRewardInfo()
+  local questID = self.questID
   if not HaveQuestData(questID) then
-    TQ_RequestPreloadRewardData(questID)
-    isPending = true
+    self.isPending = true
   else
 
+    local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality
     -- 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)
+      rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = WorldPlanQuests:GetRewardHeader(questID)
     elseif numCurrency >= 1 then
       rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
       rewardType = REWARD_CURRENCY
@@ -279,84 +351,40 @@
       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
+  print('  '..self.questID..':|cFFFFFF00SetRewardInfo():', rewardType)
+    self.itemNumber = tonumber(rewardCount or self.itemNumber)
+    self.rewardType = rewardType or REWARD_GEAR
     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
+    self.itemTexture = rewardIcon or self.itemTexture
+    self.itemName = rewardName or self.itemName
 
     -- flag unresolved info
     if not (rewardIcon and rewardName) then
-      isPending = true
-      qprint('because not have icon')
-      TQ_RequestPreloadRewardData (questID)
+      self.isPending = true
+      return true, nil
       --WorldPlan:print('|cFFFFFF00'..tostring(self.title)..'|r waiting on texture info')
     else
-      if (rewardIcon and rewardName) and isPending then
+      if (rewardIcon and rewardName) and self.isPending then
         --WorldPlan:print('|cFF00FF00'..tostring(self.title)..'|r has info', rewardIcon, rewardName)
-        hasUpdate = true
+        self.isStale = true
       end
-      isPending = false
+      self.isPending = nil
     end
 
-    self.title = questTitle or "|cFFFF0000Retrieving..."
-    self.itemTexture = rewardIcon or self.itemTexture
-    self.itemName = rewardName or self.itemName
-    self.isStale = hasUpdate
-    self.isPending = isPending
+  end
+  return self.isStale, self.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()
+function QuestPOI:OnNew()
 
   if not self.isAnimating then
     --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.')
     self:SetAlpha(0)
-    if WorldPlan.db.FadeWhileGrouped then
+    if db.Config.FadeWhileGrouped then
       self.FadeIn.FadeIn:SetToAlpha(0.15)
       self.PendingFade.FadeIn:SetToAlpha(0.15)
       self.PendingFade.FadeOut:SetFromAlpha(0.15)
@@ -367,11 +395,12 @@
     end
     self.isAnimating = true
     self.isNew = nil
+    self.isStale = true
     self.FadeIn:Play()
   end
 end
 
-function WorldPlanPOIMixin:OnShow ()
+function QuestPOI:OnShow ()
   -- pop this on principle
 
   if self.isNew or self.isStale then
@@ -392,7 +421,7 @@
   --WorldPlan:print(self:GetAlpha())
 
 end
-function WorldPlanPOIMixin:OnHide()
+function QuestPOI:OnHide()
   --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
   if not self:IsShown() then
     self.isAnimating = nil
@@ -402,8 +431,8 @@
   self.Overlay:SetShown(false)
 end
 
-function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight)
-  --qprint('  |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID, mapWidth)
+function QuestPOI:SetAnchor(frame, mapID, mapWidth, mapHeight)
+  qprint('  |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID)
   self:ClearAllPoints()
   local dX, dY = TQ_GetQuestLocation(self.questID)
   if not dX or dX == 0 then
@@ -414,50 +443,53 @@
       dX, dY = self.x, self.y
     end
   end
+  local oX, oY = self.x, self.y
   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)
 
+  if oX ~= dX then
+    wqprint('  |cFF00FF00'..self.questID..':|r', oX, dX, format("%0.2f %0.2f", pX, pY))
+  end
+
   self:SetParent(WorldMapPOIFrame)
   self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY)
 end
 
-
-function WorldPlanPOIMixin:OnLoad()
-  qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db)
+function QuestPOI:OnLoad()
+  qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
   self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
 
+  self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
+  self.isPending = true
   self.count = self.Overlay.count
   self.timeLabel = self.Overlay.timeLabel
+  self.updateRate = PIN_REQUEST_DELAY
+  self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
 end
 
-function WorldPlanPOIMixin:OnEvent(event, ...)
+function QuestPOI: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)
+function QuestPOI:OnUpdate (sinceLast)
+  -- control update check intervals
+  self.throttle = (self.throttle or self.updateRate) + sinceLast
+  if self.throttle >= self.updateRate then
+    -- factor overtime into the throttle timer
+    self.throttle = self.throttle - self.updateRate
+  else
+    return
+  end
   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
+  elseif (self.isStale or (not self.title)) and not self.isAnimating then
     wprint('|cFFFFFF00push poi update')
     self:Refresh()
     return
@@ -466,7 +498,7 @@
   -- query for reward data if it wasn't found in the original scan
   local questID = self.questID
   if self.isPending then
-    self:RefreshData()
+      self:GetData()
     if not (self.PendingFade:IsPlaying() or self.isAnimating) then
       self.PendingFade:Play()
     end
@@ -479,67 +511,100 @@
 
 
   -- 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 TQ_IsActive(self.questID) then
+
+    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
       if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
-        self:Hide()
+        self:SetShown(false)
       end
     end
+    self.alertLevel = tl
   end
-  self.alertLevel = tl
-
-  if self:IsMouseOver() then
-    self.MouseGlow:Show()
-  else
-    self.MouseGlow:Hide()
-  end
+  self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1))
 end
 
 
 
-function WorldPlanPOIMixin:Refresh ()
-  local db = WorldPlan.db
+function QuestPOI:Refresh ()
   print('|cFF00FF88'..self:GetName()..'|r:Refresh()')
 
-
+  local styleType = (self.isPending and STYLE_TYPE_PENDING) or self.rewardType
+  local style,subStyle =  self:GetTypeInfo(self.rewardType)
+  if self.filtered then
+    subStyle = style.minimized
+  end
+  self.style = style
+  self.subStyle = subStyle
+  --print(style, subStyle)
+  self.currentWidth = subStyle.iconWidth
+  self.borderWidth = subStyle.borderWidth
+  self.highlightWidth = subStyle.highlightWidth
+  self.tagSize = subStyle.TagSize
+  self.maxAlertLevel = subStyle.maxAlertLevel
+  self.NoIcon = subStyle.NoIcon
 
   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)
+      if self.itemNumber and self.itemNumber >= 1000 then
+        local numeral = floor(self.itemNumber/1000)
+        local decimal = mod(self.itemNumber, 1000)
+        local numberString = numeral
+        if decimal > 100 then
+          numberString = numberString .. '.' .. tostring(floor(decimal/100))
+        end
+        numberString = numberString .. 'k'
+        self.count:SetText(numberString)
+      else
+        self.count:SetText(self.itemNumber)
+      end
 
-      self.count:SetText(self.itemNumber)
+
   end
+  icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
   if self.itemTexture then
-    icon:SetTexture(self.itemTexture)
-    icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
+    iconBorder:SetTexture(WORLD_QUEST_BORDER)
+
+    if self.NoIcon then
+      icon:SetTexture(PENDING_ICON)
+      icon:SetDesaturated(true)
+      icon:SetVertexColor(style.r, style.g, style.b, style.a)
+    else
+
+      icon:SetTexture(self.itemTexture)
+      icon:SetDesaturated(false)
+      icon:SetVertexColor(1, 1, 1)
+    end
+  else
+    iconBorder:SetTexture(PENDING_BORDER)
+    icon:SetTexture(PENDING_ICON)
+    icon:SetDesaturated(true)
+    icon:SetVertexColor(style.r, style.g, style.b, style.a)
   end
 
-  local border = self:GetTypeInfo(self.rewardType)
-  iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
+  local borderStyle = style
+  if self.rarity and WORLD_QUEST_QUALITY_COLORS[self.rarity] then
+    borderStyle = WORLD_QUEST_QUALITY_COLORS[self.rarity]
+  end
+
+  iconBorder:SetVertexColor(borderStyle.r, borderStyle.g, borderStyle.b, 1)
   iconBorder:SetDesaturated(true)
-
+  iconBorder:SetAlpha(subStyle.alpha or 1)
 
   if questID == GetSuperTrackedQuestID() then
     trackingBorder:SetVertexColor(0,0,0,1)
@@ -547,12 +612,10 @@
     trackingBorder:SetVertexColor(0,0,0,0.5)
   end
 
+  self.tagIcon:SetShown(self.tagSize and true or false)
   self.tagIcon:SetAtlas(self.tagAtlas)
-  self.tagIcon:SetTexCoord(0,1,0,1)
+  self.tagIcon:SetAlpha(subStyle.alpha or 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)
@@ -560,9 +623,7 @@
 
 
   self:UpdateSize()
-
   self.isStale = nil
-
 end
 
 local cvar_check = {
@@ -574,44 +635,44 @@
 }
 
 
+function QuestPOI:IsFiltered ()
+  for filterKey, value in pairs(db.UsedFilters) do
+    print('|cFFFF4400', filterKey, self[filterKey])
+    if self[filterKey] ~= value then
+      return true
+    end
+  end
+  if self.rewardType  and 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
+      return true
+    end
+  end
+  print('  '..self.questID..':|cFFFFFF00IsFiltered()|r')
+end
+
 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
+  if not self.worldQuest then
+    print('ignoring showable check')
+    return self.used, self.filtered
+  end
+  self.used = TQ_IsActive(self.questID)
+
+  if qType == LE_QUEST_TAG_TYPE_PROFESSION then
+    qprint('hide flags:', (not self.isKnownProfession), (db.Config.ShowAllProfessionQuests == false))
+    if (not self.isKnownProfession) and  (db.Config.ShowAllProfessionQuests == false) then
+      qprint(self.used)
+      self.used = nil
+      qprint(self.used)
     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
+  print('  '..self.questID..':|cFFFFFF00IsShowable()|r ', self.used, self.title)
+  return self.used
 end
 
 function QuestPOI:UpdateTimer (timeLeft, timeType)
@@ -621,12 +682,10 @@
 --- 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)
+  qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', self.style, self.subStyle)
 
+  local style = self.style
+  local subStyle = self.subStyle
   local icon = self.icon
   local iconBorder = self.RewardBorder
   local trackingBorder = self.HighlightBorder
@@ -638,6 +697,7 @@
 
   local iconTexture = self.itemTexture
 
+  self.tagIcon:SetSize(self.tagSize, self.tagSize)
   self:SetSize(iconWidth, iconWidth)
   icon:SetSize(iconWidth, iconWidth)
   iconBorder:SetSize(borderWidth, borderWidth)
@@ -658,50 +718,5 @@
 
   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
\ No newline at end of file