/trunk
## Interface: 30100 |
## Interface: 30200 |
## Title: Urban Achiever |
## Author: Syzgyn |
## Notes: Improved Achievement Frame |
## Version 0.9.6.wowi:revision |
## Version 0.9.7.wowi:revision |
## OptionalDeps: Blizzard_AchievementUI |
## SavedVariables: UASV |
## SavedVariablesPerCharacter: UASVPC |
local DBG = false |
UrbanAchiever = LibStub("AceAddon-3.0"):NewAddon("UrbanAchiever", "AceConsole-3.0", "AceEvent-3.0", "AceHook-3.0") |
local self = UrbanAchiever |
if select(4, GetBuildInfo()) < 30100 then print("This version of Urban Achiever is for 3.1 Only.") return end |
------------------------------------------------------------- |
--Locals |
------------------------------------------------------------- |
BINDING_HEADER_URBANACHIEVER = "Urban Achiever" |
BINDING_NAME_URBANACHIEVER_TOGGLE = "Toggle Achievement Frame" |
local MAX_ACHIEVEMENTS = 3400 |
local MAX_ACHIEVEMENTS = 4200 |
local menuTypes = {"PLAYER", "PARTY", "RAID_PLAYER"} |
local playerFaction = UnitFactionGroup("player") == "Alliance" and 1 or 2 |
["trackTimed"] = true, |
} |
------------------------------------------------------------- |
--Local functions |
------------------------------------------------------------- |
local function debug(...) |
if DBG then print(...) end |
return |
end |
local GANC = GetAchievementNumCriteria |
local function GetAchievementNumCriteria(...) |
return GANC(...) or 0 |
end |
------------------------------------------------------------- |
--Startup Stuff |
------------------------------------------------------------- |
function self:Initialize() |
function self:Initialize(event, name) |
self:UnregisterEvent("ADDON_LOADED") |
debug("Initializing") |
self:PopulateMasterList() |
self:PopulateCategories("achievements") |
UrbanAchiever:CreateOptions() |
self:UnregisterEvent("ADDON_LOADED") |
end |
function self:OnEnable() |
--I loooooove that this event gets called for any achievement, not just when you're tracking it. |
self:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE", function(event, ...) |
local id, criteriaID, elapsed, duration = ... |
--print("TAU", id, criteriaID, elapsed, duration) |
if not elapsed or not duration or not UASVPC.trackTimed then return end |
if elapsed < duration then |
AddTrackedAchievement(id) |
CloseDropDownMenus() |
if ( this.type == "QUEST" ) then |
if IsModifiedClick("ALT") then |
RemoveQuestWatch(this.index) |
RemoveQuestWatch(GetQuestIndexForWatch(this.index)) |
WatchFrame_Update() |
else |
QuestLog_OpenToQuestIndex(this.index) |
QuestLog_OpenToQuestIndex(GetQuestIndexForWatch(this.index)) |
end |
elseif ( this.type == "ACHIEVEMENT" ) then |
if IsModifiedClick("ALT") then |
end |
function self:PopulateMasterList() |
debug("PML") |
local id, name, points, completed, month, day, year, description, icon, reward, searchString |
local criteriaName |
local catList, numAchievements, nextId |
buttonNum = buttonNum + 1 |
end |
end |
self.frame.criteriaScroll:SetMinMaxValues(0,math.max(GetAchievementNumCriteria(self.currentAch)-#self.frame.display.criteriaButtons, 0)) |
if GetAchievementNumCriteria(self.currentAch)-#self.frame.display.criteriaButtons > 0 then |