This commit is contained in:
2024-03-17 18:33:11 -04:00
commit 3725388b2c
16 changed files with 495 additions and 0 deletions

View File

@ -0,0 +1,14 @@
--------------------------------------------------------------------------------
-- # MODULES > AUTOMATION > EASY DELETE
--------------------------------------------------------------------------------
-- never type "DELETE" ever again
local deleteDialog = StaticPopupDialogs['DELETE_GOOD_ITEM']
if deleteDialog.OnShow then
hooksecurefunc(deleteDialog, 'OnShow', function(s)
s.editBox:SetText(DELETE_ITEM_CONFIRM_STRING)
s.editBox:SetAutoFocus(false)
s.editBox:ClearFocus()
end)
end

View File

@ -0,0 +1,14 @@
--------------------------------------------------------------------------------
-- # MODULES > AUTOMATION > MAIL MONEY
--------------------------------------------------------------------------------
-- automatically enters subject line when sending money
local function MailSubject(self)
if self:GetText() ~= '' and SendMailSubjectEditBox:GetText() == '' then
SendMailSubjectEditBox:SetText(MONEY)
end
end
SendMailMoneyGold:HookScript('OnTextChanged', MailSubject)
SendMailMoneySilver:HookScript('OnTextChanged', MailSubject)
SendMailMoneyCopper:HookScript('OnTextChanged', MailSubject)

View File

@ -0,0 +1,11 @@
--------------------------------------------------------------------------------
-- # MODULES > AUTOMATION > NO ESCAPE
--------------------------------------------------------------------------------
-- prevent <Esc> from closing these pop-ups
StaticPopupDialogs.RESURRECT.hideOnEscape = nil
StaticPopupDialogs.AREA_SPIRIT_HEAL.hideOnEscape = nil
StaticPopupDialogs.PARTY_INVITE.hideOnEscape = nil
StaticPopupDialogs.CONFIRM_SUMMON.hideOnEscape = nil
StaticPopupDialogs.ADDON_ACTION_FORBIDDEN.button1 = nil
StaticPopupDialogs.TOO_MANY_LUA_ERRORS.button1 = nil

View File

@ -0,0 +1,33 @@
local addon, ns = ...
local L = ns.L
--------------------------------------------------------------------------------
-- # MODULES > AUTOMATION > REPAIR
--------------------------------------------------------------------------------
local autoRepair = true
local autoRepairGuild = true
local f = CreateFrame('Frame')
f:RegisterEvent('MERCHANT_SHOW')
f:SetScript('OnEvent', function()
if CanMerchantRepair() then
local cost = GetRepairAllCost()
if cost > 0 then
-- using guild funds
if autoRepairGuild == true and GetGuildBankWithdrawMoney() >= cost then
RepairAllItems(1)
print('Klaz|cff1994ffScripts|r — |cnYELLOW_FONT_COLOR:'..L.AUTO_REPAIR_GUILD..':|r '..GetCoinTextureString(cost, 10)) -- print using currency icons
PlaySound(SOUNDKIT.ITEM_REPAIR)
-- using personal funds
elseif autoRepair == true and GetMoney() > cost then
RepairAllItems()
print('Klaz|cff1994ffScripts|r — |cnYELLOW_FONT_COLOR:'..L.AUTO_REPAIR..':|r '..GetCoinTextureString(cost, 10)) -- print using currency icons
PlaySound(SOUNDKIT.ITEM_REPAIR)
-- no money
else
print('Klaz|cff1994ffScripts|r — |cnRED_FONT_COLOR:'..L.AUTO_REPAIR_BROKE..'.|r')
end
end
end
end)

View File

@ -0,0 +1,29 @@
--------------------------------------------------------------------------------
-- # MODULES > REPUTATION TRACKER
--------------------------------------------------------------------------------
-- switch reputation tracker to most recently earned reputation
-- ignores guild reputation
local f = CreateFrame('Frame')
f:RegisterEvent('COMBAT_TEXT_UPDATE')
f:SetScript('OnEvent', function(_, event, arg1)
local lastupdate = 0
local lastamount = 0
if (event == 'COMBAT_TEXT_UPDATE' and arg1 == 'FACTION') then
local faction, amount = GetCurrentCombatTextEventInfo()
if (faction ~= 'Guild') then
if (amount > lastamount) or (time() > lastupdate) then
for i=1,GetNumFactions() do
if faction == GetFactionInfo(i) then
SetWatchedFactionIndex(i);
end
end
end
lastamount = amount
lastupdate = time()
end
end
end)

View File

@ -0,0 +1,41 @@
local addon, ns = ...
local L = ns.L
--------------------------------------------------------------------------------
-- # MODULES > AUTOMATION > SELL JUNK
--------------------------------------------------------------------------------
local f = CreateFrame('Frame')
f:RegisterEvent('MERCHANT_SHOW')
f:SetScript('OnEvent', function()
-- local bag, slot
-- for bag = 0, 4 do
-- for slot = 0, C_Container.GetContainerNumSlots(bag) do
-- local item = C_Container.GetContainerItemLink(bag, slot)
-- if item and (select(3, GetItemInfo(item)) == 0) then
-- C_Container.UseContainerItem(bag, slot)
-- end
-- end
-- end
local totalPrice = 0
for bag = 0, 4 do
for bagSlots = 1, C_Container.GetContainerNumSlots(bag) do
CurrentItemLink = C_Container.GetContainerItemLink(bag, bagSlots)
if CurrentItemLink then
_, _, itemRarity, _, _, _, _, _, _, _, itemSellPrice = GetItemInfo(CurrentItemLink)
itemInfo = C_Container.GetContainerItemInfo(bag, bagSlots)
if itemRarity == 0 and itemSellPrice ~= 0 then
totalPrice = totalPrice + (itemSellPrice * itemInfo.stackCount)
C_Container.UseContainerItem(bag, bagSlots)
PickupMerchantItem()
end
end
end
end
if totalPrice ~= 0 then
DEFAULT_CHAT_FRAME:AddMessage('Klaz|cff1994ffScripts|r — |cnYELLOW_FONT_COLOR:'..L.AUTO_SELL_JUNK..':|r '..GetCoinTextureString(totalPrice), 255, 255, 255)
end
end)