Mercurial > wow > worldplan
comparison QuestPOI.lua @ 54:b289eb3e6a32
- Fix stray pin text arising from pins that are never shown.
| author | Nenue |
|---|---|
| date | Sat, 31 Dec 2016 17:31:39 -0500 |
| parents | 44baf4f35c7c |
| children | 6a2e85836219 |
comparison
equal
deleted
inserted
replaced
| 53:44baf4f35c7c | 54:b289eb3e6a32 |
|---|---|
| 28 local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or function() end | 28 local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or function() end |
| 29 local QuestPOI = WorldPlanPOIMixin | 29 local QuestPOI = WorldPlanPOIMixin |
| 30 | 30 |
| 31 | 31 |
| 32 local PIN_REFRESH_DELAY = .5 | 32 local PIN_REFRESH_DELAY = .5 |
| 33 local PIN_REQUEST_DELAY = .2 | 33 local PIN_REQUEST_DELAY = .1 |
| 34 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" | 34 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" |
| 35 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" | 35 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" |
| 36 | 36 |
| 37 local WORLD_QUEST_BORDER = "Interface\\UNITPOWERBARALT\\Generic1Target_Circular_Frame" | 37 local WORLD_QUEST_BORDER = "Interface\\UNITPOWERBARALT\\Generic1Target_Circular_Frame" |
| 38 local PENDING_BORDER = "Interface\\BUTTONS\\YELLOWORANGE64" | 38 local PENDING_BORDER = "Interface\\BUTTONS\\YELLOWORANGE64" |
| 270 end | 270 end |
| 271 | 271 |
| 272 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID) | 272 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID) |
| 273 -- if the title is nil, then wait and try later | 273 -- if the title is nil, then wait and try later |
| 274 if not questTitle then | 274 if not questTitle then |
| 275 self.isPending = true | 275 if not self.isPending then |
| 276 C_TaskQuest.RequestPreloadRewardData(questID) | |
| 277 self.isPending = true | |
| 278 end | |
| 276 dprint('|cFFBB8844isPending=true|r|cFF00FFFF', self.questId) | 279 dprint('|cFFBB8844isPending=true|r|cFF00FFFF', self.questId) |
| 277 else | 280 else |
| 278 self.title, self.factionID, self.capped = questTitle, factionID, capped | 281 self.title, self.factionID, self.capped = questTitle, factionID, capped |
| 279 dprint('|cFFBB8844 data|r|cFF00FFFF', (self.isPending and '|cFFFF4400delayed|r' or '|cFF00FF00success|r'), self.title, '|r', self.factionID) | 282 dprint('|cFFBB8844 data|r|cFF00FFFF', (self.isPending and '|cFFFF4400delayed|r' or '|cFF00FF00success|r'), self.title, '|r', self.factionID) |
| 280 if self.dataLoaded then | 283 if self.dataLoaded then |
| 394 self:SetAlpha(db.PinAlpha) | 397 self:SetAlpha(db.PinAlpha) |
| 395 end | 398 end |
| 396 | 399 |
| 397 function QuestPOI:OnShow () | 400 function QuestPOI:OnShow () |
| 398 | 401 |
| 399 if self.isNew then | 402 if self.isStale then |
| 403 qprint('|cFF0088FFflagged for refresh') | |
| 404 self:Refresh() | |
| 405 end | |
| 406 | |
| 407 if self.isNew or (not self.Overlay:IsShown()) then | |
| 400 qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) | 408 qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) |
| 401 --qprint('|cFFFFFF00popping new pin handler') | 409 --qprint('|cFFFFFF00popping new pin handler') |
| 402 self:StartFade() | 410 self:StartFade() |
| 403 elseif not self.isAnimating then | 411 end |
| 412 | |
| 413 if not self.isAnimating then | |
| 404 self:SetAlpha(1) -- fix stuck alpha | 414 self:SetAlpha(1) -- fix stuck alpha |
| 405 end | 415 end |
| 406 | |
| 407 if self.isStale then | |
| 408 qprint('|cFF0088FFflagged for refresh') | |
| 409 self:Refresh() | |
| 410 end | |
| 411 --WorldPlan:print(self:GetAlpha()) | |
| 412 | |
| 413 if not self.Overlay:IsShown() then | |
| 414 self:StartFade() | |
| 415 end | |
| 416 | |
| 417 | |
| 418 self.Overlay:SetShown(true) | 416 self.Overlay:SetShown(true) |
| 419 end | 417 end |
| 420 function QuestPOI:OnHide() | 418 function QuestPOI:OnHide() |
| 421 qprint('|cFFFFFF00'..self:GetID()..'r:OnHide()') | 419 qprint('|cFFFFFF00'..self:GetID()..'r:OnHide()') |
| 422 self.isAnimating = nil | 420 self.isAnimating = nil |
| 424 self.Overlay:SetShown(false) | 422 self.Overlay:SetShown(false) |
| 425 end | 423 end |
| 426 | 424 |
| 427 local overlayBaseIndex = 1300 | 425 local overlayBaseIndex = 1300 |
| 428 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight) | 426 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight) |
| 427 wqprint(self:GetName()..':SetAnchor', self.filtered, self.used) | |
| 429 self:SetParent(owner) | 428 self:SetParent(owner) |
| 430 self:ClearAllPoints() | 429 self:ClearAllPoints() |
| 430 self:SetFrameLevel(overlayBaseIndex + self:GetID()) | |
| 431 self.Overlay:SetParent(owner) | 431 self.Overlay:SetParent(owner) |
| 432 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) | 432 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) |
| 433 if (dX and dY) then | 433 if (dX and dY) then |
| 434 if not (mapHeight and mapWidth) then | 434 if not (mapHeight and mapWidth) then |
| 435 mapWidth, mapHeight = owner:GetSize() | 435 mapWidth, mapHeight = owner:GetSize() |
| 450 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') | 450 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') |
| 451 | 451 |
| 452 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r' | 452 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r' |
| 453 self.isPending = true | 453 self.isPending = true |
| 454 self.count = self.Overlay.count | 454 self.count = self.Overlay.count |
| 455 self.Description = self.Overlay.Description | |
| 455 self.timeLabel = self.Overlay.timeLabel | 456 self.timeLabel = self.Overlay.timeLabel |
| 456 self.updateRate = PIN_REQUEST_DELAY | 457 self.updateRate = PIN_REQUEST_DELAY |
| 457 self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r' | 458 self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r' |
| 458 | 459 |
| 459 self:SetScript('OnMouseDown', TaskPOI_OnClick) | 460 self:SetScript('OnMouseDown', TaskPOI_OnClick) |
| 554 local count = self.count | 555 local count = self.count |
| 555 local isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID) | 556 local isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID) |
| 556 | 557 |
| 557 if self.itemName then | 558 if self.itemName then |
| 558 | 559 |
| 559 if self.itemNumber and self.itemNumber >= 1000 then | 560 if self.itemNumber then |
| 560 local numeral = floor(self.itemNumber/1000) | 561 local numberString = self.itemNumber |
| 561 local decimal = mod(self.itemNumber, 1000) | 562 if self.itemNumber >= 1000 then |
| 562 local numberString = numeral | 563 local numeral = floor(self.itemNumber/1000) |
| 563 if decimal > 100 then | 564 local decimal = mod(self.itemNumber, 1000) |
| 564 numberString = numberString .. '.' .. tostring(floor(decimal/100)) | 565 numberString = numeral |
| 565 end | 566 if decimal > 100 then |
| 566 numberString = numberString .. 'k' | 567 numberString = numberString .. '.' .. tostring(floor(decimal/100)) |
| 568 end | |
| 569 numberString = numberString .. 'k' | |
| 570 end | |
| 567 self.count:SetText(numberString) | 571 self.count:SetText(numberString) |
| 568 else | 572 else |
| 569 self.count:SetText(self.itemNumber) | 573 self.count:SetText(nil) |
| 570 end | 574 end |
| 571 | 575 end |
| 572 | 576 |
| 573 end | 577 self.Description:SetText(self.title .. "\n" .. floor(self.x*100+.5) .. "," .. floor(self.y*100+.5)) |
| 578 | |
| 574 icon:SetMask("Interface\\Minimap\\UI-Minimap-Background") | 579 icon:SetMask("Interface\\Minimap\\UI-Minimap-Background") |
| 575 if self.itemTexture then | 580 if self.itemTexture then |
| 576 --iconBorder:SetTexture(WORLD_QUEST_BORDER) | 581 --iconBorder:SetTexture(WORLD_QUEST_BORDER) |
| 577 | 582 |
| 578 if self.NoIcon then | 583 if self.NoIcon then |
| 592 icon:SetVertexColor(style.r, style.g, style.b) | 597 icon:SetVertexColor(style.r, style.g, style.b) |
| 593 end | 598 end |
| 594 | 599 |
| 595 iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") | 600 iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") |
| 596 iconBorder:SetTexture(PENDING_BORDER) | 601 iconBorder:SetTexture(PENDING_BORDER) |
| 597 if isBounty then | 602 iconBorder:SetVertexColor(style.r, style.g, style.b, 1) |
| 598 iconBorder:SetVertexColor(0,.4,.9) | |
| 599 else | |
| 600 iconBorder:SetVertexColor(style.r, style.g, style.b, 1) | |
| 601 end | |
| 602 | 603 |
| 603 iconBorder:SetDesaturated(true) | 604 iconBorder:SetDesaturated(true) |
| 604 iconBorder:SetAlpha(subStyle.alpha or 1) | 605 iconBorder:SetAlpha(subStyle.alpha or 1) |
| 605 | 606 |
| 606 trackingBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") | 607 trackingBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") |
| 607 trackingBorder:SetTexture(PENDING_BORDER) | 608 trackingBorder:SetTexture(PENDING_BORDER) |
| 608 trackingBorder:SetVertexColor(0,0,0,1) | 609 if isBounty then |
| 610 trackingBorder:SetVertexColor(.25,.5,1) | |
| 611 else | |
| 612 trackingBorder:SetVertexColor(0,0,0,1) | |
| 613 end | |
| 609 | 614 |
| 610 self.tagIcon:SetShown((not self.filtered) and true or false) | 615 self.tagIcon:SetShown((not self.filtered) and true or false) |
| 611 self.tagIcon:SetAtlas(self.tagAtlas) | 616 self.tagIcon:SetAtlas(self.tagAtlas) |
| 612 | 617 |
| 613 self.EliteBorder:SetShown(self.isElite and not self.filtered) | 618 self.EliteBorder:SetShown(self.isElite and not self.filtered) |
