/trunk
## Notes-frFR: Fenêtre de Hauts Faits améliorée |
## Notes-zhTW:æ¹é²æå°±æ¡æ¶ |
## Notes-zhCN:æ¹è¿æå°±æ¡æ¶ |
## Version 13.5.wowi:revision |
## Version 14.0.wowi:revision |
## OptionalDeps: Blizzard_AchievementUI |
## SavedVariables: UASV |
## SavedVariablesPerCharacter: UASVPC |
--bindings |
BINDING_HEADER_URBANACHIEVER = "Urban Achiever" |
local MAX_ACHIEVEMENTS = 5986 --last 5985 |
local MAX_ACHIEVEMENTS = 6186 --last 6185 |
local menuTypes = {"PLAYER", "PARTY", "RAID_PLAYER"} |
local playerFaction = UnitFactionGroup("player") == "Alliance" and 1 or 2 |
self.isAchList = {} --Used to see if id's are achievements or statistics or guild |
self.isGuildList = {} --Used to see if id's are achievements or statistics or guild |
self.achieveList = {} |
self.currentTab = "achievements" |
self.currentCat = -1 |
self.currentAch = 0 |
self:SetupFrames() |
UrbanAchiever:CreateOptions() |
self:PopulateAchieveList() |
end |
function self:PopulateAchieveList() |
--self.achieveList = {} |
for id = 1, MAX_ACHIEVEMENTS do |
category = GetAchievementCategory(id) |
if category and category ~= nil then |
_, _, _, completed = GetAchievementInfo(id) |
if(type(self.achieveList[category]) == "table") then |
table.insert(self.achieveList[category], id, completed) |
else |
self.achieveList[category] = {[id] = completed} |
end |
end |
end |
end |
function self:OnEnable() |
------------------------------------------------------------- |
function self:InsertIntoChat(id) |
--Taken from Historian, thanks Ixchael! |
if (ChatFrame1EditBox == nil) then |
if (GetCurrentKeyBoardFocus() == nil) then |
return; |
end; |
if not ChatFrame1EditBox:IsVisible() then |
ChatFrame1EditBox:Show(); |
if not GetCurrentKeyBoardFocus():IsVisible() then |
GetCurrentKeyBoardFocus():Show(); |
end; |
ChatFrame1EditBox:Insert(GetAchievementLink(id)); |
GetCurrentKeyBoardFocus():Insert(GetAchievementLink(id)); |
end |
function self:SortDisplayTable(sortStr) |
button:SetScript("OnClick", function() |
local id = button:GetID() |
if self.masterList[id] then |
if ChatFrame1EditBox:HasFocus() and IsModifiedClick("CHATLINK") then |
SetFocusedAchievement(id) |
if GetCurrentKeyBoardFocus() ~= nil and IsModifiedClick("CHATLINK") then |
self:InsertIntoChat(id) |
elseif IsShiftKeyDown() then |
if IsTrackedAchievement(id) 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 |
--[[self.frame.achButtons[buttonNum]:SetWidth(300) |
self.frame.achButtons[buttonNum].name:SetText(UARecentStat .. ":") |
self.frame.achButtons[buttonNum].completed:SetText("") |
self.frame.achButtons[buttonNum].compare:SetText("") |
self.frame.achButtons[buttonNum].points:SetText("") |
self.frame.achButtons[buttonNum].stat:SetText("") |
self.frame.achButtons[buttonNum]:SetID(-1) |
self.frame.achButtons[buttonNum].expand:Hide() |
self.frame.achButtons[buttonNum].comparison:Hide() |
self.frame.achButtons[buttonNum].background:SetTexture("Interface\\AchievementFrame\\UI-Achievement-Parchment-Horizontal-Desaturated") |
self.frame.achButtons[buttonNum].comparison.background:SetTexture("Interface\\AchievementFrame\\UI-Achievement-Parchment-Horizontal-Desaturated") |
self.frame.achButtons[buttonNum].offset:SetWidth(1) |
self.frame.achButtons[buttonNum]:UnlockHighlight() |
if self.isComparing then |
self.frame.achButtons[buttonNum]:SetWidth(370) |
self.frame.achButtons[buttonNum].comparison:Show() |
end |
self.frame.achButtons[buttonNum]:Show() |
buttonNum = buttonNum + 1 |
for k,id in next, {GetLatestUpdatedStats()} do |
statId = GetAchievementInfoFromCriteria(id) |
self:SetAchievementButton(buttonNum, statId) |
buttonNum = buttonNum + 1 |
end]] |
--new in sumarry |
local numTotal, numDone |
local catName |
local numItems2, numCompleted2 |
for i,id in ipairs(GetCategoryList()) do |
numTotal = 0 |
numDone = 0 |
catName, parentCatID = GetCategoryInfo(id) |
if parentCatID == -1 then |
numTotal, numDone = self:GetRealCategoryNumAchievements(id) |
for i2,id2 in ipairs(GetCategoryList()) do |
_, parentCatID2 = GetCategoryInfo(id2) |
if parentCatID2 == id then |
numItems, numCompleted = GetCategoryNumAchievements(id) |
numItems, numCompleted = self:GetRealCategoryNumAchievements(id) |
numTotal = (numTotal + numItems) |
numDone = (numDone + numCompleted) |
end |
end |
numItems2, numCompleted2 = GetCategoryNumAchievements(id) |
numTotal = (numTotal + numItems2) |
numDone = (numDone + numCompleted2) |
self.frame.category[id]:Hide() |
self.frame.category[id]:SetMinMaxValues(0, numTotal) |
self.frame.category[id]:SetValue(numDone) |
end |
end |
function self:GetRealCategoryNumAchievements(id) |
local numItems, numCompleted = 0, 0 |
if self.achieveList[id] ~= nil then |
for k,v in pairs(self.achieveList[id]) do |
if(id == 92)then |
_, name = GetAchievementInfo(k) |
print(name) |
end |
numItems = numItems+1 |
if v then |
numCompleted = numCompleted+1 |
end |
end |
end |
return numItems, numCompleted |
end |
function self:RefreshSummaryBar() |
local total, completed |
local name |