Skip to content

Instantly share code, notes, and snippets.

Created June 25, 2010 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/453121 to your computer and use it in GitHub Desktop.
Save anonymous/453121 to your computer and use it in GitHub Desktop.
-- ACTION BAR PANEL
TukuiDB.buttonsize = TukuiDB:Scale(27)
TukuiDB.buttonspacing = TukuiDB:Scale(4)
TukuiDB.petbuttonsize = TukuiDB:Scale(29)
TukuiDB.petbuttonspacing = TukuiDB:Scale(4)
local barbg = CreateFrame("Frame", "TukuiActionBarBackground", UIParent)
TukuiDB:CreatePanel(barbg, 1, 1, "BOTTOM", UIParent, "BOTTOM", 0, TukuiDB:Scale(14))
if TukuiDB.lowversion == true then
barbg:SetWidth((TukuiDB.buttonsize * 12) + (TukuiDB.buttonspacing * 13))
if TukuiDB["actionbar"].bottomrows == 2 then
barbg:SetHeight((TukuiDB.buttonsize * 2) + (TukuiDB.buttonspacing * 3))
else
barbg:SetHeight(TukuiDB.buttonsize + (TukuiDB.buttonspacing * 2))
end
else
barbg:SetWidth((TukuiDB.buttonsize * 22) + (TukuiDB.buttonspacing * 23))
if TukuiDB["actionbar"].bottomrows == 2 then
barbg:SetHeight((TukuiDB.buttonsize * 2) + (TukuiDB.buttonspacing * 3))
else
barbg:SetHeight(TukuiDB.buttonsize + (TukuiDB.buttonspacing * 2))
end
end
-- LEFT VERTICAL LINE
local ileftlv = CreateFrame("Frame", "TukuiInfoLeftLineVertical", barbg)
TukuiDB:CreatePanel(ileftlv, 2, 130, "BOTTOMLEFT", UIParent, "BOTTOMLEFT", TukuiDB:Scale(22), TukuiDB:Scale(30))
-- RIGHT VERTICAL LINE
local irightlv = CreateFrame("Frame", "TukuiInfoRightLineVertical", barbg)
TukuiDB:CreatePanel(irightlv, 2, 130, "BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", TukuiDB:Scale(-22), TukuiDB:Scale(30))
-- CUBE AT LEFT, WILL ACT AS A BUTTON
local cubeleft = CreateFrame("Frame", "TukuiCubeLeft", barbg)
TukuiDB:CreatePanel(cubeleft, 10, 10, "BOTTOM", ileftlv, "TOP", 0, 0)
-- CUBE AT RIGHT, WILL ACT AS A BUTTON
local cuberight = CreateFrame("Frame", "TukuiCubeRight", barbg)
TukuiDB:CreatePanel(cuberight, 10, 10, "BOTTOM", irightlv, "TOP", 0, 0)
-- HORIZONTAL LINE LEFT
local ltoabl = CreateFrame("Frame", "TukuiLineToABLeft", barbg)
TukuiDB:CreatePanel(ltoabl, 5, 2, "BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0)
ltoabl:ClearAllPoints()
ltoabl:SetPoint("BOTTOMLEFT", ileftlv, "BOTTOMLEFT", 0, 0)
ltoabl:SetPoint("RIGHT", barbg, "BOTTOMLEFT", TukuiDB:Scale(-1), TukuiDB:Scale(17))
-- HORIZONTAL LINE RIGHT
local ltoabr = CreateFrame("Frame", "TukuiLineToABRight", barbg)
TukuiDB:CreatePanel(ltoabr, 5, 2, "BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0)
ltoabr:ClearAllPoints()
ltoabr:SetPoint("LEFT", barbg, "BOTTOMRIGHT", TukuiDB:Scale(1), TukuiDB:Scale(17))
ltoabr:SetPoint("BOTTOMRIGHT", irightlv, "BOTTOMRIGHT", 0, 0)
-- INFO LEFT (FOR STATS)
local ileft = CreateFrame("Frame", "TukuiInfoLeft", barbg)
TukuiDB:CreatePanel(ileft, TukuiDB["panels"].tinfowidth, 23, "LEFT", ltoabl, "LEFT", TukuiDB:Scale(14), 0)
ileft:SetFrameLevel(2)
-- INFO RIGHT (FOR STATS)
local iright = CreateFrame("Frame", "TukuiInfoRight", barbg)
TukuiDB:CreatePanel(iright, TukuiDB["panels"].tinfowidth, 23, "RIGHT", ltoabr, "RIGHT", TukuiDB:Scale(-14), 0)
iright:SetFrameLevel(2)
-- CHAT EDIT BOX
for i = 1, NUM_CHAT_WINDOWS do
ChatFrameEditBox = _G["ChatFrame"..i.."EditBox"]
local edit = CreateFrame("Frame", "TukuiChatFrameEditBoxBackground", ChatFrameEditBox)
TukuiDB:CreatePanel(edit, 1, 1, "LEFT", "ChatFrameEditBox", "LEFT", 0, 0)
edit:ClearAllPoints()
edit:SetAllPoints(ileft)
edit:SetFrameStrata("HIGH")
edit:SetFrameLevel(2)
local function colorize(r,g,b)
edit:SetBackdropBorderColor(r, g, b)
end
hooksecurefunc("ChatEdit_UpdateHeader", function()
local activechat = _G["ChatFrame"..i]
local type = activechat.editBox:GetAttribute("chatType")
if ( type == "CHANNEL" ) then
local id = GetChannelName(activechat.editBox:GetAttribute("channelTarget"))
if id == 0 then
colorize(0.6,0.6,0.6)
else
colorize(ChatTypeInfo[type..id].r,ChatTypeInfo[type..id].g,ChatTypeInfo[type..id].b)
end
else
colorize(ChatTypeInfo[type].r,ChatTypeInfo[type].g,ChatTypeInfo[type].b)
end
end)
end
if TukuiMinimap then
local minimapstatsleft = CreateFrame("Frame", "TukuiMinimapStatsLeft", TukuiMinimap)
TukuiDB:CreatePanel(minimapstatsleft, ((TukuiMinimap:GetWidth() + 4) / 2) - 1, 19, "TOPLEFT", TukuiMinimap, "BOTTOMLEFT", 0, TukuiDB:Scale(-2))
local minimapstatsright = CreateFrame("Frame", "TukuiMinimapStatsRight", TukuiMinimap)
TukuiDB:CreatePanel(minimapstatsright, ((TukuiMinimap:GetWidth() + 4) / 2) -1, 19, "TOPRIGHT", TukuiMinimap, "BOTTOMRIGHT", 0, TukuiDB:Scale(-2))
end
--RIGHT BAR BACKGROUND
if TukuiDB["actionbar"].enable == true or not (IsAddOnLoaded("Dominos") or IsAddOnLoaded("Bartender4") or IsAddOnLoaded("Macaroon")) then
local barbgr = CreateFrame("Frame", "TukuiActionBarBackgroundRight", MultiBarRight)
TukuiDB:CreatePanel(barbgr, 1, (TukuiDB.buttonsize * 12) + (TukuiDB.buttonspacing * 13), "RIGHT", UIParent, "RIGHT", TukuiDB:Scale(-23), TukuiDB:Scale(-13.5))
if TukuiDB["actionbar"].rightbars == 1 then
barbgr:SetWidth(TukuiDB.buttonsize + (TukuiDB.buttonspacing * 2))
elseif TukuiDB["actionbar"].rightbars == 2 then
barbgr:SetWidth((TukuiDB.buttonsize * 2) + (TukuiDB.buttonspacing * 3))
elseif TukuiDB["actionbar"].rightbars == 3 then
barbgr:SetWidth((TukuiDB.buttonsize * 3) + (TukuiDB.buttonspacing * 4))
else
barbgr:Hide()
end
if TukuiDB["actionbar"].rightbars > 0 then
local rbl = CreateFrame("Frame", "TukuiRightBarLine", barbgr)
local crblu = CreateFrame("Frame", "TukuiCubeRightBarUP", barbgr)
local crbld = CreateFrame("Frame", "TukuiCubeRightBarDown", barbgr)
TukuiDB:CreatePanel(rbl, 2, (TukuiDB.buttonsize / 2 * 27) + (TukuiDB.buttonspacing * 6), "RIGHT", barbgr, "RIGHT", TukuiDB:Scale(1), 0)
rbl:SetWidth(TukuiDB:Scale(2))
TukuiDB:CreatePanel(crblu, 10, 10, "BOTTOM", rbl, "TOP", 0, 0)
TukuiDB:CreatePanel(crbld, 10, 10, "TOP", rbl, "BOTTOM", 0, 0)
end
local petbg = CreateFrame("Frame", "TukuiPetActionBarBackground", PetActionButton1)
if TukuiDB["actionbar"].rightbars > 0 then
TukuiDB:CreatePanel(petbg, TukuiDB.petbuttonsize + (TukuiDB.petbuttonspacing * 2), (TukuiDB.petbuttonsize * 10) + (TukuiDB.petbuttonspacing * 11), "RIGHT", barbgr, "LEFT", TukuiDB:Scale(-6), 0)
else
TukuiDB:CreatePanel(petbg, TukuiDB.petbuttonsize + (TukuiDB.petbuttonspacing * 2), (TukuiDB.petbuttonsize * 10) + (TukuiDB.petbuttonspacing * 11), "RIGHT", UIParent, "RIGHT", TukuiDB:Scale(-6), TukuiDB:Scale(-13.5))
end
local ltpetbg1 = CreateFrame("Frame", "TukuiLineToPetActionBarBackground", petbg)
TukuiDB:CreatePanel(ltpetbg1, 30, 265, "TOPLEFT", petbg, "TOPRIGHT", 0, TukuiDB:Scale(-33))
ltpetbg1:SetFrameLevel(0)
ltpetbg1:SetAlpha(.8)
end
--BATTLEGROUND STATS FRAME
if TukuiDB["datatext"].battleground == true then
local bgframe = CreateFrame("Frame", "TukuiInfoLeftBattleGround", UIParent)
TukuiDB:CreatePanel(bgframe, 1, 1, "TOPLEFT", Minimap, "BOTTOMLEFT", 0, 0)
bgframe:SetAllPoints(ileft)
bgframe:SetFrameStrata("MEDIUM")
bgframe:EnableMouse(true)
local function OnEvent(self, event)
if event == "PLAYER_ENTERING_WORLD" then
inInstance, instanceType = IsInInstance()
if inInstance and (instanceType == "pvp") then
bgframe:Show()
else
bgframe:Hide()
end
end
end
bgframe:SetScript("OnEnter", function(self)
local numScores = GetNumBattlefieldScores()
for i=1, numScores do
name, killingBlows, honorKills, deaths, honorGained, faction, rank, race, class, classToken, damageDone, healingDone = GetBattlefieldScore(i);
if ( name ) then
if ( name == UnitName("player") ) then
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, TukuiDB:Scale(4));
GameTooltip:ClearLines()
GameTooltip:SetPoint("BOTTOM", self, "TOP", 0, TukuiDB:Scale(1))
GameTooltip:ClearLines()
GameTooltip:AddLine(tukuilocal.datatext_ttstatsfor.."[|cffCC0033"..name.."|r]")
GameTooltip:AddLine' '
GameTooltip:AddDoubleLine(tukuilocal.datatext_ttkillingblows, killingBlows,1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_tthonorkills, honorKills,1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_ttdeaths, deaths,1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_tthonorgain, honorGained,1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_ttdmgdone, damageDone,1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_tthealdone, healingDone,1,1,1)
--Add extra statistics to watch based on what BG you are in.
if GetRealZoneText() == "Arathi Basin" then --
GameTooltip:AddDoubleLine(tukuilocal.datatext_basesassaulted,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_basesdefended,GetBattlefieldStatData(i, 2),1,1,1)
elseif GetRealZoneText() == "Warsong Gulch" then --
GameTooltip:AddDoubleLine(tukuilocal.datatext_flagscaptured,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_flagsreturned,GetBattlefieldStatData(i, 2),1,1,1)
elseif GetRealZoneText() == "Eye of the Storm" then --
GameTooltip:AddDoubleLine(tukuilocal.datatext_flagscaptured,GetBattlefieldStatData(i, 1),1,1,1)
elseif GetRealZoneText() == "Alterac Valley" then
GameTooltip:AddDoubleLine(tukuilocal.datatext_graveyardsassaulted,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_graveyardsdefended,GetBattlefieldStatData(i, 2),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_towersassaulted,GetBattlefieldStatData(i, 3),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_towersdefended,GetBattlefieldStatData(i, 4),1,1,1)
elseif GetRealZoneText() == "Strand of the Ancients" then
GameTooltip:AddDoubleLine(tukuilocal.datatext_demolishersdestroyed,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_gatesdestroyed,GetBattlefieldStatData(i, 2),1,1,1)
elseif GetRealZoneText() == "Isle of Conquest" then
GameTooltip:AddDoubleLine(tukuilocal.datatext_basesassaulted,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_basesdefended,GetBattlefieldStatData(i, 2),1,1,1)
end
GameTooltip:Show()
end
end
end
end)
bgframe:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
bgframe:RegisterEvent("PLAYER_ENTERING_WORLD")
bgframe:SetScript("OnEvent", OnEvent)
-- this part is to enable left cube as a button for battleground stat panel.
local function CubeLeftClick(self, event)
if event == "ZONE_CHANGED_NEW_AREA" or event == "PLAYER_ENTERING_WORLD" then
cubeleft:SetBackdropBorderColor(unpack(TukuiDB["media"].bordercolor))
inInstance, instanceType = IsInInstance()
if TukuiDB["datatext"].battleground == true and (inInstance and (instanceType == "pvp")) then
cubeleft:EnableMouse(true)
else
cubeleft:EnableMouse(false)
end
end
end
cubeleft:SetScript("OnMouseDown", function()
if bgframe:IsShown() then
bgframe:Hide()
cubeleft:SetBackdropBorderColor(0.78,0.03,0.08)
else
cubeleft:SetBackdropBorderColor(unpack(TukuiDB["media"].bordercolor))
bgframe:Show()
end
end)
cubeleft:RegisterEvent("ZONE_CHANGED_NEW_AREA")
cubeleft:RegisterEvent("PLAYER_ENTERING_WORLD")
cubeleft:SetScript("OnEvent", CubeLeftClick)
end
local LSM = LibStub("LibSharedMedia-3.0")
OUI = LibStub("AceAddon-3.0"):GetAddon("OUI")
TukuiDB.buttonsize = OUI:Scale(25)
TukuiDB.buttonspacing = OUI:Scale(4)
TukuiDB.petbuttonsize = OUI:Scale(25)
TukuiDB.petbuttonspacing = OUI:Scale(4)
buttonsize = TukuiDB.buttonsize
buttonspacing = TukuiDB.buttonspacing
petbuttonsize = TukuiDB.petbuttonsize
petbuttonspacing = TukuiDB.petbuttonspacing
--------------------------------------------------------------------------------
-- INFO LEFT (FOR STATS)
local ileft = CreateFrame("Frame", "InfoLeft", UIParent)
OUI:CreatePanel(ileft, OUI.db.profile.LF.tinfowidth - 18, OUI:Scale(23), "BOTTOMLEFT", UIParent, OUI:Scale(4), OUI:Scale(4))
ileft:SetFrameLevel(2)
-- INFO RIGHT (FOR STATS)
local iright = CreateFrame("Frame", "InfoRight", UIParent)
OUI:CreatePanel(iright, OUI.db.profile.LF.tinfowidth - 18, OUI:Scale(23), "BOTTOMRIGHT", UIParent, OUI:Scale(-4), OUI:Scale(4))
iright:SetFrameLevel(2)
-- CHAT EDIT BOX
for i = 1, NUM_CHAT_WINDOWS do
ChatFrameEditBox = _G["ChatFrame"..i.."EditBox"]
local edit = CreateFrame("Frame", "TukuiChatFrameEditBoxBackground", ChatFrameEditBox)
OUI:CreatePanel(edit, 1, 1, "LEFT", "ChatFrameEditBox", "LEFT", 0, 0)
edit:ClearAllPoints()
edit:SetAllPoints(ileft)
edit:SetFrameStrata("HIGH")
edit:SetFrameLevel(2)
local function colorize(r,g,b)
edit:SetBackdropBorderColor(r, g, b)
end
hooksecurefunc("ChatEdit_UpdateHeader", function()
local activechat = _G["ChatFrame"..i]
local type = activechat.editBox:GetAttribute("chatType")
if ( type == "CHANNEL" ) then
local id = GetChannelName(activechat.editBox:GetAttribute("channelTarget"))
if id == 0 then
colorize(0.6,0.6,0.6)
else
colorize(ChatTypeInfo[type..id].r,ChatTypeInfo[type..id].g,ChatTypeInfo[type..id].b)
end
else
colorize(ChatTypeInfo[type].r,ChatTypeInfo[type].g,ChatTypeInfo[type].b)
end
end)
end
-- NEW STAT PANELS // MINIMAP
local minimapstatsleft = CreateFrame("Frame", "MinimapStatsLeft", MapBorder)
OUI:CreatePanel(minimapstatsleft, (MapBorder:GetWidth() / 2), 19, "TOPLEFT", MapBorder, "BOTTOMLEFT", 0, OUI:Scale(-4))
local minimapstatsright = CreateFrame("Frame", "MinimapStatsRight", MapBorder)
OUI:CreatePanel(minimapstatsright, (MapBorder:GetWidth() / 2), 19, "TOPRIGHT", MapBorder, "BOTTOMRIGHT", 0, OUI:Scale(-4))
-- CHAT BACKGROUNDS
local chatlbg = CreateFrame("Frame", "ChatLBackground", UIParent)
OUI:CreatePanel(chatlbg, OUI.db.profile.LF.tinfowidth - 18, 116, "BOTTOMLEFT", ileft, "TOPLEFT", 0, OUI:Scale(4))
chatlbg:SetFrameLevel(2)
if OUI.db.profile.Skins.chat_left == false then
chatlbg:SetAlpha(0)
end
local chatrbg = CreateFrame("Frame", "ChatRBackground", UIParent)
OUI:CreatePanel(chatrbg, OUI.db.profile.LF.tinfowidth - 18, 116, "BOTTOMRIGHT", iright, "TOPRIGHT", 0, OUI:Scale(4))
chatrbg:SetFrameLevel(2)
if OUI.db.profile.Skins.chat_right == false then
chatrbg:SetAlpha(0)
end
--RIGHT BAR BACKGROUND
--horizonbars by eclipse
if OUI.db.profile.Actionbar.enable == true or not (IsAddOnLoaded("Dominos") or IsAddOnLoaded("Bartender4") or IsAddOnLoaded("Macaroon")) then
local barbgr = CreateFrame("Frame", "TukuiActionBarBackgroundRight", MultiBarRight)
if OUI.db.profile.Actionbar.horizonbars == true then
OUI:CreatePanel(barbgr, (buttonsize * 12) + (buttonspacing * 13), 1, "BOTTOMRIGHT", ChatRBackground, "TOPRIGHT", OUI:Scale(0), OUI:Scale(3))
if OUI.db.profile.Actionbar.rightbars == 1 then
barbgr:SetHeight(buttonsize + (buttonspacing * 2))
elseif OUI.db.profile.Actionbar.rightbars == 2 then
barbgr:SetHeight((buttonsize * 2) + (buttonspacing * 3))
elseif OUI.db.profile.Actionbar.rightbars == 3 then
barbgr:SetHeight((buttonsize * 2) + (buttonspacing * 3))
else
barbgr:Hide()
end
else
OUI:CreatePanel(barbgr, 1, (buttonsize * 12) + (buttonspacing * 13), "BOTTOMRIGHT", ChatRBackground, "TOPRIGHT", OUI:Scale(0), OUI:Scale(3))
if OUI.db.profile.Actionbar.rightbars == 1 then
barbgr:SetWidth(buttonsize + (buttonspacing * 2))
elseif OUI.db.profile.Actionbar.rightbars == 2 then
barbgr:SetWidth((buttonsize * 2) + (buttonspacing * 3))
elseif OUI.db.profile.Actionbar.rightbars == 3 then
barbgr:SetWidth((buttonsize * 2) + (buttonspacing * 3))
else
barbgr:Hide()
end
end
local petbg = CreateFrame("Frame", "PetTukuiActionBarBackground", PetActionButton1)
if OUI.db.profile.Actionbar.horizonbars == true then
if OUI.db.profile.Actionbar.rightbars > 0 then
OUI:CreatePanel(petbg, (petbuttonsize * 10)+ (petbuttonspacing * 11), petbuttonsize + (petbuttonspacing * 2), "BOTTOMRIGHT", barbgr, "TOPRIGHT", 0, OUI:Scale(3))
else
OUI:CreatePanel(petbg, (petbuttonsize * 10) + (petbuttonspacing * 11), petbuttonsize + (petbuttonspacing * 2), "BOTTOMRIGHT", ChatRBackground, "TOPRIGHT", 0, OUI:Scale(3))
end
else
if OUI.db.profile.Actionbar.rightbars > 0 then
OUI:CreatePanel(petbg, petbuttonsize + (petbuttonspacing * 2), (petbuttonsize * 10) + (petbuttonspacing * 11), "BOTTOMRIGHT", barbgr, "BOTTOMLEFT", OUI:Scale(-3), 0)
else
OUI:CreatePanel(petbg, petbuttonsize + (petbuttonspacing * 2), (petbuttonsize * 10) + (petbuttonspacing * 11), "BOTTOMRIGHT", ChatRBackground, "TOPRIGHT", OUI:Scale(0), OUI:Scale(3))
end
end
end
-- INFO CENTER (FOR STATS)
local icenter = CreateFrame("Frame", "InfoCenter", UIParent)
local function OnEvent(self, event)
if event == "ZONE_CHANGED_NEW_AREA" or event == "PLAYER_ENTERING_WORLD" then
InInstance, instanceType = IsInInstance()
if OUI.db.profile.General.bgstats == true and (InInstance and (instanceType == "pvp")) then
icenter:EnableMouse(true)
else
icenter:EnableMouse(false)
end
end
end
icenter:SetScript("OnMouseDown", function()
if BattleGroundInfo:IsShown() then
BattleGroundInfo:Hide()
else
BattleGroundInfo:Show()
end
end)
icenter:RegisterEvent("ZONE_CHANGED_NEW_AREA")
icenter:RegisterEvent("PLAYER_ENTERING_WORLD")
icenter:SetScript("OnEvent", OnEvent)
OUI:CreatePanel(icenter, OUI.db.profile.LF.centerinfowidth + 190, 23, "BOTTOM", UIParent, 0, OUI:Scale(4))
icenter:SetFrameLevel(2)
-- workaround so reloadui doesnt taint the ui and crash
StaticPopupDialogs["RELOAD_ME"] = {
text = "Reload UI?",
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = ReloadUI,
timeout = 0,
whileDead = 1,
}
-- Left Lower Cube will toggle Omen
if OUI.db.profile.General.CubeLeft ~= 1 then
local cubeleft = CreateFrame("Frame", "CubeLeft", icenter)
OUI:CreatePanel(cubeleft, 10, 10, "LEFT", icenter, "LEFT", OUI:Scale(-13), 0)
cubeleft:EnableMouse(true)
cubeleft:SetScript("OnMouseDown", function()
if IsAddOnLoaded("Recount") and OUI.db.profile.General.CubeLeft == 2 then
if Recount.MainWindow:IsShown() then
Recount.MainWindow:Hide()
else
Recount.MainWindow:Show()
Recount:RefreshMainWindow()
end
elseif IsAddOnLoaded("Omen") and OUI.db.profile.General.CubeLeft == 3 then
if OmenBarList:IsShown() then
OmenBarList:Hide()
OmenTitle:Hide()
else
OmenBarList:Show()
OmenTitle:Show()
end
elseif OUI.db.profile.General.CubeLeft == 4 then
StaticPopup_Show("RELOAD_ME")
elseif OUI.db.profile.General.CubeLeft == 5 then
Quit() --logout of game
elseif OUI.db.profile.General.CubeLeft == 6 then
InterfaceOptionsFrame_OpenToCategory("OUI")
end
end)
end
-- Right Lower Cube will toggle Recount
if OUI.db.profile.General.CubeRight ~= 1 then
local cuberight = CreateFrame("Frame", "CubeRight", icenter)
OUI:CreatePanel(cuberight, 10, 10, "RIGHT", icenter, "RIGHT", OUI:Scale(13), 0)
cuberight:EnableMouse(true)
cuberight:SetScript("OnMouseDown", function()
if IsAddOnLoaded("Recount") and OUI.db.profile.General.CubeRight == 2 then
if Recount.MainWindow:IsShown() then
Recount.MainWindow:Hide()
else
Recount.MainWindow:Show()
Recount:RefreshMainWindow()
end
elseif IsAddOnLoaded("Omen") and OUI.db.profile.General.CubeRight == 3 then
if OmenBarList:IsShown() then
OmenBarList:Hide()
OmenTitle:Hide()
else
OmenBarList:Show()
OmenTitle:Show()
end
elseif OUI.db.profile.General.CubeRight == 4 then
StaticPopup_Show("RELOAD_ME")
elseif OUI.db.profile.General.CubeRight == 5 then
Quit() --logout of game
elseif OUI.db.profile.General.CubeRight == 6 then
InterfaceOptionsFrame_OpenToCategory("OUI")
end
end)
end
local barbg = CreateFrame("Frame", "TukuiActionBarBackground", UIParent)
OUI:CreatePanel(barbg, 1, 1, "BOTTOM", icenter, "TOP", 0, OUI:Scale(4))
if OUI.db.profile.LF.lowres == true then
if OUI.db.profile.Actionbar.bottombars > 1 then
barbg:SetWidth((buttonsize * 12) + (buttonspacing * 13))
barbg:SetHeight((buttonsize * 2) + (buttonspacing * 3))
else
barbg:SetWidth((buttonsize * 12) + (buttonspacing * 13))
barbg:SetHeight((buttonsize * 1) + (buttonspacing * 2))
end
else
if OUI.db.profile.Actionbar.bottombars > 1 then
barbg:SetWidth((buttonsize * 12) + (buttonspacing * 13))
barbg:SetHeight((buttonsize * 2) + (buttonspacing * 3))
else
barbg:SetWidth((buttonsize * 12) + (buttonspacing * 13))
barbg:SetHeight((buttonsize * 1) + (buttonspacing * 2))
end
end
--SPLIT BAR BACKGROUND
local splitrbg = CreateFrame("Frame", "ActionBarSplitLeftBackground", UIParent)
OUI:CreatePanel(splitrbg, 1, 1, "BOTTOMRIGHT", barbg, "BOTTOMLEFT", OUI:Scale(-4), OUI:Scale(0))
if OUI.db.profile.Actionbar.bottombars > 1 then
splitrbg:SetWidth((buttonsize * 3) + (buttonspacing * 4))
splitrbg:SetHeight((buttonsize * 2) + (buttonspacing * 3))
else
splitrbg:SetWidth((buttonsize * 3) + (buttonspacing * 4))
splitrbg:SetHeight((buttonsize * 1) + (buttonspacing * 2))
end
local splitlbg = CreateFrame("Frame", "ActionBarSplitRightBackground", UIParent)
OUI:CreatePanel(splitlbg, 1,1, "BOTTOMLEFT", barbg, "BOTTOMRIGHT", OUI:Scale(4), OUI:Scale(0))
if OUI.db.profile.Actionbar.bottombars > 1 then
splitlbg:SetWidth((buttonsize * 3) + (buttonspacing * 4))
splitlbg:SetHeight((buttonsize * 2) + (buttonspacing * 3))
else
splitlbg:SetWidth((buttonsize * 3) + (buttonspacing * 4))
splitlbg:SetHeight((buttonsize * 1) + (buttonspacing * 2))
end
if IsAddOnLoaded("CoolLine") and OUI.db.profile.Skins.coolline == true then
local coolbg = CreateFrame("Frame", "CoolLinePanel", UIParent)
OUI:CreatePanel(coolbg, OUI.db.profile.LF.centerinfowidth + 190, OUI:Scale(28), "TOP", TukuiActionBarBackground, 0, OUI:Scale(28) + 4) -- four plus 28
coolbg:SetFrameLevel(2)
end
--BATTLEGROUND STATS PANEL
if OUI.db.profile.General.bgstats == true then
local bgframe = CreateFrame("Frame", "BattleGroundInfo", UIParent)
OUI:CreatePanel(bgframe, 1, 1, "TOPLEFT", UIParent, "BOTTOMLEFT", 0, 0)
bgframe:SetAllPoints(icenter)
bgframe:SetFrameStrata("MEDIUM")
bgframe:EnableMouse(true)
local function OnEvent(self, event)
if event == "ZONE_CHANGED_NEW_AREA" or event == "PLAYER_ENTERING_WORLD" then
InInstance, instanceType = IsInInstance()
if OUI.db.profile.General.bgstats == true and (InInstance and (instanceType == "pvp")) then
bgframe:EnableMouse(true)
else
bgframe:EnableMouse(false)
end
end
end
bgframe:SetScript("OnMouseDown", function()
if bgframe:IsShown() then
bgframe:Hide()
else
bgframe:Show()
end
end)
bgframe:RegisterEvent("ZONE_CHANGED_NEW_AREA")
bgframe:RegisterEvent("PLAYER_ENTERING_WORLD")
bgframe:SetScript("OnEvent", OnEvent)
local function OnEvent(self, event)
if event == "PLAYER_ENTERING_WORLD" then
inInstance, instanceType = IsInInstance()
if inInstance and (instanceType == "pvp") then
bgframe:Show()
else
bgframe:Hide()
end
end
end
bgframe:SetScript("OnEnter", function(self)
local numScores = GetNumBattlefieldScores()
for i=1, numScores do
name, killingBlows, honorKills, deaths, honorGained, faction, rank, race, class, classToken, damageDone, healingDone = GetBattlefieldScore(i);
if ( name ) then
if ( name == UnitName("player") ) then
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, OUI:Scale(4));
GameTooltip:ClearLines()
GameTooltip:AddLine(tukuilocal.datatext_ttstatsfor.."[|cffCC0033"..name.."|r]")
GameTooltip:AddLine' '
GameTooltip:AddDoubleLine(tukuilocal.datatext_tthonorkills, honorKills,1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_ttdeaths, deaths,1,1,1)
--Add extra statistics to watch based on what BG you are in.
if GetRealZoneText() == "Arathi Basin" then --
GameTooltip:AddDoubleLine(tukuilocal.datatext_basesassaulted,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_basesdefended,GetBattlefieldStatData(i, 2),1,1,1)
elseif GetRealZoneText() == "Warsong Gulch" then --
GameTooltip:AddDoubleLine(tukuilocal.datatext_flagscaptured,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_flagsreturned,GetBattlefieldStatData(i, 2),1,1,1)
elseif GetRealZoneText() == "Eye of the Storm" then --
GameTooltip:AddDoubleLine(tukuilocal.datatext_flagscaptured,GetBattlefieldStatData(i, 1),1,1,1)
elseif GetRealZoneText() == "Alterac Valley" then
GameTooltip:AddDoubleLine(tukuilocal.datatext_graveyardsassaulted,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_graveyardsdefended,GetBattlefieldStatData(i, 2),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_towersassaulted,GetBattlefieldStatData(i, 3),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_towersdefended,GetBattlefieldStatData(i, 4),1,1,1)
elseif GetRealZoneText() == "Strand of the Ancients" then
GameTooltip:AddDoubleLine(tukuilocal.datatext_demolishersdestroyed,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_gatesdestroyed,GetBattlefieldStatData(i, 2),1,1,1)
elseif GetRealZoneText() == "Isle of Conquest" then
GameTooltip:AddDoubleLine(tukuilocal.datatext_basesassaulted,GetBattlefieldStatData(i, 1),1,1,1)
GameTooltip:AddDoubleLine(tukuilocal.datatext_basesdefended,GetBattlefieldStatData(i, 2),1,1,1)
end
GameTooltip:Show()
end
end
end
end)
bgframe:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
bgframe:RegisterEvent("PLAYER_ENTERING_WORLD")
bgframe:SetScript("OnEvent", OnEvent)
end
if IsAddOnLoaded("Recount") and OUI.db.profile.Skins.recount == true then
local Recount = _G.Recount
local function SkinFrame(frame)
OUI:SetTemplate(frame)
frame.CloseButton:SetPoint("TOPRIGHT",frame,"TOPRIGHT",-4,-4)
frame.Title:SetPoint("TOPLEFT",frame,"TOPLEFT",6,-7)
end
Recount.UpdateBarTextures = function(self)
for k, v in pairs(Recount.MainWindow.Rows) do
v.StatusBar:SetStatusBarTexture(LSM:Fetch("statusbar", OUI.db.profile.LF.normTex))
v.StatusBar:GetStatusBarTexture():SetHorizTile(false)
v.StatusBar:GetStatusBarTexture():SetVertTile(false)
end
end
Recount.SetBarTextures = Recount.UpdateBarTextures
Recount.CreateFrame_ = Recount.CreateFrame
Recount.CreateFrame = function(self, Name, Title, Height, Width, ShowFunc, HideFunc)
local frame = self:CreateFrame_(Name, Title, Height, Width, ShowFunc, HideFunc)
SkinFrame(frame)
return frame
end
-- Skin existing frames
if Recount.MainWindow then SkinFrame(Recount.MainWindow) end
if Recount.ConfigWindow then SkinFrame(Recount.ConfigWindow) end
if Recount.GraphWindow then SkinFrame(Recount.GraphWindow) end
if Recount.DetailWindow then SkinFrame(Recount.DetailWindow) end
if _G["Recount_Realtime_!RAID_DAMAGE"] then SkinFrame(_G["Recount_Realtime_!RAID_DAMAGE"].Window) end
if _G["Recount_Realtime_!RAID_HEALING"] then SkinFrame(_G["Recount_Realtime_!RAID_HEALING"].Window) end
if _G["Recount_Realtime_!RAID_HEALINGTAKEN"] then SkinFrame(_G["Recount_Realtime_!RAID_HEALINGTAKEN"].Window) end
if _G["Recount_Realtime_!RAID_DAMAGETAKEN"] then SkinFrame(_G["Recount_Realtime_!RAID_DAMAGETAKEN"].Window) end
if _G["Recount_Realtime_Bandwidth Available_AVAILABLE_BANDWIDTH"] then SkinFrame(_G["Recount_Realtime_Bandwidth Available_AVAILABLE_BANDWIDTH"].Window) end
if _G["Recount_Realtime_FPS_FPS"] then SkinFrame(_G["Recount_Realtime_FPS_FPS"].Window) end
if _G["Recount_Realtime_Latency_LAG"] then SkinFrame(_G["Recount_Realtime_Latency_LAG"].Window) end
if _G["Recount_Realtime_Downstream Traffic_DOWN_TRAFFIC"] then SkinFrame(_G["Recount_Realtime_Downstream Traffic_DOWN_TRAFFIC"].Window) end
if _G["Recount_Realtime_Upstream Traffic_UP_TRAFFIC"] then SkinFrame(_G["Recount_Realtime_Upstream Traffic_UP_TRAFFIC"].Window) end
end
if IsAddOnLoaded("Omen") and OUI.db.profile.Skins.omen == true then
local Omen = LibStub("AceAddon-3.0"):GetAddon("Omen")
local LSM = LibStub("LibSharedMedia-3.0")
--Skin Title/Bars backgrounds
Omen.UpdateBackdrop_ = Omen.UpdateBackdrop
Omen.UpdateBackdrop = function(self)
self:UpdateBackdrop_()
OUI:SetTemplate(self.BarList)
OUI:SetTemplate(self.Title)
self.BarList:SetPoint("TOPLEFT", self.Title, "BOTTOMLEFT",0,-1)
end
-- Skin Title Bar
Omen.UpdateTitleBar_ = Omen.UpdateTitleBar
Omen.UpdateTitleBar = function(self)
self:UpdateTitleBar_()
self.TitleText:SetFont(LSM:Fetch("font", OUI.db.profile.Font.uffont2),self.db.profile.TitleBar.FontSize)
self.BarList:SetPoint("TOPLEFT", self.Title, "BOTTOMLEFT",0,-1)
end
-- Skin Bar Texture
Omen.UpdateBarTextureSettings_ = Omen.UpdateBarTextureSettings
Omen.UpdateBarTextureSettings = function(self)
for i, v in ipairs(self.Bars) do
v.texture:SetTexture(LSM:Fetch("statusbar", OUI.db.profile.LF.normTex))
end
end
-- Skin Bar fonts
Omen.UpdateBarLabelSettings_ = Omen.UpdateBarLabelSettings
Omen.UpdateBarLabelSettings = function(self)
self:UpdateBarLabelSettings_()
for i, v in ipairs(self.Bars) do
v.Text1:SetFont(LSM:Fetch("font", OUI.db.profile.Font.font2),self.db.profile.Bar.FontSize)
v.Text2:SetFont(LSM:Fetch("font", OUI.db.profile.Font.font2),self.db.profile.Bar.FontSize)
v.Text3:SetFont(LSM:Fetch("font", OUI.db.profile.Font.font2),self.db.profile.Bar.FontSize)
end
end
-- Hook bar creation to apply settings
local meta = getmetatable(Omen.Bars)
local oldidx = meta.__index
meta.__index = function(self, barID)
local bar = oldidx(self, barID)
Omen:UpdateBarTextureSettings()
Omen:UpdateBarLabelSettings()
return bar
end
-- Option Overrides
Omen.db.profile.Scale = 1
Omen.db.profile.Background.EdgeSize = 1
Omen.db.profile.Background.BarInset = 2
Omen.db.profile.Bar.Spacing = 1
Omen.db.profile.TitleBar.UseSameBG = true
-- Force updates
Omen:UpdateBarTextureSettings()
Omen:UpdateBarLabelSettings()
Omen:UpdateTitleBar()
Omen:UpdateBackdrop()
Omen:ReAnchorBars()
Omen:ResizeBars()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment