diff ClassPlan.lua @ 95:b29b35cb8539

- 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
author Nenue
date Mon, 08 May 2017 22:38:52 -0400
parents 79e5e96e5f18
children 4d1520186ea4 a3800989f515
line wrap: on
line diff
--- 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