Init
This commit is contained in:
commit
e75e661b57
|
@ -0,0 +1,3 @@
|
|||
[submodule "Common"]
|
||||
path = Common
|
||||
url = https://git.grml.de/rilgamon/Common.git
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 762c59c6c6abc6ecaa71f3e36bb2c6dd16b8e0ed
|
|
@ -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)
|
|
@ -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.
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,6 @@
|
|||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
|
||||
<script file="locale_deDE.lua"/>
|
||||
<script file="locale_enUS.lua"/>
|
||||
<script file="specialframe.lua"/>
|
||||
<Script file="core.lua"/>
|
||||
</Ui>
|
|
@ -0,0 +1,113 @@
|
|||
local addon, tab = ...
|
||||
local _G = _G
|
||||
|
||||
local function uniqueName(name)
|
||||
local unique,n = name.."1" ,1
|
||||
while(_G[unique]) do
|
||||
n = n + 1
|
||||
unique = format("%s%s",name,n)
|
||||
end
|
||||
return unique
|
||||
end
|
||||
|
||||
local function onclick(self)
|
||||
PanelTemplates_SetTab(self:GetParent(), self:GetID());
|
||||
end
|
||||
|
||||
local function createSpecialFrame(name, store, tabin)
|
||||
name = name or addon
|
||||
tabin = tabin or {}
|
||||
tabin['tex1'] = tabin['tex1'] or "Interface/TaxiFrame/UI-TaxiFrame-TopLeft.blp" -- 256x256
|
||||
tabin['tex1w'] = tabin['tex1w'] or 256
|
||||
tabin['tex1h'] = tabin['tex1h'] or 256
|
||||
tabin['tex2'] = tabin['tex2'] or "Interface/TaxiFrame/UI-TaxiFrame-TopRight" -- 128x256
|
||||
tabin['tex2w'] = tabin['tex2w'] or 128
|
||||
tabin['tex2h'] = tabin['tex2h'] or 256
|
||||
tabin['tex3'] = tabin['tex3'] or "Interface/TaxiFrame/UI-TaxiFrame-BotLeft" -- 256x256
|
||||
tabin['tex3w'] = tabin['tex3w'] or 256
|
||||
tabin['tex3h'] = tabin['tex3h'] or 256
|
||||
tabin['tex4'] = tabin['tex4'] or "Interface/TaxiFrame/UI-TaxiFrame-BotRight" -- 128x256
|
||||
tabin['tex4w'] = tabin['tex4w'] or 128
|
||||
tabin['tex4h'] = tabin['tex4h'] or 256
|
||||
tabin['tex5'] = tabin['tex5'] or "Interface/MERCHANTFRAME/UI-BuyBack-Icon" -- 64x64
|
||||
tabin['tex5w'] = tabin['tex5w'] or 64
|
||||
tabin['tex5h'] = tabin['tex5h'] or 64
|
||||
tabin['title'] = tabin['title'] or addon
|
||||
tabin['strata'] = tabin['strata'] or "MEDIUM"
|
||||
local frame = CreateFrame("Frame",uniqueName(name),UIParent)
|
||||
frame:SetWidth(348)
|
||||
frame:SetHeight(512)
|
||||
frame:SetPoint("CENTER",UIParent,"CENTER",0,0)
|
||||
frame['tab'] = store
|
||||
-- tab['loadFrame'](frame)
|
||||
tab['AddDrag'](frame)
|
||||
frame['title'] = frame:CreateFontString("$PARENTTitle","OVERLAY","GameFontNormal")
|
||||
frame['title']:SetPoint("TOP",frame,"TOP",0,-17)
|
||||
frame['title']:SetText(tabin['title'])
|
||||
frame['tex1'] = frame:CreateTexture(tabin['tex1'],tabin['strata'])
|
||||
frame['tex1f'] = CreateFrame("Frame","$PARENTt1",frame)
|
||||
frame['tex1f']:SetWidth(tabin['tex1w'])
|
||||
frame['tex1f']:SetFrameLevel(5)
|
||||
frame['tex1f']:SetHeight(tabin['tex1w'])
|
||||
frame['tex1']:SetAllPoints(frame['tex1f'])
|
||||
frame['tex1']:SetTexture(tabin['tex1'])
|
||||
frame['tex2'] = frame:CreateTexture(tabin['tex2'],tabin['strata'])
|
||||
frame['tex2f'] = CreateFrame("Frame","$PARENTt2",frame)
|
||||
frame['tex2f']:SetWidth(tabin['tex2w'])
|
||||
frame['tex2f']:SetHeight(tabin['tex2h'])
|
||||
frame['tex2']:SetAllPoints(frame['tex2f'])
|
||||
frame['tex2']:SetTexture(tabin['tex2'])
|
||||
frame['tex3'] = frame:CreateTexture(tabin['tex3'],tabin['strata'])
|
||||
frame['tex3f'] = CreateFrame("Frame","$PARENTt3",frame)
|
||||
frame['tex3f']:SetWidth(tabin['tex3w'])
|
||||
frame['tex3f']:SetHeight(tabin['tex3h'])
|
||||
frame['tex3']:SetAllPoints(frame['tex3f'])
|
||||
frame['tex3']:SetTexture(tabin['tex3'])
|
||||
frame['tex4'] = frame:CreateTexture(tabin['tex4'],tabin['strata'])
|
||||
frame['tex4f'] = CreateFrame("Frame","$PARENTt4",frame)
|
||||
frame['tex4f']:SetWidth(tabin['tex4w'])
|
||||
frame['tex4f']:SetHeight(tabin['tex4h'])
|
||||
frame['tex4']:SetAllPoints(frame['tex4f'])
|
||||
frame['tex4']:SetTexture(tabin['tex4'])
|
||||
frame['tex5'] = frame:CreateTexture(tabin['tex5'],"BACKGROUND")
|
||||
frame['tex5f'] = CreateFrame("Frame","$PARENTt5",frame)
|
||||
frame['tex5f']:SetWidth(tabin['tex5w'])
|
||||
frame['tex5f']:SetHeight(tabin['tex5h'])
|
||||
frame['tex5']:SetAllPoints(frame['tex5f'])
|
||||
frame['tex5']:SetTexture(tabin['tex5'])
|
||||
frame['tex5f']:SetFrameLevel(6)
|
||||
frame['tex1f']:SetPoint("TOPLEFT",frame,"TOPLEFT")
|
||||
frame['tex5f']:SetPoint("TOPLEFT",frame,"TOPLEFT",8,-5)
|
||||
frame['tex2f']:SetPoint("TOPRIGHT",frame,"TOPRIGHT")
|
||||
frame['tex3f']:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT")
|
||||
frame['tex4f']:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT")
|
||||
frame['closebutton'] = CreateFrame("Button","$PARENTCloseButton",frame,"UIPanelCloseButton")
|
||||
frame['closebutton']:SetPoint("TOPRIGHT",frame,"TOPRIGHT",-30,-8)
|
||||
frame['numTabs'] = tabin['numTabs'] or 0
|
||||
local prev = frame
|
||||
local anchor = "CENTER"
|
||||
local parentanchor = "BOTTOMLEFT"
|
||||
local x,y = 60,62
|
||||
local framenum
|
||||
if(frame['numTabs'] and frame['numTabs'] > 0) then
|
||||
for k = 1, frame['numTabs'] do
|
||||
framenum = format("frametab%d",k)
|
||||
frame[framenum] = CreateFrame("Button",format("$PARENTTab%d",k),frame,"CharacterFrameTabButtonTemplate")
|
||||
frame[framenum]:SetPoint(anchor,prev,parentanchor,x,y)
|
||||
frame[framenum]:SetFrameStrata("HIGH")
|
||||
frame[framenum]:SetText(tabin['tabtxt'..k] or "none")
|
||||
frame[framenum]:SetID(k)
|
||||
frame[framenum]:SetScript("OnClick", onclick)
|
||||
x = -16
|
||||
y = 0
|
||||
anchor = "LEFT"
|
||||
parentanchor = "RIGHT"
|
||||
prev = frame[framenum]
|
||||
end
|
||||
end
|
||||
PanelTemplates_SetTab(frame, 1);
|
||||
frame:Hide()
|
||||
return frame
|
||||
end
|
||||
|
||||
tab['createSpecialFrame'] = createSpecialFrame
|
|
@ -0,0 +1,15 @@
|
|||
## Interface: 90002
|
||||
## X-Repository: https://svn.grml.de/zz_Bags
|
||||
## X-WoWI-ID: 18952
|
||||
## X-Curse-Project-ID: 39076
|
||||
## X-TOC-Classic: 11302
|
||||
## Title: Bags
|
||||
## Notes: Broker displaying free bagspace
|
||||
## Notes-deDE: Broker Anzeige freier Taschenplatz
|
||||
## Author: Rilgamon
|
||||
## SavedVariables: zz_BagsDB
|
||||
## LoadManagers: AddonLoader
|
||||
## X-LoadOn-Always: delayed
|
||||
## OptionalDeps: Ace3,BrokerPack,zzLibCommon
|
||||
Common\common.xml
|
||||
pack.xml
|
Loading…
Reference in New Issue