view ObjectiveTracker/Achievements.lua @ 28:c33c17dd97e7

file renames
author Nenue
date Wed, 13 Apr 2016 20:19:37 -0400
parents
children adcd7c328d07
line wrap: on
line source
--- ${PACKAGE_NAME}
-- @file-author@
-- @project-revision@ @project-hash@
-- @file-revision@ @file-hash@
-- Created: 4/13/2016 7:48 PM
local B = select(2,...).frame
local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText
local Cheevs = T.Cheevs
local format = format
local print = B.print('Tracker')
local lprint = B.print('Line')
local iprint = B.print('Info')



Cheevs.UpdateLine = function(handler, block, line, data)
  local print = B.print('CheevsLine')
  line.progress = 0
  print('  ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text)
  if data.flags then
    if band(data.flags, 0x00000001) > 0 then
      line.format = "%d/%d"
      line.widget = T.SetWidget(line, data, 'ProgressBar', data.criteriaID)
      line.height = line.widget.height
    elseif band(data.flags, 0x00000002) then
      line.widget = nil
    else
      line.widget = nil
      line.displayColor = 'FFFFFF'
      line.displayText = line.text

    end
  else

    line.displayText = data.text
  end
  print('line.type =', data.type)
  print('  ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID)
end

Cheevs.Select = function(self)
  --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);
  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