# HG changeset patch # User Nenue # Date 1494297532 14400 # Node ID b29b35cb8539fdb54071f67d1520d583aabd8f45 # Parent dfd53f7c0fe56256b65d34dc196b53d747990e9c - Fixed quest completion checking and handling - Changed animation method to hopefully stop weird flickering. - Pins are now visible before full reward data is loaded - Filter bar redesigned: - aligned horizontally along the top of the map display - filter buttons display a '+' when there are matches in both current and other zones, and '*' when there only matches in other zones - button tooltips separate local and global quests - button categories are highlighted and labeled when the cursor is over them - Fixed invalid POI targets appearing when the spell targeting cursor is active - ClassOrderPlan can be closed with the game menu button diff -r dfd53f7c0fe5 -r b29b35cb8539 ClassPlan.lua --- a/ClassPlan.lua Sat Apr 15 11:05:32 2017 -0400 +++ b/ClassPlan.lua Mon May 08 22:38:52 2017 -0400 @@ -35,6 +35,8 @@ local seconds = mod(timeLeft, 60) if days >= 1 then return (days .. 'd' .. ' ') .. ((hours > 0) and (hours .. 'h') or '') + elseif timeLeft < 60 then + return (seconds .. ' sec') else return ((hours > 0) and (hours .. 'h') or '') .. ((minutes > 0) and (' ' ..minutes .. ' min') or '') end @@ -81,6 +83,7 @@ self:RegisterEvent('PLAYER_REGEN_DISABLED') self:RegisterEvent('GARRISON_SHOW_LANDING_PAGE') self:RegisterForDrag('LeftButton') + self:EnableMouse(true) self:SetMovable(true) self:SetToplevel(true) @@ -113,6 +116,8 @@ --end) C_Garrison.RequestLandingPageShipmentInfo(); self.isStale = true + UIPanelWindows[self:GetName()] = { area = "right", pushable = 3, whileDead = 1 }; + tinsert(UISpecialFrames, self:GetName()) end @@ -148,6 +153,8 @@ self.ClassStripe:SetColorTexture(classColor.r, classColor.g, classColor.b, 1) self.ClassStripe:SetPoint('TOPLEFT', self.HeaderInset, 'BOTTOMLEFT') + self.maxItems = db.maxItems or self.maxItems + return self.profile end @@ -165,7 +172,7 @@ local listTitle = frame.listTitle[index] setmetatable(self.profile[listKey], { __tostring = function() return listTitle end }) frame.sortedItems[listKey] = {} - + frame.maxItems = self.maxItems end frame.owningFrame = self frame:SetList(1) @@ -305,6 +312,14 @@ end +function ClassPlan:OnMouseDown(button) + print(button) + if button == 'RightButton' then + self:Toggle() + end + +end + function ClassPlan:OnUpdate() if self.requestingData then self:RefreshData() @@ -406,8 +421,34 @@ end end +function ClassPlanHandlerBase:OnLoad(...) + print(self:GetName()..':OnLoad()', ...) + self:EnableMouse(true) +end + +function ClassPlanHandlerBase:OnMouseDown(button, down) + print(self:GetName().. ':OnMouseDown()', button) + ClassOrderPlan:OnMouseDown(button) +end + function ClassPlanHandlerBase:OnMouseWheel(delta) - self.scrollOffset = (self.scrollOffset or 0) - ((delta > 0) and 1 or -1) + if IsControlKeyDown() then + if delta > 0 then + if self.maxItems < 30 then + self.maxItems = self.maxItems + 1 + end + + else + if self.maxItems >= 2 then + self.maxItems = self.maxItems - 1 + end + end + if WorldPlanData.OrderHall then + WorldPlanData.OrderHall.maxItems = self.maxItems + end + else + self.scrollOffset = (self.scrollOffset or 0) - ((delta > 0) and 1 or -1) + end self:UpdateItems() end @@ -547,6 +588,7 @@ block.lastProfile = lastProfile -- blot out arbitrary flags block.offerEndTime = nil + block.isComplete = data.isComplete block.missionEndTime = nil block.creationTime = nil block.duration = nil @@ -607,14 +649,13 @@ end function ClassPlanEntryBase:SetTimeLeft(expires, duration) - self.ProgressBG:Hide() - self.ProgressBar:Hide() if not expires then return end -- calculate here since time isn't available local timeLeft = expires - time() + --print(self:GetName(), timeLeft) if timeLeft < 0 then -- handle being complete if self.shipmentsReady and (self.shipmentsReady < self.shipmentsTotal) then @@ -624,17 +665,20 @@ end else self.TimeLeft:SetText(GetTimeLeftString(timeLeft)) - end + if duration then + local progress = (duration - timeLeft) / duration + local r = ((progress >= .5) and (progress/2)) or 1 + local g = ((progress <= .5) and (progress*2)) or 1 + self.ProgressBG:Show() + self.ProgressBar:Show() + self.ProgressBG:SetColorTexture(r,g,0,0.25) + self.ProgressBar:SetColorTexture(r,g,0,0.5) + self.ProgressBar:SetWidth(self.ProgressBG:GetWidth() * progress) + else - if (timeLeft > 0) and duration then - local progress = (duration - timeLeft) / duration - local r = ((progress >= .5) and (progress/2)) or 1 - local g = ((progress <= .5) and (progress*2)) or 1 - self.ProgressBG:Show() - self.ProgressBar:Show() - self.ProgressBG:SetColorTexture(r,g,0,0.25) - self.ProgressBar:SetColorTexture(r,g,0,0.5) - self.ProgressBar:SetWidth(self.ProgressBG:GetWidth() * progress) + self.ProgressBG:Hide() + self.ProgressBar:Hide() + end end end diff -r dfd53f7c0fe5 -r b29b35cb8539 ClassPlan.xml --- a/ClassPlan.xml Sat Apr 15 11:05:32 2017 -0400 +++ b/ClassPlan.xml Mon May 08 22:38:52 2017 -0400 @@ -7,7 +7,7 @@ - + @@ -18,6 +18,7 @@ + diff -r dfd53f7c0fe5 -r b29b35cb8539 ClassPlanFollowers.lua --- a/ClassPlanFollowers.lua Sat Apr 15 11:05:32 2017 -0400 +++ b/ClassPlanFollowers.lua Mon May 08 22:38:52 2017 -0400 @@ -3,7 +3,7 @@ local c = { templateName = 'ClassPlanShipmentEntry', - listKey = {'followers'}, + listKey = {'followers','troops'}, listTitle = {'Followers'}, events = { 'GARRISON_FOLLOWER_LIST_UPDATE', @@ -16,6 +16,7 @@ function c:OnLoad() + print('Followers:OnLoad()') self.followerType = 4 -- follower type, versus garrison_type end @@ -31,10 +32,24 @@ print('|cFF0088FF'..self:GetName()..':GetPlayerData()|r') local profileList = self:GetParent().profile.followers + local troopList = self:GetParent().profile.troops + local followerInfo = C_Garrison.GetFollowers(self.followerType) + + if followerInfo then table.wipe(profileList) for followerID, follower in pairs(followerInfo) do + print(FOLLOWER_QUALITY_COLORS[follower.quality].hex, follower.name, follower.isTroop) + if follower.isTroop then + troopList[followerID] = follower + else + print(follower.isMaxLevel, follower.xp, follower.levelXP, follower.iLevel) + + profileList[followerID] = follower + end + + profileList[followerID] = follower end end @@ -42,6 +57,13 @@ end function c:UpdateItems() + + local profileList = self:GetParent().profile.followers + + local troopList = self:GetParent().profile.troops + + + end function c:Reanchor() end diff -r dfd53f7c0fe5 -r b29b35cb8539 ClassPlanMissions.lua --- a/ClassPlanMissions.lua Sat Apr 15 11:05:32 2017 -0400 +++ b/ClassPlanMissions.lua Mon May 08 22:38:52 2017 -0400 @@ -40,12 +40,14 @@ wipe(profile.available) - for i = 1, #items do - if (not items[i].isBuilding and items[i].isZoneSupport) then - else + for _, data in ipairs(items) do - tinsert(profile.available, items[i]) + --print(' -',data.name, '|cFF00FF00'.. data.offerEndTime .. '|r', date("%A %I:%m %p", data.offerEndTime)) + if data.offerEndTime then + data.offerEndTime = time() + (data.offerEndTime - GetTime()) end + tinsert(profile.available, data) + end local items = C_Garrison.GetLandingPageItems(ORDERHALL_TYPE) diff -r dfd53f7c0fe5 -r b29b35cb8539 ClassPlanMissions.xml --- a/ClassPlanMissions.xml Sat Apr 15 11:05:32 2017 -0400 +++ b/ClassPlanMissions.xml Mon May 08 22:38:52 2017 -0400 @@ -8,9 +8,10 @@ - + + + - @@ -20,6 +21,7 @@ + \ No newline at end of file diff -r dfd53f7c0fe5 -r b29b35cb8539 ClassPlanShipments.lua --- a/ClassPlanShipments.lua Sat Apr 15 11:05:32 2017 -0400 +++ b/ClassPlanShipments.lua Mon May 08 22:38:52 2017 -0400 @@ -209,39 +209,42 @@ ShipmentList.SortHandler = function(a, b) - if a[SortKey] then - if b[SortKey] then - return SortTable[a[SortKey]] < SortTable[b[SortKey]] - else - return true + local status = false + if b.isComplete ~= a.isComplete then + if a.isComplete then + status = true end else - if b.isComplete ~= a.isComplete then - return a.isComplete and true or false + if a[SortKey] then + if b[SortKey] then + status = (SortTable[a[SortKey]] < SortTable[b[SortKey]]) + else + status = true + end else if a.profileKey ~= b.profileKey then - return a.profileKey < b.profileKey + status = (a.profileKey < b.profileKey) + else if a.shipmentsReady and b.shipmentsReady then - return (a.shipmentsReady) > (b.shipmentsReady) + status = (a.shipmentsReady) > (b.shipmentsReady) elseif a.shipmentsReady or b.shipmentsReady then - return (a.shipmentsReady) or true or false + status = (a.shipmentsReady) or true or false else if (a.creationTime ~= b.creationTime) then - return (a.creationTime) < (b.creationTime) + status = (a.creationTime) < (b.creationTime) else - return (a.name) < (b.name) + status = (a.name) < (b.name) end end end end end + return status end -function ShipmentList:OnLoad() -end function ShipmentList:OnShow() print('|cFF00FF88'..self:GetName()..':OnShow()|r') end diff -r dfd53f7c0fe5 -r b29b35cb8539 ClassPlanShipments.xml --- a/ClassPlanShipments.xml Sat Apr 15 11:05:32 2017 -0400 +++ b/ClassPlanShipments.xml Mon May 08 22:38:52 2017 -0400 @@ -9,6 +9,7 @@ + \ No newline at end of file diff -r dfd53f7c0fe5 -r b29b35cb8539 FilterBar.lua --- a/FilterBar.lua Sat Apr 15 11:05:32 2017 -0400 +++ b/FilterBar.lua Mon May 08 22:38:52 2017 -0400 @@ -23,7 +23,7 @@ local BUTTONS_SPACING = 1 local BUTTONS_HEIGHT = 20 local TOGGLE_SIZE = 20 -local HEADERS_HEIGHT = 40 +local HEADERS_HEIGHT = 24 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE @@ -201,6 +201,9 @@ end function Module:Reset() + + + self:UpdateFilters('SUMMARY_RESET') self:UpdateMatches('SUMMARY_RESET') self:UpdateLayout('SUMMARY_RESET') @@ -222,13 +225,15 @@ wipe(db.FilterList) for index, info in ipairs(db.DefaultFilters) do + info.used = true tinsert(db.FilterList, info) end self.bounties = db.Bounties self.BountyFilters = {} + local numBounties = 0 for index, data in ipairs(self.bounties) do if not IsQuestComplete(data.questID) then - + numBounties = numBounties + 1 local info = self.BountyFilters[index] if not info then info = {} @@ -241,6 +246,7 @@ end local questTitle = GetQuestLogTitle(GetQuestLogIndexByID(data.questID)) + info.used = true info.filterKey = 'factionID' info.filterFunc = IsBountyCriteria info.filterValue = data.questID @@ -251,8 +257,12 @@ tinsert(db.FilterList, info) --{ filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", }, end + end + for i = numBounties + 1, #self.BountyFilters do + self.BountyFilters[i].used = nil end + end function Module:UpdateMatches(event) @@ -268,15 +278,12 @@ print(info.filterKey, info.filterValue, info.filterFunc and 'func test' or 'compare') for questID, pin in pairs(quests) do print('', questID, pin.dataLoaded, (not IsQuestComplete(questID))) - if pin.dataLoaded and not IsQuestComplete(questID) then - + if pin.dataLoaded and (not IsQuestComplete(questID)) then local keyName, keyValue = info.filterKey, info.filterValue local isMatch if info.filterFunc then - isMatch = info.filterFunc(pin, keyValue) print(' running special function, result =', isMatch) - elseif pin[keyName] and (pin[keyName] == keyValue) then isMatch = true print(' rote match') @@ -287,10 +294,8 @@ print(' local map') tinsert(info.LocalMatches, pin) end - end end - end print('global', #info.GlobalMatches, 'local', #info.LocalMatches) end @@ -411,9 +416,9 @@ layoutWidth = layoutWidth + headerWidth + HEADERS_SPACING end - self:SetSize(layoutWidth, BUTTONS_HEIGHT + BUTTONS_SPACING * 2) + self:SetSize(layoutWidth, BUTTONS_HEIGHT + (BUTTONS_SPACING * 2)) self:ClearAllPoints() - self:SetPoint('TOP') + self:SetPoint('BOTTOM') self.isStale = nil layoutDirty = nil end diff -r dfd53f7c0fe5 -r b29b35cb8539 FilterBar.xml --- a/FilterBar.xml Sat Apr 15 11:05:32 2017 -0400 +++ b/FilterBar.xml Mon May 08 22:38:52 2017 -0400 @@ -101,7 +101,7 @@ diff -r dfd53f7c0fe5 -r b29b35cb8539 QuestPOI.lua --- a/QuestPOI.lua Sat Apr 15 11:05:32 2017 -0400 +++ b/QuestPOI.lua Mon May 08 22:38:52 2017 -0400 @@ -44,6 +44,7 @@ local overlayBaseIndex = 1380 local previousHighlight +local FADE_TIMING_MULTIPLIER = 3 local DATA_DEBUG = false local PIN_REFRESH_DELAY = 1 local PIN_REQUEST_DELAY = .2 @@ -93,7 +94,7 @@ borderWidth = 2, highlightWidth = 2, TagSize = 8, - maxAlertLevel = 0, + maxAlertLevel = 3, numberFontObject = 'WorldPlanFont' } local MINIMIZED_STYLE = { @@ -170,6 +171,39 @@ }} end + +do + local timeStates = { + {maxSeconds = 60, + r=1, g=0.25, b =0, format = function (minutes) return '|cFFFF4400'.. minutes .. 'm' end, + }, + {maxSeconds = 240, + r=1, g=.5, b=0, format = function(minutes) return '|cFFFF4400'.. floor(minutes/60) .. 'h' end, + }, + {maxSeconds = 1440, + r=1, g=1, b=0, format = function(minutes) return '|cFFFFFF00'.. floor(minutes/60) .. 'h' end, + }, + {maxSeconds = 10081, + r=0, g=1, b=0, + }, -- 7 days + 1 minute + } + -- Generates a timeleft string + function QuestPOI:GetTimeInfo(timeLeft, limit) + for index = 1, limit do + local state = timeStates[index] + if timeLeft <= state.maxSeconds then + local text + if state.format then + text = state.format(timeLeft) + end + return text, index, state + end + end + return + end +end + + local GetAchievementTooltipExtras = function(info) local hasInfo @@ -273,6 +307,12 @@ --print('|cFF00FF00refresh on show') self:Refresh('POI_ONSHOW_STALE') end + + if self.questID and IsQuestComplete(self.questID) then + self:Release() + return + end + self:RegisterEvent('QUEST_TURNED_IN') self:RegisterEvent('QUEST_LOG_UPDATE') self:HideOrShowFrames(true) @@ -393,16 +433,46 @@ function QuestPOI:OnUpdate (sinceLast) -- control update check intervals - if self.animating then - local alpha = self.icon:GetAlpha() + sinceLast*3 + if self.toAlpha then + if not self.alphaStart then + self.alphaStart = GetTime() + end - self.animateTime = (self.animateTime or 0) + sinceLast - if alpha >= 1 then - alpha = 1 - print('fade over', self.animateTime) - self.animating = nil - self.animateTime = nil + local alpha = self.icon:GetAlpha() + local alphaMod = ((GetTime()-self.alphaStart) *FADE_TIMING_MULTIPLIER) + if self:GetID() == 1 then + print(alpha, self.toAlpha, sinceLast, alphaMod) + end + if alpha > self.toAlpha then + alpha = alpha - (sinceLast*FADE_TIMING_MULTIPLIER) + + if (alpha <= self.toAlpha) then + alpha = self.toAlpha + self.toAlpha = nil + elseif (alpha <= 0) then + alpha = 0 + self.toAlpha = nil + end + elseif alpha < self.toAlpha then + alpha = alpha + alphaMod + + if (alpha >= self.toAlpha) then + alpha = self.toAlpha + self.toAlpha = nil + elseif (alpha >= 1) then + alpha = 1 + self.toAlpha = nil + end + + else + self.toAlpha = nil + end + + if not self.toAlpha then + self.alphaStart = nil + else + self.alphaStart = GetTime() end self.icon:SetAlpha(alpha) @@ -450,8 +520,9 @@ function QuestPOI:StartFading() - if not self.animating then - self.animating = true + if not self.toAlpha then + print('setting toAlpha') + self.toAlpha = 1 self.icon:SetAlpha(0) self.RewardBorder:SetAlpha(0) end @@ -507,7 +578,7 @@ self.dataLoaded = true self.isStale = true self.xpType, self.xpName, self.xpIcon, self.xpCount = xpType, xpName, xpIcon, xpCount - + WorldPlan.dataFlush = true end end @@ -683,9 +754,19 @@ for i = 1, WorldPlanTooltip:NumLines() do local line = _G['WorldPlanTooltipTextLeft' .. i] local text = line and line:GetText() - local ap = text and text:gsub(',', ''):gsub(' million', '000000'):match('([%d%.]+) '..ARTIFACT_POWER) - if ap then - rewardCount = tonumber(ap) + local multiplier = (text:match('million') and 1000000) or 1 + if text then + text = text:gsub(',', '') + local ap = text:match('([%d]+) '..ARTIFACT_POWER) + if not ap then + ap = text:match('([%d%.]+) million '..ARTIFACT_POWER) + if ap then + ap = tonumber(ap) * 1000000 + end + end + if ap then + rewardCount = tonumber(ap) + end end end return rewardCount @@ -857,16 +938,15 @@ self.maxAlertLevel = style.maxAlertLevel or DEFAULT_STYLE.maxAlertLevel if self.dataLoaded then - print('new pin, has data, cue fade') if self.isNew then + print('new pin, has data, cue fade') self:StartFading() self.isNew = nil end else - if not self.animating then - print('new pin, but no data, hide icon') - self.icon:SetAlpha(0) - self.RewardBorder:SetAlpha(0) + if not self.toAlpha then + icon:SetAlpha(0) + iconBorder:SetAlpha(0) end end @@ -987,26 +1067,24 @@ function QuestPOI:UpdateStatus() -- update time elements self.isActive = TQ_IsActive(self.questID) + --print(self.maxAlertLevel) + local border = (self.isBounty or self.isCriteria) and self.RewardBorder or self.HighlightBorder if self.isActive then local tl = self.alertLevel local timeLeft = TQ_GetQuestTimeLeftMinutes(self.questID) if timeLeft > 0 then - local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel) + local text, timeState, style = self:GetTimeInfo(timeLeft, self.maxAlertLevel) if tl ~= timeState then tl = timeState self.timeLabel:SetText(text) end + if style then + self.RewardBorder:SetVertexColor(style.r, style.g, style.b, style.a) + end end - local border = (self.isBounty or self.isCriteria) and self.RewardBorder or self.HighlightBorder - - if tl and (timeLeft < 120) then - border:SetVertexColor(1,0,0,0.7) - else - border:SetVertexColor(0,0,0,0.7) - end self.alertLevel = tl self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1)) else @@ -1022,7 +1100,7 @@ -- print('|cFFFFFF00' ..self:GetName()..':HideOrShowFrames()') -- do not SetShown() here if not self.hideReason then - self.hideReason = "HideOrShowFrames() called" + self.hideReason = "HideOrShowFrames() called without a reason." end end self.Overlay:SetShown(isShown) @@ -1031,9 +1109,9 @@ end function QuestPOI:Release() - + print('|cFFFF4400'..self:GetID()..':Release()', self.hideReason) self.hideReason = 'Released by script.' - self:SetShown(false) + self:HideOrShowFrames(false) if self.questID then db.QuestsByID[self.questID] = nil for _, map in pairs(db.QuestsByZone) do @@ -1058,12 +1136,15 @@ for i, pin in ipairs(db.UsedPins) do if pin == self then + print('|cFFFF4400cleared from UsedPins|r') tremove(db.UsedPins, i) break end - end tinsert(db.FreePins, self) WorldPlan.dataFlush = true + WorldPlanSummary.isStale = true + + return true end \ No newline at end of file diff -r dfd53f7c0fe5 -r b29b35cb8539 WorldPlan.lua --- a/WorldPlan.lua Sat Apr 15 11:05:32 2017 -0400 +++ b/WorldPlan.lua Mon May 08 22:38:52 2017 -0400 @@ -601,36 +601,6 @@ return info, info[subType] or db.DefaultType[subType] end -do - local timeStates = { - {maxSeconds = 60, - r=1, g=0.25, b =0, format = function (minutes) return '|cFFFF4400'.. minutes .. 'm' end, - }, - {maxSeconds = 240, - r=1, g=.5, b=0, format = function(minutes) return '|cFFFF4400'.. floor(minutes/60) .. 'h' end, - }, - {maxSeconds = 1440, - r=1, g=1, b=0, format = function(minutes) return '|cFFFFFF00'.. floor(minutes/60) .. 'h' end, - }, - {maxSeconds = 10081, - r=0, g=1, b=0, - }, -- 7 days + 1 minute - } - -- Generates a timeleft string - function WorldPlanCore:GetTimeInfo(timeLeft, limit) - for index = 1, limit do - local state = timeStates[index] - if timeLeft <= state.maxSeconds then - local text - if state.format then - text = state.format(timeLeft) - end - return text, index - end - end - return nil, nil - end -end function WorldPlanCore:Refresh (forced) print('|cFFFFFF00'..self:GetName()..':Refresh()|r forced:', forced, 'init:', self.initialized) diff -r dfd53f7c0fe5 -r b29b35cb8539 WorldPlan.xml --- a/WorldPlan.xml Sat Apr 15 11:05:32 2017 -0400 +++ b/WorldPlan.xml Mon May 08 22:38:52 2017 -0400 @@ -61,7 +61,7 @@ -