/trunk
self.seriesList = {} |
self.expandList = {} |
self.isAchList = {} --Used to see if id's are achievements or statistics |
self.currentTab = "achievements" |
self.currentCat = -1 |
self.currentAch = 0 |
end, |
["points d"] = function(a, b) |
if self.masterList[a].isAchievement then |
if self.isAchList[GetAchievementCategory(a)] then |
_,_,a = GetAchievementInfo(a) |
else |
a = GetStatistic(a) |
end |
if self.masterList[b].isAchievement then |
if self.isAchList[GetAchievementCategory(b)] then |
_,_,b = GetAchievementInfo(b) |
else |
b = GetStatistic(b) |
end |
return a < b |
return tonumber(a) < tonumber(b) |
end, |
["points a"] = function(a, b) |
if self.masterList[a].isAchievement then |
if self.isAchList[GetAchievementCategory(a)] then |
_,_,a = GetAchievementInfo(a) |
else |
a = GetStatistic(a) |
end |
if self.masterList[b].isAchievement then |
if self.isAchList[GetAchievementCategory(b)] then |
_,_,b = GetAchievementInfo(b) |
else |
b = GetStatistic(b) |
end |
return a > b |
return tonumber(a) > tonumber(b) |
end, |
["completed d"] = function(a, b) |
["compare d"] = function(a, b) |
if not self.isComparing then return false end |
--They're both achievements, go by date |
if self.masterList[a].isAchievement and self.masterList[b].isAchievement then |
if self.isAchList[GetAchievementCategory(a)] and self.isAchList[GetAchievementCategory(b)] then |
local _,a1,a2,a3 = GetAchievementComparisonInfo(a,1) |
a1, a2, a3 = a1 or 0, a2 or 0, a3 or 0 |
local _,b1,b2,b3 = GetAchievementComparisonInfo(b,1) |
if a1 ~= b1 then return a1 < b1 end --Then Months |
if a2 ~= b2 then return a2 < b2 end --Finally Days |
return false --They're exactly the same, return false |
end |
if self.masterList[a].isAchievement then |
local _,a1, a2, a3 = GetAchievementComparisonInfo(a,1) |
a = (a1 or "") .. "/" .. (a2 or "") .. "/" .. (a3 or "") |
else |
a = GetStatistic(a) |
if self.isAchList[GetAchievementCategory(a)] then |
local _,a1, a2, a3 = GetAchievementComparisonInfo(a,1) |
a = (a1 or "") .. "/" .. (a2 or "") .. "/" .. (a3 or "") |
else |
a = GetStatistic(a) |
end |
if self.isAchList[GetAchievementCategory(b)] then |
local _,b1, b2, b3 = GetAchievementComparisonInfo(b,1) |
b = (b1 or "") .. "/" .. (b2 or "") .. "/" .. (b3 or "") |
else |
b = GetStatistic(b) |
end |
return a < b |
end |
if self.masterList[b].isAchievement then |
local _,b1, b2, b3 = GetAchievementComparisonInfo(b,1) |
b = (b1 or "") .. "/" .. (b2 or "") .. "/" .. (b3 or "") |
else |
b = GetStatistic(b) |
end |
return a < b |
end, |
["compare a"] = function(a, b) |
if not self.isComparing then return false end |
if self.masterList[a].isAchievement and self.masterList[b].isAchievement then |
if self.isAchList[GetAchievementCategory(a)] and self.isAchList[GetAchievementCategory(b)] then |
local _,a1,a2,a3 = GetAchievementComparisonInfo(a,1) |
a1, a2, a3 = a1 or 0, a2 or 0, a3 or 0 |
local _,b1,b2,b3 = GetAchievementComparisonInfo(b,1) |
return false --They're exactly the same, return false |
end |
if self.masterList[a].isAchievement then |
if self.isAchList[GetAchievementCategory(a)] then |
local _,a1, a2, a3 = GetAchievementComparisonInfo(a,1) |
a = (a1 or "") .. "/" .. (a2 or "") .. "/" .. (a3 or "") |
else |
a = GetStatistic(a) |
end |
if self.masterList[b].isAchievement then |
if self.isAchList[GetAchievementCategory(b)] then |
local _,b1, b2, b3 = GetAchievementComparisonInfo(b,1) |
b = (b1 or "") .. "/" .. (b2 or "") .. "/" .. (b3 or "") |
else |
end |
} |
SLASH_URBANACHIEVER1 = "/urbanachiever" |
SLASH_URBANACHIEVER2 = "/ua" |
SlashCmdList["URBANACHIEVER"] = function(msg) |
if msg == "tracker" then |
self.tracker.header:Show() |
else |
self:ToggleFrame() |
end |
end |
UASVPC = { |
["tracker"] = { |
["x"] = 955, |
["y"] = 815, |
} |
} |
------------------------------------------------------------- |
--Startup Stuff |
------------------------------------------------------------- |
if id == nil then id = self.currentAch end |
if not self.masterList[id] then return end |
if self.masterList[id].isAchievement then |
local category = GetAchievementCategory(id) |
if self.isAchList[category] then |
self.currentTab = "achievements" |
else |
self.currentTab = "statistics" |
end |
local category = GetAchievementCategory(self.currentAch) |
self.currentCat = category |
local _, catParent = GetCategoryInfo(category) |
if catParent ~= -1 then --It's a child category, expand the parent |
--Add all the info to the master list |
self.masterList[i] = { |
["searchString"] = searchString:lower(), |
["isAchievement"] = true, |
-- ["isAchievement"] = true, |
} |
if not GetNextAchievement(i) then |
end |
]]-- |
--Set the statitistics to not achievements |
--[[ |
catList = GetStatisticsCategoryList() |
for _, catId in next, catList do |
for i=1, GetCategoryNumAchievements(catId) do |
self.masterList[id].isAchievement = false |
end |
end |
]]-- |
--Go through and add all the Feat of Strength achievements |
--[[ |
function self:PopulateCategories(tab) |
local list, name, parent |
local isAch = false |
--Populate the list from API |
if tab == "achievements" then |
list = GetCategoryList() |
isAch = true |
else |
list = GetStatisticsCategoryList() |
end |
--Add top level Categories |
for _,id in next, list do |
name, parent = GetCategoryInfo(id) |
self.isAchList[id] = isAch |
if parent == -1 then |
tinsert(self.categories[tab], { |
["id"] = id, |
self.frame.achButtons[button].background:SetTexture("Interface\\AchievementFrame\\UI-Achievement-Parchment-Horizontal") |
self.frame.achButtons[button].comparison.background:SetTexture("Interface\\AchievementFrame\\UI-Achievement-Parchment-Horizontal") |
if self.masterList[id].isAchievement == false then |
if self.isAchList[GetAchievementCategory(id)] == false then |
--Its a statistic, no date, no points |
self.frame.achButtons[button].stat:SetText(GetStatistic(id)) |
self.frame.achButtons[button].points:SetText("") |
self.frame.display.desc:SetText(description) |
self.frame.display.compareDate:Hide() |
if self.masterList[id].isAchievement == false then |
if self.isAchList[GetAchievementCategory(id)] == false then |
--Statistic |
--self.frame.display:Hide() |
self.frame.display.icon:Hide() |
self.tracker:SetMovable(true) |
self.tracker:SetWidth(200) |
self.tracker:SetHeight(200) |
self.tracker:SetPoint("TOPRIGHT", -210, -210) |
self.tracker:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", UASVPC.tracker.x, UASVPC.tracker.y) |
--local background = self.tracker:CreateTexture() |
--background:SetTexture(0,0,0,0.25) |
--background:SetAllPoints(self.tracker) |
--Create Tracker Header/Drag Frame |
self.tracker.header = CreateFrame("Frame", "UrbanAchieverTrackerFrame", self.tracker) |
self.tracker.header = CreateFrame("Button", "UrbanAchieverTrackerFrame", self.tracker) |
self.tracker.header:SetBackdrop({ |
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", |
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, |
if ( arg1 == "RightButton" ) then |
self.tracker.header:Hide() |
end |
UASVPC.tracker.x = self.tracker:GetLeft() |
UASVPC.tracker.y = self.tracker:GetTop() |
end) |
self.tracker.header:SetScript("OnEnter", function() |
GameTooltip:SetOwner(self.tracker.header, "ANCHOR_TOPLEFT") |
GameTooltip:SetText("|cff00ff00Drag|r to move") |
GameTooltip:AddLine("|cff00ff00Right-click|r to hide") |
GameTooltip:Show() |
end) |
self.tracker.header:SetScript("OnLeave", function() |
GameTooltip:Hide() |
end) |
local text = self.tracker.header:CreateFontString(nil, "OVERLAY", "GameFontNormal") |
text:SetPoint("CENTER") |
text:SetText("UrbanAchiever Tracker") |
self.tracker.header:Hide() |
self.tracker.achievements = {} |
--Now the criteria |
local str = "" |
if self.masterList[id].isAchievement then |
if self.isAchList[GetAchievementCategory(id)] then |
for i=1, GetAchievementNumCriteria(id) do |
cName, _,cCompleted, cQuantity, cReqQuantity, _,cFlags, _,cQuantityStr = GetAchievementCriteriaInfo(id, i) |