changeset 19:6016ec3c8adf v1.0-rc5

ClassPlan: - Colored progress bars accompany the mission and shipment journal entries. - Significant load time improvements in the order hall. * Data events are spammed gratuitously at load-in, so any sort of operation that results should be done from a delayed enclosure. In this case: using a self-destructing C_Timer identified by the function handle, and setting a flag that frame scripts can respond to.
author Nenue
date Mon, 24 Oct 2016 18:32:00 -0400
parents 08b03bcdfeac
children 5078829f9b42
files ClassPlan.lua ClassPlan.xml
diffstat 2 files changed, 4 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/ClassPlan.lua	Mon Oct 24 18:23:06 2016 -0400
+++ b/ClassPlan.lua	Mon Oct 24 18:32:00 2016 -0400
@@ -95,7 +95,6 @@
   --end
 end
 
-
 ShipmentsHandler.OnGetItem = function(data)
   if data.shipmentsTotal then
     local timeLeft = data.creationTime + data.duration - GI_currentTime
@@ -155,7 +154,6 @@
   end
   wipe(ShipmentsInfo)
 
-
   local garrisonType = LE_GARRISON_TYPE_7_0
   local buildings = C_Garrison.GetBuildings(garrisonType);
   local shipmentIndex = 0
@@ -201,7 +199,6 @@
     tinsert(self.profile.shipments, data)
   end
   self.isStale = true
-
 end
 
 function core:OnLoad ()
@@ -210,22 +207,16 @@
   self:RegisterEvent('PLAYER_REGEN_ENABLED')
   self:RegisterEvent('PLAYER_REGEN_DISABLED')
   -- Blizzard_GarrisonUI already fires a shipment data request for GARRISON_SHIPMENT_RECEIVED; this is unlikely to
-
-
   self:AddHandler('missions', MissionsHandler)
   self:AddHandler('shipments', ShipmentsHandler)
-
-
   self:Reanchor()
 end
+
 local parentFrames = {'VeneerWorldState', 'OrderHallCommandBar'}
 function core:Reanchor()
-
-
   self:ClearAllPoints()
-
+  self.anchorParent = UIParent
   local anchorTo = 'TOP'
-  self.anchorParent = UIParent
   for i, name in ipairs(parentFrames) do
     local frame = _G[name]
     if frame then
@@ -362,8 +353,6 @@
   --end
   self.Owner:SetText(ownerText)
   self.Name:SetTextColor(data.classColor.r, data.classColor.g, data.classColor.b)
-
-
 end
 
 function core:RefreshItems(configKey, prototype)
@@ -454,7 +443,6 @@
     print('updating items on show')
     self:Refresh()
   end
-
 end
 
 function core:OnShow()
@@ -530,14 +518,12 @@
     return
   end
 
-
   if self.missionEndTime then
     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
@@ -552,7 +538,6 @@
         self.ProgressBar:SetWidth(w)
       else
         self.ProgressBar:SetWidth(progress * w)
-
         local r, g = 1, 0
         if progress >= 0.5 then
           g = 1
@@ -564,32 +549,26 @@
         self.ProgressBar:SetColorTexture(r,g,0,1)
         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 MissionsHandler:Refresh()
-
-
   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]
@@ -603,17 +582,14 @@
     self.Done:Hide()
   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 MissionsHandler:OnEnter()
   if self.rewardInfo and self.rewardInfo.itemID then
     GameTooltip:SetOwner(self, 'ANCHOR_LEFT')
@@ -621,16 +597,14 @@
     GameTooltip:Show()
   end
 end
+
 function MissionsHandler:OnLeave()
   if GameTooltip:IsOwned(self) then
     GameTooltip:Hide()
   end
 end
 
-
-
 function ShipmentsHandler:Refresh()
-
   --[[
   self.icon = data.icon
   self.shipmentCapacity = data.shipmentCapacity
@@ -653,14 +627,11 @@
       itemID = itemID
 
   --]]
-
   self.Icon:SetTexture(self.icon)
-
   self.Name:SetText(self.name)
   self.Count:SetText(self.shipmentsReady)
   self.Done:SetShown(self.shipmentsReady and (self.shipmentsReady >= 1))
 
-
   -- flag as complete
   if ( self.shipmentsReady >= self.shipmentsTotal ) and (not self.isBeingResearched) then
     self.Swipe:SetCooldownUNIX(0, 0);
@@ -678,8 +649,8 @@
   else
     self.Background:SetColorTexture(0,0,0,0.5)
   end
+end
 
-end
 local time = time
 function ShipmentsHandler:OnUpdate(sinceLast)
   self.throttle = (self.throttle or 1) + sinceLast
@@ -705,7 +676,6 @@
         -- text will be set on next update
       end
     end
-
   elseif self.isBeingResearched then
     self.TimeLeft:SetText(GetTimeLeftString(self.researchStartTime + self.researchDuration - time()))
     self.TimeLeft:SetTextColor(1,1,0)
@@ -714,7 +684,6 @@
     self.TimeLeft:SetTextColor(0,1,0)
   end
 
-
   if not self.isComplete then
     local progress =  ((time() - self.creationTime) / self.duration)
     local w = self.ProgressBG:GetWidth()
@@ -732,7 +701,6 @@
       g = min(progress * 2, 1)
       r = 1
     end
-
     self.ProgressBar:SetColorTexture(r, g, 0, 1)
     self.ProgressBG:SetColorTexture(r, g, 0, .125)
     self.ProgressBG:Show()
@@ -741,14 +709,11 @@
     self.ProgressBG:Hide()
     self.ProgressBar:Hide()
   end
-
 end
 
 function ShipmentsHandler:OnEnter()
-
   if ( self.shipmentsReady and self.shipmentsTotal ) then
     GameTooltip:SetOwner(self, 'ANCHOR_LEFT')
-
     GameTooltip:AddLine(self.Owner:GetText(), self.Owner:GetTextColor())
     GameTooltip:AddLine(self.shipmentType)
     GameTooltip:AddLine(self.shipmentsReady .. ' of '.. self.shipmentsTotal)
--- a/ClassPlan.xml	Mon Oct 24 18:23:06 2016 -0400
+++ b/ClassPlan.xml	Mon Oct 24 18:32:00 2016 -0400
@@ -78,9 +78,7 @@
     </Layers>
   </Frame>
 
-
   <Button name="ClassPlanListEntryTemplate" virtual="true" hidden="true">
-
     <Scripts>
       <OnLoad>
         self.Count = self.Overlay.Count