view ObjectiveUI.lua @ 13:9455693fc290

Init - recall XML display state on reload ObjectiveFrame - quest coloring by relative level - quest coloring by daily/weekly/complete status - remember starting scroll value between reload - limit anchor points to edges for regions affected by style attributes ObjectiveInfo - AutoQuest outline definitions - Pull Quest title and tag data in addition to WatchInfo ObjectiveStyle - ensure consistent style table - hardcode certain attributes for sanity XML - ensure consistent naming conventions for heading and content elements - ensure hardcore anchors are based on edges - expansion of file structure to deal with complexities of dynamic widgets and style caching ObjectiveUI - determine primary style by block handler when restoring original style - moved framescript to 'ObjectiveWidgets' lua
author Nenue
date Sat, 02 Apr 2016 17:46:52 -0400
parents 8238cddaddb1
children ed642234f017
line wrap: on
line source
--- ${PACKAGE_NAME}
-- @file-author@
-- @project-revision@ @project-hash@
-- @file-revision@ @file-hash@
-- Created: 3/29/2016 7:07 PM
local B = select(2,...).frame
local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local print = B.print('Objectives')
local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, mod.AutoQuest, mod.Quest, mod.Cheevs
local itemButtonSize, itemButtonSpacing =  36, 1
local tremove, tremovebyval = table.remove, table.removebyval

--------------------------------------------------------------------
--- Functions responsible for:
--- - UI interactions that propagate to the BlizzardUI (sending RemoveQuestWatch() on remove quest action)
--- -
--------------------------------------------------------------------

Tracker.Select = function(self) end
Tracker.Open = function(self) end
Tracker.Remove = function(self) end
Tracker.Report = function(self)
  print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.')
end

Tracker.OnMouseUp = function(self, button)
  if button == 'LeftButton' then
    if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
      self:Link()
      self:SetStyle('TrackerBlock',  self.info.type, 'Normal')
    elseif IsModifiedClick("QUESTWATCHTOGGLE") then
      self:Remove()
    else
      self:Select()
    end
  elseif button == 'RightButton' then
    self:Open()
    self:SetStyle('TrackerBlock',  self.info.type, 'Normal')
  end
  self.initialButton = nil
  self.modChatLink = nil
  self.modQuestWatch = nil
  print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r')
end

Tracker.OnMouseDown = function(self, button)
  self:SetStyle('TrackerBlock', 'MouseDown')
  print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE"))
  print(self.info.title)
end

Quest.Select = function(self)
  SetSuperTrackedQuestID(self.info.questID)
  mod.UpdateWrapper()
end
Quest.Link = function(self)
  local questLink = GetQuestLink(block.questLogIndex);
  if ( questLink ) then
    ChatEdit_InsertLink(questLink);
  end
end
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


-----------------------------
--- CHEEVS
Cheevs.Select = function(self)
  self:SetStyle('TrackerBlock',  self.info.type, 'Normal')
end
Cheevs.Remove = function(self)
  RemoveTrackedAchievement(self.info.cheevID)
end
Cheevs.OnMouseUp = function(self, button)
  Tracker.OnMouseUp(self, button)
end
Cheevs.Link = function(self)
  local achievementLink = GetAchievementLink(self.info.cheevID);
  if ( achievementLink ) then
    ChatEdit_InsertLink(achievementLink);
  end
end

Cheevs.Open = function(self)
  if ( not AchievementFrame ) then
    AchievementFrame_LoadUI();
  end
  if ( not AchievementFrame:IsShown() ) then
    AchievementFrame_ToggleAchievementFrame();
  end
  AchievementFrame_SelectAchievement(self.info.cheevID);
end