WoWInterface SVN zz_UI

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 17 to Rev 18
    Reverse comparison

Rev 17 → Rev 18

zz_UI/pack.xml
1,4 → 1,3
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
<include file="Libs\LibBabble-Inventory-3.0\lib.xml"/>
<Script file="core.lua"/>
</Ui>
\ No newline at end of file
zz_UI/zz_UI.toc
1,4 → 1,4
## Interface: 60000
## Interface: 60200
## Title: zz UI
## Notes: All the stuff that does not fit elsewhere
## Author: Rilgamon
zz_UI/core.lua
1,7 → 1,5
local name, addon = ...
local LibBabble = LibStub("LibBabble-Inventory-3.0")
local LibBabbleDB = LibBabble:GetLookupTable()
local LibBabbleDBR = LibBabble:GetReverseLookupTable()
 
local hooked = {}
--[[*** Settings Start***]]
local HideBorder = true -- Hides the editboxborder when not active
216,233 → 214,7
end
end
end
--[[
Sendout stuff
]]--
local function GetUName()
local name = UnitName("player")
return name.."-"..realm
end
local sendouttable = {
['Tirion'] = {
['Trade Goods'] = {
['Leather'] = {
['Rilgalyco-Tirion'] = {
['order'] = 1,
['skip'] = {"Rilgamon-Tirion"},
},
},
['Cloth'] = {
['Ritalein-Tirion'] = {
['order'] = 1,
['skip'] = {},
},
},
['Elemental'] = {
['Rilgana-Tirion'] = {
['order'] = 1,
['skip'] = {"Ritalein-Tirion"},
},
},
['Cooking'] = {
['Rilgana-Tirion'] = {
['order'] = 1,
['skip'] = {},
},
},
['Enchanting'] = {
['Rilgana-Tirion'] = {
['order'] = 1,
['skip'] = {"Ritalein-Tirion"},
},
},
},
['Armor'] = {
['Plate'] = {
['Drilane-Durotan'] = {
['order'] = 1,
['skip'] = {},
},
},
['Cloth'] = {
['Drilane-Durotan'] = {
['order'] = 1,
['skip'] = {},
},
},
['Leather'] = {
['Drilane-Durotan'] = {
['order'] = 1,
['skip'] = {"Rilgalyco-Tirion"},
},
},
}
},
['Arygos'] = {
['Trade Goods'] = {
['Elemental'] = {
['Pastorella-Arygos'] = {
['order'] = 1,
['skip'] = {},
},
},
['Cloth'] = {
['Pastorella-Arygos'] = {
['order'] = 1,
['skip'] = {},
},
},
['Cooking'] = {
['Pastorella-Arygos'] = {
['order'] = 1,
['skip'] = {},
},
},
},
['Armor'] = {
['Plate'] = {
['Pastorella-Arygos'] = {
['order'] = 1,
['skip'] = {},
},
},
['Cloth'] = {
['Pastorella-Arygos'] = {
['order'] = 1,
['skip'] = {},
},
},
 
}
}
}
local cTip = CreateFrame("GameTooltip",name.."Tooltip",nil,"GameTooltipTemplate")
local function IsSoulbound(bag, slot)
cTip:SetOwner(UIParent, "ANCHOR_NONE")
cTip:SetBagItem(bag, slot)
cTip:Show()
for i = 1,cTip:NumLines() do
if(_G[name.."TooltipTextLeft"..i]:GetText()==ITEM_SOULBOUND) then
cTip:Hide()
return true
end
end
cTip:Hide()
return false
end
local function GetDestination(bag,slot)
if(IsSoulbound(bag, slot)) then return end
local texture, itemCount, locked, quality, readable, lootable, itemLink, isFiltered = GetContainerItemInfo(bag, slot)
if(itemLink) then
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(itemLink)
if(itemName) then
itemType = LibBabbleDBR[itemType]
itemSubType = LibBabbleDBR[itemSubType]
if(sendouttable[realm] and sendouttable[realm][itemType] and sendouttable[realm][itemType][itemSubType]) then
local tmp = sendouttable[realm][itemType][itemSubType]
sort(tmp, function(a,b)
return (a['order'] or 0) < (b['order'] or 0)
end)
for dest,destInfo in pairs(tmp) do
local doSkip = false
for _,skip in ipairs(destInfo['skip']) do
if(skip == GetUName()) then doSkip=true end
end
if(not doSkip) then
return dest
end
end
end
end
end
end
local function GetNumMailboxItems()
local count = 0
for i = 1, ATTACHMENTS_MAX_SEND do
local name, texture, count, quality = GetInboxItem(i)
if(name) then
count = count + 1
end
end
return count
end
 
