Add LibSharedMedia-3.0.
Add Bar Texture options. Force optdeped libraries to load in the main chunk. This is because WoW no longer loads LoD addons even when optdeped, and only LoadAddOn() will. Reshuffle bar options in the savedvariables. Remove embeds.xml and move its contents directly into the TOC.
This commit is contained in:
@@ -1,16 +1,45 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-- Force used libraries to load. This is necessary because load on demand
|
||||
-- addons (in our case, disembedded libs) will no longer load even when
|
||||
-- listed in OptionalDeps and can only be loaded via LoadAddOn(). This must
|
||||
-- be done before a LibStub("AceAddon-3.0"):NewAddon() call due to
|
||||
-- ADDON_LOADED firing, as AceAddon-3.0 will call :OnInit() on any addon's
|
||||
-- ADDON_LOADED event due to needing to support submodules which may not be
|
||||
-- its their own addons.
|
||||
LoadAddOn("Ace3")
|
||||
LoadAddOn("LibSharedMedia-3.0")
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Addon declaration
|
||||
local Omen = LibStub("AceAddon-3.0"):NewAddon("Omen", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("Omen", false)
|
||||
local LSM = LibStub("LibSharedMedia-3.0")
|
||||
_G["Omen"] = Omen
|
||||
|
||||
|
||||
-- TODO: Add TPS calculations
|
||||
-- TODO: Add config
|
||||
-- TODO: Add visible/audible warnings
|
||||
-- TODO: Add Sink/SharedMedia stuff
|
||||
-- TODO: Code optimizations
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Register some media
|
||||
LSM:Register("sound", "Rubber Ducky", [[Sound\Doodad\Goblin_Lottery_Open01.wav]])
|
||||
LSM:Register("sound", "Cartoon FX", [[Sound\Doodad\Goblin_Lottery_Open03.wav]])
|
||||
LSM:Register("sound", "Explosion", [[Sound\Doodad\Hellfire_Raid_FX_Explosion05.wav]])
|
||||
LSM:Register("sound", "Shing!", [[Sound\Doodad\PortcullisActive_Closed.wav]])
|
||||
LSM:Register("sound", "Wham!", [[Sound\Doodad\PVP_Lordaeron_Door_Open.wav]])
|
||||
LSM:Register("sound", "Simon Chime", [[Sound\Doodad\SimonGame_LargeBlueTree.wav]])
|
||||
LSM:Register("sound", "War Drums", [[Sound\Event Sounds\Event_wardrum_ogre.wav]])
|
||||
LSM:Register("sound", "Cheer", [[Sound\Event Sounds\OgreEventCheerUnique.wav]])
|
||||
LSM:Register("sound", "Humm", [[Sound\Spells\SimonGame_Visual_GameStart.wav]])
|
||||
LSM:Register("sound", "Short Circuit", [[Sound\Spells\SimonGame_Visual_BadPress.wav]])
|
||||
LSM:Register("sound", "Fel Portal", [[Sound\Spells\Sunwell_Fel_PortalStand.wav]])
|
||||
LSM:Register("sound", "Fel Nova", [[Sound\Spells\SeepingGaseous_Fel_Nova.wav]])
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Localize some global functions
|
||||
local floor, format = floor, format
|
||||
@@ -34,9 +63,13 @@ local defaults = {
|
||||
NumBars = 10,
|
||||
CollapseHide = false,
|
||||
Locked = false,
|
||||
BarHeight = 16,
|
||||
AnimateBars = true,
|
||||
ShortNumbers = true,
|
||||
Bar = {
|
||||
Texture = "Blizzard",
|
||||
Height = 16,
|
||||
Spacing = 0,
|
||||
AnimateBars = true,
|
||||
ShortNumbers = true,
|
||||
},
|
||||
ShowWith = {
|
||||
Pet = true,
|
||||
Alone = false,
|
||||
@@ -135,7 +168,7 @@ function Omen:CreateFrames()
|
||||
-- Create anchor
|
||||
self.Anchor = CreateFrame("Frame", "OmenAnchor", UIParent)
|
||||
self.Anchor:SetResizable(true)
|
||||
self.Anchor:SetMinResize(90, db.BarHeight)
|
||||
self.Anchor:SetMinResize(90, db.Bar.Height)
|
||||
self.Anchor:SetMovable(true)
|
||||
self.Anchor:SetPoint("CENTER", UIParent, "CENTER")
|
||||
self.Anchor:SetWidth(225)
|
||||
@@ -390,8 +423,8 @@ do
|
||||
self[barID] = bar
|
||||
|
||||
bar:SetWidth(Omen.BarList:GetWidth())
|
||||
bar:SetHeight(db.BarHeight)
|
||||
bar:SetPoint("TOPLEFT", Omen.BarList, "TOPLEFT", 0, (barID-1) * -db.BarHeight)
|
||||
bar:SetHeight(db.Bar.Height)
|
||||
bar:SetPoint("TOPLEFT", Omen.BarList, "TOPLEFT", 0, (barID-1) * -db.Bar.Height)
|
||||
|
||||
bar.Text1 = bar:CreateFontString(nil, nil, "GameFontNormalSmall")
|
||||
bar.Text1:SetPoint("LEFT", bar, "LEFT", 10, 0)
|
||||
@@ -405,7 +438,8 @@ do
|
||||
bar.Text2:SetText("def")
|
||||
|
||||
bar.texture = bar:CreateTexture()
|
||||
bar.texture:SetTexture(1, 1, 1, 0.6)
|
||||
--bar.texture:SetTexture(1, 1, 1, 0.6)
|
||||
bar.texture:SetTexture(LSM:Fetch("statusbar", db.Bar.Texture))
|
||||
bar.texture:SetPoint("TOPLEFT", bar, "TOPLEFT")
|
||||
bar.texture:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT")
|
||||
|
||||
@@ -682,14 +716,14 @@ function Omen:UpdateBars()
|
||||
local bar = bars[j]
|
||||
local threat = threatTable[guid]
|
||||
bar.Text1:SetText(guidNameLookup[guid] or L["Unknown"])
|
||||
if db.ShortNumbers and threat > 100000 then
|
||||
if db.Bar.ShortNumbers and threat > 100000 then
|
||||
bar.Text2:SetFormattedText("%2.1fk [%d%%]", threat / 100000, tankThreat == 0 and 0 or threat / tankThreat * 100)
|
||||
else
|
||||
bar.Text2:SetFormattedText("%d [%d%%]", threat / 100, tankThreat == 0 and 0 or threat / tankThreat * 100)
|
||||
end
|
||||
local c = (class == "PET" and pet_color) or RAID_CLASS_COLORS[class] or default_color
|
||||
bar.texture:SetVertexColor(c.r, c.g, c.b)
|
||||
if db.AnimateBars then
|
||||
if db.Bar.AnimateBars then
|
||||
bar:AnimateTo(w * threat / topthreat)
|
||||
else
|
||||
bar.texture:SetWidth(w * threat / topthreat)
|
||||
@@ -708,7 +742,7 @@ function Omen:UpdateBars()
|
||||
bars[j]:Hide()
|
||||
end
|
||||
if db.Autocollapse then
|
||||
self.Anchor:SetHeight(i*db.BarHeight)
|
||||
self.Anchor:SetHeight(i*db.Bar.Height)
|
||||
end
|
||||
self.Anchor:Show()
|
||||
end
|
||||
@@ -719,7 +753,7 @@ function Omen:ClearAll()
|
||||
end
|
||||
self.TitleText:SetText(self.defaultTitle)
|
||||
if db.Autocollapse then
|
||||
self.Anchor:SetHeight(db.BarHeight)
|
||||
self.Anchor:SetHeight(db.Bar.Height)
|
||||
if db.CollapseHide and not self.Anchor.IsMovingOrSizing then
|
||||
self.Anchor:Hide()
|
||||
end
|
||||
@@ -730,7 +764,7 @@ function Omen:ResizeBars()
|
||||
local w = Omen.BarList:GetWidth()
|
||||
for i = 1, #bars do
|
||||
bars[i]:SetWidth(w)
|
||||
bars[i]:SetHeight(db.BarHeight)
|
||||
bars[i]:SetHeight(db.Bar.Height)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -738,6 +772,15 @@ end
|
||||
-----------------------------------------------------------------------------
|
||||
-- Omen config stuff
|
||||
|
||||
local function GetLSMIndex(t, value)
|
||||
for k, v in pairs(LSM:List(t)) do
|
||||
if v == value then
|
||||
return k
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local options = {
|
||||
type = "group",
|
||||
name = "Omen",
|
||||
@@ -883,8 +926,9 @@ local options = {
|
||||
type = "group",
|
||||
name = L["Bar Settings"],
|
||||
desc = L["Bar Settings"],
|
||||
get = function(info) return Omen.db.profile.Bar[ info[#info] ] end,
|
||||
set = function(info, value)
|
||||
Omen.db.profile[ info[#info] ] = value
|
||||
Omen.db.profile.Bar[ info[#info] ] = value
|
||||
Omen:UpdateBars()
|
||||
end,
|
||||
args = {
|
||||
@@ -903,6 +947,20 @@ local options = {
|
||||
name = L["Short Numbers"],
|
||||
desc = L["Display large numbers in Ks"],
|
||||
},
|
||||
Texture = {
|
||||
type = "select",
|
||||
name = L["Bar Texture"],
|
||||
desc = L["The texture that the bar will use"],
|
||||
values = function() return LSM:List("statusbar") end,
|
||||
get = function(info) return GetLSMIndex("statusbar", db.Bar.Texture) end,
|
||||
set = function(info, v)
|
||||
db.Bar.Texture = LSM:List("statusbar")[v]
|
||||
local texturepath = LSM:Fetch("statusbar", db.Bar.Texture)
|
||||
for i = 1, #bars do
|
||||
bars[i].texture:SetTexture(texturepath)
|
||||
end
|
||||
end
|
||||
},
|
||||
},
|
||||
},
|
||||
Help = {
|
||||
|
||||
Reference in New Issue
Block a user