WoWInterface SVN zz_UI

Compare Revisions

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

Rev 16 → Rev 17

zz_UI/core.lua
1,7 → 1,7
local name, addon = ...
local parentName = addon['parentName'] or "BrokerPack"
local childName = "zz_UI"
local _G = _G
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
9,7 → 9,7
local HideFriendButton = true -- Hide the friendsbutton
local Unsticky = true -- Dont remember whispers for next enter
local NoSay = true -- Dont default chat to say
 
local realm
local defaults = {
['cvars'] = {
['autoLootDefault'] = "1",
59,12 → 59,12
 
local function guildRoster(nameC)
for i=1,GetNumGuildMembers() do
local name, _, _, _, _, _, note, officernote, _ = GetGuildRosterInfo(i)
if(name == nameC) then
rosterOfficer[name] = officernote
rosterNotice[name] = note
return (rosterOfficer[name] and rosterOfficer[name]~="") and rosterOfficer[name] or (rosterNotice[name] or "")
end
local name, _, _, _, _, _, note, officernote, _ = GetGuildRosterInfo(i)
if(name == nameC) then
rosterOfficer[name] = officernote
rosterNotice[name] = note
return (rosterOfficer[name] and rosterOfficer[name]~="") and rosterOfficer[name] or (rosterNotice[name] or "")
end
end
return ""
end
165,7 → 165,7
end
 
local function OnText(message)
addon['OnText'](childName, message)
addon['OnText'](name, message)
end
local ClassColorUnits = {
["target"] = {
216,12 → 216,158
end
end
end
local sf_show = SendMailFrame:GetScript("OnShow")
local sf_new = function(self)
if(type(sf_show == 'function')) then
sf_show(self)
--[[
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
print("check")
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
231,41 → 377,74
if(itemLink) then
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,
itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(itemLink)
tab[itemType] = tab[itemType] or {}
tab[itemType][itemSubType] = tab[itemType][itemSubType] or {}
tab[itemType][itemSubType][#tab[itemType][itemSubType] + 1] = {
['bag'] = a,
['slot'] = b,
}
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
print(k,c,#d)
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
local function checkBags(on)
if(on) then
SendMailFrame:SetScript("OnShow", sf_new)
else
SendMailFrame:SetScript("OnShow", sf_show)
end
end
SendMailFrame:HookScript("OnShow", function()
C_Timer.After(0.25, sf_new)
end)
 
local function getPref(pref)
return db[pref[#pref]]
end
 
local function setPref(pref,value)
db[pref[#pref]] = value
end
 
local function OnEvent(self, event, arg1, ...)
if(arg1 == childName and event=="ADDON_LOADED") then
if(arg1 == name and event=="ADDON_LOADED") then
if(PlayerFrame:IsUserPlaced()) then
PlayerFrame:SetMoveable(false)
else
307,10 → 486,10
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
checkBags(true)
elseif(event == "MAIL_CLOSE") then
checkBags(false)
-- sf_new()
elseif(event == "UNIT_INVENTORY_CHANGED") then
if(itemCount()<12) then return end
if(UnitName("player") == dest) then
450,11 → 629,76
End Healthbar color Phanx
http://www.wowinterface.com/forums/showthread.php?p=302918#post302918
--]]
 
local function UpdateChar()
local name = UnitName('player')
local uname = name.."-"..realm
local _,class = UnitClass("player")
db['chardb'] = db['chardb'] or {}
db['chardb'][uname] = db['chardb'][uname] or {}
db['chardb'][uname]['level'] = UnitLevel("player")
db['chardb'][uname]['class'] = class
end
 
local function getPref(pref)
return db[pref[#pref]]
end
 
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
n[#n+1] = k
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, ...)
options = addon['InitConfig'](addon, childName, true, {
realm = GetRealmName()
options = addon['InitConfig'](addon, name, true, {
['type'] = "launcher",
}, getPref, setPref)
db = addon['db']['profile'][childName]
db = addon['db']['profile'][name]
for k, v in pairs(db['cvars']) do
SetCVar(k,v)
end
464,19 → 708,20
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, childName, 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'},"OnEvent", OnEvent)
addon['RegisterEventThrottle'](childName,'UNIT_INVENTORY_CHANGED', 0.07, OnEvent)
 
 
 
 
 
 
 
 
 
 
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['RegisterEventThrottle'](name,'UNIT_INVENTORY_CHANGED', 0.07, OnEvent)
zz_UI/pack.xml
1,3 → 1,4
<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