/
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/> |
<Include file="Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/> |
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml"/> |
<Include file="Libs\LibFuBarPlugin-3.0\lib.xml"/> |
</Ui> |
-- Define the ADDON |
BB = LibStub("AceAddon-3.0"):NewAddon("BattleBar", "AceConsole-3.0", "AceEvent-3.0"); |
LibStub("AceAddon-3.0"):EmbedLibrary(BB, "LibFuBarPlugin-3.0", true) |
-- Define the Locale |
local L = LibStub("AceLocale-3.0"):GetLocale("BattleBar"); |
hidden = false, |
faction = "both", |
sortMode = "kbs", |
behaviour = { |
hideMode = false, |
rolloverMode = false |
}, |
gui = { |
showSelf = true, |
showCount = 10 |
} |
} |
}); |
-- State Variables |
BB.State = { |
InQueue = false, |
InBattleground = false, |
CurrentBattleground = "", |
Scoreboard = {}, |
Rollover = false |
Scoreboard = {} |
} |
-- Initial Variables |
BB.UpdateInterval = 1; |
BB.CheckInterval = 5; |
-- FuBar Settings |
if LibStub:GetLibrary("LibFuBarPlugin-Mod-3.0", true) then |
-- Create the FuBarPlugin bits. |
self:SetFuBarOption("GameTooltip", true) |
self:SetFuBarOption("hasNoColor", true) |
self:SetFuBarOption("cannotDetachTooltip", true) |
self:SetFuBarOption("hideWithoutStandby", true) |
self:SetFuBarOption("cannotDetachTooltip", true) |
--self:SetFuBarOption("iconPath", "Interface\\AddOns\\MicroManager\\Icon") |
end |
-- Initialize the GUI |
BB:Gui_Init(); |
end |
end |
--------------------------- FuBar Plugin --------------------------------------------------- |
function BB:OnUpdateFuBarText() |
self:SetFuBarText("Battle Bar"); |
end |
function BB:OnUpdateFuBarTooltip() |
GameTooltip:AddLine("Battle Bar"); |
GameTooltip:AddLine("Left Click - Open Config."); |
GameTooltip:AddLine("Shift & Left Click - Toggle Main Window."); |
end |
function BB:OnFuBarClick(button) |
if (button == "LeftButton") then |
if (IsShiftKeyDown()) then |
BB:ToggleDialog(); |
else |
BB:ShowConfig(); |
end |
end |
end |
--------------------------- Event Handling ------------------------------------------------ |
function BB:PLAYER_LOGIN() |
BB:OnUpdate(elapsed) |
end); |
tFrame:SetScript("OnEnter", function() |
BB.State.Rollover = true; |
if (BB.db.profile.behaviour.rolloverMode == true) then |
BB:Gui_Update(); |
end |
end); |
tFrame:SetScript("OnLeave", function() |
BB.State.Rollover = false; |
if (BB.db.profile.behaviour.rolloverMode == true) then |
BB:Gui_Update(); |
end |
end); |
-- Title |
local t = tFrame:CreateFontString("$parent_Title", "ARTWORK", "GameFontHighlight"); |
t:SetText("BattleBar"); |
BB.Gui.TitleFrame:Show(); |
end |
if (BB.db.profile.behaviour.hideMode == true and BB.State.InBattleground == false) then |
BB.Gui.TitleFrame:Hide() |
end |
-- Update The Title-Bar First |
local tTxtCol = {} |
local tBgCol = {} |
local showSelf = BB.db.profile.gui.showSelf |
local myName = UnitName("player"); |
BB.Gui.GroupFrame:Show(); |
if (BB.db.profile.behaviour.rolloverMode == true and BB.State.Rollover == false) then |
BB.Gui.GroupFrame:Hide() |
else |
-- Check if we're in a BG |
if (BB.State.InBattleground == false) then |
-- Hide Everything |
BB.Gui.GroupFrame:Hide(); |
for i = 1, 20 do |
BB.Gui.Detail[i]:Hide(); |
end |
-- We're done here |
return |
-- Check if we're in a BG |
if (BB.State.InBattleground == false) then |
-- Hide Everything |
BB.Gui.GroupFrame:Hide(); |
for i = 1, 20 do |
BB.Gui.Detail[i]:Hide(); |
end |
-- We're done here |
return |
end |
BB.Gui.GroupFrame:Show(); |
-- Show/Hide Appropriate # of Bars |
for i = 1, (showCount) do |
BB.Gui.Detail[i]:Show(); |
} |
} |
}, |
behaviour = { |
type = "group", |
name = "Behaviour", |
desc = "General BattleBar Behaviour Options", |
args = { |
hideMode = { |
type = "toggle", |
name = "Hide Mode", |
desc = "Toggles 'Hide Mode' which will makes BattleBar completely invisible when not in a battleground.", |
get = function(info) return BB.db.profile.behaviour.hideMode end, |
set = function(info, v) |
BB.db.profile.behaviour.hideMode = v |
BB:Gui_Update(); |
end |
}, |
rolloverMode = { |
type = "toggle", |
name = "Rollover Mode", |
desc = "Toggles 'Rollover Mode' which will makes BattleBar's Scoreboard hidden until you mouse-over the title-bar.", |
get = function(info) return BB.db.profile.behaviour.rolloverMode end, |
set = function(info, v) |
BB.db.profile.behaviour.rolloverMode = v |
BB:Gui_Update(); |
end |
} |
} |
}, |
gui = { |
type = "group", |
name = L["Appearance"], |