changeset 25:4b3da1b221de v1.0-beta

- distinction between all possible types of values for the 'isComplete' field - style polish applied to title headers - clickable regions altered to somewhat match those of the blizzard objectives tracker, for more world frame space and quicker user familiarity
author Nenue
date Wed, 13 Apr 2016 11:20:09 -0400
parents 66b927b46776
children d5563cae5bf1
files ObjectiveTracker/ObjectiveCore.lua ObjectiveTracker/ObjectiveFrame.lua ObjectiveTracker/ObjectiveInfo.lua ObjectiveTracker/ObjectiveTracker.xml ObjectiveTracker/ObjectiveUI.lua ObjectiveTracker/QuestTracker.lua
diffstat 6 files changed, 128 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/ObjectiveTracker/ObjectiveCore.lua	Mon Apr 11 09:07:40 2016 -0400
+++ b/ObjectiveTracker/ObjectiveCore.lua	Wed Apr 13 11:20:09 2016 -0400
@@ -192,6 +192,7 @@
   self:Update(reason)
 end
 local Handler_Initialize = function (self, name, index)
+  local c = T.Conf.Wrapper
   print('Initializing |cFF00FFFF'..name..'|r module...')
 
   local handler = setmetatable(T[name] or {}, {
@@ -232,7 +233,7 @@
   local handler = T[name]
   local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate')
   frame.title:SetText(handler.displayName)
-  T.SetBlockStyle(frame, 'Tracker', 'Normal')
+  frame:SetWidth(c.Width)
   handler.frame = frame
   handler.trackerName = trackerName
   handler.lines = {}
@@ -374,7 +375,8 @@
   end
 end
 T.animateReasons = 0
-T.SetAnimate = function(animate, reason)
+T.SetAnimate = function(reason)
+  print('comparing', T.animateReasons, reason)
   if animate then
     if band(T.animateReasons, reason) == 0 then
       T.animateReasons = T.animateReasons + reason
--- a/ObjectiveTracker/ObjectiveFrame.lua	Mon Apr 11 09:07:40 2016 -0400
+++ b/ObjectiveTracker/ObjectiveFrame.lua	Wed Apr 13 11:20:09 2016 -0400
@@ -34,19 +34,28 @@
 local currentBlock
 --- todo: source these from config
 local itemButtonSize, itemButtonSpacing =  36, 1
-local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
-local titleSize, textSize = 16, 16
-local titlebg, textbg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}, {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }
-local titlebg_daily, textbg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }
-local textbg_account,titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0,  .45, 1, .125}, {'HORIZONTAL', 0, .45, 1, 0.4, 0,  .41, 1, .085 }
+
+local headerHeight, headerColor, headerSpacing = 16, {1,1,1,1}, 2
+local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0}
+local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'
+
+local titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}
+local titlebg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125 }
+local titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0,  .45, 1, .125}
+local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'
+
+local textbg =  {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }
+local textbg_daily = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }
+local textbg_account = {'HORIZONTAL', 0, .45, 1, 0.4, 0,  .41, 1, .085 }
+local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'
+
+
 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}
-local titleOutline, textOutline = "OUTLINE", "OUTLINE"
 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1
 local titleIndent, textIndent,selectionIndent = 2, 5, 50
+
 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed
 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
-local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24
-local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 }
 local rewardSize = 32
 local oprint = B.print('Objectives')
@@ -177,8 +186,8 @@
       block.Open = handler.Open
       block.Remove = handler.Remove
       block.Link = handler.Link
-      block:SetScript('OnMouseUp', handler.OnMouseUp)
-      block:SetScript('OnMouseDown', handler.OnMouseDown)
+      block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end)
+      block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end)
       block.attachmentHeight = 0
       block:ClearAllPoints()
 
@@ -230,11 +239,6 @@
   local completionScore, completionMax = 0, 0
   local displayObjectiveHeader = false
 
-  if info.description and #info.description >= 1 then
-    print('   |cFF00FFFF  header line:|r', info.description)
-    block.status:SetText(info.description)
-    displayObjectiveHeader = true
-  end
 
   --- The first line is going to be used no matter what, so it is hard-pulled.
    -- It also ensures that we're in the right position for cleaning up the leftover lines.
@@ -243,13 +247,27 @@
 
   block.numLines = 0
   block.attachmentHeight = 0
-  if info.isComplete then
-    print('     overriding line #1 for a completed block')
+
+  if info.description and #info.description >= 1 then
+    print('   |cFF00FFFF  header line:|r', info.description)
+    line.status:SetText(info.description)
+    line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
     if line.widget then
       line.widget:Hide()
     end
+    T.AddLine(block, line)
+
+    lineIndex = lineIndex + 1
+    line = T.GetLine(handler, block, lineIndex)
+  end
+
+  if (info.isComplete == true or info.isComplete == nil) and info.completionText then
+    print('     overriding line #1 for completion text:', info.completionText)
     line.status:SetText(info.completionText)
-    line.height = floor(line.status:GetHeight()+.5) + textSpacing
+    line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
+    if line.widget then
+      line.widget:Hide()
+    end
     T.AddLine(block, line)
   else
     if info.objectives then
