commit e75e661b570235e049565f8e2e1c8f20b9fee79b Author: Robin Date: Wed Jan 13 16:12:30 2021 +0100 Init diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..34950ac --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Common"] + path = Common + url = https://git.grml.de/rilgamon/Common.git diff --git a/Common b/Common new file mode 160000 index 0000000..762c59c --- /dev/null +++ b/Common @@ -0,0 +1 @@ +Subproject commit 762c59c6c6abc6ecaa71f3e36bb2c6dd16b8e0ed diff --git a/core.lua b/core.lua new file mode 100644 index 0000000..98959c2 --- /dev/null +++ b/core.lua @@ -0,0 +1,179 @@ +local name, addon = ... +local parentName = addon['parentName'] or "BrokerPack" +local childName = "zz_Bags" + +local defaults = { +} +local options = { +} +local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0") +local L = LibStub("AceLocale-3.0"):GetLocale(childName, true) +local db,modDB +--[[ +4 Leatherworking Supplies +5 Inscription Supplies +6 Herbs +7 Enchanting Supplies +8 Engineering Supplies +10 Gems +11 Mining Supplies +12 Soulbound Equipment +16 Fishing Supplies +17 Cooking Supplies +20 Toys +21 Archaeology +22 Alchemy +23 Blacksmithing +24 First Aid +25 Jewelcrafting +26 Skinning +27 Tailoring +]] +local bagTypes = { + [0] = L['Unspecified'], + [1] = L['Quiver'], + [2] = L['Ammo Pouch'], + [4] = L['Soul Bag'], + [8] = L['Leatherworking Bag'],--4 + [16] = L['Inscription Bag'],--5 + [32] = L['Herb Bag'],--6 + [64] = L['Enchanting Bag'],--7 + [128] = L['Engineering Bag'],--8 + [256] = L['Keyring'],--9? + [512] = L['Gem Bag'], --10 + [1024] = L['Mining Bag'], --11 + [2048] = L['Unknown'], --12 + [4096] = L['Vanity Pets'], --13 + [32768] = L['Fishing Supplies'], --16 + [65536] = L['Cooking Supplies'], --17 + [524288] = L['Toys'], --20 + [1048576] = L['Archaeology'], --21 + [2097152] = L['Alchemy'], --22 + [4194304] = L['Blacksmithing'], --23 + [8388608] = L['First Aid'], --24 + [16777216] = L['Jewelcrafting'], --25 + [33554432] = L['Skinning'], --26 + [67108864] = L['Tailoring'], --27 +} +local refillframe +local x,y,n,m,b,c +local free, full +local bagID,bagType +local NUM_BAG_SLOTS = NUM_BAG_SLOTS +local NUM_BANKBAGSLOTS = NUM_BANKBAGSLOTS +local BANK_CONTAINER = BANK_CONTAINER +local currentFrame +local function OnText(message) + addon:OnText(childName, message) +end + +local function OnDataUpdate() + bagID = 0 + n,m = 0,0 + free,full = {},{} + while(bagID<=NUM_BAG_SLOTS) do + b = GetContainerNumSlots(bagID) + c = GetContainerNumFreeSlots(bagID) + bagType = GetItemFamily(GetBagName(bagID)) + if(not bagType or bagType==0) then + bagType = 0 + full[0] = full[0] or 0 + free[0] = free[0] or 0 + free[0] = free[0] + c + full[0] = full[0] + b + else + full[bagType] = full[bagType] or 0 + free[bagType] = free[bagType] or 0 + free[bagType] = free[bagType] + c + full[bagType] = full[bagType] + b + end + if(db['bagTypes'][bagTypes[bagType]]==true) then + n = n + c + m = m + b + end + bagID = bagID + 1 + end + if(not db['showFree']) then + n = m - n + end + OnText(format("%d/%d",n,m)) +end + +local function getPref2(info) + return db['bagTypes'][info[#info]] +end + +local function setPref2(info,value) + db['bagTypes'][info[#info]] = value + OnDataUpdate() +end + +local function getPref(info) + return db[info[#info]] +end + +local function setPref(info,value) + db[info[#info]] = value + OnDataUpdate() +end +local function OnClick(self, button) + if(IsShiftKeyDown() and button == "LeftButton") then + addon['db']['global']['ldbicons'][childName]['hide'] = not addon['db']['global']['ldbicons'][childName]['hide'] + if(ldbicon) then + if(addon['db']['global']['ldbicons'][childName]['hide']) then + ldbicon:Hide(childName) + else + ldbicon:Show(childName) + end + end + else + if(InterfaceOptionsFrame:IsVisible() and not InCombatLockdown()) then + InterfaceOptionsFrame:Hide() + else + InterfaceOptionsFrame_OpenToCategory(childName) + InterfaceOptionsFrame_OpenToCategory(childName) -- Twice because of a bug in InterfaceOptionsFrame_OpenToCategory + end + end +end +local function OnTooltip(tip) + tip:AddLine(childName) + x, y = 0, 0 + while(x<8000) do + if(full[x] and full[x] > 0) then + n = free[x] + if(not db['showFree']) then + n = full[x] - n + end + tip:AddDoubleLine(bagTypes[x],n.."/"..full[x]) + end + x = 2^y + y = y + 1 + end +end +local function init() + options = addon:InitConfig(childName, true, { + ['name'] = childName, + ['type'] = "data source", + ['OnClick'] = OnClick, + ['OnTooltipShow'] = OnTooltip, + }, getPref, setPref) + db = addon['db']['profile'][childName] + addon:AddConfigMenu({ + ['name'] = L['Bagtypes'], + ['order'] = 2, + ['childGroups'] = 'tab', + ['menuGet'] = getPref2, + ['menuSet'] = setPref2 + }, options) + db['bagTypes'] = db['bagTypes'] or { + [bagTypes[0]] = true, + } + addon:AddConfigEntry(childName, "toggle","showFree",L['Show free space'],L['Show free space instead of used space'],1,nil,nil,nil,nil,options['args'][childName]) + for k,v in pairs(bagTypes) do + addon:AddConfigEntry(childName, "toggle",v,v,nil,1,nil,nil,nil,nil,options['args'][L['Bagtypes']]) + end + addon:RegisterEventThrottle(childName,"BAG_UPDATE", 1, OnDataUpdate) + OnDataUpdate() +end + +addon:startup(name, childName, init, true, defaults) \ No newline at end of file diff --git a/icon2.tga b/icon2.tga new file mode 100644 index 0000000..9aecf80 Binary files /dev/null and b/icon2.tga differ diff --git a/license.txt b/license.txt new file mode 100644 index 0000000..6d2e364 --- /dev/null +++ b/license.txt @@ -0,0 +1,6 @@ +The following license excludes the libraries (Libs) included. See the libraries directory or website. + +This AddOn is public domain. That means you can change it, rename it or paint it yellow. +My name (Rilgamon) is valid only for WoWInterface.com and curse.com. +If you use/offer this addon on another website please remove my name. +If you want to give me credit you can replace it with a link to my profile on WoWInterface.com. \ No newline at end of file diff --git a/locale_deDE.lua b/locale_deDE.lua new file mode 100644 index 0000000..6daa8bd --- /dev/null +++ b/locale_deDE.lua @@ -0,0 +1,71 @@ +local addonname, tab = ... +local name = "zz_Bags" +local L = LibStub("AceLocale-3.0"):NewLocale(name, "deDE", false) +if L then + L['Init module'] = function(v) return "Initialisiere Modul "..v end + L['Could not init module'] = function(v) return "Fehler beim Initialisieren von Modul "..v end + L['Unspecified']='Allgemein' + L['Quiver']='K\195\182cher' + L['Ammo Pouch']='Munitionsbeutel' + L['Soul Bag']='Seelenbeutel' + L['Leatherworking Bag']='Lederer Tasche' + L['Inscription Bag']='Inschriftler Tasche' + L['Herb Bag']='Kr\195\164utertasche' + L['Enchanting Bag']='Verzauberertasche' + L['Engineering Bag']='Werkzeugkasten' + L['Keyring']='Schl\195\188sselring' + L['Gem Bag']='Juwelenbeutel' + L['Mining Bag']='Bergbautasche' + L['Unknown']='Unbekannt' + L['Vanity Pets']='Haustiere' + L['Fishing Supplies']='Angelzubeh\195\182r' + L['Cooking Supplies']='Kochausr\195\188stung' + L['Toys']='Spielzeug' + L['Archaeology']='Arch\195\164ologie' + L['Alchemy']='Alchemie' + L['Blacksmithing']='Schmiedekunst' + L['First Aid']='Erste Hilfe' + L['Jewelcrafting']='Juwelenschleifen' + L['Skinning']='K\195\188rschnerei' + L['Tailoring']='Scheiderei' + L['Bagtypes'] = 'Taschentypen' + L['Show free space']='Zeige freie Pl\195\164tze' + L['Show free space instead of used space']='Zeige freie Taschenpl\195\164tze statt die belegten' + L['Refill']=true + L['Items per Row']='Gegenst\195\164nde pro Zeile' + L['Locked'] = 'Gesperrt' + L['Fix position of the window'] = 'Verhindert das ziehen vom Fenster' + L['Visible'] = 'Sichtbar' + L['Show window on startup'] = 'Zeige Fenster beim Start' + L['main_nav'] = function(v) + local i + local t = { + ['refill'] = "Refill - Konfiguration", + }; + if(t[v]) then + i = t[v] + end + if(not i) then + i = v + end + return i + end + L['empty_info'] = format("%s",name) + L['close'] = 'Schlie\195\159en' + L['move'] = 'Fenster ziehen' + L['refill here'] = 'Gegenstand reinziehen um zur Refill-Liste hinzuf\195\188gen' + L['delete refill'] = 'Diesen Refill l\195\182schen' + L['solditem'] = function(link,price) return link.." verkauft" end + L['earnedmoney'] = function(m) return format("Goldanstieg: %s",tab['buildMoneyString'](m,false)) end + L['Autosell'] = "Automatisch verkaufen" + L['Sells grey items to the next merchant'] = 'Grauen Schrott beim n\195\164chsten H\195\164ndler verkaufen' + L["Bags to front"] = "Bags nach vorne holen" + L["Bags to back"] = "Bags in den Hintergrund schicken" + L["Toggle window"] = "Fenster ein/aus" +end + +-- ö \195\182 ß \195\159 +-- ü \195\188 ä \195\164 +-- Ä \195\132 +-- ö \195\182 +-- Ü \195\156 \ No newline at end of file diff --git a/locale_enUS.lua b/locale_enUS.lua new file mode 100644 index 0000000..3af8c5d --- /dev/null +++ b/locale_enUS.lua @@ -0,0 +1,65 @@ +local addonname, tab = ... +local name = "zz_Bags" +local L = LibStub("AceLocale-3.0"):NewLocale(name, "enUS", true) +if L then + L['Init module'] = function(v) return "Initializing module "..v end + L['Could not init module'] = function(v) return "Could not init module "..v end + L['Unspecified']=true + L['Quiver']=true + L['Ammo Pouch']=true + L['Soul Bag']=true + L['Leatherworking Bag']=true + L['Inscription Bag']=true + L['Herb Bag']=true + L['Enchanting Bag']=true + L['Engineering Bag']=true + L['Keyring']=true + L['Gem Bag']=true + L['Mining Bag']=true + L['Unknown']=true + L['Vanity Pets']=true + L['Fishing Supplies']=true + L['Cooking Supplies']=true + L['Toys']=true + L['Archaeology']=true + L['Alchemy']=true + L['Blacksmithing']=true + L['First Aid']=true + L['Jewelcrafting']=true + L['Skinning']=true + L['Tailoring']=true + L['Bagtypes']=true + L['Show free space']=true + L['Show free space instead of used space']=true + L['Refill'] = true + L['Items per Row']=true + L['Locked'] = true + L['Fix position of the window'] = true + L['Visible'] = true + L['Show window on startup'] = true + L['main_nav'] = function(v) + local i + local t = { + ['refill'] = "Refill - Configuration", + }; + if(t[v]) then + i = t[v] + end + if(not i) then + i = v + end + return i + end + L['empty_info'] = format("%s",name) + L['close'] = 'Close' + L['move'] = 'Move window' + L['refill here'] = 'Drag item here to add to refill list' + L['delete refill'] = 'Remove this refill' + L['solditem'] = function(link,price) return "Sold item "..link end + L['earnedmoney'] = function(m) return format("Goldgrowth: %s",tab['buildMoneyString'](m,false)) end + L['Autosell'] = true + L['Sells grey items to the next merchant'] = true + L["Bags to front"] = true + L["Bags to back"] = true + L["Toggle window"] = true +end \ No newline at end of file diff --git a/pack.xml b/pack.xml new file mode 100644 index 0000000..ee6073d --- /dev/null +++ b/pack.xml @@ -0,0 +1,6 @@ + +