Mercurial > wow > worldplan
diff QuestPOI.lua @ 66:e43e10c5576b
Update for Legion Patch 7.2
- Massive performance improvements through largely re-written update routines.
- Removed AP token caching until reliable mechanisms for detecting AK shifts can be resolved.
author | Nenue |
---|---|
date | Thu, 30 Mar 2017 02:32:44 -0400 |
parents | 02f1d3bce558 |
children | 96183f981acb |
line wrap: on
line diff
--- a/QuestPOI.lua Wed Mar 29 13:45:41 2017 -0400 +++ b/QuestPOI.lua Thu Mar 30 02:32:44 2017 -0400 @@ -72,6 +72,42 @@ local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL +local DEFAULT_STYLE = { + border = {1,1,1}, + x = 0, y = 0, + desaturated = true, + iconMask = "Interface\\Minimap\\UI-Minimap-Background", + borderMask = "Interface\\Minimap\\UI-Minimap-Background", + rewardMark = "Interface\\Minimap\\UI-Minimap-Background", + scaleFactors = {0.25, 0.7, 1}, + iconWidth = 18, + borderWidth = 2, + highlightWidth = 2, + TagSize = 8, + maxAlertLevel = 0, + numberFontObject = 'WorldPlanFont' +} +local MINIMIZED_STYLE = { + hideNumber = true, + hideIcon = true, +} +local REWARD_TYPE_STYLES = { + [REWARD_CASH] = { + border = {1,1,0}, + hideNumber = true, + }, + [REWARD_ARTIFACT_POWER] = {}, + [REWARD_GEAR] = { + + hideNumber = true, + }, + [REWARD_CURRENCY] = {}, + [REWARD_REAGENT] = { + + hideNumber = true, + }, +} + local LE_ITEM_CLASS_WEAPON, LE_ITEM_CLASS_ARMOR, LE_ITEM_CLASS_GEM, LE_ITEM_GEM_ARTIFACTRELIC, LE_ITEM_CLASS_TRADEGOODS = LE_ITEM_CLASS_WEAPON, LE_ITEM_CLASS_ARMOR, LE_ITEM_CLASS_GEM, LE_ITEM_GEM_ARTIFACTRELIC, LE_ITEM_CLASS_TRADEGOODS @@ -550,28 +586,30 @@ end -- Places the pin and triggers display -function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight) - wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, self.filtered, self.used) +function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor) + wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used) if not self.used then self:HideFrames() return end - + self:SetScale(scaleFactor) self:SetParent(owner) self:ClearAllPoints() self:SetFrameLevel(pinBaseIndex + self:GetID()) self.Overlay:SetParent(owner) + self.Overlay:SetScale(scaleFactor) self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) if (dX and dY) then if not (mapHeight and mapWidth) then mapWidth, mapHeight = owner:GetSize() end - if (self.x ~= dY) or (self.y ~= dY) then + if (self.x ~= dY) or (self.y ~= dY) or (self.scaleFactor ~= scaleFactor) then self.x = dX self.y = dY - local pX = (dX * mapWidth) - local pY = (-dY * mapHeight) + self.scaleFactor = scaleFactor + local pX = (dX * mapWidth) * (1 / scaleFactor) + local pY = (-dY * mapHeight) * (1 / scaleFactor) self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY) end else @@ -646,7 +684,7 @@ if self.isNew then --print('|cFFFFFF00push new poi stuff') self:OnNew() - elseif (self.isStale or (not self.title)) and not self.isAnimating then + elseif self.isStale then --wprint('|cFFFFFF00push poi update') self:Refresh() return @@ -659,7 +697,10 @@ if not (self.isAnimating) then self.PendingFade:Play() end - self:GetData() + local dataLoaded = self:GetData() + if dataLoaded then + WorldPlanQuests.isZoomDirty = true + end return else if self.PendingFade:IsPlaying() then @@ -708,37 +749,43 @@ end end + function QuestPOI:Refresh () rprint('|cFF00FF88'..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title) + local style = DEFAULT_STYLE + if self.dataLoaded and not self.filtered then + style = REWARD_TYPE_STYLES[self.rewardType] + else + style = MINIMIZED_STYLE + end + local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth - local styleType = (self.dataLoaded and self.rewardType) or STYLE_TYPE_PENDING - local style,subStyle = self:GetTypeInfo(self.rewardType) - if (self.filtered or (not self.dataLoaded)) and (self.questID ~= GetSuperTrackedQuestID()) 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 borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth + local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth + local tagSize = style.TagSize or DEFAULT_STYLE.TagSize + local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon + local borderColor = style.border or DEFAULT_STYLE.border local questID = self.questID local iconBorder = self.RewardBorder local trackingBorder = self.HighlightBorder local icon = self.icon local count = self.count + local hideNumbers = style.hideNumber or DEFAULT_STYLE.hideNumber + + local tagIcon = self.tagIcon + self.maxAlertLevel = style.maxAlertLevel or DEFAULT_STYLE.maxAlertLevel + + self.isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID) if self.itemName then - if self.itemNumber then + if self.itemNumber and (self.itemNumber > 1) and (not hideNumbers) then local numberString = self.itemNumber if self.itemNumber >= 1000000 then numberString = (floor(self.itemNumber/100000)/10) .. 'M' @@ -754,9 +801,13 @@ numberString = numberString .. 'k' end self.count:SetText(numberString) + self.count:Show() else self.count:SetText(nil) + self.count:Hide() end + else + self.count:Hide() end if db.Config.ShowVerboseInfo then @@ -764,16 +815,16 @@ end - icon:SetMask("Interface\\Minimap\\UI-Minimap-Background") + icon:SetSize(currentWidth, currentWidth) + icon:SetMask(style.iconMask or DEFAULT_STYLE.iconMask) if self.itemTexture then --iconBorder:SetTexture(WORLD_QUEST_BORDER) - if self.NoIcon then + if hideIcon then icon:SetTexture(PENDING_ICON) icon:SetDesaturated(true) - icon:SetVertexColor(style.r, style.g, style.b) + icon:SetVertexColor(unpack(borderColor)) else - icon:SetTexture(self.itemTexture) icon:SetDesaturated(false) icon:SetVertexColor(1, 1, 1) @@ -782,22 +833,32 @@ -- icon:SetTexture(PENDING_ICON) icon:SetDesaturated(true) - icon:SetVertexColor(style.r, style.g, style.b) + icon:SetVertexColor(unpack(borderColor)) end + local borderMask = style.borderMask or DEFAULT_STYLE.borderMask + local borderSize = currentWidth + (borderWidth * 2) - iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") + + iconBorder:SetSize(borderSize, borderSize) + iconBorder:SetMask(borderMask) iconBorder:SetTexture(PENDING_BORDER) - iconBorder:SetVertexColor(style.r, style.g, style.b, 1) + iconBorder:SetVertexColor(unpack(borderColor)) + iconBorder:SetDesaturated(true) - iconBorder:SetDesaturated(true) - iconBorder:SetAlpha(subStyle.alpha or 1) + local highlightSize = borderSize + (highlightWidth * 2) + trackingBorder:SetSize(highlightSize, highlightSize) + trackingBorder:SetMask(borderMask) + trackingBorder:SetTexture(PENDING_BORDER) - trackingBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") - trackingBorder:SetTexture(PENDING_BORDER) + self:SetSize(borderSize, borderSize) + + + + iconBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0)) + trackingBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0)) self.tagIcon:SetShown((not self.filtered) and true or false) self.tagIcon:SetAtlas(self.tagAtlas) - self.EliteBorder:SetShown(self.isElite and not self.filtered) self:UpdateSize() @@ -862,7 +923,8 @@ function QuestPOI:UpdateSize () --qprint('|cFF00BB88'..self:GetID()..'|r:UpdateSize()', self.style, self.subStyle) - + return + --[[ local style = self.style local subStyle = self.subStyle local icon = self.icon @@ -909,4 +971,5 @@ else self.count:SetText(nil) end + --]] end \ No newline at end of file