local MakeMovable = PhanxMod.MakeMovable |
local noop = function() end |
|
local mods = { |
--------------------------------------------------------------------- |
-- Move archaeology digsite progress bar |
--------------------------------------------------------------------- |
Blizzard_ArchaeologyUI = function() |
MakeMovable(ArcheologyDigsiteProgressBar) |
end, |
--------------------------------------------------------------------- |
-- Hide the 3D model controls in the character frame, etc. |
--------------------------------------------------------------------- |
Blizzard_AuctionUI = function() |
Hide(SideDressUpModelControlFrame) |
end, |
Blizzard_InspectUI = function() |
Hide(InspectModelFrameControlFrame) |
end, |
--------------------------------------------------------------------- |
-- Lower objective tracker strata |
--------------------------------------------------------------------- |
Blizzard_ObjectiveTracker = function() |
ObjectiveTrackerFrame:SetFrameStrata("BACKGROUND") |
end, |
--------------------------------------------------------------------- |
-- Fix long reagent count text in tradeskill UI |
--------------------------------------------------------------------- |
Blizzard_TradeSkillUI = function() |
hooksecurefunc("TradeSkillFrame_SetSelection", function(id) |
for i = 1, GetTradeSkillNumReagents(id) do |
local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i) |
if reagentName and reagentTexture then |
local button = _G["TradeSkillReagent"..i] |
local count = _G["TradeSkillReagent"..i.."Count"] |
count:SetFormattedText("%d/%d", playerReagentCount, reagentCount) |
if floor(count:GetStringWidth()) > floor(button.icon:GetWidth() + .5) then |
count:SetFormattedText("%d\n/%d", playerReagentCount, reagentCount) |
end |
end |
local mods = {} |
|
local function DoMods(addon) |
for name, func in pairs(mods) do |
if IsAddOnLoaded(name) then |
--print("PhanxMod =>", name) |
func() |
mods[name] = nil |
else |
local _, _, _, loadable, reason = GetAddOnInfo(name) |
if not loadable and reason ~= "DEMAND_LOADED" then |
--print("PhanxMod =>", name, reason) |
mods[name] = nil |
end |
end) |
end, |
--------------------------------------------------------------------- |
-- Shift-click to learn all available skills at trainers |
--------------------------------------------------------------------- |
Blizzard_TrainerUI = function() |
local _, _, _, enabled, loadable, reason = GetAddOnInfo("LearningAid") |
if enabled and (loadable or IsAddOnLoaded("LearningAid")) then |
if LearningAid_TrainAllButton then |
LearningAid_TrainAllButton:SetScript("OnClick", function() LearningAid:BuyAllTrainerServices(LearningAid.CONFIRM_TRAINER_BUY_ALL) end) |
else |
local func = LearningAid.CreateTrainAllButton |
function LearningAid:CreateTrainAllButton() |
local button = func(LearningAid) |
button:SetScript("OnClick", function() self:BuyAllTrainerServices(LearningAid.CONFIRM_TRAINER_BUY_ALL) end) |
LearningAid.CreateTrainAllButton = func |
return button |
end |
end |
else |
local function GetTrainAllCost(ACUTALLY_BUY_ALL_SKILLS) |
local totalCost = 0 |
local playerLevel = UnitLevel("player") |
local _, hasProfession = GetProfessions() |
end |
end |
if next(mods) then |
PhanxMod:RegisterEvent("ADDON_LOADED", DoMods) |
else |
return PhanxMod.UNREGISTER |
end |
end |
|
local queue = ACUTALLY_BUY_ALL_SKILLS and {} or nil |
PhanxMod:RegisterEvent("PLAYER_LOGIN", DoMods) |
|
for i = GetNumTrainerServices(), 1, -1 do |
local serviceName, serviceSubText, serviceType, texture, reqLevel, topServiceLine = GetTrainerServiceInfo(i) |
local moneyCost, isProfession = GetTrainerServiceCost(i) |
if serviceType == "available" and not isProfession and playerLevel >= reqLevel then |
totalCost = totalCost + moneyCost |
if queue then tinsert(queue, i) end |
end |
end |
|
if queue and totalCost > 0 and totalCost < GetMoney() then |
for i = 1, #queue do |
BuyTrainerService(queue[i]) |
end |
--------------------------------------------------------------------- |
-- Move archaeology digsite progress bar |
--------------------------------------------------------------------- |
|
mods["Blizzard_ArchaeologyUI"] = function() |
MakeMovable(ArcheologyDigsiteProgressBar) |
end |
|
--------------------------------------------------------------------- |
-- Hide the 3D model controls in the character frame, etc. |
--------------------------------------------------------------------- |
|
mods["Blizzard_AuctionUI"] = function() |
Hide(SideDressUpModelControlFrame) |
end |
|
mods["Blizzard_InspectUI"] = function() |
Hide(InspectModelFrameControlFrame) |
end |
|
--------------------------------------------------------------------- |
-- Lower objective tracker strata |
--------------------------------------------------------------------- |
|
mods["Blizzard_ObjectiveTracker"] = function() |
ObjectiveTrackerFrame:SetFrameStrata("BACKGROUND") |
end |
|
--------------------------------------------------------------------- |
-- Fix long reagent count text in tradeskill UI |
--------------------------------------------------------------------- |
|
mods["Blizzard_TradeSkillUI"] = function() |
hooksecurefunc("TradeSkillFrame_SetSelection", function(id) |
for i = 1, GetTradeSkillNumReagents(id) do |
local reagentName, reagentTexture, reagentCount, playerReagentCount = GetTradeSkillReagentInfo(id, i) |
if reagentName and reagentTexture then |
local button = _G["TradeSkillReagent"..i] |
local count = _G["TradeSkillReagent"..i.."Count"] |
count:SetFormattedText("%d/%d", playerReagentCount, reagentCount) |
if floor(count:GetStringWidth()) > floor(button.Icon:GetWidth() + .5) then |
count:SetFormattedText("%d\n/%d", playerReagentCount, reagentCount) |
end |
end |
end |
end) |
end |
|
return totalCost |
--------------------------------------------------------------------- |
-- Shift-click to learn all available skills at trainers |
--------------------------------------------------------------------- |
|
mods["Blizzard_TrainerUI"] = function() |
local _, _, _, enabled, loadable, reason = GetAddOnInfo("LearningAid") |
if enabled and (loadable or IsAddOnLoaded("LearningAid")) then |
if LearningAid_TrainAllButton then |
LearningAid_TrainAllButton:SetScript("OnClick", function() LearningAid:BuyAllTrainerServices(LearningAid.CONFIRM_TRAINER_BUY_ALL) end) |
else |
local func = LearningAid.CreateTrainAllButton |
function LearningAid:CreateTrainAllButton() |
local button = func(LearningAid) |
button:SetScript("OnClick", function() self:BuyAllTrainerServices(LearningAid.CONFIRM_TRAINER_BUY_ALL) end) |
LearningAid.CreateTrainAllButton = func |
return button |
end |
end |
else |
local function GetTrainAllCost(ACUTALLY_BUY_ALL_SKILLS) |
local totalCost = 0 |
local playerLevel = UnitLevel("player") |
local _, hasProfession = GetProfessions() |
|
local TRAIN_ALL = "Train All" |
local TRAIN_ALL_REPORT = "Learned all skills for %s." |
if GetLocale() == "deDE" then |
TRAIN_ALL = "Alle erlernen" |
TRAIN_ALL_REPORT = "Alles hat für %s gelernt werden." |
elseif GetLocale():match("es") then |
TRAIN_ALL = "Aprender todos" |
TRAIN_ALL_REPORT = "Todos se aprendió para %s." |
local queue = ACUTALLY_BUY_ALL_SKILLS and {} or nil |
|
for i = GetNumTrainerServices(), 1, -1 do |
local serviceName, serviceSubText, serviceType, texture, reqLevel, topServiceLine = GetTrainerServiceInfo(i) |
local moneyCost, isProfession = GetTrainerServiceCost(i) |
if serviceType == "available" and not isProfession and playerLevel >= reqLevel then |
totalCost = totalCost + moneyCost |
if queue then tinsert(queue, i) end |
end |
end |
|
local button = CreateFrame("Button", "ClassTrainerTrainAllButton", ClassTrainerTrainButton:GetParent(), "MagicButtonTemplate") |
button:SetPoint("RIGHT", ClassTrainerTrainButton, "LEFT") |
button:SetWidth(100) |
button:SetText(TRAIN_ALL) |
button:SetScript("OnShow", function(self) |
self:SetEnabled(GetTrainAllCost() > 0) |
end) |
button:SetScript("OnEnter", function(self) |
local totalCost = GetTrainAllCost() |
if totalCost > 0 then |
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT") |
GameTooltip:AddLine(TRAIN_ALL) |
GameTooltip:AddLine(GetCoinTextureString(totalCost)) |
GameTooltip:Show() |
if queue and totalCost > 0 and totalCost < GetMoney() then |
for i = 1, #queue do |
BuyTrainerService(queue[i]) |
end |
end) |
button:SetScript("OnLeave", GameTooltip_Hide) |
button:SetScript("OnClick", function(self) |
local totalCost = GetTrainAllCost(true) |
if totalCost > 0 then |
print(format(TRAIN_ALL_REPORT, GetCoinTextureString(totalCost))) |
end |
end) |
end |
end, |
--------------------------------------------------------------------- |
-- Ampere |
-- Add slash command to open Ampere |
--------------------------------------------------------------------- |
--[[ |
Ampere = function() |
SLASH_AMPERE1 = "/ampere" |
SLASH_AMPERE2 = "/amp" |
end |
|
SlashCmdList["AMPERE"] = function() |
InterfaceOptionsFrame_OpenToCategory("Ampere") |
return totalCost |
end |
end, |
]] |
--------------------------------------------------------------------- |
-- Bagnon |
-- Move frames |
--------------------------------------------------------------------- |
Bagnon = function() |
local function MoveFrame(frame) |
--print("Bagnon: OnShow:", frame:GetName()) |
local bg = PhanxMod.BACKDROP |
frame:SetBackdrop({ bgFile = bg.texture, tile = true, tileSize = bg.size }) |
frame:GetSettings():SetColor(bg.color.r, bg.color.g, bg.color.b, bg.color.a) |
frame:SetBackdropColor(bg.color.r, bg.color.g, bg.color.b, bg.color.a) |
-- ^ Required because :SetColor won't actually set the color if it's the same as the previously saved color. |
--[[ |
local inventory = Bagnon.frames.inventory |
if not inventory then return end |
--print("Moving inventory frame...") |
inventory:ClearAllPoints() |
inventory:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -15) |
inventory.titleFrame:StopMovingFrame() |
|
local bank = Bagnon.frames.bank |
if not bank then return end |
--print("Moving bank frame...") |
bank:ClearAllPoints() |
bank:SetPoint("TOPRIGHT", inventory, "TOPLEFT", -15, 0) |
bank.titleFrame:StopMovingFrame() |
]] |
local TRAIN_ALL = "Train All" |
local TRAIN_ALL_REPORT = "Learned all skills for %s." |
if GetLocale() == "deDE" then |
TRAIN_ALL = "Alle erlernen" |
TRAIN_ALL_REPORT = "Alles hat für %s gelernt werden." |
elseif GetLocale():match("es") then |
TRAIN_ALL = "Aprender todos" |
TRAIN_ALL_REPORT = "Todos se aprendió para %s." |
end |
|
hooksecurefunc(Bagnon, "CreateFrame", function(Bagnon, id) |
--print("Bagnon: CreateFrame:", id) |
local frame = Bagnon.frames[id] |
local LibBackdrop = LibStub and LibStub("LibBackdrop-1.0", true) |
if LibBackdrop then |
LibBackdrop:EnhanceBackdrop(frame) |
frame.SetBackdropBorderColor = PhanxBorder.SetBorderColor |
local button = CreateFrame("Button", "ClassTrainerTrainAllButton", ClassTrainerTrainButton:GetParent(), "MagicButtonTemplate") |
button:SetPoint("RIGHT", ClassTrainerTrainButton, "LEFT") |
button:SetWidth(100) |
button:SetText(TRAIN_ALL) |
button:SetScript("OnShow", function(self) |
self:SetEnabled(GetTrainAllCost() > 0) |
end) |
button:SetScript("OnEnter", function(self) |
local totalCost = GetTrainAllCost() |
if totalCost > 0 then |
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT") |
GameTooltip:AddLine(TRAIN_ALL) |
GameTooltip:AddLine(GetCoinTextureString(totalCost)) |
GameTooltip:Show() |
end |
frame:HookScript("OnShow", MoveFrame) |
end) |
end, |
--------------------------------------------------------------------- |
-- OPie |
-- * Kill the stupid spin-out animation -- removed: is now an option |
-- * Overwrite the annoying custom error handling |
--------------------------------------------------------------------- |
OPie = function() |
--OneRingLib:SetOption("MISpinOnHide", false) |
EC_Error = function(source, aspect, text, level) |
error(gsub(aspect .. "\n" .. text .. "\n" .. debugstack((level or 0) + 3), "Interface\\AddOns\\", "")) |
end |
end, |
--------------------------------------------------------------------- |
-- PetTracker |
-- * Better statusbar texture |
-- * Move enemy action buttons to micro button area |
--------------------------------------------------------------------- |
PetTracker = function() |
--[[ |
local bar = PetTracker.Objectives.Bar |
for i = 1, bar:GetNumChildren() do |
local child = select(i, bar:GetChildren()) |
if child:IsObjectType("StatusBar") then |
local r, g, b = child:GetStatusBarColor() |
child:SetStatusBarTexture(PhanxMod.STATUSBAR) |
child:SetStatusBarColor(r * 0.75, g * 0.75, b * 0.75) |
button:SetScript("OnLeave", GameTooltip_Hide) |
button:SetScript("OnClick", function(self) |
local totalCost = GetTrainAllCost(true) |
if totalCost > 0 then |
print(format(TRAIN_ALL_REPORT, GetCoinTextureString(totalCost))) |
end |
end) |
end |
end |
|
--------------------------------------------------------------------- |
-- Bagnon |
-- Move frames |
--------------------------------------------------------------------- |
|
mods["Bagnon"] = function() |
local function MoveFrame(frame) |
--print("Bagnon: OnShow:", frame:GetName()) |
local bg = PhanxMod.BACKDROP |
frame:SetBackdrop({ bgFile = bg.texture, tile = true, tileSize = bg.size }) |
frame:GetSettings():SetColor(bg.color.r, bg.color.g, bg.color.b, bg.color.a) |
frame:SetBackdropColor(bg.color.r, bg.color.g, bg.color.b, bg.color.a) |
-- ^ Required because :SetColor won't actually set the color if it's the same as the previously saved color. |
--[[ |
local inventory = Bagnon.frames.inventory |
if not inventory then return end |
--print("Moving inventory frame...") |
inventory:ClearAllPoints() |
inventory:SetPoint("TOPRIGHT", Minimap, "BOTTOMRIGHT", 0, -15) |
inventory.titleFrame:StopMovingFrame() |
|
local bank = Bagnon.frames.bank |
if not bank then return end |
--print("Moving bank frame...") |
bank:ClearAllPoints() |
bank:SetPoint("TOPRIGHT", inventory, "TOPLEFT", -15, 0) |
bank.titleFrame:StopMovingFrame() |
]] |
end |
|
hooksecurefunc(Bagnon, "CreateFrame", function(Bagnon, id) |
--print("Bagnon: CreateFrame:", id) |
local frame = Bagnon.frames[id] |
local LibBackdrop = LibStub and LibStub("LibBackdrop-1.0", true) |
if LibBackdrop then |
LibBackdrop:EnhanceBackdrop(frame) |
frame.SetBackdropBorderColor = PhanxBorder.SetBorderColor |
end |
]] |
frame:HookScript("OnShow", MoveFrame) |
end) |
end |
|
-- Move enemy action buttons to micro button area |
-- local _, parent = EnemyActions:GetPoint(1) |
local EnemyActions = PetTracker.EnemyActions |
EnemyActions:ClearAllPoints() |
EnemyActions:SetPoint("TOPRIGHT", PetBattleFrame.BottomFrame, "TOPRIGHT", 32, -20) |
--------------------------------------------------------------------- |
-- MasterPlan |
-- * Enlarge group suggestion buttons, colorize success chances |
--------------------------------------------------------------------- |
|
-- Remove the micro buttons from the pet battle UI |
hooksecurefunc("UpdateMicroButtonsParent", function(parent) |
print("UpdateMicroButtonsParent", parent and parent:GetName() or UNKNOWN) |
--[[ |
if parent and okparents[parent:GetName() or UNKNOWN] and not InCombatLockdown() then |
MainMenuBar:GetScript("OnShow")(MainMenuBar) |
mods["MasterPlan"] = function() |
local hooked, setting, ScheduleScan = {}, {} |
|
local function Colorize(button, text) |
if setting[button] then return end |
setting[button] = true |
local ptext, pval, ctext, ntext = strmatch(gsub(text, "\124cff%x%x%x%x%x%x", ""), "((%d+)%%)") |
if pval then |
pval = tonumber(pval) |
if pval > 95 then |
ctext = "\124cff00ff00" .. pval .. "%" |
else |
local perc = pval > 40 and (pval - 40) / 60 or 0 |
local r = perc > 0.5 and (2*(1-perc)) or 1 |
local g = perc < 0.5 and (2*perc) or 1 |
ctext = format("\124cff%02x%02x55%d%%", (r+((1-r)*0.35))*255, (g+((1-g)*0.35))*255, pval) |
end |
]] |
end) |
end, |
--------------------------------------------------------------------- |
-- PetTracker_Broker |
-- * Better statusbar texture |
--------------------------------------------------------------------- |
--[[ |
PetTracker_Broker = function() |
for i = 1, PetTracker_BrokerTip:GetNumChildren() do |
local child = select(i, PetTracker_BrokerTip:GetChildren()) |
local bar = child.Bar |
if bar then |
for i = 1, bar:GetNumChildren() do |
local child = select(i, bar:GetChildren()) |
if child:IsObjectType("StatusBar") then |
local r, g, b = child:GetStatusBarColor() |
child:SetStatusBarTexture(PhanxMod.STATUSBAR) |
child:SetStatusBarColor(r * 0.75, g * 0.75, b * 0.75) |
ptext = gsub(ptext, "%%", "%%%%") |
ctext = gsub(ctext, "%%", "%%%%") |
ntext = gsub(text, ptext, ctext) |
--print("Colorize:", text, "=>", ntext) |
button:SetText(ntext) |
end |
local bw = math.max(110, button:GetFontString():GetStringWidth() + 14) |
button:SetWidth(bw + (10 - bw % 10) % 10) |
setting[button] = nil |
end |
|
local function ScanChildren(f) |
if not f then |
--print("ScanChildren") |
f = MasterPlanMissionList |
end |
for i = 1, f:GetNumChildren() do |
local c = select(i, f:GetChildren()) |
if c.veil and c.groups then |
for j = 1, #c.groups do |
local button = c.groups[j] |
if not hooked[button] then |
--print("HOOK", button:GetText()) |
button:SetHeight(28) |
for _, tex in pairs(button.tex) do tex:SetHeight(28) end |
button:SetNormalFontObject(GameFontHighlight) |
button:SetDisabledFontObject(GameFontDisable) |
hooksecurefunc(button, "SetText", Colorize) |
Colorize(button, button:GetText()) |
hooked[button] = true |
end |
end |
break |
elseif c:IsObjectType("Slider") then |
if not hooked[c] then |
c:HookScript("OnValueChanged", ScheduleScan) |
hooked[c] = true |
end |
else |
ScanChildren(c) |
end |
end |
end, |
end |
|
function ScheduleScan() |
C_Timer.After(0.1, ScanChildren) |
end |
|
MasterPlanMissionList:HookScript("OnShow", ScheduleScan) |
hooksecurefunc("GarrisonMissionList_UpdateMissions", ScheduleScan) |
end |
|
--------------------------------------------------------------------- |
-- OPie |
-- * Overwrite the annoying custom error handling |
--------------------------------------------------------------------- |
|
mods["OPie"] = function() |
--OneRingLib:SetOption("MISpinOnHide", false) |
EC_Error = function(source, aspect, text, level) |
error(gsub(aspect .. "\n" .. text .. "\n" .. debugstack((level or 0) + 3), "Interface\\AddOns\\", "")) |
end |
end |
|
--------------------------------------------------------------------- |
-- PetTracker |
-- * Better statusbar texture |
-- * Move enemy action buttons to micro button area |
--------------------------------------------------------------------- |
|
mods["PetTracker"] = function() |
--[[ |
local bar = PetTracker.Objectives.Bar |
for i = 1, bar:GetNumChildren() do |
local child = select(i, bar:GetChildren()) |
if child:IsObjectType("StatusBar") then |
local r, g, b = child:GetStatusBarColor() |
child:SetStatusBarTexture(PhanxMod.STATUSBAR) |
child:SetStatusBarColor(r * 0.75, g * 0.75, b * 0.75) |
end |
end |
]] |
--------------------------------------------------------------------- |
-- Who Framed Watcher Wabbit |
--------------------------------------------------------------------- |
["Who Framed Watcher Wabbit"] = function() |
OTFContainer:SetFrameStrata("BACKGROUND") |
end, |
} |
|
local f = CreateFrame("Frame") |
f:RegisterEvent("PLAYER_LOGIN") |
f:SetScript("OnEvent", function(self, event, addon) |
for name, func in pairs(mods) do |
if name == addon or IsAddOnLoaded(name) then |
--print("PhanxMod =>", name) |
func() |
mods[name] = nil |
else |
local _, _, _, enabled, loadable, reason = GetAddOnInfo(name) |
if not enabled or reason == "MISSING" then |
--print("PhanxMod =>", name, "DISABLED") |
mods[name] = nil |
-- Move enemy action buttons to micro button area |
local EnemyActions = PetTracker.EnemyActions |
EnemyActions:ClearAllPoints() |
EnemyActions:SetPoint("CENTER", PetBattleFrame.BottomFrame.MicroButtonFrame) |
|
-- Remove the micro buttons from the pet battle UI |
hooksecurefunc("UpdateMicroButtonsParent", function(parent) |
if parent == PetBattleFrame.BottomFrame.MicroButtonFrame and not InCombatLockdown() then |
MainMenuBar:GetScript("OnShow")(MainMenuBar) |
end |
end) |
end |
|
--------------------------------------------------------------------- |
-- PetTracker_Broker |
-- * Better statusbar texture |
--------------------------------------------------------------------- |
--[[ |
mods["PetTracker_Broker"]end() |
for i = 1, PetTracker_BrokerTip:GetNumChildren() do |
local child = select(i, PetTracker_BrokerTip:GetChildren()) |
local bar = child.Bar |
if bar then |
for i = 1, bar:GetNumChildren() do |
local child = select(i, bar:GetChildren()) |
if child:IsObjectType("StatusBar") then |
local r, g, b = child:GetStatusBarColor() |
child:SetStatusBarTexture(PhanxMod.STATUSBAR) |
child:SetStatusBarColor(r * 0.75, g * 0.75, b * 0.75) |
end |
end |
break |
end |
end |
end |
]] |
--------------------------------------------------------------------- |
-- Who Framed Watcher Wabbit |
--------------------------------------------------------------------- |
|
if next(mods) then |
self:RegisterEvent("ADDON_LOADED") |
else |
self:UnregisterAllEvents() |
self:SetScript("OnEvent", nil) |
end |
end) |
mods["Who Framed Watcher Wabbit"] = function() |
OTFContainer:SetFrameStrata("BACKGROUND") |
end |
|
------------------------------------------------------------------------ |
-- Remove raid restrictions |