Mercurial > wow > worldplan
diff QuestPOI.lua @ 75:78d78dc77822
update conditional tweaks
author | Nenue |
---|---|
date | Mon, 10 Apr 2017 07:13:29 -0400 |
parents | 2ba11b25aa7f |
children | fadf00b437fb |
line wrap: on
line diff
--- a/QuestPOI.lua Sat Apr 08 17:07:58 2017 -0400 +++ b/QuestPOI.lua Mon Apr 10 07:13:29 2017 -0400 @@ -45,8 +45,8 @@ local previousHighlight local DATA_DEBUG = false -local PIN_REFRESH_DELAY = .5 -local PIN_REQUEST_DELAY = .1 +local PIN_REFRESH_DELAY = 1 +local PIN_REQUEST_DELAY = .2 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" @@ -338,21 +338,21 @@ -- attempt to pull pin data function QuestPOI:GetData () - dprint('|cFF00FF88'..self:GetID()..':GetData()|r') + --dprint('|cFF00FF88'..self:GetID()..':GetData()|r') local questID = self.questID if not questID then - dprint('|cFFFF4400bad pin|r', self:GetName()) + --dprint('|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 - dprint('|cFFBB8844dataLoaded|r = false|cFF00FFFF', self.questId) + --dprint('|cFFBB8844dataLoaded|r = false|cFF00FFFF', self.questId) return false else self.title, self.factionID, self.capped = questTitle, factionID, capped - dprint(questTitle, factionID, capped) + print(questTitle, factionID, capped) -- set tag details local worldQuestType self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.tradeskillLineIndex = GetQuestTagInfo(questID); @@ -366,7 +366,7 @@ local id = self.tradeskillLineIndex and select(7, GetProfessionInfo(self.tradeskillLineIndex)) if id then self.isKnownProfession = true - qprint('profession' , self.title, id) + --qprint('profession' , self.title, id) tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id] end elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then @@ -376,7 +376,7 @@ self.tagAtlas = tagAtlas local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality, xpType, xpName, xpIcon, xpCount = self:UpdateRewards() - dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality) + --dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality) if dataLoaded then self.rewardType = rewardType self.itemName = itemName @@ -426,7 +426,7 @@ rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" rewardCount = artifactXP rewardType = REWARD_ARTIFACT_POWER - qprint(' artifactXP', artifactXP) + --dprint(' artifactXP', artifactXP) foundPrimary = true end @@ -441,7 +441,7 @@ text = text }) - qprint(' currency', i, currencyID, name, " |T"..tostring(texture)..":12:12|t") + --dprint(' currency', i, currencyID, name, " |T"..tostring(texture)..":12:12|t") if currencyID == ID_RESOURCES then rewardIcon = texture rewardCount = numItems @@ -494,7 +494,7 @@ local ap = text and text:gsub(',', ''):gsub(' million', '000000'):match('(%d+) '..ARTIFACT_POWER) if ap then rewardCount = tonumber(ap) - print(ap) + --dprint(ap) end end @@ -503,7 +503,7 @@ local text = WorldPlanTooltipTextLeft2:GetText() end - print('is an AP token') + --dprint('is an AP token') elseif classID == LE_ITEM_CLASS_TRADEGOODS then rewardType = REWARD_REAGENT rewardIcon = texture @@ -513,7 +513,7 @@ end - qprint(' reward', i, name, " |T"..tostring(texture)..":12:12|t", quality, isUsable, itemID) + --dprint(' reward', i, name, " |T"..tostring(texture)..":12:12|t", quality, isUsable, itemID) tinsert(rewardItems, { name = name, texture = texture, @@ -522,7 +522,7 @@ isUsable = isUsable }) if not foundPrimary then - print(' -updating primary') + --print(' -updating primary') rewardType = REWARD_GEAR rewardIcon = texture @@ -535,8 +535,8 @@ end end - qprint(' '..self.questID..':|cFFFFFF00SetRewardInfo():', numQuestRewards, rewardType) - qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) + --dprint(' '..self.questID..':|cFFFFFF00UpdateRewards():', numQuestRewards, rewardType) + --dprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) if (self.itemNumber ~= rewardCount) or (self.rewardType ~= rewardType) or (self.itemName ~= rewardName) or (self.itemTexture ~= rewardIcon) then if DATA_DEBUG and (self.debugTimer <= 0) then @@ -571,25 +571,33 @@ -- run from OnShow if .isNew is set -function QuestPOI:StartFade() - if not self.isAnimating then - qprint('|cFFFFFF00clearing new status') +function QuestPOI:OnAnimStart() + --qprint('|cFFFFFF00OnAnimStart(|r'..self:GetID()..'|cFFFFFF00)|r', self.fadeEvent) + self.isAnimating = true + self.isNew = nil +end + +function QuestPOI:TryToFade(event) + if self.FadeIn:IsPlaying() then + --qprint('|cFFFF4400TryToFade('..self:GetID()..'|cFFFF4400)|r stopping because already in progress') + return + end + + self.fadeEvent = event + if self.dataLoaded then + --qprint('|cFFFFFF00TryToFade('..self:GetID()..'|cFFFFFF00)|r', event) self:SetAlpha(0) - if self.dataLoaded then - self:Refresh('POI_ISNEW') - self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha) - self.PendingFade.FadeIn:SetToAlpha(db.PinAlpha) - self.PendingFade.FadeOut:SetFromAlpha(db.PinAlpha) + self:Refresh(event) + self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha) + self.isStale = true + self.FadeIn:Play() + else - self.isAnimating = true - self.isNew = nil - self.isStale = true - self.FadeIn:Play() - end + --qprint('|cFFFF4400TryToFade('..self:GetID()..'|cFFFF4400)|r stopping because not loaded') end end -function QuestPOI:EndFade() +function QuestPOI:OnAnimStop() self.isAnimating = nil self:SetAlpha(db.PinAlpha) end @@ -597,15 +605,15 @@ function QuestPOI:OnShow () if self.isNew then - self:StartFade() + self:TryToFade('POI_ONSHOW_NEW') else if not self.isAnimating then - print('|cFF00FF00Alpha correction') + --print('|cFF00FF00Alpha correction') self:SetAlpha(db.PinAlpha) -- fix stuck alpha end if self.isStale then - print('|cFF00FF00refresh on show') - self:Refresh('POI_SCRIPT') + --print('|cFF00FF00refresh on show') + self:Refresh('POI_ONSHOW_STALE') end end self:ShowFrames() @@ -625,13 +633,14 @@ -- Applies position and sizing parameters to the pin data function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor) - dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used) + --dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used) if not self.used then self.hideReason = 'SetAnchor() on an unused frame.' self:HideFrames() return end + if owner then self:SetParent(owner) self.Overlay:SetParent(owner) @@ -640,9 +649,6 @@ owner = self:GetParent() end - self:SetFrameLevel(pinBaseIndex + self:GetID()) - self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) - if scaleFactor then --print('scaleFactor') @@ -672,7 +678,7 @@ -- Show/Hide the text overlays associated with the quest pin; they aren't hierarchically linked function QuestPOI:ShowFrames() if not self:IsShown() then - print('|cFFFFFF00' ..self:GetName()..':ShowFrames()') + -- print('|cFFFFFF00' ..self:GetName()..':ShowFrames()') -- do not SetShown() here end self.Overlay:SetShown(true) @@ -685,8 +691,6 @@ if not self.hideReason then self.hideReason = "HideFrames() called" end - --print(self:GetName()..':HideFrames()') - self:SetShown(false) end self.Overlay:SetShown(false) self.count:SetShown(false) @@ -695,7 +699,7 @@ end function QuestPOI:OnLoad() - qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config) + --qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config) self.debugTimer = 4 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r' self.isPending = true @@ -717,7 +721,7 @@ end end - +local updateTime, markTime function QuestPOI:OnUpdate (sinceLast) -- control update check intervals @@ -734,6 +738,7 @@ self.debugTimer = self.debugTimer - sinceLast if self.debugTimer >= 0 then print(self.debugTimer) + return end end --@end-debug@ @@ -741,13 +746,16 @@ -- query for reward data if it wasn't found in the original scan if not self.dataLoaded then - print('|cFFFF4400'..self:GetID()..':|r polling reward info') local dataLoaded = self:GetData() if dataLoaded and not tContains(db.UpdatedPins, self) then - self.PendingFade:Stop() + -- self.PendingFade:Stop() -- scale info from the parent module is needed, so deal with it there + --print('|cFF00FF88 queueing for update') tinsert(db.UpdatedPins, self) + else + + --print('|cFFFF4400OnUpdate(|r'..self:GetID()..'|cFFFF4400)|r poll failed') end return end @@ -761,35 +769,26 @@ function QuestPOI:GetCriteriaState() local isCriteria, isBounty, isSpellTarget if self.factionID then - - local bounties = db.BountiesByFactionID - if bounties then - for factionID, bounty in pairs(bounties) do - - if IsQuestCriteriaForBounty(self.questID, bounty.questID) then - isCriteria = true - if db.selectedBounty == bounty then - isBounty = true - end - print('|cFF00FF88Criteria:|r', self.questID, bounty.questID, isCriteria, isBounty) + for index, bounty in pairs(db.Bounties) do + if IsQuestCriteriaForBounty(self.questID, bounty.questID) then + isCriteria = true + if db.selectedBounty == bounty then + isBounty = true end + --dprint('|cFF00FF88Criteria:|r', self.questID, bounty.questID, isCriteria, isBounty) end - - - print('|cFFFF4400Criteria:|r', self.questID, self.isCriteria, self.isBounty) - end end isSpellTarget = IsQuestIDValidSpellTarget(self.questID) if (self.isBounty ~= isBounty) or (self.isCriteria ~= isCriteria) or (self.isSpellTarget ~= isSpellTarget) then - + --wqprint('|cFF00FF00criteria state changed') self.isBounty = isBounty self.isCriteria = isCriteria self.isSpellTarget = isSpellTarget + self.isStale = true return true end - end -- Called at static intervals and with Refresh @@ -828,7 +827,7 @@ function QuestPOI:Refresh (event) - print('|cFF00FF88'..self:GetID()..'|r:Refresh()', event) + print('|cFF00FF88Refresh(|r'..self:GetID()..'|cFF00FF88)|r', event, self.title) local style = DEFAULT_STYLE if self.dataLoaded and not self.filtered then @@ -942,11 +941,11 @@ self.isStale = nil if self.isBounty then - print('is bounty') + --print('is bounty') iconBorder:SetVertexColor(trackingBorder:GetVertexColor()) trackingBorder:SetVertexColor(unpack(BORDER_SELECTED_BOUNTY)) elseif self.isCriteria then - print('is criteria of a bounty') + --print('is criteria of a bounty') iconBorder:SetVertexColor(trackingBorder:GetVertexColor()) trackingBorder:SetVertexColor(unpack(BORDER_CRITERIA)) else