Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
Robin Hüskes | 4fcacb8701 | |
Robin Hüskes | 66196c9ba6 | |
Robin Hüskes | 8fee33869c | |
Robin Hüskes | 0924683f58 | |
Robin Hüskes | f508e01f0d | |
Robin Hüskes | 0ebf6dc71f | |
Robin Hüskes | b5c389c61f | |
Robin Hüskes | b581b96d72 | |
Robin Hüskes | 2a87c943cd | |
Robin Hüskes | b1dc280012 | |
Robin Hüskes | ef8524f344 |
|
@ -1,5 +1,5 @@
|
|||
--[[ $Id: CallbackHandler-1.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]
|
||||
local MAJOR, MINOR = "CallbackHandler-1.0", 7
|
||||
--[[ $Id: CallbackHandler-1.0.lua 26 2022-12-12 15:09:39Z nevcairiel $ ]]
|
||||
local MAJOR, MINOR = "CallbackHandler-1.0", 8
|
||||
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not CallbackHandler then return end -- No upgrade needed
|
||||
|
@ -7,21 +7,16 @@ if not CallbackHandler then return end -- No upgrade needed
|
|||
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
|
||||
|
||||
-- Lua APIs
|
||||
local error = error
|
||||
local securecallfunction, error = securecallfunction, error
|
||||
local setmetatable, rawget = setmetatable, rawget
|
||||
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
|
||||
|
||||
local xpcall = xpcall
|
||||
|
||||
local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
end
|
||||
|
||||
local function Dispatch(handlers, ...)
|
||||
local index, method = next(handlers)
|
||||
if not method then return end
|
||||
repeat
|
||||
xpcall(method, errorhandler, ...)
|
||||
securecallfunction(method, ...)
|
||||
index, method = next(handlers, index)
|
||||
until not method
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
--@curseforge-project-slug: libdbicon-1-0@
|
||||
-----------------------------------------------------------------------
|
||||
-- LibDBIcon-1.0
|
||||
--
|
||||
|
@ -6,7 +6,7 @@
|
|||
--
|
||||
|
||||
local DBICON10 = "LibDBIcon-1.0"
|
||||
local DBICON10_MINOR = 44 -- Bump on changes
|
||||
local DBICON10_MINOR = 45 -- Bump on changes
|
||||
if not LibStub then error(DBICON10 .. " requires LibStub.") end
|
||||
local ldb = LibStub("LibDataBroker-1.1", true)
|
||||
if not ldb then error(DBICON10 .. " requires LibDataBroker-1.1.") end
|
||||
|
@ -218,37 +218,49 @@ local function createButton(name, object, db)
|
|||
button.dataObject = object
|
||||
button.db = db
|
||||
button:SetFrameStrata("MEDIUM")
|
||||
if button.SetFixedFrameStrata then -- Classic support
|
||||
button:SetFixedFrameStrata(true)
|
||||
end
|
||||
button:SetFixedFrameStrata(true)
|
||||
button:SetFrameLevel(8)
|
||||
if button.SetFixedFrameLevel then -- Classic support
|
||||
button:SetFixedFrameLevel(true)
|
||||
end
|
||||
button:SetFixedFrameLevel(true)
|
||||
button:SetSize(31, 31)
|
||||
button:RegisterForClicks("anyUp")
|
||||
button:RegisterForDrag("LeftButton")
|
||||
button:SetHighlightTexture(136477) --"Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight"
|
||||
local overlay = button:CreateTexture(nil, "OVERLAY")
|
||||
overlay:SetSize(53, 53)
|
||||
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
|
||||
overlay:SetPoint("TOPLEFT")
|
||||
local background = button:CreateTexture(nil, "BACKGROUND")
|
||||
background:SetSize(20, 20)
|
||||
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
|
||||
background:SetPoint("TOPLEFT", 7, -5)
|
||||
local icon = button:CreateTexture(nil, "ARTWORK")
|
||||
icon:SetSize(17, 17)
|
||||
icon:SetTexture(object.icon)
|
||||
icon:SetPoint("TOPLEFT", 7, -6)
|
||||
button.icon = icon
|
||||
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
|
||||
local overlay = button:CreateTexture(nil, "OVERLAY")
|
||||
overlay:SetSize(50, 50)
|
||||
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
|
||||
overlay:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0)
|
||||
local background = button:CreateTexture(nil, "BACKGROUND")
|
||||
background:SetSize(24, 24)
|
||||
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
|
||||
background:SetPoint("CENTER", button, "CENTER", 0, 1)
|
||||
local icon = button:CreateTexture(nil, "ARTWORK")
|
||||
icon:SetSize(18, 18)
|
||||
icon:SetTexture(object.icon)
|
||||
icon:SetPoint("CENTER", button, "CENTER", 0, 1)
|
||||
button.icon = icon
|
||||
else
|
||||
local overlay = button:CreateTexture(nil, "OVERLAY")
|
||||
overlay:SetSize(53, 53)
|
||||
overlay:SetTexture(136430) --"Interface\\Minimap\\MiniMap-TrackingBorder"
|
||||
overlay:SetPoint("TOPLEFT")
|
||||
local background = button:CreateTexture(nil, "BACKGROUND")
|
||||
background:SetSize(20, 20)
|
||||
background:SetTexture(136467) --"Interface\\Minimap\\UI-Minimap-Background"
|
||||
background:SetPoint("TOPLEFT", 7, -5)
|
||||
local icon = button:CreateTexture(nil, "ARTWORK")
|
||||
icon:SetSize(17, 17)
|
||||
icon:SetTexture(object.icon)
|
||||
icon:SetPoint("TOPLEFT", 7, -6)
|
||||
button.icon = icon
|
||||
end
|
||||
|
||||
button.isMouseDown = false
|
||||
local r, g, b = button.icon:GetVertexColor()
|
||||
button.icon:SetVertexColor(object.iconR or r, object.iconG or g, object.iconB or b)
|
||||
|
||||
local r, g, b = icon:GetVertexColor()
|
||||
icon:SetVertexColor(object.iconR or r, object.iconG or g, object.iconB or b)
|
||||
|
||||
icon.UpdateCoord = updateCoord
|
||||
icon:UpdateCoord()
|
||||
button.icon.UpdateCoord = updateCoord
|
||||
button.icon:UpdateCoord()
|
||||
|
||||
button:SetScript("OnEnter", onEnter)
|
||||
button:SetScript("OnLeave", onLeave)
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
local lib = LibStub:NewLibrary("zzAddOn", 10)
|
||||
local lib = LibStub:NewLibrary("zzAddOn", 12)
|
||||
if not lib then return end
|
||||
local config = LibStub:GetLibrary("zzConfig")
|
||||
lib['callbacks'] = lib['callbacks'] or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib)
|
||||
lib['addons'] = lib['addons'] or {}
|
||||
lib['managerframe'] = lib['managerframe'] or CreateFrame("FRAME")
|
||||
lib['events'] = lib['events'] or CreateFrame("FRAME")
|
||||
local function errormsg(err)
|
||||
print(format("|cffff0000Error:|r %s",err))
|
||||
end
|
||||
local mixins = {'NewAddOn', 'GetAddOn', 'AddChild', 'HasChild', 'IsChild', 'HasParent', 'GetParent', 'GetOptions', 'RegisterEvent','UnregisterEvent','IsClassic','IsBCC','IsRetail', 'GetSpecs', 'Fire'}
|
||||
local mixins = {'NewAddOn', 'GetAddOn', 'AddChild', 'HasChild', 'IsChild', 'HasParent', 'GetParent', 'GetOptions', 'RegisterEvent','UnregisterEvent','IsClassic','IsBCC','IsRetail', 'GetSpecs', 'Fire', 'RegisterOpen', 'RegisterClose'}
|
||||
function lib:Fire(...)
|
||||
lib['callbacks']:Fire(...)
|
||||
end
|
||||
|
@ -103,6 +104,44 @@ end
|
|||
function lib:IsRetail()
|
||||
return WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
|
||||
end
|
||||
local function handleManagerFrame(self, event, num)
|
||||
if(event == "PLAYER_INTERACTION_MANAGER_FRAME_SHOW") then
|
||||
lib['callbacks']:Fire(format("show-%i", num))
|
||||
else
|
||||
lib['callbacks']:Fire(format("hide-%i", num))
|
||||
end
|
||||
end
|
||||
local function addManagerFrame(self, mode, num, globalfunc)
|
||||
if(type(num) == 'table') then
|
||||
for k, v in pairs(num) do
|
||||
local n = k
|
||||
local func = v
|
||||
if(type(v) == 'number') then
|
||||
n = v
|
||||
func = globalfunc
|
||||
end
|
||||
addManagerFrame(self, mode, n, func)
|
||||
end
|
||||
elseif(type(num) == 'number') then
|
||||
lib.RegisterCallback(self, format("%s-%i", mode, num), globalfunc)
|
||||
end
|
||||
end
|
||||
function lib:RegisterOpen(num, func)
|
||||
if(not num) then return end
|
||||
if(not lib['managerframe']:IsEventRegistered("PLAYER_INTERACTION_MANAGER_FRAME_SHOW")) then
|
||||
lib['managerframe']:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_SHOW")
|
||||
lib['managerframe']:SetScript("OnEvent", handleManagerFrame)
|
||||
end
|
||||
addManagerFrame(self, 'show', num, func)
|
||||
end
|
||||
function lib:RegisterClose(num, func)
|
||||
if(not num) then return end
|
||||
if(not lib['managerframe']:IsEventRegistered("PLAYER_INTERACTION_MANAGER_FRAME_HIDE")) then
|
||||
lib['managerframe']:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_HIDE")
|
||||
lib['managerframe']:SetScript("OnEvent", handleManagerFrame)
|
||||
end
|
||||
addManagerFrame(self, 'hide', num, func)
|
||||
end
|
||||
function lib:NewAddOn(addonName, addonTable)
|
||||
local specs = self['specs']
|
||||
local childName = specs['name']
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local lib = LibStub:NewLibrary("zzHelper", 3)
|
||||
local lib = LibStub:NewLibrary("zzHelper", 4)
|
||||
if not lib then return end
|
||||
lib['targets'] = lib['targets'] or {}
|
||||
local mixins = {'colorize', 'round', 'sortArray', 'IsTwink', 'classcolor', 'MoneyString', 'MoneyStringSetString', 'MoneyStringSetSize'}
|
||||
|
@ -34,7 +34,7 @@ function lib:MoneyStringSetSize(size)
|
|||
iconSize = size
|
||||
end
|
||||
end
|
||||
function lib:MoneyString(money, color, abrevK, abrevM, noicon, noiconcolor, size)
|
||||
function lib:MoneyString(money, color, abrevK, abrevM, noicon, noiconcolor, size, seperate)
|
||||
local iconSize = size or iconSize
|
||||
local goldicon = noicon and (noiconcolor and moneyText['goldColor'] or moneyText['gold']) or format(iconbase, 'Gold', iconSize, iconSize)
|
||||
local silvericon = noicon and (noiconcolor and moneyText['silverColor'] or moneyText['silver']) or format(iconbase, 'Silver', iconSize, iconSize)
|
||||
|
@ -66,6 +66,9 @@ function lib:MoneyString(money, color, abrevK, abrevM, noicon, noiconcolor, size
|
|||
end
|
||||
if(money > 0) then
|
||||
if(g>0) then
|
||||
if(seperate) then
|
||||
g = BreakUpLargeNumbers(g)
|
||||
end
|
||||
moneystring = format("%s%s%s", color and lib:colorize(g, neg and "ff0000" or "44dd44") or g,abrev, goldicon)
|
||||
end
|
||||
if(s>0) then
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local lib = LibStub:NewLibrary("zzLDB", 5)
|
||||
local lib = LibStub:NewLibrary("zzLDB", 6)
|
||||
if not lib then return end
|
||||
local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
|
||||
local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0")
|
||||
|
@ -25,7 +25,8 @@ function lib:DefaultOnClick(_, button, addon, childName)
|
|||
if(not InCombatLockdown()) then
|
||||
if(SettingsPanel) then
|
||||
if(SettingsPanel:IsVisible()) then
|
||||
SettingsPanel:Hide()
|
||||
HideUIPanel(SettingsPanel)
|
||||
HideUIPanel(GameMenuFrame)
|
||||
else
|
||||
Settings.OpenToCategory(childName)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# zz_Repair
|
||||
|
||||
zz_Repair is a broker to display durability.
|
||||
Optionally it can automaticly repair at a vendor.
|
||||
Optionally it can automaticly repair at a vendor and sell grey items.
|
||||
|
||||
#### Links
|
||||
[Releases](https://git.grml.de/rilgamon/zz_Repair/releases "Releases") | [Source](https://git.grml.de/rilgamon/zz_Repair "Source") | [Bugs&Comments](https://git.grml.de/rilgamon/zz_Repair/issues "Bugs&Comments") | [Donate](https://liberapay.com/bundesloser "Donate") | [Contact](https://mastodon.grml.de/@robin "Contact")
|
76
core.lua
76
core.lua
|
@ -5,7 +5,11 @@ local events = child['events']
|
|||
local db, player
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
|
||||
LibStub("zzHelper"):Embed(child)
|
||||
child['statusItem'] = {}
|
||||
child['statusItem'] = {}
|
||||
local NUM_BAG_SLOTS = NUM_BAG_SLOTS
|
||||
local GetContainerItemLink = GetContainerItemLink
|
||||
local GetContainerItemInfo = GetContainerItemInfo
|
||||
|
||||
local function prepareDB()
|
||||
db = addon['db']['profile'][childName]
|
||||
child['db'] = db
|
||||
|
@ -28,7 +32,68 @@ local function getGBLimit()
|
|||
end
|
||||
return amount
|
||||
end
|
||||
function events:MERCHANT_SHOW()
|
||||
local function itemInfo(id)
|
||||
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(id)
|
||||
if(itemName) then
|
||||
return {
|
||||
['itemId'] = id,
|
||||
['itemName'] = itemName,
|
||||
['itemLink'] = itemLink,
|
||||
['itemRarity'] = itemRarity,
|
||||
['itemLevel'] = itemLevel,
|
||||
['itemMinLevel'] = itemMinLevel,
|
||||
['itemType'] = itemType,
|
||||
['itemSubType'] = itemSubType,
|
||||
['itemStackCount'] = itemStackCount,
|
||||
['itemEquipLoc'] = itemEquipLoc,
|
||||
['itemTexture'] = itemTexture,
|
||||
['itemSellPrice'] = itemSellPrice
|
||||
}
|
||||
end
|
||||
end
|
||||
local function CheckGrey(dont)
|
||||
local info,i = {},{}
|
||||
local a = 0
|
||||
local numberOfSlots,link,id
|
||||
local earnedMoney = 0
|
||||
while(a<=NUM_BAG_SLOTS) do
|
||||
numberOfSlots = C_Container.GetContainerNumSlots(a)
|
||||
local b = 1
|
||||
while(b<=numberOfSlots) do
|
||||
local item = ItemLocation:CreateFromBagAndSlot(a, b)
|
||||
if(item:IsValid()) then
|
||||
-- link = C_Container.GetContainerItemLink(a, b)
|
||||
id = C_Item.GetItemID(item)
|
||||
info = itemInfo(id)
|
||||
if(info) then
|
||||
if(info['itemRarity'] == 0) then
|
||||
if(info['itemSellPrice'] and info['itemSellPrice'] > 0) then
|
||||
local cinfo = C_Container.GetContainerItemInfo(a, b)
|
||||
if(cinfo['stackCount']) then
|
||||
if(not dont) then
|
||||
print(L['solditem'](C_Item.GetItemLink(item), info['itemSellPrice']))
|
||||
end
|
||||
earnedMoney = earnedMoney + info['itemSellPrice'] * cinfo['stackCount']
|
||||
C_Container.PickupContainerItem(a, b)
|
||||
PickupMerchantItem()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
b = b + 1
|
||||
end
|
||||
a = a + 1
|
||||
end
|
||||
if(earnedMoney > 0 and not dont) then
|
||||
print(L['earnedmoney'](earnedMoney))
|
||||
end
|
||||
if(earnedMoney>0 and not dont) then
|
||||
C_Timer.After(1,function() CheckGrey(true) end)
|
||||
end
|
||||
end
|
||||
|
||||
local function MERCHANT_SHOW()
|
||||
if(CanMerchantRepair()) then
|
||||
local m = GetMoney()
|
||||
local r = GetRepairAllCost()
|
||||
|
@ -60,6 +125,9 @@ function events:MERCHANT_SHOW()
|
|||
db['repairstats'][player] = db['repairstats'][player] + r
|
||||
end
|
||||
end
|
||||
if(db['sellgrey']) then
|
||||
CheckGrey()
|
||||
end
|
||||
end
|
||||
function child:pickColor(v)
|
||||
local col = 'ffffff'
|
||||
|
@ -102,6 +170,9 @@ function events:UPDATE_INVENTORY_DURABILITY()
|
|||
end
|
||||
events.UPDATE_INVENTORY_ALERTS = events.UPDATE_INVENTORY_DURABILITY
|
||||
events.UNIT_INVENTORY_CHANGED = events.UPDATE_INVENTORY_DURABILITY
|
||||
local function MFOpen(...)
|
||||
MERCHANT_SHOW()
|
||||
end
|
||||
child['specs'] = {
|
||||
['name'] = childName,
|
||||
['sv'] = true,
|
||||
|
@ -122,5 +193,6 @@ function events:PLAYER_ENTERING_WORLD(event)
|
|||
child:UnregisterEvent('PLAYER_ENTERING_WORLD')
|
||||
player = format("%s-%s", UnitFullName("player"))
|
||||
events.UPDATE_INVENTORY_DURABILITY()
|
||||
child:RegisterOpen(5, MFOpen)
|
||||
end
|
||||
child:NewAddOn(...)
|
|
@ -40,10 +40,13 @@ if L then
|
|||
L['Allow Guildbank Repair'] = "Repariere aus Gildenbank"
|
||||
L['Money low'] = "Nicht genug Geld f\195\188r Reparatur!"
|
||||
L['HINT3'] = "|c0000ff00Shift-Linksklick|r |c00ffffffschaltet Minimapicon an/aus|r"
|
||||
L["SellGrey"] = "Verkaufe graue Gegenst\195\164nde"
|
||||
L['solditem'] = function(link, price) return format("%s verkauft f\195\188r %s", link, child:MoneyString(price, true)) end
|
||||
L['earnedmoney'] = function(earnedMoney) return format ("%s verdient.", child:MoneyString(earnedMoney, true)) end
|
||||
end
|
||||
|
||||
-- <20> \195\182 <20> \195\159
|
||||
-- <20> \195\188 <20> \195\164
|
||||
-- <20> \195\132
|
||||
-- <20> \195\182
|
||||
-- <20> \195\156
|
||||
-- <20> \195\182 <20> \195\159
|
||||
-- <20> \195\188 <20> \195\164
|
||||
-- <20> \195\132
|
||||
-- <20> \195\182
|
||||
-- <20> \195\156
|
|
@ -40,4 +40,7 @@ if L then
|
|||
L['Allow Guildbank Repair'] = true
|
||||
L['Money low'] = "No fund for repair!"
|
||||
L['HINT3'] = "|c0000ff00Shift-Leftclick|r |c00fffffftoggles minimap icon|r"
|
||||
L["SellGrey"] = "Sell grey items"
|
||||
L['solditem'] = function(link, price) return format("%s sold for %s", link, child:MoneyString(price, true)) end
|
||||
L['earnedmoney'] = function(earnedMoney) return format ("Earned %s.", child:MoneyString(earnedMoney, true)) end
|
||||
end
|
|
@ -12,6 +12,7 @@ local init = {
|
|||
local main = options['args'][childName]
|
||||
-- print("setup prefs", childName)
|
||||
config:AddConfigEntry(main, "autorepair", "toggle", L['Autorepair'], nil, 1)
|
||||
config:AddConfigEntry(main, "sellgrey", "toggle", L['SellGrey'], nil, 1)
|
||||
config:AddConfigEntry(main, "showlowest", "toggle", L['Show lowest'], L['Show durability of your lowest item only'], 1)
|
||||
config:AddConfigEntry(main, "listall", "toggle", L['Show all slots'], L['Show all slots in the tooltip instead of damaged only'], 1)
|
||||
config:AddConfigEntry(main, "guildbankrepair", "toggle", L['Allow Guildbank Repair'], nil, 1)
|
||||
|
|
Loading…
Reference in New Issue