Add various autocollapse options.

Fix position saving bugs resulting from adding autocollapse options.
Fix grip hiding script bug.
Uncomment LDB launcher code now that config code is in.
Fix OnProfileChanged code.
Add ShowWith options.
Add mouseover and mouseovertarget to raid scanning.
Fix division by 0 percentage display.
Add FAQ section.
This commit is contained in:
Xinhuan
2008-10-02 18:07:09 +08:00
parent 49895213a4
commit 25f0e03c4e
2 changed files with 293 additions and 29 deletions
+93
View File
@@ -16,6 +16,33 @@ L["Alpha"] = true
L["Controls the transparency of the main Omen window."] = true
L["Scale"] = true
L["Controls the scaling of the main Omen window."] = true
L["Autocollapse"] = true
L["Collapse to show a minimum number of bars"] = true
L["Autocollapse Options"] = true
L["Grow bars upwards"] = true
L["Hide Omen on 0 bars"] = true
L["Hide Omen entirely if it collapses to show 0 bars"] = true
L["Max bars to show"] = true
L["Max number of bars to show"] = true
-- Config strings, show when... section
L["Show When..."] = true
L["Show Omen when..."] = true
L["Show Omen when any of the following are true"] = true
L["You have a pet"] = true
L["Show Omen when you have a pet out"] = true
L["You are alone"] = true
L["Show Omen when you are alone"] = true
L["You are in a party"] = true
L["Show Omen when you are in a 5-man party"] = true
L["You are in a raid"] = true
L["Show Omen when you are in a raid"] = true
L["You are resting"] = true
L["Show Omen when you are resting"] = true
L["You are in a battleground"] = true
L["Show Omen when you are in a battleground or arena"] = true
L["You are in a dungeon"] = true
L["Show Omen when you are in a dungeon (5 man and raid)"] = true
-- Config strings, slash command section
L["OMEN_SLASH_DESC"] = "These buttons execute the same functions as the ones in the slash command /omen"
@@ -24,6 +51,72 @@ L["Center Omen"] = true
L["Configure"] = true
L["Open the configuration dialog"] = true
-- FAQ
L["Help File"] = true
L["A collection of help pages"] = true
L["Frequently Asked Questions"] = true
L["Warrior"] = true
L["GENERAL_FAQ"] = [[
|cffffd200Why does no threat data show on a mob when I target it even though it is in combat?|r
The Blizzard threat API does not return threat data on any mob you are not in direct combat with. We suspect this is an effort on Blizzard's part to save bandwidth.
|cffffd200Does Omen3 sync or parse the combat log?|r
No. Omen3 does not attempt to sync or parse the combat log. Currently there is no intention to do so.
|cffffd200The threat updates are slow...|r
Omen3 updates the threat values you see as often as Blizzard updates the threat values to us.
|cffffd200Where can I report bugs or give suggestions?|r
http://forums.wowace.com/showthread.php?t=14249
|cffffd200Who wrote Omen3?|r
Xinhuan (Blackrock US Alliance) did.
]]
L["WARRIOR_FAQ"] = [[The following data is obtained from http://www.tankspot.com/forums/f200/39775-wow-3-0-threat-values.html on 2nd Oct 2008 (credits to Satrina). The numbers are for a level 80.
|cffffd200Modifiers|r
Battle Stance ________ x 80
Berserker Stance _____ x 80
Tactical Mastery _____ x 121/142/163
Defensive Stance _____ x 207.35
Note that in our original threat estimations (that we use now in WoW 2.0), we equated 1 damage to 1 threat, and used 1.495 to represent the stance+defiance multiplier. We see that Blizzard's method is to use the multiplier without decimals, so in 2.x it would've been x149 (maybe x149.5); it is x207 (maybe 207.3) in 3.0. I expect that this is to allow the transport of integer values instead of decimal values across the Internet for efficiency. It appears that threat values are multiplied by 207.35 at the server, then rounded.
If you still want to use the 1 damage = 1 threat method, the stance modifiers are 0.8 and 2.0735, etc.
|cffffd200Threat Values (stance modifiers apply unless otherwise noted):|r
Battle Shout _________ 78 (split)
Cleave _______________ damage + 225 (split)
Commanding Shout _____ 80 (split)
Concussion Blow ______ damage only
Damage Shield ________ damage only
Demoralising Shout ___ 63 (split)
Devastate ____________ damage + 5% of AP *** Needs re-checking for 8982 **
Dodge/Parry/Block_____ 1 (in defensive stance with Improved Defensive Stance only)
Heroic Strike ________ damage + 259
Heroic Throw _________ 1.50 x damage
Rage Gain ____________ 5 (stance modifier is not applied)
Rend _________________ damage only
Revenge ______________ damage + 121
Shield Bash __________ 36
Shield Slam __________ damage + 770
Shockwave ____________ damage only
Slam _________________ damage + 140
Spell Reflect ________ damage only (only for spells aimed at you)
Social Aggro _________ 0
Sunder Armour ________ 345 + 5%AP
Thunder Clap _________ 1.85 x damage
Vigilance ____________ 10% of target's generated threat (stance modifier is not applied)
You do not gain threat for refecting spells targetted at allies with Improved Spell Reflect. When you reflect a spell for an ally, your ally gains the threat for the damage dealt by the reflected spell.
]]
-- Slash command
BINDING_HEADER_OMEN = "Omen"
+200 -29
View File
@@ -31,6 +31,7 @@ local defaults = {
GrowUp = false,
Autocollapse = false,
NumBars = 10,
CollapseHide = false,
Locked = false,
BarHeight = 16,
ShowWith = {
@@ -110,13 +111,17 @@ end
local function startmoving()
if not db.Locked then
Omen.Anchor.IsMovingOrSizing = true
Omen.Anchor:StartMoving()
end
end
local function stopmoving()
Omen.Anchor:StopMovingOrSizing()
Omen:SetAnchors()
Omen:UpdateBars()
if Omen.Anchor.IsMovingOrSizing then
Omen.Anchor:StopMovingOrSizing()
Omen:SetAnchors()
Omen:UpdateBars()
Omen.Anchor.IsMovingOrSizing = nil
end
end
local function sizing()
Omen:ResizeBars()
@@ -187,13 +192,15 @@ function Omen:CreateFrames()
end
end)
self.Grip:SetScript("OnMouseUp", function()
self.Anchor:SetScript("OnSizeChanged", nil)
self.Anchor:StopMovingOrSizing()
self.Anchor.IsMovingOrSizing = nil
sizing()
self:SetAnchors()
if self.Anchor.IsMovingOrSizing then
self.Anchor:SetScript("OnSizeChanged", nil)
self.Anchor:StopMovingOrSizing()
sizing()
self:SetAnchors()
self.Anchor.IsMovingOrSizing = nil
end
end)
self.Grip:SetScript("OnHide", self.Grip:GetScript("OnHide"))
self.Grip:SetScript("OnHide", self.Grip:GetScript("OnMouseUp"))
end
function Omen:OnInitialize()
@@ -221,7 +228,6 @@ function Omen:PLAYER_LOGIN()
self:SetAnchors(true)
self:UnregisterEvent("PLAYER_LOGIN")
--[[
-- Optional launcher support for LDB-1.1 if present, this code is placed here so
-- that it runs after all other addons have loaded since we don't embed LDB-1.1
local DataBroker = LibStub("LibDataBroker-1.1", true)
@@ -234,7 +240,6 @@ function Omen:PLAYER_LOGIN()
end,
})
end
]]
end
function Omen:OnEnable()
@@ -246,7 +251,6 @@ function Omen:OnEnable()
self:PARTY_MEMBERS_CHANGED()
self:PLAYER_TARGET_CHANGED()
self:Toggle(true)
end
function Omen:Disable()
@@ -269,6 +273,9 @@ end
function Omen:OnProfileChanged(db, name)
db = self.db.profile
self:SetAnchors(true)
self:UpdateVisible()
self:UpdateBars()
end
function Omen:SetAnchors(useDB)
@@ -316,6 +323,27 @@ function Omen:Toggle(setting)
end
end
function Omen:UpdateVisible()
local inInstance, instanceType = IsInInstance()
local show
if not db.ShowWith.Resting and IsResting() then
show = false
end
if not db.ShowWith.PVP and inInstance and (instanceType == "pvp" or instanceType == "arena") then
show = false
end
if not db.ShowWith.Dungeon and inInstance and (instanceType == "party" or instanceType == "raid") then
show = false
end
if show == nil then
show = (db.ShowWith.Pet and UnitExists("pet")) or
(db.ShowWith.Alone and GetNumPartyMembers() + GetNumRaidMembers() == 0 and not UnitExists("pet")) or
(db.ShowWith.Party and GetNumPartyMembers() > 0) or
(db.ShowWith.Raid and GetNumRaidMembers() > 0)
end
self:Toggle(show)
end
-----------------------------------------------------------------------------
-- Omen bar stuff
@@ -382,14 +410,13 @@ end
function Omen:UNIT_PET()
self:PARTY_MEMBERS_CHANGED()
-- TODO: Add automatic show/hide triggers
end
function Omen:PLAYER_ENTERING_WORLD()
if UnitGUID("player") then
guidNameLookup[UnitGUID("player")] = UnitName("player")
end
-- TODO: Add automatic show/hide triggers
self:UpdateVisible()
end
local lastPartyUpdateTime = GetTime()
@@ -397,6 +424,7 @@ local lastPartyUpdateTime = GetTime()
function Omen:PARTY_MEMBERS_CHANGED()
inRaid = GetNumRaidMembers() > 0
inParty = GetNumPartyMembers() > 0
self:UpdateVisible()
-- Run the update if the last call is more than 0.5 seconds ago else
-- schedule an update 0.5 seconds later if one isn't already scheduled
@@ -507,7 +535,7 @@ local function updatethreat(unitid, mobunitid)
end
function Omen:UpdateBars()
if not self.Anchor:IsShown() then return end
if not self.Anchor:IsShown() and not db.CollapseHide then return end
-- TODO: Put a update throtle on this function
@@ -574,6 +602,8 @@ function Omen:UpdateBars()
updatethreat("focus", mob)
updatethreat("focustarget", mob)
updatethreat(mobTarget, mob)
updatethreat("mouseover", mob)
updatethreat("mouseovertarget", mob)
-- Sort the threatTable
local i = 1
@@ -605,7 +635,11 @@ function Omen:UpdateBars()
if class == nil or db.Classes[class] then -- class == nil implies its not in your raid
local bar = bars[j]
bar.Text1:SetText(guidNameLookup[guid] or L["Unknown"])
bar.Text2:SetText(floor(threatTable[guid] / 100).." ["..floor(threatTable[guid] / tankThreat * 100).."%]")
if tankThreat == 0 then
bar.Text2:SetFormattedText("%d [100%%]", threatTable[guid] / 100)
else
bar.Text2:SetFormattedText("%d [%d%%]", threatTable[guid] / 100, threatTable[guid] / 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)
bar.texture:SetWidth(w * threatTable[guid] / topthreat)
@@ -625,6 +659,7 @@ function Omen:UpdateBars()
if db.Autocollapse then
self.Anchor:SetHeight(i*db.BarHeight)
end
self.Anchor:Show()
end
function Omen:ClearAll()
@@ -634,6 +669,9 @@ function Omen:ClearAll()
self.TitleText:SetText(self.defaultTitle)
if db.Autocollapse then
self.Anchor:SetHeight(db.BarHeight)
if db.CollapseHide and not self.Anchor.IsMovingOrSizing then
self.Anchor:Hide()
end
end
end
@@ -652,14 +690,8 @@ end
local options = {
type = "group",
name = "Omen",
get = function(info)
local key = info[#info]
return Omen.db.profile[key]
end,
set = function(info, value)
local key = info[#info]
Omen.db.profile[key] = value
end,
get = function(info) return Omen.db.profile[ info[#info] ] end,
set = function(info, value) Omen.db.profile[ info[#info] ] = value end,
args = {
general = {
order = 1,
@@ -675,10 +707,10 @@ local options = {
Alpha = {
order = 3,
name = L["Alpha"],
desc = L["Controls the transparency of the main Omen window."],
type = "range",
min = 0, max = 1, step = 0.01,
isPercent = true,
desc = L["Controls the transparency of the main Omen window."],
set = function(info, value)
local key = info[#info]
Omen.db.profile[key] = value
@@ -688,16 +720,152 @@ local options = {
Scale = {
order = 5,
name = L["Scale"],
desc = L["Controls the scaling of the main Omen window."],
type = "range",
min = 0.50, max = 1.50, step = 0.01,
isPercent = true,
desc = L["Controls the scaling of the main Omen window."],
set = function(info, value)
local key = info[#info]
Omen.db.profile[key] = value
Omen.db.profile[ info[#info] ] = value
Omen:SetAnchors()
end,
},
Autocollapse = {
type = "toggle",
name = L["Autocollapse"],
desc = L["Collapse to show a minimum number of bars"],
order = 7,
set = function(info, value)
Omen.db.profile[ info[#info] ] = value
Omen:UpdateVisible()
Omen:UpdateBars()
end,
},
AutocollapseGroup = {
type = "group",
name = L["Autocollapse Options"],
guiInline = true,
order = 8,
disabled = function() return not Omen.db.profile.Autocollapse end,
set = function(info, value)
Omen.db.profile[ info[#info] ] = value
Omen:UpdateVisible()
Omen:UpdateBars()
end,
args = {
GrowUp = {
order = 1,
type = "toggle",
name = L["Grow bars upwards"],
desc = L["Grow bars upwards"],
},
CollapseHide = {
order = 2,
type = "toggle",
name = L["Hide Omen on 0 bars"],
desc = L["Hide Omen entirely if it collapses to show 0 bars"],
},
NumBars = {
order = 3,
name = L["Max bars to show"],
desc = L["Max number of bars to show"],
type = "range",
min = 1, max = 40, step = 1,
},
},
},
},
},
ShowWhen = {
type = "group",
name = L["Show When..."],
desc = L["Show Omen when..."],
get = function(info) return Omen.db.profile.ShowWith[ info[#info] ] end,
set = function(info, value)
Omen.db.profile.ShowWith[ info[#info] ] = value
Omen:UpdateVisible()
Omen:UpdateBars()
end,
args = {
intro = {
order = 1,
type = "description",
name = L["Show Omen when any of the following are true"],
},
Pet = {
type = "toggle",
name = L["You have a pet"],
desc = L["Show Omen when you have a pet out"],
},
Alone = {
type = "toggle",
name = L["You are alone"],
desc = L["Show Omen when you are alone"],
},
Party = {
type = "toggle",
name = L["You are in a party"],
desc = L["Show Omen when you are in a 5-man party"],
},
Raid = {
type = "toggle",
name = L["You are in a raid"],
desc = L["Show Omen when you are in a raid"],
},
Resting = {
type = "toggle",
name = L["You are resting"],
desc = L["Show Omen when you are resting"],
},
PVP = {
type = "toggle",
name = L["You are in a battleground"],
desc = L["Show Omen when you are in a battleground or arena"],
},
Dungeon = {
type = "toggle",
name = L["You are in a dungeon"],
desc = L["Show Omen when you are in a dungeon (5 man and raid)"],
},
},
},
Help = {
type = "group",
name = L["Help File"],
desc = L["A collection of help pages"],
childGroups = "select",
args = {
FAQ = {
type = "group",
name = "FAQ",
args = {
header = {
type = "header",
name = L["Frequently Asked Questions"],
order = 0,
},
text = {
order = 1,
type = "description",
name = L["GENERAL_FAQ"],
},
},
},
WARRIOR = {
type = "group",
name = "Warrior",
args = {
header = {
type = "header",
name = L["Warrior"],
order = 0,
},
text = {
order = 1,
type = "description",
name = L["WARRIOR_FAQ"],
},
},
},
},
},
},
@@ -739,10 +907,11 @@ local optionsSlash = {
Omen:ShowConfig()
end,
guiHidden = true,
}
},
},
}
function Omen:SetupOptions()
self.optionsFrames = {}
@@ -753,6 +922,8 @@ function Omen:SetupOptions()
self:RegisterModuleOptions("Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db), L["Profiles"])
self:RegisterModuleOptions("OmenSlashCommand", optionsSlash, L["Slash Command"])
self.optionsFrames["Help"] = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Omen", L["Help File"], "Omen", "Help")
self.optionsFrames["ShowWhen"] = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Omen", L["Show When..."], "Omen", "ShowWhen")
end
function Omen:RegisterModuleOptions(name, optionTbl, displayName)