self:RegisterEvent("INSPECT_ACHIEVEMENT_READY", function() |
self:ComparisonUpdate() |
self:RefreshAchievementButtons(false) |
self.frame:Show() |
end) |
|
--Use a different button so InspectAchievements() doesnt get called. Easier hooking. |
UnitPopupButtons["UA_ACHIEVEMENTS"] = { text = COMPARE_ACHIEVEMENTS, dist = 1 }; |
--Replace their Acheivement Button with mine. |
for j = 1, #menuTypes do |
local t = menuTypes[j] |
for i = 1, #UnitPopupMenus[t] do |
if UnitPopupMenus[t][i] == "ACHIEVEMENTS" then |
UnitPopupMenus[t][i] = "UA_ACHIEVEMENTS" |
break |
end |
end |
end |
|
self:SecureHook("UnitPopup_ShowMenu") |
end |
|
function self:OnDisable() |
self:UnregisterEvent("ADDON_LOADED") |
self:UnregisterEvent("ACHIEVEMENT_EARNED") |
self:UnregisterEvent("CRITERIA_UPDATE") |
|
--Go back to the original button. |
for j = 1, #menuTypes do |
local t = menuTypes[j] |
for i = 1, #UnitPopupMenus[t] do |
if UnitPopupMenus[t][i] == "UA_ACHIEVEMENTS" then |
UnitPopupMenus[t][i] = "ACHIEVEMENTS" |
break |
end |
end |
end |
end |
|
------------------------------------------------------------- |
--Hooking Stuff |
------------------------------------------------------------- |
function self:UnitPopup_ShowMenu(dropdownMenu, which, unit, name, userData, ...) |
for i=1, UIDROPDOWNMENU_MAXBUTTONS do |
button = _G["DropDownList"..UIDROPDOWNMENU_MENU_LEVEL.."Button"..i]; |
if button.value == "UA_ACHIEVEMENTS" then |
button.func = function() |
self:SetComparisonUnit(unit) |
end |
end |
end |
end |
------------------------------------------------------------- |
--Utilities |
------------------------------------------------------------- |
function self:InsertIntoChat(id) |