use [bonusbar:x] instead of [stance:x], simplifies detection logic of stances, no more skipped aquatic form shit =P

This commit is contained in:
Hendrik Leppkes
2008-03-25 10:10:10 +00:00
parent 1c10f11fad
commit eeea3683f2
8 changed files with 19 additions and 154 deletions
+19 -49
View File
@@ -77,7 +77,6 @@ local validStanceTable = {
local _, playerclass = UnitClass("player")
local num_shapeshift_forms
local function createOptionGroup(k, id)
local tbl = {
@@ -87,8 +86,7 @@ local function createOptionGroup(k, id)
get = optGetter,
set = optSetter,
values = validStanceTable,
name = module.DefaultStanceMap[playerclass][k].name or module.DefaultStanceMap[playerclass][k].match or "BUG",
hidden = function() return not module.stancemap[k].position end,
name = module.DefaultStanceMap[playerclass][k].name,
}
return tbl
end
@@ -121,7 +119,7 @@ function module:GetStateOptionsTable()
type = "group",
inline = true,
name = "",
hidden = function() return not hasStances end,
hidden = function() return not (module.DefaultStanceMap[playerclass]) end,
args = {
stance_header = {
order = 1,
@@ -146,28 +144,25 @@ function module:GetStateOptionsTable()
return options
end
local S = LibStub("AceLocale-3.0"):GetLocale("BT4Stances")
-- specifiy the available stances for each class
module.DefaultStanceMap = {
WARRIOR = {
{ id = "battle", match = S["Battle Stance"] },
{ id = "def", match = S["Defensive Stance"] },
{ id = "berserker", match = S["Berserker Stance"] },
{ id = "battle", name = "Battle Stance", index = 1},
{ id = "def", name = "Defensive Stance", index = 2 },
{ id = "berserker", name = "Berserker Stance", index = 3 },
},
DRUID = {
{ id = "bear", match = S["Bear Form"], match2 = S["Dire Bear Form"] },
{ id = "cat", match = S["Cat Form"] },
{ id = "bear", name = "Bear Form", index = 3 },
{ id = "cat", name = "Cat Form", index = 1 },
-- prowl is virtual, no real stance
{ id = "prowl", virtual = true, name = "Cat Form (Prowl)", depend = "cat" },
{ id = "moonkin", match = S["Moonkin Form"] },
{ id = "tree", match = S["Tree of Life"] },
{ id = "prowl", name = "Cat Form (Prowl)", index = false},
{ id = "moonkintree", name = "Moonkin/Tree of Life", index = 2 },
},
ROGUE = {
{ id = "stealth", match = S["Stealth"] },
{ id = "stealth", match = "Stealth", index = 1 },
},
PRIEST = { --shadowform gets a position override because it doesnt have a real stance position .. and priests dont have other stances =)
{ id = "shadowform", virtual = true, name = "Shadowform", position = 1 },
{ id = "shadowform", name = "Shadowform", index = 1 },
}
}
@@ -176,38 +171,13 @@ function module:CreateStanceMap()
local defstancemap = self.DefaultStanceMap[playerclass]
if not defstancemap then return end
self.stancemap = {}
num_shapeshift_forms = GetNumShapeshiftForms()
for k,v in pairs(defstancemap) do
local entry = { id = v.id, match = v.match, match2 = v.match2, virtual = v.virtual, depend = v.depend, position = v.position }
if not v.virtual and type(v.match) == "string" then
entry.name = v.match
elseif not v.virtual and type(v.match) == "table" then
entry.name = v.match[1]
else
entry.name = v.name
end
table_insert(self.stancemap, entry)
end
for i = 1, num_shapeshift_forms do
local _, name = GetShapeshiftFormInfo(i)
local index = tfind(self.stancemap, name, searchFunc)
if index then
self.stancemap[index].position = i
if self.stancemap[index].id == "cat" then
local prowl = tfind(self.stancemap, "prowl", searchFunc)
self.stancemap[prowl].position = i
end
end
end
hasStances = (num_shapeshift_forms > 0)
self.stancemap = defstancemap
end
function ActionBar:UpdateStates()
if not module.stancemap and module.DefaultStanceMap[playerclass] then module:CreateStanceMap() end
if not module.stancemap and module.DefaultStanceMap[playerclass] then
module.stancemap = module.DefaultStanceMap[playerclass]
end
for i=0,10 do
self:AddButtonStates(i)
end
@@ -238,18 +208,18 @@ function ActionBar:UpdateStates()
end
-- third priority the stances
if not stateconfig.stance[playerclass] then stateconfig.stance[playerclass] = {} end
if module.stancemap then
if not stateconfig.stance[playerclass] then stateconfig.stance[playerclass] = {} end
for i,v in pairs(module.stancemap) do
local state = self:GetStanceState(v)
if state and state ~= 0 and v.position then
if state and state ~= 0 and v.index then
if playerclass == "DRUID" and v.id == "cat" then
local prowl = self:GetStanceState("prowl")
if prowl then
table_insert(statedriver, fmt("[stance:%s,stealth:1]%s", v.position, prowl))
table_insert(statedriver, fmt("[bonusbar:%s,stealth:1]%s", v.index, prowl))
end
end
table_insert(statedriver, fmt("[stance:%s]%s", v.position, state))
table_insert(statedriver, fmt("[bonusbar:%s]%s", v.index, state))
end
end
end
-15
View File
@@ -1,16 +1 @@
--[[ $Id$ ]]
local S = LibStub("AceLocale-3.0"):NewLocale("BT4Stances", "deDE")
if not S then return end
-- warrior
S["Battle Stance"] = "Kampfhaltung"
S["Defensive Stance"] = "Verteidigungshaltung"
S["Berserker Stance"] = "Berserkerhaltung"
-- druid
S["Bear Form"] = "B\195\164rengestalt"
S["Dire Bear Form"] = "Terrorb\195\164rengestalt"
S["Cat Form"] = "Katzengestalt"
S["Tree of Life"] = "Baum des Lebens"
S["Moonkin Form"] = "Mondkingestalt"
-- rogue
S["Stealth"] = "Verstohlenheit"
-15
View File
@@ -1,16 +1 @@
--[[ $Id$ ]]
local S = LibStub("AceLocale-3.0"):NewLocale("BT4Stances", "enUS", true)
-- warrior
S["Battle Stance"] = true
S["Defensive Stance"] = true
S["Berserker Stance"] = true
-- druid
S["Bear Form"] = true
S["Dire Bear Form"] = true
S["Cat Form"] = true
S["Tree of Life"] = true
S["Moonkin Form"] = true
-- rogue
S["Stealth"] = true
-15
View File
@@ -1,16 +1 @@
--[[ $Id$ ]]
local S = LibStub("AceLocale-3.0"):NewLocale("BT4Stances", "esES")
if not S then return end
-- warrior
S["Battle Stance"] = "Actitud de batalla"
S["Defensive Stance"] = "Actitud defensiva"
S["Berserker Stance"] = "Actitud rabiosa"
-- druid
S["Bear Form"] = "Forma de oso"
S["Dire Bear Form"] = "Forma de oso temible"
S["Cat Form"] = "Forma felina"
S["Tree of Life"] = "\195\129rbol de vida"
S["Moonkin Form"] = "Forma de lech\195\186cico lunar"
-- rogue
S["Stealth"] = "Sigilo"
-15
View File
@@ -1,16 +1 @@
--[[ $Id$ ]]
local S = LibStub("AceLocale-3.0"):NewLocale("BT4Stances", "frFR")
if not S then return end
-- warrior
S["Battle Stance"] = "Posture de combat"
S["Defensive Stance"] = "Posture d\195\169fensive"
S["Berserker Stance"] = "Posture berserker"
-- druid
S["Bear Form"] = "Forme d'ours"
S["Dire Bear Form"] = "Forme d'ours redoutable"
S["Cat Form"] = "Forme de f\195\169lin"
S["Tree of Life"] = "Arbre de vie"
S["Moonkin Form"] = "Forme de s\195\169l\195\169nien"
-- rogue
S["Stealth"] = "Camouflage"
-15
View File
@@ -1,16 +1 @@
--[[ $Id$ ]]
local S = LibStub("AceLocale-3.0"):NewLocale("BT4Stances", "koKR")
if not S then return end
-- warrior
S["Battle Stance"] = "전투 태세"
S["Defensive Stance"] = "방어 태세"
S["Berserker Stance"] = "광폭 태세"
-- druid
S["Bear Form"] = "곰 변신"
S["Dire Bear Form"] = "광포한 곰 변신"
S["Cat Form"] = "표범 변신"
S["Tree of Life"] = "생명의 나무"
S["Moonkin Form"] = "달빛야수 변신"
-- rogue
S["Stealth"] = "은신"
-15
View File
@@ -1,16 +1 @@
--[[ $Id$ ]]
local S = LibStub("AceLocale-3.0"):NewLocale("BT4Stances", "zhCN")
if not S then return end
-- warrior
S["Battle Stance"] = "战斗姿态"
S["Defensive Stance"] = "防御姿态"
S["Berserker Stance"] = "狂暴姿态"
-- druid
S["Bear Form"] = "熊形态"
S["Dire Bear Form"] = "巨熊形态"
S["Cat Form"] = "猎豹形态"
S["Tree of Life"] = "生命之树"
S["Moonkin Form"] = "枭兽形态"
-- rogue
S["Stealth"] = "潜行"
-15
View File
@@ -1,16 +1 @@
--[[ $Id$ ]]
local S = LibStub("AceLocale-3.0"):NewLocale("BT4Stances", "zhTW")
if not S then return end
-- warrior
S["Battle Stance"] = "戰鬥姿態"
S["Defensive Stance"] = "防禦姿態"
S["Berserker Stance"] = "狂暴姿態"
-- druid
S["Bear Form"] = "熊形態"
S["Dire Bear Form"] = "巨熊形態"
S["Cat Form"] = "獵豹形態"
S["Tree of Life"] = "生命之樹"
S["Moonkin Form"] = "梟獸形態"
-- rogue
S["Stealth"] = "潛行"