/trunk/TotemManager
if ( GetLocale() == "esES" ) then |
TotemManager.ENAMORED_WATER_SPIRIT = "EspÃritu de agua enamorado" |
TotemManager.EARTHLIVING_WEAPON = "Arma de vida terrestre" |
TotemManager.EARTHLIVING_WEAPON = "Arma de Vida terrestre" |
TotemManager.FLAMETONGUE_EFFECT = "Tótem Lengua de Fuego" |
TotemManager.WINDFURY_EFFECT = "Tótem Viento Furioso" |
TotemManager.TOTEMIC_CALL = "Llamada totémica" |
TotemManager.REINCARNATION = "Reencarnación" |
TotemManager.ANKH = "Ankh" |
TotemManager.LIGHTNING_SHIELD = "Escudo de relámpagos" |
TotemManager.WATER_SHIELD = "Escudo de agua" |
TotemManager.EARTH_SHIELD = "Escudo de tierra" |
TotemManager.TOTEMIC_CALL = "Appel tot\195\169mique" |
TotemManager.REINCARNATION = "R\195\169incarnation" |
TotemManager.ANKH = "Ankh" |
TotemManager.LIGHTNING_SHIELD = "Bouclier d'eau" |
TotemManager.WATER_SHIELD = "Bouclier de foudre" |
TotemManager.EARTH_SHIELD = "Bouclier de terre" |
TotemManager.TOTEMIC_CALL = "Ruf der Totems" |
TotemManager.REINCARNATION = "Reinkarnation" |
TotemManager.ANKH = "Ankh" |
TotemManager.LIGHTNING_SHIELD = "Blitzschlagschild" |
TotemManager.WATER_SHIELD = "Wasserschild" |
TotemManager.EARTH_SHIELD = "Erdschild" |
TotemManager.TOTEMIC_CALL = "Totemic Call" |
TotemManager.REINCARNATION = "Reincarnation" |
TotemManager.ANKH = "Ankh" |
TotemManager.LIGHTNING_SHIELD = "Lightning Shield" |
TotemManager.WATER_SHIELD = "Water Shield" |
TotemManager.EARTH_SHIELD = "Earth Shield" |
TotemManager.TOTEMIC_CALL = "ТоÑемнÑй клиÑ" |
TotemManager.REINCARNATION = "ÐоÑÑÑание из меÑÑвÑÑ " |
-- TotemManager.ANKH = "?????" |
TotemManager.LIGHTNING_SHIELD = "Ð©Ð¸Ñ Ð¼Ð¾Ð»Ð½Ð¸Ð¹" |
TotemManager.WATER_SHIELD = "ÐоднÑй ÑиÑ" |
TotemManager.EARTH_SHIELD = "Ð©Ð¸Ñ Ðемли" |
-- my saved variable |
TotemManager.defaultTotemManagerData = { |
["alreadyActivate"] = true, |
["tooltipVisibility"] = 1, |
["skin"] = 1, |
["actionBarSkin"] = 2, |
["buffActionFrame"] = { |
["visible"] = true, |
["direction"] = 1, |
}, |
["totemActionFrame"] = { |
["visible"] = true, |
["direction"] = 1, |
}, |
["wotlk2"] = true, |
["actionBarBackup"] = { |
["earthTotem"] = { |
["favoriteCount"] = 1, |
["selectedVisibility"] = 0, |
["selectedPosition"] = 0, |
["selectedAction"] = 0, |
["selectedVisibility"] = 1, |
["selectedPosition"] = 4, |
["selectedAction"] = 4, |
["visibilityList"] = { |
1, -- [1] |
0, -- [2] |
0, -- [3] |
0, -- [4] |
0, -- [5] |
0, -- [6] |
3, -- [1] |
2, -- [2] |
2, -- [3] |
2, -- [4] |
2, -- [5] |
2, -- [6] |
}, |
["originalSelectedAction"] = 0, |
["originalSelectedPosition"] = 0, |
["originalSelectedAction"] = 4, |
["originalSelectedPosition"] = 4, |
["actionList"] = { |
2, -- [1] |
1, -- [2] |
}, |
["totalCount"] = 6, |
}, |
["ankh"] = { |
["favoriteCount"] = 0, |
["selectedVisibility"] = 1, |
["selectedPosition"] = 1, |
["selectedAction"] = 1, |
["visibilityList"] = { |
2, -- [1] |
}, |
["originalSelectedAction"] = 1, |
["originalSelectedPosition"] = 1, |
["actionList"] = { |
1, -- [1] |
}, |
["unavailable"] = { |
}, |
["totalCount"] = 1, |
}, |
["airTotem"] = { |
["favoriteCount"] = 1, |
["selectedVisibility"] = 1, |
2, -- [4] |
2, -- [5] |
}, |
["originalSelectedAction"] = 4, |
["originalSelectedPosition"] = 4, |
["actionList"] = { |
1, -- [1] |
["totalCount"] = 5, |
}, |
["waterTotem"] = { |
["favoriteCount"] = 2, |
["favoriteCount"] = 1, |
["selectedVisibility"] = 1, |
["selectedPosition"] = 5, |
["selectedPosition"] = 4, |
["selectedAction"] = 3, |
["visibilityList"] = { |
3, -- [1] |
3, -- [2] |
2, -- [2] |
2, -- [3] |
2, -- [4] |
2, -- [5] |
2, -- [6] |
4, -- [6] |
4, -- [7] |
}, |
["originalSelectedAction"] = 3, |
["originalSelectedPosition"] = 5, |
["originalSelectedPosition"] = 4, |
["actionList"] = { |
6, -- [1] |
5, -- [2] |
1, -- [3] |
2, -- [4] |
3, -- [5] |
7, -- [6] |
5, -- [1] |
1, -- [2] |
2, -- [3] |
3, -- [4] |
7, -- [5] |
0, -- [6] |
0, -- [7] |
}, |
["unavailable"] = { |
4, -- [1] |
false, -- [2] |
}, |
[6] = { |
1, -- [1] |
true, -- [2] |
}, |
}, |
["totalCount"] = 6, |
["totalCount"] = 5, |
}, |
["shield"] = { |
["favoriteCount"] = 2, |
["favoriteCount"] = 1, |
["selectedVisibility"] = 1, |
["selectedPosition"] = 3, |
["selectedPosition"] = 2, |
["selectedAction"] = 1, |
["visibilityList"] = { |
3, -- [1] |
3, -- [2] |
2, -- [3] |
2, -- [2] |
4, -- [3] |
}, |
["originalSelectedAction"] = 1, |
["originalSelectedPosition"] = 3, |
["originalSelectedPosition"] = 2, |
["actionList"] = { |
3, -- [1] |
2, -- [2] |
1, -- [3] |
2, -- [1] |
1, -- [2] |
0, -- [3] |
}, |
["unavailable"] = { |
[3] = { |
1, -- [1] |
true, -- [2] |
}, |
}, |
["totalCount"] = 3, |
["totalCount"] = 2, |
}, |
["earthShield"] = { |
["favoriteCount"] = 1, |
["selectedVisibility"] = 1, |
["selectedPosition"] = 2, |
["selectedAction"] = 2, |
["favoriteCount"] = 0, |
["selectedVisibility"] = 0, |
["selectedPosition"] = 0, |
["selectedAction"] = 0, |
["visibilityList"] = { |
3, -- [1] |
2, -- [2] |
2, -- [3] |
2, -- [4] |
4, -- [1] |
4, -- [2] |
4, -- [3] |
4, -- [4] |
}, |
["originalSelectedAction"] = 2, |
["originalSelectedPosition"] = 2, |
["actionList"] = { |
1, -- [1] |
2, -- [2] |
3, -- [3] |
4, -- [4] |
0, -- [1] |
0, -- [2] |
0, -- [3] |
0, -- [4] |
}, |
["unavailable"] = { |
{ |
1, -- [1] |
true, -- [2] |
}, -- [1] |
{ |
2, -- [1] |
false, -- [2] |
}, -- [2] |
{ |
3, -- [1] |
false, -- [2] |
}, -- [3] |
{ |
4, -- [1] |
false, -- [2] |
}, -- [4] |
}, |
["totalCount"] = 4, |
["totalCount"] = 0, |
}, |
["fireTotem"] = { |
["favoriteCount"] = 3, |
["favoriteCount"] = 4, |
["selectedVisibility"] = 1, |
["selectedPosition"] = 5, |
["selectedAction"] = 3, |
["selectedPosition"] = 6, |
["selectedAction"] = 6, |
["visibilityList"] = { |
3, -- [1] |
3, -- [2] |
3, -- [3] |
2, -- [4] |
3, -- [4] |
2, -- [5] |
2, -- [6] |
4, -- [7] |
2, -- [7] |
}, |
["originalSelectedAction"] = 3, |
["originalSelectedPosition"] = 5, |
["originalSelectedPosition"] = 6, |
["actionList"] = { |
1, -- [1] |
4, -- [2] |
5, -- [3] |
7, -- [4] |
3, -- [5] |
2, -- [6] |
0, -- [7] |
6, -- [6] |
2, -- [7] |
}, |
["unavailable"] = { |
[6] = { |
6, -- [1] |
false, -- [2] |
}, |
}, |
["totalCount"] = 6, |
["totalCount"] = 7, |
}, |
["weapon"] = { |
["favoriteCount"] = 0, |
["favoriteCount"] = 1, |
["selectedVisibility"] = 1, |
["selectedPosition"] = 5, |
["selectedAction"] = 5, |
["selectedAction"] = 3, |
["visibilityList"] = { |
2, -- [1] |
3, -- [1] |
2, -- [2] |
2, -- [3] |
2, -- [4] |
2, -- [5] |
}, |
["originalSelectedAction"] = 5, |
["originalSelectedAction"] = 3, |
["originalSelectedPosition"] = 5, |
["actionList"] = { |
1, -- [1] |
2, -- [2] |
3, -- [3] |
5, -- [1] |
1, -- [2] |
2, -- [3] |
4, -- [4] |
5, -- [5] |
3, -- [5] |
}, |
["unavailable"] = { |
}, |
["totalCount"] = 5, |
}, |
}, |
["tooltipVisibility"] = 1, |
["actionBarSkin"] = 2, |
["ankhActionFrame"] = { |
["visible"] = true, |
["direction"] = 1, |
}, |
["skin"] = 1, |
["totemActionFrame"] = { |
["visible"] = true, |
["direction"] = 1, |
}, |
["buffActionFrame"] = { |
["visible"] = true, |
["direction"] = 1, |
}, |
}; |
-- Ankh cooldown updater (only shaman) |
local AnkhTimerUpdater, ankhTimerUpdater = factoryLib.Factory.CreateSingletonType(timerLib.TimerUpdater); |
local AnkhTimerUpdater, ankhTimerUpdater = factoryLib.Factory.CreateSingletonType(timerUpdaterLib.TimerUpdaterFactory, {"UNIT_INVENTORY_CHANGED"}); |
function AnkhTimerUpdater:Enable(timer) |
timerUpdaterLib.TimerUpdater.Enable(self, timer); |
self:UNIT_INVENTORY_CHANGED(timer); |
end |
function AnkhTimerUpdater:UNIT_INVENTORY_CHANGED(timer) |
timer:SetCount(GetItemCount(self.ankh)); |
end |
{name=self.EARTH_SHIELD, target="mouseover", duration = 600, updater=updater}, |
} |
self.actionBarConfList["ankh"] = { |
{name=self.REINCARNATION, updater=ankhTimerUpdater}, |
} |
--[[ |
----------------- |
GUI CREATION PART |
messages, |
rendererCreatorFunc |
); |
self.frames["ankhActionFrame"] = managerFrameLib.managerFrameFactory:Create( |
self.wowFrame["ankhActionFrame"], |
{"ankh"}, |
self.actionBarConfList, |
"cooldown", |
self.removeMacroTextMap, |
totemManagerData["ankhActionFrame"], |
messages, |
rendererCreatorFunc |
); |
self:UPDATE_BINDINGS(); |
-- frame are created before PLAYER_ENTERING_WORLD, so wow restore their position. |
self.wowFrame = { |
totemActionFrame = CreateFrame("Frame", "totemActionFrame", parent), |
buffActionFrame = CreateFrame("Frame", "buffActionFrame", parent) |
buffActionFrame = CreateFrame("Frame", "buffActionFrame", parent), |
ankhActionFrame = CreateFrame("Frame", "ankhActionFrame", parent), |
}; |
self.wowFrame.totemActionFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 280, -180); |
self.wowFrame.buffActionFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 280, -380); |
self.wowFrame.ankhActionFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 280, -110); |
for _, frame in pairs(self.wowFrame) do |
frame:SetMovable(true); |
end |
end |
function TotemManager:PLAYER_ENTERING_WORLD() |
if totemManagerData.alreadyActivate then |
-- check older version |
if totemManagerData.wotlk2==nil then |
totemManagerData.wotlk = nil; |
self:FirstActivation(); |
totemManagerData.alreadyActivate = true; |
totemManagerData.wotlk2 = true; |
else |
-- activate |
self:Activate(); |
if totemManagerData.ankhActionFrame==nil then |
totemManagerData.ankhActionFrame = {visible=true, direction=managerFrameLib.ManagerFrame.TWISTED_LEFT_DIRECTION}; |
end |
-- activate |
self:Activate(); |
else |
self:FirstActivation(); |
totemManagerData.alreadyActivate = true; |
totemManagerData.wotlk2 = true; |
end |
environmentLib.environment:UnregisterEvent("PLAYER_ENTERING_WORLD", self); |
end |