/trunk
local parentName = addon['parentName'] or "BrokerPack" |
local childName = "zz_UI" |
local _G = _G |
local hooked = {} |
--[[*** Settings Start***]] |
local HideBorder = true -- Hides the editboxborder when not active |
local UnClamp = true -- Make the window movable (take care! you can move it out of your screen) |
local HideFriendButton = true -- Hide the friendsbutton |
local Unsticky = true -- Dont remember whispers for next enter |
local NoSay = true -- Dont default chat to say |
local defaults = { |
['cvars'] = { |
['autoLootDefault'] = "1", |
return false |
end |
local function focusToggle(self) |
local name = self:GetName() |
if(self:HasFocus()) then |
_G[name..'Left']:Show() |
_G[name..'Right']:Show() |
_G[name..'Mid']:Show() |
else |
_G[name..'Left']:Hide() |
_G[name..'Right']:Hide() |
_G[name..'Mid']:Hide() |
end |
end |
local function hookFrame(self) |
if(not hooked[self]) then |
self:HookScript("OnEditFocusGained",focusToggle) |
self:HookScript("OnEditFocusLost",focusToggle) |
hooked[self] = true |
end |
return |
end |
local function apply(eb) |
local d = 'PARTY' |
local i, t = IsInInstance() |
if (t=='raid') then |
d = 'RAID' |
elseif (t=='party' or t=='pvp') then |
d = 'INSTANCE_CHAT' |
elseif (not i and GetNumGroupMembers()>0) then |
d = 'PARTY' |
elseif IsInGuild() then |
d = 'GUILD' |
end |
eb:SetAttribute("chatType", d) |
-- eb:SetAttribute("stickyType", d) |
end |
local function chatHoverIn(cf,link,text) |
local typ = string.match(link, "^(.-):") |
--[[ print(typ,link) |
local tbl = { strsplit(":", link) } |
for k,v in pairs(tbl) do |
print(v) |
end |
]]-- |
if(typ == "item" or typ == "enchant" or typ == "spell" or typ == "quest") then |
ShowUIPanel(GameTooltip) |
GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR") |
local function OnText(message) |
addon['OnText'](childName, message) |
end |
local ClassColorUnits = { |
["target"] = { |
["name"] = "TargetFrame", |
["back"] = "TargetFrame", |
["x-offset"] = -104, |
["y-offset"] = 60, |
["x-offset2"] = 6, |
["y-offset2"] = -22, |
}, |
["player"] = { |
["name"] = "PlayerFrame", |
["back"] = "PlayerFrameBackground", |
["x-offset"] = 0, |
["y-offset"] = 22, |
["x-offset2"] = 0, |
["y-offset2"] = 0, |
}, |
["focus"] = { |
["name"] = "FocusFrame", |
["back"] = "FocusFrame", |
["x-offset"] = -104, |
["y-offset"] = 60, |
["x-offset2"] = 6, |
["y-offset2"] = -22, |
}, |
} |
local function updateClassColor(unit) |
if(unit and UnitExists(unit)) then |
local _,class = UnitClass(unit) |
if(class and RAID_CLASS_COLORS[class]) then |
if(ClassColorUnits[unit]) then |
local uf = _G[ClassColorUnits[unit]['name']] |
local bg = _G[ClassColorUnits[unit]['back']] |
if(not uf['unitClassColorBack']) then |
uf['unitClassColorBack'] = uf:CreateTexture(nil, "ARTWORK") |
uf['unitClassColorBack']:SetPoint("TOPLEFT", bg, ClassColorUnits[unit]['x-offset2'], ClassColorUnits[unit]['y-offset2']) |
uf['unitClassColorBack']:SetPoint("BOTTOMRIGHT", bg, ClassColorUnits[unit]['x-offset'], ClassColorUnits[unit]['y-offset']) |
uf['unitClassColorBack']:SetTexture("Interface\\TargetingFrame\\UI-StatusBar") |
end |
local col = RAID_CLASS_COLORS[class] |
if(not UnitIsPlayer(unit)) then |
uf['unitClassColorBack']:SetVertexColor(0, 0, 0, 0) |
else |
uf['unitClassColorBack']:SetVertexColor(col['r'], col['g'], col['b'],1) |
end |
end |
end |
end |
end |
local function getPref(pref) |
return db[pref[#pref]] |
end |
local function OnEvent(self, event, arg1, ...) |
if(arg1 == childName and event=="ADDON_LOADED") then |
-- print(name, event, tostring(PlayerFrame:IsUserPlaced())) |
PlayerFrame:SetUserPlaced(true) |
PlayerFrame:ClearAllPoints() |
PlayerFrame:SetPoint("RIGHT", UIParent, "CENTER", 0, -140) |
-- TargetFrame:SetUserPlaced(true) |
-- TargetFrame:ClearAllPoints() |
TargetFrame:SetPoint("TOPLEFT", PlayerFrame, "TOPRIGHT",0,0) |
if(PlayerFrame:IsUserPlaced()) then |
PlayerFrame:SetMoveable(true) |
else |
PlayerFrame:SetUserPlaced(true) |
PlayerFrame:ClearAllPoints() |
PlayerFrame:SetPoint("RIGHT", UIParent, "CENTER", 0, -140) |
end |
if(not TargetFrame:IsUserPlaced()) then |
TargetFrame:SetUserPlaced(true) |
TargetFrame:ClearAllPoints() |
TargetFrame:SetPoint("TOPLEFT", PlayerFrame, "TOPRIGHT",0,0) |
else |
TargetFrame:SetMoveable(true) |
end |
self:UnregisterEvent(event) |
-- Remove the cancel button (Reduce the taint caused by InterfaceOptionsFrame src: http://www.wowinterface.com/forums/showpost.php?p=275119&postcount=17 ) |
InterfaceOptionsFrameCancel:SetScript("OnClick", function() |
InterfaceOptionsFrameOkay:Click() |
end) |
if(HideFriendButton) then |
local fb = _G['FriendsMicroButton'] |
fb:UnregisterAllEvents() |
if(not hooked[fb]) then |
fb:HookScript("OnShow", function(self) self:Hide() end) |
hooked[fb] = true |
end |
fb:Hide() |
end |
if(Unsticky) then |
ChatTypeInfo['WHISPER']['sticky'] = 0 |
ChatTypeInfo['BN_WHISPER']['sticky'] = 0 |
end |
-- PlayerFrame:SetUserPlaced(true) |
elseif(event == "PLAYER_TARGET_CHANGED") then |
updateClassColor("target") |
elseif(event == "PLAYER_FOCUS_CHANGED") then |
updateClassColor("focus") |
elseif(event == "UNIT_INVENTORY_CHANGED") then |
if(itemCount()<12) then return end |
if(UnitName("player") == dest) then |
if(cfname == iname) then |
ifound = true |
end |
if(UnClamp) then |
local cf = _G['ChatFrame'..i] |
cf:SetClampedToScreen(false) |
cf:Raise() |
end |
if(HideBorder) then |
local ef = _G['ChatFrame'..i..'EditBox'] |
focusToggle(ef) |
hookFrame(ef) |
end |
end |
if(not ifound) then |
local frame = FCF_OpenNewWindow(iname) |
FCF_DockUpdate() |
end |
self:UnregisterEvent(event) |
elseif(event == 'PLAYER_ENTERING_WORLD') then |
for i = 1, NUM_CHAT_WINDOWS do |
if(NoSay) then |
local eb = _G['ChatFrame'..i..'EditBox'] |
apply(eb) |
if(not hooked['NoSay']) then |
-- hooksecurefunc(ChatEdit_OnLoad, apply) |
hooked['NoSay'] = true |
end |
end |
end |
updateClassColor("player") |
elseif(event == 'CHAT_MSG_SYSTEM') then -- http://www.wowinterface.com/downloads/info23035-AFKQuit.html |
if(arg1 and arg1 == IDLE_MESSAGE) then |
ForceQuit() |
end |
end |
end |
local function init(self, ...) |
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", addNotice) |
end |
addon['startup'](addon, name, childName, init, true, defaults) |
addon['RegisterFunc']({'UPDATE_CHAT_WINDOWS','ADDON_LOADED'},"OnEvent", OnEvent) |
addon['RegisterEventThrottle'](childName,'UNIT_INVENTORY_CHANGED', 0.07, OnEvent) |
if(not lpanels) return end |
local rilgamonHeight = 200 |
local rilgamonWidth = rilgamonHeight * 2 |
local rilgamonTopHeight = 22 |