# HG changeset patch
# User Nenue
# Date 1478208555 14400
# Node ID 26dfa661daa7a63f9d10f092c7e97d2cd9c92750
# Parent 0100d923d8c348287b6bd9ac06db2f392706c033
WorldPlan:
- Quest pins will appear in the flight map. They follow the filter settings applied from the world map.
- Reward filter toggle changed to clear out other reward filters. The assumption being that one is most often looking only for that particular type of quest when they go to use it.
- Fixed filter bar info falling out of sync after player-triggered world map updates.
- Code stuff:
-- Quest pin shown-state management makes better use of OnShow OnHide handlers, SetShown is toggled and it all goes from there
-- WorldQuests module re-factored outside of the top level frame script.
ClassPlan:
- Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
diff -r 0100d923d8c3 -r 26dfa661daa7 ClassPlan.lua
--- a/ClassPlan.lua Wed Nov 02 19:04:47 2016 -0400
+++ b/ClassPlan.lua Thu Nov 03 17:29:15 2016 -0400
@@ -38,6 +38,7 @@
ClassOrderPlanCore = {
events = {},
freeBlocks = {},
+ characterButtons = {},
blocks = {},
sortedItems = {},
timers = {},
@@ -73,6 +74,7 @@
local SharedHandlers = {
numBlocks = 0,
isStale = true,
+ maxItems = 10
}
local SharedEntry = {}
local ShipmentEntry = {}
@@ -122,6 +124,8 @@
self.Background:SetColorTexture(classColor.r, classColor.g, classColor.b, 0.5)
self.profile.classColor = classColor
self.profile.className = className
+ self.profile.characterName = name
+ self.profile.characterRealm = realm
return self.profile
end
@@ -189,22 +193,23 @@
print(' |cFF00FF00'..index..' '..handler:GetName()..'|r')
local sortedItems = handler.sortedItems
local activeKey = handler.activeKey
+
handler.profile = self.profile[handler.activeKey]
-
+ handler.currentTime = GI_currentTime
+ handler:GetPlayerData(self.profile)
wipe(sortedItems)
- handler:GetPlayerData(self.profile)
for key, profile in pairs(self.data.characters) do
print('profile', key, activeKey)
local profileList = profile[activeKey]
if profileList and #profileList >= 1 then
- local classColor = profile.classColor or defaultClassColor
+ local classColor = profile.classColor or RAID_CLASS_COLORS['HUNTER']
local isMine = (profile == self.profile)
for index, data in ipairs(profileList) do
data.classColor = classColor
data.profileKey = key
data.isMine = isMine
if handler.OnGetItem then
- handler.OnGetItem(data)
+ handler:OnGetItem(data)
end
tinsert(sortedItems, data)
end
@@ -222,6 +227,37 @@
end
+ local index = 1
+ for id, profile in pairs(self.data.characters) do
+ local button = self.characterButtons[index]
+ if not button then
+ button = CreateFrame('Button', nil, self, 'ClassOrderPlanCharacterButton')
+ button:SetID(index)
+ self.characterButtons[index] = button
+
+ if not self.lastButton then
+ button:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 0)
+ else
+ button:SetPoint('BOTTOMLEFT', self.lastButton, 'BOTTOMRIGHT', 2, 0)
+ end
+ self.lastButton = button
+ end
+ if not profile.characterName then
+ profile.characterName, profile.characterRealm = id:match("%(.+)%-(.+)^")
+ end
+
+ button.className = profile.className
+ button.classColor = profile.classColor
+ button.characterName = profile.characterName
+ button.characterRealm = profile.characterRealm
+ button.hideItems = (profile.showItems == false) and (profile ~= self.profile)
+ button.isMine = (profile == self.profile)
+ button:Update()
+ button:Show()
+ index = index + 1
+ end
+
+
self.isStale = nil
self:Reanchor()
self:SetHeight(self.currentHeight + CP_HEADER_SIZE)
@@ -265,6 +301,17 @@
for index, frame in ipairs(self.Handlers) do
frame:Reanchor()
+
+ local ListTab = frame.ListTab
+ if ListTab then
+ ListTab:ClearAllPoints()
+ ListTab:SetPoint('TOPLEFT', frame, 'TOPLEFT', 0, CP_HEADER_SIZE)
+ ListTab:SetPoint('BOTTOMRIGHT', frame, 'TOPRIGHT', 0, 0)
+ ListTab.Label:SetText(frame.listTitle[frame.currentListIndex])
+ ListTab:Show()
+ print(ListTab:GetSize())
+ end
+
end
end
@@ -300,6 +347,11 @@
self.isStale = true
end
+function SharedHandlers:OnMouseWheel(delta)
+ self.scrollOffset = (self.scrollOffset or 0) - ((delta > 0) and 1 or -1)
+ self:UpdateItems()
+end
+
function SharedHandlers:RequestData()
print('|cFF0088FF'..self:GetName()..':RequestData()')
self.isStale = true
@@ -345,34 +397,57 @@
self.Name:SetTextColor(data.classColor.r, data.classColor.g, data.classColor.b)
end
+function SharedHandlers:Acquire(id)
+end
+function SharedHandlers:FreeBlock (block)
+end
+
function SharedHandlers:UpdateItems()
+
+ self.MoreItemsUp:Hide()
+ self.MoreItemsDown:Hide()
+
local sortedItems = self.sortedItems
+ local scrollOffset = self.scrollOffset or 0
+ local numItems = #sortedItems
+ if (not sortedItems[scrollOffset+1]) or (numItems <= self.maxItems) then
+ scrollOffset = 0
+ elseif (numItems > self.maxItems) and (scrollOffset > (numItems - self.maxItems)) then
+ scrollOffset = (numItems - self.maxItems)
+ end
+
self.blocks = self.blocks or {}
local blocks = self.blocks
local lastProfile
- local numItems = #sortedItems
local totalHeight = 0
self.lastBlock = nil
self.numActive = 0
- for i, data in ipairs(sortedItems) do
+ for i = 1, self.maxItems do
+ local index = scrollOffset + i
+ local data = sortedItems[index]
+ if not data then
+ break
+ end
+
+
local block = blocks[i]
if not block then
block = CreateFrame('Button', nil, self, self.templateName)
- block:SetID(i)
block.listType = self.activeKey
block.handler = self
self.numBlocks = self.numBlocks + 1
blocks[i] = block
end
+ block:SetID(index)
print('RefreshItem', block)
self.numActive = self.numActive + 1
if self.lastBlock then
block:SetPoint('TOPLEFT', self.lastBlock, 'BOTTOMLEFT', 0, 0)
- print('--', i, data.isComplete, data.missionEndTime, data.name)
+ print('--', index, data.isComplete, data.missionEndTime, data.name)
else
block:SetPoint('TOPLEFT', 0, 0)
print('--top')
@@ -401,12 +476,22 @@
lastProfile = data.profileKey
end
- for i = numItems + 1, self.numBlocks do
+ if self.numActive < numItems then
+ if scrollOffset < (numItems - self.maxItems) then
+ self.MoreItemsDown:Show()
+ end
+ if scrollOffset > 0 then
+ self.MoreItemsUp:Show()
+ end
+ end
+
+ for i = self.numActive + 1, self.numBlocks do
if blocks[i] then
blocks[i]:Hide()
end
end
+ self.scrollOffset = scrollOffset
self:Reanchor()
return totalHeight
@@ -419,38 +504,7 @@
self:SetPoint('BOTTOMRIGHT', -ClassOrderPlan:GetWidth()/2, 0)
end
-function MissionList:Reanchor()
- self:SetPoint('TOPRIGHT', 0, -24)
- self:SetPoint('BOTTOMLEFT', ClassOrderPlan:GetWidth()/2, 0)
- self.ListTab:ClearAllPoints()
- self.ListTab:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, CP_HEADER_SIZE)
- self.ListTab:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', 0, 0)
- self.ListTab.Label:SetText(self.listTitle[self.currentListIndex])
- self.ListTab:Show()
- print(self.ListTab:GetSize())
-end
-
-function MissionList:GetPlayerData (profile)
- wipe(profile.missions)
- wipe(profile.available)
-
- local items = C_Garrison.GetAvailableMissions(GetPrimaryGarrisonFollowerType(LE_GARRISON_TYPE_7_0));
- for i = 1, #items do
- if (not items[i].isBuilding and items[i].isZoneSupport) then
- else
-
- tinsert(profile.available, items[i])
- end
- end
-
- local items = C_Garrison.GetLandingPageItems(LE_GARRISON_TYPE_7_0)
- for index, data in ipairs(items) do
- print(' -',data.name, '|cFF00FF00'.. data.timeLeft .. '|r', date("%A %I:%m %p", data.missionEndTime))
- tinsert(profile.missions, data)
- end
- return true
-end
do
local ShipmentsInfo = {}
@@ -532,63 +586,47 @@
return true
end
end
-MissionList.OnGetItem = function(data)
- if data.missionEndTime and (data.missionEndTime < GI_currentTime) then
- data.isComplete = true
+
+
+function SharedEntry:SetTimeLeft(expires, duration)
+ self.ProgressBG:Hide()
+ self.ProgressBar:Hide()
+ if not expires then
+ return
end
-end
-MissionList.FreeBlock = function(self, block)
-end
+ -- calculate here since time isn't available
+ local timeLeft = expires - GI_currentTime
+ if timeLeft < 0 then
+ -- handle being complete
-MissionList.SortHandler = function (a,b)
- local result = false
- --if not a or not b then
- -- return true
- --else
- --if (a.isMine ~= b.isMine) then
- -- result = a.isMine
- --else
- --if (not b.missionEndTime) or (not a.missionEndTime) then
- -- print('missing article', b.missionEndTime, a.missionEndTime)
- --end
- if b.isComplete ~= a.isComplete then
- return a.isComplete
- elseif b.isMine ~= a.isMine then
- return a.isMine
- elseif b.missionEndTime then
- return ( b.missionEndTime > a.missionEndTime)
- else
- return ( b.offerEndTime > a.offerEndTime)
- end
+ else
+ self.TimeLeft:SetText(GetTimeLeftString(timeLeft))
+ end
- --end
- --end
-end
+ 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()
-
-function MissionList:OnShow()
- print('|cFF00FF88'..self:GetName()..':OnShow()|r')
-end
-
-function ShipmentList:OnLoad()
- C_Garrison.RequestLandingPageShipmentInfo();
-end
-function ShipmentList:OnShow()
- print('|cFF00FF88'..self:GetName()..':OnShow()|r')
- C_Garrison.RequestLandingPageShipmentInfo()
+ self.ProgressBG:SetColorTexture(r,g,0,0.25)
+ self.ProgressBar:SetColorTexture(r,g,0,0.5)
+ self.ProgressBar:SetWidth(self:GetWidth() * progress)
+ end
end
-- Update shipment flags data
local SetActualShipmentTime = function(self)
if self.isComplete then
- print('|cFF00FF88isComplete '..self.name..'|r')
- return true
+ return nil, nil
end
local timestamp = time()
local timeLeft = self.creationTime + self.duration - timestamp
+ local duration = self.duration * self.shipmentsTotal
local justFinished = false
while (self.shipmentsReady < self.shipmentsTotal) and (timeLeft <= 0) do
if not self.originalReady then
@@ -608,10 +646,13 @@
self.isStale = true
end
- return timeLeft
+
+ local expires = (self.originalCreationTime or self.creationTime) + duration
+
+ return expires, duration
end
-ShipmentList.OnGetItem = function(data)
+function ShipmentList:OnGetItem (data)
print('OnGetItem()')
if data.shipmentsTotal then
SetActualShipmentTime(data)
@@ -628,118 +669,12 @@
end
end
-
-function MissionEntry:OnComplete()
- print('flagging complete', self.name)
- self:Update()
+function ShipmentList:OnLoad()
+ C_Garrison.RequestLandingPageShipmentInfo();
end
-
-function MissionEntry:OnUpdate(sinceLast)
- self.throttle = (self.throttle or .5) + sinceLast
- if self.throttle < .5 then
- return
- else
- self.throttle = self.throttle - .5
- end
- if self.offerEndTime then
- local timeLeft = self.offerEndTime
- self.TimeLeft:SetText(GetTimeLeftString(timeLeft))
- self.TimeLeft:SetTextColor(1,1,1)
- elseif self.missionEndTime then
-
- if self.isComplete then
- return
- end
- local timeLeft = self.missionEndTime - time()
- if timeLeft < 0 then
- self:OnComplete()
- else
- self.TimeLeft:SetText(GetTimeLeftString(timeLeft))
- if timeLeft > 3600 then
- self.TimeLeft:SetTextColor(1,1,1)
- else
- self.TimeLeft:SetTextColor(1,1,0)
- end
- end
-
- if not self.isComplete then
- local progress = (time() - (self.missionEndTime - self.durationSeconds)) / self.durationSeconds
- local w = self.ProgressBG:GetWidth()
- if progress >= 1 then
- self.ProgressBar:SetWidth(w)
- else
- self.ProgressBar:SetWidth(progress * w)
- local r, g = 1, 0
- if progress >= 0.5 then
- g = 1
- r = 1-((progress-0.5)*2)
- else
- g = min(progress * 2, 1)
- r = 1
- end
- self.ProgressBar:SetColorTexture(r,g,0,.4)
- self.ProgressBG:SetColorTexture(r,g,0,0.125)
- end
- self.ProgressBG:Show()
- self.ProgressBar:Show()
- else
- self.ProgressBG:Hide()
- self.ProgressBar:Hide()
- end
- else
- self.TimeLeft:SetText(self.missionEndTime)
- end
-end
-
-function MissionEntry:OnLoad()
- print('|cFFFF4400',self:GetName() or tostring(self), 'onload')
- self.Count = self.Overlay.Count
- self.Name = self.Overlay.Name
- self.TimeLeft = self.Overlay.TimeLeft
- self.Owner = self.Overlay.Owner
-
- self.Icon:SetDesaturated(false)
- self.Done:Hide()
-end
-
-function MissionEntry:Update()
- local r,g,b = 1, 1, 1
- if self.isRare then
- r,g,b = 0.1, 0.4, 1
- self.IconBorder:SetVertexColor(r, g, b, 1)
- end
-
- --self.missionData = data
- self.Name:SetText(self.name)
- if #self.rewards >= 1 then
- self.Icon:SetTexture(self.rewards[1].icon or GetItemIcon(self.rewards[1].itemID))
- self.rewardInfo = self.rewards[1]
- else
- self.Icon:SetAtlas(self.typeAtlas, false)
- end
-
-
-
- if self.isComplete then
- self.TimeLeft:SetText('Complete!')
- self.Background:SetColorTexture(.25,.25,.25,1)
- else
- self.Background:SetColorTexture(0,0,0,0.5)
- end
-end
-
-function MissionEntry:OnEnter()
- if self.rewardInfo and self.rewardInfo.itemID then
- GameTooltip:SetOwner(self, 'ANCHOR_LEFT')
- GameTooltip:SetItemByID(self.rewardInfo.itemID)
- GameTooltip:Show()
- end
-end
-
-function MissionEntry:OnLeave()
- if GameTooltip:IsOwned(self) then
- GameTooltip:Hide()
- end
+function ShipmentList:OnShow()
+ print('|cFF00FF88'..self:GetName()..':OnShow()|r')
+ C_Garrison.RequestLandingPageShipmentInfo()
end
function ShipmentEntry:OnLoad()
@@ -785,52 +720,27 @@
if (self.shipmentsReady and self.shipmentsTotal) and (self.shipmentsReady < self.shipmentsTotal) then
- local timeLeft = SetActualShipmentTime(self)
+ local expires, duration = SetActualShipmentTime(self)
if self.isComplete then
self.TimeLeft:SetText('Complete!')
- self.TimeLeft:SetTextColor(0,0.5,1)
+ self.TimeLeft:SetTextColor(0,1,1)
elseif self.shipmentsReady >= 1 then
- self.TimeLeft:SetText(GetTimeLeftString(timeLeft))
+ self:SetTimeLeft(expires, duration)
self.TimeLeft:SetTextColor(0,1,0)
else
- self.TimeLeft:SetText(GetTimeLeftString(timeLeft))
+ self:SetTimeLeft(expires, duration)
self.TimeLeft:SetTextColor(1,1,1)
end
elseif self.isBeingResearched then
- self.TimeLeft:SetText(GetTimeLeftString(self.researchStartTime + self.researchDuration - time()))
- self.TimeLeft:SetTextColor(1,1,0)
+ self:SetTimeLeft(self.researchStartTime + self.researchDuration - time(), self.researchDuration)
+ self.TimeLeft:SetTextColor(1,1,1)
else
self.TimeLeft:SetText('Complete!')
self.TimeLeft:SetTextColor(0,1,0)
end
- if not self.isComplete then
- local progress = ((time() - self.creationTime) / self.duration)
- local w = self.ProgressBG:GetWidth()
- if progress >= 1 then
- self.ProgressBar:SetWidth(w)
- else
- self.ProgressBar:SetWidth(progress * w)
- end
-
- local r, g = 1, 0
- if progress >= 0.5 then
- g = 1
- r = 1-((progress-0.5)*2)
- else
- g = min(progress * 2, 1)
- r = 1
- end
- self.ProgressBar:SetColorTexture(r, g, 0, .4)
- self.ProgressBG:SetColorTexture(r, g, 0, .125)
- self.ProgressBG:Show()
- self.ProgressBar:Show()
- else
- self.ProgressBG:Hide()
- self.ProgressBar:Hide()
- end
end
function ShipmentEntry:OnEnter()
@@ -855,9 +765,12 @@
end
end
+
+
+
ClassPlanMissionHandler = Mixin(MissionList, SharedHandlers)
+ClassPlanMissionEntryMixin = Mixin(MissionEntry, SharedEntry)
ClassPlanShipmentHandler = Mixin(ShipmentList, SharedHandlers)
-ClassPlanMissionEntryMixin = Mixin(MissionEntry, SharedEntry)
ClassPlanShipmentEntryMixin = Mixin(ShipmentEntry,SharedEntry)
ClassPlanHeaderMixin = {
@@ -866,4 +779,19 @@
self:GetParent().isStale = true
ClassOrderPlan:Update()
end
-}
\ No newline at end of file
+}
+
+ClassPlanCharacterButtonMixin = {
+ Update = function(self)
+ print(CLASS_ICON_TCOORDS[self.className:upper()])
+ if self.className and CLASS_ICON_TCOORDS[self.className:upper()] then
+ self.Icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[self.className:upper()]))
+ end
+ self.Icon:SetDesaturated(self.showItems)
+ self.SelectGlow:SetShown(self.isMine)
+ end
+}
+
+function ClassPlanCharacterButtonMixin:OnEnter() end
+function ClassPlanCharacterButtonMixin:OnLeave() end
+function ClassPlanCharacterButtonMixin:OnClick() end
\ No newline at end of file
diff -r 0100d923d8c3 -r 26dfa661daa7 ClassPlan.xml
--- a/ClassPlan.xml Wed Nov 02 19:04:47 2016 -0400
+++ b/ClassPlan.xml Thu Nov 03 17:29:15 2016 -0400
@@ -35,56 +35,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-