@@ -498,7 +516,12 @@
   local print = tprint
   local tracker = self.frame
   local blockIndex = 0
-  local trackerHeight = floor(tracker.titlebg:GetHeight()+.5)
+  local trackerHeight = headerHeight
+
+  tracker.title:SetFont(headerFont, headerSize, headerOutline)
+  tracker.titlebg:SetHeight(headerHeight)
+  tracker.title:SetTextColor(unpack(headerColor))
+  --tracker.titlebg:SetGradientAlpha(unpack(headerbg))
 
   self.currentAnchor = tracker.titlebg
   local numWatched = self:GetNumWatched()
@@ -543,13 +566,15 @@
   tracker.previousHeight = tracker.height
   if numBlocks >= 1 then
     previousBlock = nil
-
+    if tracker.isEmpty then
+      tracker.headerFade:Play()
+      tracker.isEmpty = nil
+    end
     tracker.height = trackerHeight
     tracker:SetHeight(tracker.height)
     tracker:Show()
-
-
   else
+    tracker.isEmpty = true
     tracker.height = 0
     tracker:Hide()
   end
--- a/ObjectiveTracker/ObjectiveInfo.lua	Mon Apr 11 09:07:40 2016 -0400
+++ b/ObjectiveTracker/ObjectiveInfo.lua	Wed Apr 13 11:20:09 2016 -0400
@@ -89,7 +89,7 @@
 
   local questID, type = GetAutoQuestPopUp(popupIndex)
   local questLogIndex = GetQuestLogIndexByID(questID)
-  local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
+  local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questLogIndex)
 
   self.Info[questID] = self.Info[questID] or {}
   local popup = self.Info[questID]
@@ -265,12 +265,29 @@
 
 --- info cleanup done when  turn-ins are detected
 Bonus.OnTurnIn = function(self, questID, xp, money)
+
+  if #self.info.rewardInfo >= 1 then
+    for i, reward in ipairs(self.info.rewardInfo) do
+      --[[
+        type = 'item',
+        index = i ,
+        name = name,
+        texture = texture,
+        count = count,
+        quality = quality,
+        isUsable = isUsable
+       ]]
+      print(' reward ', i, ' ', reward.type, reward.name, reward.count)
+
+    end
+  end
+
   print('|cFFFF8800'..self.name..':OnTurnIn call', questID, xp, money)
   local savedTasks = B.Conf.TasksLog
 
   self.Info[questID].completedTime = GetTime()
   self.Info[questID].animate = true
-  T.SetAnimate(self.watchReason)
+  T.SetAnimate(self.watchReasonModule)
   savedTasks[questID] = self.Info[questID]
 end
 
--- a/ObjectiveTracker/ObjectiveTracker.xml	Mon Apr 11 09:07:40 2016 -0400
+++ b/ObjectiveTracker/ObjectiveTracker.xml	Wed Apr 13 11:20:09 2016 -0400
@@ -190,7 +190,7 @@
 
   <!-- Background panels -->
 
-  <Frame name="VeneerTrackerTemplate" parent="UIParent" virtual="true">
+  <Frame name="VeneerTrackerTemplate" parent="UIParent" virtual="true" hidden="true">
     <Layers>
       <Layer level="BACKGROUND">
         <Texture name="$parentTitleBackground" parentKey="titlebg">
@@ -224,16 +224,15 @@
         </FontString>
       </Layer>
     </Layers>
+    <Animations>
+      <AnimationGroup parentKey="headerFade" setToFinalAlpha="true">
+        <Alpha childKey="titlebg" duration="0.7" fromAlpha="1" toAlpha="0" order="1" />
+      </AnimationGroup>
+    </Animations>
   </Frame>
 
 
-  <Frame name="VeneerTrackerBlock" parent="VeneerObjectiveScroll" virtual="true" enableMouse="true">
-    <TitleRegion>
-      <Anchors>
-        <Anchor point="TOPLEFT" />
-        <Anchor point="BOTTOMRIGHT" relativeKey="TOPRIGHT" x="0" y="-22" />
-      </Anchors>
-    </TitleRegion>
+  <Frame name="VeneerTrackerBlock" parent="VeneerObjectiveScroll" virtual="true">
     <Layers>
       <Layer level="BACKGROUND">
         <Texture name="$parentTitleBackground" parentKey="titlebg">
@@ -397,6 +396,23 @@
         </Texture>
       </Layer>
     </Layers>
+    <Frames>
+      <Frame name="$parentHeaderBox" parentKey="clickZone"  enableMouse="true">
+        <Anchors>
+          <Anchor point="TOP" relativeKey="$parent.title"  />
+          <Anchor point="RIGHT" relativeKey="$parent.title"  />
+          <Anchor point="LEFT" relativeKey="$parent.title"  />
+          <Anchor point="BOTTOM" relativeKey="$parent.title" />
+        </Anchors>
+        <Layers>
+          <Layer level="HIGHLIGHT">
+            <Texture setAllPoints="true">
+              <Color r="1" g="1" b="0.5" a="0.5" />
+            </Texture>
+          </Layer>
+        </Layers>
+      </Frame>
+    </Frames>
   </Frame>
 
   <Frame name="VeneerTrackerObjective" virtual="true" hidden="true">