sf_new = function()
local a,b = 0,0
local tab = {}
while(a<=NUM_BAG_SLOTS) do
b = 1
while(b<=GetContainerNumSlots(a)) do
local texture, itemCount, locked, quality, readable, lootable, itemLink, isFiltered = GetContainerItemInfo(a, b)
if(itemLink) then
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,
itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(itemLink)
if(itemName) then
tab[itemType] = tab[itemType] or {}
tab[itemType][itemSubType] = tab[itemType][itemSubType] or {}
tab[itemType][itemSubType][#tab[itemType][itemSubType] + 1] = {
['bag'] = a,
['slot'] = b,
}
end
end
b = b + 1
end
a = a + 1
end
for k,v in pairs(tab) do
local t = LibBabbleDBR[k]
for c,d in pairs(v) do
local target,firsttarget
local count = 0
local s = LibBabbleDBR[c]
print(t,s)
db['itemdb'][realm] = db['itemdb'][realm] or {}
db['itemdb'][realm][t] = db['itemdb'][realm][t] or {
['default'] = {
[GetUName()] = {
['order'] = 1,
['skip'] = {},
}
}
}
db['itemdb'][realm][t][s] = db['itemdb'][realm][t][s] or CopyTable(db['itemdb'][realm][t]['default'])
if(sendouttable[realm]) then
if(sendouttable[realm][t]) then
if(sendouttable[realm][t][s]) then
for g,h in pairs(d) do
target = GetDestination(tonumber(h['bag']),tonumber(h['slot']))
if(target) then
if(not firsttarget and target ~= GetUName()) then
firsttarget = target
end
if(target==firsttarget) then
UseContainerItem(tonumber(h['bag']),tonumber(h['slot']))
count = count + 1
end
end
end
end
end
end
if(firsttarget and count>0) then
C_Timer.After(0.25, function()
if(firsttarget and SendMailFrame:IsVisible()) then
SendMail(firsttarget,"Post",nil)
SELECTED_CHAT_FRAME:AddMessage("Sending "..firsttarget)
end
end)
return
end
end
 
end
end
SendMailFrame:HookScript("OnShow", function()
C_Timer.After(0.25, sf_new)
end)
 
 
local function OnEvent(self, event, arg1, ...)
if(arg1 == name and event=="ADDON_LOADED") then
if(PlayerFrame:IsUserPlaced()) then
486,8 → 258,6
updateClassColor("target")
elseif(event == "PLAYER_FOCUS_CHANGED") then
updateClassColor("focus")
elseif(event == "MAIL_SEND_SUCCESS") then
C_Timer.After(1,sf_new)
elseif(event == "MAIL_SHOW") then
-- sf_new()
elseif(event == "UNIT_INVENTORY_CHANGED") then
647,14 → 417,7
local function setPref(pref,value)
db[pref[#pref]] = value
end
local function getPrefI(pref)
print(pref[#pref-1],pref[#pref])
return db['itemdb'][realm][pref[#pref-2]][pref[#pref-1]][pref[#pref]]
end
 
local function setPrefI(pref,value)
db['itemdb'][realm][pref[#pref-2]][pref[#pref-1]][pref[#pref]] = value
end
local function getUNames()
local n = {}
for k,v in pairs(db['chardb']) do
662,36 → 425,6
end
return n
end
local function updatePrefs()
local p = addon['options']['args']['Types']['args']
for k, v in pairs(db['itemdb'][realm]) do
p[k] = {
['type'] = 'group',
['childGroups'] = 'tree',
['name'] = k,
['args'] = {},
}
for a,b in pairs(v) do
p[k]['args'][a]={
['type'] = 'group',
['name'] = a,
['get'] = getPrefI,
['set'] = setPrefI,
['args'] = {},
}
local c = p[k]['args'][a]['args']
for d,e in pairs(b) do
c[d] = {
['name'] = d,
['type'] = "group",
['args'] = {},
}
local f = c[d]['args']
 
end
end
end
end
 
local function init(self, ...)
realm = GetRealmName()
703,25 → 436,13
SetCVar(k,v)
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", addNotice)
if(Bartender4 and Bartender4.db) then
if(Bartender4.db:GetCurrentProfile() ~= "Default") then
Bartender4.db:SetProfile("Default")
end
end
addon['AddConfigMenu'](addon,{
['name'] = "Types",
['order'] = 2,
['childGroups'] = 'tree',
['menuGet'] = getPref,
['menuSet'] = setPref,
}, addon['options'])
db['itemdb'] = db['itemdb'] or {}
db['itemdb'][realm] = db['itemdb'][realm] or {}
 
 
HandleBar(PlayerFrameHealthBar)
HandleBar(TargetFrameHealthBar)
UpdateChar()
updatePrefs()
 
end
addon['startup'](addon, name, name, init, true, defaults)
addon['RegisterFunc']({'MAIL_INBOX_UPDATE','PLAYER_TARGET_CHANGED','PLAYER_FOCUS_CHANGED','UPDATE_CHAT_WINDOWS','ADDON_LOADED','PLAYER_ENTERING_WORLD','CHAT_MSG_SYSTEM','MAIL_SHOW','MAIL_CLOSE','MAIL_SEND_SUCCESS'},"OnEvent", OnEvent)
addon['RegisterFunc']({'MAIL_INBOX_UPDATE','PLAYER_TARGET_CHANGED','PLAYER_FOCUS_CHANGED','UPDATE_CHAT_WINDOWS','ADDON_LOADED','PLAYER_ENTERING_WORLD','CHAT_MSG_SYSTEM','MAIL_SHOW','MAIL_CLOSE'},"OnEvent", OnEvent)
addon['RegisterEventThrottle'](name,'UNIT_INVENTORY_CHANGED', 0.07, OnEvent)