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:
Xinhuan
2008-10-08 18:09:04 +08:00
parent b1dd4bc092
commit 7f32140efa
5 changed files with 90 additions and 34 deletions
+1
View File
@@ -12,3 +12,4 @@ externals:
Libs/AceEvent-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0
Libs/AceLocale-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0
Libs/AceTimer-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceTimer-3.0
Libs/LibSharedMedia-3.0: svn://svn.wowace.com/wow/libsharedmedia-3-0/mainline/trunk/LibSharedMedia-3.0
+3 -1
View File
@@ -51,7 +51,9 @@ L["Animate Bars"] = true
L["Smoothly animate bar changes"] = true
L["Short Numbers"] = true
L["Display large numbers in Ks"] = true
L["Bar Texture"] = true
L["The texture that the bar will use"] = true
-- Config strings, slash command section
L["OMEN_SLASH_DESC"] = "These buttons execute the same functions as the ones in the slash command /omen"
L["Toggle Omen"] = true
+72 -14
View File
@@ -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 = {
+14 -3
View File
@@ -8,13 +8,24 @@
## Notes-zhTW: 一個輕量級、有彈性、可監視多個目標的仇恨統計插件。
## Notes-koKR: 다중-대상에 대한 위협수준 미터기로 보여줍니다.
## Author: Xinhuan
## OptionalDeps: Ace3
## OptionalDeps: Ace3, LibSharedMedia-3.0
## X-Category: Combat
## SavedVariables: Omen3DB
## X-Embeds: Ace3
## X-Embeds: Ace3, LibSharedMedia-3.0
#@no-lib-strip@
embeds.xml
Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
Libs\AceAddon-3.0\AceAddon-3.0.xml
Libs\AceGUI-3.0\AceGUI-3.0.xml
Libs\AceConfig-3.0\AceConfig-3.0.xml
Libs\AceConsole-3.0\AceConsole-3.0.xml
Libs\AceDB-3.0\AceDB-3.0.xml
Libs\AceEvent-3.0\AceEvent-3.0.xml
Libs\AceLocale-3.0\AceLocale-3.0.xml
Libs\AceTimer-3.0\AceTimer-3.0.xml
Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
Libs\LibSharedMedia-3.0\lib.xml
#@end-no-lib-strip@
Localization\enUS.lua
-16
View File
@@ -1,16 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="Libs\LibStub\LibStub.lua"/>
<Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
<Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/>
<Include file="Libs\AceGUI-3.0\AceGUI-3.0.xml"/>
<Include file="Libs\AceConfig-3.0\AceConfig-3.0.xml"/>
<Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/>
<Include file="Libs\AceDB-3.0\AceDB-3.0.xml"/>
<Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
<Include file="Libs\AceLocale-3.0\AceLocale-3.0.xml"/>
<Include file="Libs\AceTimer-3.0\AceTimer-3.0.xml"/>
<Include file="Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
</Ui>