--- a/ObjectiveTracker/ObjectiveUI.lua	Mon Apr 11 09:07:40 2016 -0400
+++ b/ObjectiveTracker/ObjectiveUI.lua	Wed Apr 13 11:20:09 2016 -0400
@@ -24,6 +24,7 @@
 end
 
 Default.OnMouseUp = function(self, button)
+
   print(self.handler.name, self.mainStyle, self.subStyle)
   if button == 'LeftButton' then
     if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
@@ -44,12 +45,13 @@
 end
 
 Default.OnMouseDown = function(self, button)
+
   print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE"))
   print(self.info.title)
 end
 
+AutoQuest.Select = function(self)
 
-AutoQuest.Select = function(self)
   if self.info.popupType == 'OFFER'  then
     ShowQuestOffer(self.info.questIndex)
   else
@@ -59,6 +61,7 @@
 end
 
 Quest.Select = function(self)
+
   if self.info.isAutoComplete and self.info.isComplete then
     ShowQuestComplete(self.info.questLogIndex)
   else
@@ -67,16 +70,22 @@
 end
 
 Quest.Link = function(self)
-  local questLink = GetQuestLink(block.questLogIndex);
+
+  local questLink = GetQuestLink(self.info.questLogIndex);
   if ( questLink ) then
     ChatEdit_InsertLink(questLink);
   end
 end
+
+AutoQuest.Link = Quest.Link
+
 Quest.Open = function(self)
+
   QuestMapFrame_OpenToQuestDetails(self.info.questID)
 end
 
 Quest.Remove = function(self)
+
   print('removing', self.info.questLogIndex, 'from watcher')
   RemoveQuestWatch(self.info.questLogIndex)
 end
@@ -88,12 +97,15 @@
   --mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
 end
 Cheevs.Remove = function(self)
+
   RemoveTrackedAchievement(self.info.cheevID)
 end
 Cheevs.OnMouseUp = function(self, button)
+
   Default.OnMouseUp(self, button)
 end
 Cheevs.Link = function(self)
+
   local achievementLink = GetAchievementLink(self.info.cheevID);
   if ( achievementLink ) then
     ChatEdit_InsertLink(achievementLink);
@@ -101,6 +113,7 @@
 end
 
 Cheevs.Open = function(self)
+
   if ( not AchievementFrame ) then
     AchievementFrame_LoadUI();
   end
@@ -111,8 +124,10 @@
 end
 
 local Bonus = mod.Bonus
-Bonus.Select = function(self, questID)
-  Bonus:OnTurnIn(self.info.questID, 0, 30800)
+Bonus.Select = function(self)
+
+  Bonus:OnTurnIn(self.info.questID)
 end
-Bonus.Remove = function(self, questID)
+Bonus.Remove = function(self)
+
 end
\ No newline at end of file
--- a/ObjectiveTracker/QuestTracker.lua	Mon Apr 11 09:07:40 2016 -0400
+++ b/ObjectiveTracker/QuestTracker.lua	Wed Apr 13 11:20:09 2016 -0400
@@ -46,16 +46,17 @@
   block.statusbg:SetGradientAlpha(unpack(textbg))
 
   local completionText
-  if info.isAutoComplete then
-    local questID, popupType = GetAutoQuestPopUp(info.questLogIndex)
-    if popupType == 'COMPLETE' then
-      print('    :: auto-complete quest :: set the message')
-      info.completionText = T.strings.CLICK_TO_COMPLETE
-    end
-  end
   if info.isComplete then
-    if not completionText or info.completionText then
-      info.completionText = GetQuestLogCompletionText(info.questLogIndex)
+    if info.isAutoComplete then
+      local questID, popupType = GetAutoQuestPopUp(info.questLogIndex)
+      if popupType == 'COMPLETE' then
+        print('    :: auto-complete quest :: set the message')
+        info.completionText = T.strings.CLICK_TO_COMPLETE
+      end
+    else
+      if not completionText or info.completionText then
+        info.completionText = GetQuestLogCompletionText(info.questLogIndex)
+      end
     end
     print('    :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"')
   end
@@ -113,6 +114,7 @@
     return
   end
 
+
   local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
 
 
@@ -194,9 +196,6 @@
 
   q.tagID = questTagID
   q.tagName = tagName
-
-
-
   --q.isBreadCrumb = isBreadCrumb
   q.completionText= GetQuestLogCompletionText(questIndex)
   q.numObjectives = GetNumQuestLeaderBoards(questIndex)
@@ -290,6 +289,9 @@
   self.WatchInfo[watchIndex] = q
   self.LogInfo[questIndex] = q
   print('- logIndex =', questIndex, 'title =', title)
+  for k,v in pairs(q) do
+    print('|cFFFFFF00'..k..'|r:', v)
+  end
   return q
 end