/trunk
local dir = "d" |
if self.currentSort == sortStr .. " d" then |
dir = "a" |
--elseif self.currentSort == sortStr .. " a" then |
-- dir = "d" |
end |
sortStr = sortStr .. " " .. dir |
self:RefreshAchievementButtons(sortStr) |
end |
end |
--self.currentTab = "search" |
self.currentCat = -2 |
--self:RefreshCategoryButtons() |
self:RefreshAchievementButtons("name a") |
end |
local sMin, sMax = self.frame[scrollbar]:GetMinMaxValues() |
self[offset] = math.min(sMax, math.max(sMin, self[offset] + (arg1 * -1))) |
self.frame[scrollbar]:SetValue(self[offset]) |
--self:RefreshCriteriaButtons() |
end |
function self:ToggleFrame() |
compMin = gold .. (gold:len() > 0 and silver:len() > 0 and fSpace or "") .. |
silver .. (silver:len() > 0 and copper:len() > 0 and fSpace or "") .. copper |
if compMin == "" then compMin = format(self.moneyFormats.copper[fIndex], 0) end |
compMax = format(self.moneyFormats.gold[fIndex], compMax:sub(1, compMax:len() - 4)) |
return compMin, compMax |
button.text:SetTextColor(1,1,1) |
button.text:SetText(text) |
button:SetScript("OnClick", function() |
self:SortDisplayTable(sortStr) |
--self.currentSort = sortStr |
--self:RefreshAchievementButtons(true) |
--self:Print(self.currentSort) |
end) |
button:SetScript("OnClick", function() self:SortDisplayTable(sortStr) end) |
return button |
end |
for i=1, MAX_ACHIEVEMENTS do |
searchString = self:GetSearchString(i) |
if searchString then |
--Add all the info to the master list |
self.masterList[i] = { |
["searchString"] = searchString:lower(), |
-- ["isAchievement"] = true, |
} |
if not GetNextAchievement(i) then |
end |
end |
end |
--Setting the achievement categories |
--Go through the categories |
--[[ |
catList = GetCategoryList() |
for _, catId in next, catList do |
for i=1, GetCategoryNumAchievements(catId) do |
nextId = GetAchievementInfo(catId, i) |
while nextId do --We want the highest up achievement in the series |
if GetNextAchievement(nextId) then |
nextId = GetNextAchievement(nextId) |
else |
break --Infinite loops are bad, mkay? |
end |
end |
if not self.seriesList[catId] then |
self.seriesList[catId] = {} |
end |
tempTable[nextId] = true --Use a temporary table to prevent duplicates from showing up in the final table |
--self:SetChainCategory(id, catId) |
end |
for id,_ in next, tempTable do |
tinsert(self.seriesList[catId], id) |
end |
tempTable = {} |
end |
]]-- |
--Set the statitistics to not achievements |
--[[ |
catList = GetStatisticsCategoryList() |
for _, catId in next, catList do |
for i=1, GetCategoryNumAchievements(catId) do |
id = GetAchievementInfo(catId, i) |
self.masterList[id].isAchievement = false |
end |
end |
]]-- |
--Go through and add all the Feat of Strength achievements |
--[[ |
for id, v in next, self.masterList do |
_,_,points, completed = GetAchievementInfo(id) |
if (v.isAchievement) and (points == 0) and (not completed) then --Achievement + and no points = Feat of Strength |
tinsert(self.seriesList[81], id) --Completed ones are already in there. |
end |
end |
]]-- |
--[[ |
--Now we create the achievement list by category |
--Only adding the last achievement in each series |
for id, v in next, self.masterList do |
nextId = id |
while nextId do |
if self.masterList[nextId].next then --if there is a next in the series |
nextId = self.masterList[nextId].next --move to it and try again |
else |
break --Infinite loops are bad, mkay? |
end |
end |
if not self.seriesList[v.category] then |
self.seriesList[v.category] = {} |
end |
tinsert(self.seriesList[v.category], nextId) |
v.category = nil --We dont need categories in the masterList anymore |
end |
]]-- |
--so now self.seriesList can be called by category and you get all the top level achievements in it |
--then through calling self.masterList[id].previous, we can get the children achievement |
--these lists work for both achievements and statistics, though statistics are populated and displayed differently |
end |
function self:PopulateCategories(tab) |
if id == nil then id = self.currentAch end |
if not self.masterList[id] then return end |
--self.frame:Show() |
self.currentAch = id |
--Update the category list |
if self.isAchList[GetAchievementCategory(id)] == false then |
--Statistic |
--self.frame.display:Hide() |
self.frame.display.icon:Hide() |
self.frame.display.icon:SetWidth(1) |
self.frame.display.shield:Hide() |
self.frame.display.criteriaButtons[a].icon:Hide() |
end |
--self.frame.display.criteriaButtons[1]:Show() |
self.frame.display.reward:SetText("|cffffffff" .. self:FormatString(GetStatistic(id))) |
if self.isComparing then |
--self.frame.display.criteriaButtons[2]:Show() |
self.frame.display.compareDate:Show() |
self.frame.display.compareDate:SetText("|cffffffff" .. self.comparisonUnitName .. ": " .. self:FormatString(GetComparisonStatistic(id))) |
self.frame.display.reward:SetText("|cffffffff" .. UnitName("player") .. ": " .. self:FormatString(GetStatistic(id))) |
function self:RefreshCriteriaButtons() |
if not self.frame:IsShown() then return end |
local criteriaName, criteriaType, criteriaCompleted, criteriaQuantity, criteriaReqQuantity,_ ,criteriaFlags, criteriaAssetID, icon, quantityStr |
--local c = self.masterList[self.currentAch] or {} |
--c = c.criteria or {} |
local buttonNum = 1 |
local str = "" |
local offset = 1 |
str = str .. criteriaName -- .. "= " .. criteriaQuantity .. " (" .. criteriaAssetID .. ")" |
if self.isComparing and not compDone and UASVPC.statCriteria then |
--compDone = GetAchievementComparisonInfo(self.currentAch,1) |
compCriteriaText,comparisonComplete = GetCriteriaComparisonInfo(self.currentAch, a, 1) |
self.frame.display.criteriaButtons[buttonNum].comparison:Show() |
offset = 1 |
self.frame.display.criteriaButtons[buttonNum]:Hide() |
str = "" |
--self.frame.display.criteriaButtons[buttonNum]:Hide() |
self.frame.display.bar:Show() |
self.frame.display.bar:SetMinMaxValues(0,criteriaReqQuantity) |
if self.isComparing and compCriteriaText then |
self.frame.display.compareBar:Show() |
self.frame.display.compareBar:SetMinMaxValues(0, criteriaReqQuantity) |
if compDone then --This should never trigger, I think. |
self.frame.display.compareBar:SetValue(criteriaReqQuantity) |
self.frame.display.compareBar.text:SetText(criteriaReqQuantity .. " / " .. criteriaReqQuantity) |
else |
local _,_,min, max = string.find(compCriteriaText, "(%d+)/(%d+)") |
self.frame.display.compareBar:SetValue(min) |
--If theres money textures in the string, we're gonna need to format it. |
if quantityStr:find("|T") then |
min, criteriaReqQuantity = self:FormatMoney(min, criteriaReqQuantity) |
end |
self.frame.display.compareBar.text:SetText(min .. " / " .. criteriaReqQuantity) |
self.frame.display.compareBar.nameText:SetText(self.comparisonUnitName .. ":") |
local _,_,min, max = string.find(compCriteriaText, "(%d+)/(%d+)") |
self.frame.display.compareBar:SetValue(min) |
--If theres money textures in the string, we're gonna need to format it. |
if quantityStr:find("|T") then |
min, criteriaReqQuantity = self:FormatMoney(min, criteriaReqQuantity) |
end |
self.frame.display.compareBar.text:SetText(min .. " / " .. criteriaReqQuantity) |
self.frame.display.compareBar.nameText:SetText(self.comparisonUnitName .. ":") |
end |
--If theres a progress bar, theres no other achievements |
end |
self.tracker = CreateFrame("Frame", "UrbanAchieverTrackerFrame", UIParent) |
--self.tracker:EnableMouse(true) |
self.tracker:SetMovable(true) |
self.tracker:SetClampedToScreen(true) |
self.tracker:SetWidth(200) |
self.tracker:SetHeight(200) |
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("Button", "UrbanAchieverTrackerFrame", self.tracker) |
self.tracker.header:SetBackdrop({ |
frame.criteria:SetWidth(200) |
frame.criteria:SetJustifyH("LEFT") |
frame.criteria:SetJustifyV("TOP") |
--frame.criteria:SetPoint("BOTTOMRIGHT") |
frame.bar = CreateFrame("StatusBar", "$parentBar", frame, "AchievementProgressBarTemplate") |
frame.bar.text:SetFontObject("GameFontHighlight") |
height = height + 20 |
else |
str = str .. " - " .. cName .. "\n" |
--height = height + 14 |
end |
end |
end |
local iconBody = panel:CreateFontString(nil, "ARTWORK", "GameFontNormal") |
iconBody:SetJustifyH("LEFT") |
iconBody:SetWidth(380) |
iconBody:SetWidth(370) |
iconBody:SetTextColor(1,1,1) |
iconBody:SetText("- There's a reward for completing this achievement.\n" .. |
"- This achievement is currently being tracked.\n" .. |
## Title: Urban Achiever |
## Author: Syzgyn |
## Notes: Improved Achievement Frame |
## Version 0.7.1.wowi:revision |
## Version 0.8.wowi:revision |
## SavedVariables: UASV |
## SavedVariablesPerCharacter: UASVPC |