Johnny C. Lam [04-06-14 - 18:47]
diff --git a/OvaleBanditsGuile.lua b/OvaleBanditsGuile.lua
index 997df03..b28f500 100644
--- a/OvaleBanditsGuile.lua
+++ b/OvaleBanditsGuile.lua
@@ -1,6 +1,6 @@
--[[--------------------------------------------------------------------
Ovale Spell Priority
- Copyright (C) 2013 Johnny C. Lam
+ Copyright (C) 2013, 2014 Johnny C. Lam
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License in the LICENSE
@@ -87,8 +87,8 @@ function OvaleBanditsGuile:OnDisable()
end
end
-function OvaleBanditsGuile:Ovale_SpecializationChanged(event, specialization)
- if specialization == 2 then
+function OvaleBanditsGuile:Ovale_SpecializationChanged(event, specialization, previousSpecialization)
+ if specialization == "combat" then
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterMessage("Ovale_AuraAdded")
self:RegisterMessage("Ovale_AuraChanged")
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index d0811c1..9e23059 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -1,7 +1,7 @@
--[[--------------------------------------------------------------------
Ovale Spell Priority
Copyright (C) 2009, 2010, 2011, 2012 Sidoine
- Copyright (C) 2012, 2013 Johnny C. Lam
+ Copyright (C) 2012, 2013, 2014 Johnny C. Lam
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License in the LICENSE
@@ -141,7 +141,7 @@ local function TestConditions(paramList)
if paramList.glyph and not OvaleSpellBook:IsActiveGlyph(paramList.glyph) then
return false
end
- if paramList.mastery and OvalePaperDoll.specialization ~= paramList.mastery then
+ if paramList.mastery and not OvalePaperDoll:IsSpecialization(paramList.mastery) then
return false
end
if paramList.if_stance then
diff --git a/OvalePaperDoll.lua b/OvalePaperDoll.lua
index 883cf9c..2b453db 100644
--- a/OvalePaperDoll.lua
+++ b/OvalePaperDoll.lua
@@ -1,6 +1,6 @@
--[[--------------------------------------------------------------------
Ovale Spell Priority
- Copyright (C) 2013 Johnny C. Lam
+ Copyright (C) 2013, 2014 Johnny C. Lam
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License in the LICENSE
@@ -75,6 +75,19 @@ local OVALE_HEALING_CLASS = {
PRIEST = true,
SHAMAN = true,
}
+local OVALE_SPECIALIZATION_NAME = {
+ DEATHKNIGHT = { "blood", "frost", "unholy" },
+ DRUID = { "balance", "feral", "guardian", "restoration" },
+ HUNTER = { "beast_mastery", "marksmanship", "survival" },
+ MAGE = { "arcane", "fire", "frost" },
+ MONK = { "brewmaster", "mistweaver", "windwalker" },
+ PALADIN = { "holy", "protection", "retribution" },
+ PRIEST = { "discipline", "holy", "shadow" },
+ ROGUE = { "assassination", "combat", "subtlety" },
+ SHAMAN = { "elemental", "enhancement", "restoration" },
+ WARLOCK = { "affliction", "demonology", "destruction" },
+ WARRIOR = { "arms", "fury", "protection" },
+}
--</private-static-properties>
--<public-static-properties>
@@ -390,8 +403,9 @@ end
function OvalePaperDoll:UpdateSpecialization(event)
local newSpecialization = API_GetSpecialization()
if self.specialization ~= newSpecialization then
+ local oldSpecialization = self.specialization
self.specialization = newSpecialization
- self:SendMessage("Ovale_SpecializationChanged", self.specialization)
+ self:SendMessage("Ovale_SpecializationChanged", self:GetSpecialization(newSpecialization), self:GetSpecialization(oldSpecialization))
end
end
@@ -429,6 +443,24 @@ function OvalePaperDoll:GetSpellHasteMultiplier(snapshot)
return 1 + snapshot.spellHaste / 100
end
+-- Return the given specialization's name, or the current one if none is specified.
+function OvalePaperDoll:GetSpecialization(specialization)
+ specialization = specialization or self.specialization
+ return OVALE_SPECIALIZATION_NAME[self_class][specialization]
+end
+
+-- Return true if the current specialization matches the given name.
+function OvalePaperDoll:IsSpecialization(name)
+ if name and self.specialization then
+ if type(name) == "number" then
+ return name == self.specialization
+ else
+ return name == OVALE_SPECIALIZATION_NAME[self_class][self.specialization]
+ end
+ end
+ return false
+end
+
-- Copy the current snapshot into the given snapshot table.
function OvalePaperDoll:UpdateSnapshot(snapshot)
local snapshot = self:CurrentSnapshot()