/trunk
-- end import |
local TotemManagerFrameHandler, TotemManagerFrameHandlerFactory, totemManagerFrameHandlerFactory = factoryLib.Factory.CreateType(); |
function TotemManagerFrameHandler:GetDirection() |
return self.frame:GetDirection(); |
end |
function TotemManagerFrameHandler:SetDirection(_, direction) |
if self.totemManager:CheckCombat() then |
return; |
end |
self.frame:SetDirection(tonumber(direction)); |
end |
function TotemManagerFrameHandler:IsVisible() |
return self.frame:IsVisible(); |
end |
function TotemManagerFrameHandler:ToggleVisibility() |
if self.totemManager:CheckCombat() then |
return; |
end |
self.frame:ToggleVisibility(); |
end |
function TotemManagerFrameHandlerFactory:Create(totemManager, frame) |
local totemManagerFrame = self:NewInstance(); |
totemManagerFrame.totemManager = totemManager; |
totemManagerFrame.frame = frame; |
return totemManagerFrame; |
end |
-- Ankh cooldown updater (only shaman) |
local AnkhTimerUpdater, ankhTimerUpdater = factoryLib.Factory.CreateSingletonType(timerUpdaterLib.TimerUpdaterFactory, {"UNIT_INVENTORY_CHANGED"}); |
end |
function TotemManager:CheckCombat() |
if InCombatLockdown() then |
self.console:Print("You are in combat"); |
return true; |
else |
return false; |
end |
end |
function TotemManager:Reset() |
self:FirstActivation(); |
totemManagerData.alreadyActivate3_1 = true; |
self.console:Print("Configuration reset, you need to restart your UI"); |
totemManagerData.alreadyActivate3_1 = false; |
self.console:Print("Configuration will be reset, you need to restart your UI"); |
end |
function TotemManager:SetTooltipVisibility(_, value) |
end |
function TotemManager:ToggleLocked() |
if self:CheckCombat() then |
return; |
end |
self.locked = not self.locked; |
for _, frame in pairs(self.frames) do |
frame:ToggleLocked(); |
end |
function TotemManager:SetTimerSkin(_, value) |
if self:CheckCombat() then |
return; |
end |
totemManagerData.timerSkin = tonumber(value); |
end |
end |
function TotemManager:SetActionBarSkin(_, value) |
if self:CheckCombat() then |
return; |
end |
local nvalue = tonumber(value); |
local rendererCreatorFunc = self.ACTION_BAR_SKIN[nvalue]; |
if rendererCreatorFunc ~= nil then |
end |
function TotemManager:SetScale(_, value) |
if self:CheckCombat() then |
return; |
end |
local nvalue = tonumber(value); |
if nvalue>0 then |
totemManagerData.scale = nvalue; |
for _, frame in pairs(self.wowFrame) do |
frame:SetScale(nvalue); |
frame:Raise(); |
end |
end |
end |
function TotemManager:OpenGui() |
InterfaceOptionsFrame_OpenToCategory(self.optionFrame); |
end |
function TotemManager:CreateConsole() |
get = "GetScale", |
set = "SetScale", |
}, |
--[[ |
reset = { |
type = "execute", |
name = "reset", |
func = "Reset", |
desc = "reset configuration (delete savedVariables in WTF)" |
scale = { |
type = "execute", |
name = "mark for reset", |
desc = "on next ui load, default values will be used", |
func = "Reset", |
}, |
]] |
} |
}; |
for frameName, frame in pairs(self.frames) do |
options.args[frameName] = {type="group", name=frameName, handler=frame, args = { |
options.args[frameName] = {type="group", name=frameName, handler=totemManagerFrameHandlerFactory:Create(self, frame), args = { |
visibility = { |
type = "toggle", |
name = "visible", |
end}); |
LibStub("AceConfig-3.0"):RegisterOptionsTable("TotemManager", options); |
LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TotemManager", "TotemManager"); |
self.optionFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TotemManager", "TotemManager"); |
console:RegisterChatCommand("totemmanager", "ChatCommand"); |
console:RegisterChatCommand("tm", "ChatCommand"); |
function console:ChatCommand(input) |
LibStub("AceConfigCmd-3.0").HandleCommand(totemManager, "tm", "TotemManager", input); |
if not input or input:trim() == "" then |
totemManager:OpenGui(); |
else |
LibStub("AceConfigCmd-3.0").HandleCommand(totemManager, "tm", "TotemManager", input); |
end |
end |
end |
function TotemManager:FirstActivation() |
if true then |
-- these data are in TotemManagerBackup |
totemManagerData = self.defaultTotemManagerData; |
else |
-- or new data |
totemManagerData = { timerSkin = 1, actionBarSkin = 2, tooltipVisibility = 1, scale = 1 }; |
end |
self:Activate(); |
end |
function TotemManager:Activate() |
ActionBarRenderer.tooltipVisibility = totemManagerData.tooltipVisibility; |
self.removeFuncMap, |
totemManagerData["totemActionFrame"], |
messages, |
rendererCreatorFunc |
rendererCreatorFunc, |
280, |
590 |
); |
totemManagerData["totemActionFrame"] = self.frames["totemActionFrame"]:GetBackup(); |
self.removeFuncMap, |
totemManagerData["buffActionFrame"], |
messages, |
rendererCreatorFunc |
rendererCreatorFunc, |
280, |
390 |
); |
totemManagerData["buffActionFrame"] = self.frames["buffActionFrame"]:GetBackup(); |
self.removeFuncMap, |
totemManagerData["ankhActionFrame"], |
messages, |
rendererCreatorFunc |
rendererCreatorFunc, |
845, |
615 |
); |
totemManagerData["ankhActionFrame"] = self.frames["ankhActionFrame"]:GetBackup(); |
-- activate |
self:Activate(); |
else |
self:FirstActivation(); |
totemManagerData = self.defaultTotemManagerData; |
self:Activate(); |
totemManagerData.alreadyActivate3_1 = true; |
self.console:Print("Successful installation"); |
end |
totem manager functionnalities |
- Add scaling capability |
- ActionBar skins can be changed dynamically |
- Add mark for reset option |
- GUI configuration can now be acceded with /tm or /totemmanager |
Bug correction : |
- Duration of searing totem |
- Fix issue which can happend when specialisations changed |
- Check for combat before doing unsafe operations |
Regression : |
- Remove candy bar timer renderer (maybe LibBar will be use in future) |
["ankhActionFrame"] = { |
["visible"] = true, |
["direction"] = 1, |
["left"] = 845, |
["top"] = 615, |
}, |
["totemActionFrame"] = { |
["visible"] = true, |
["direction"] = 1, |
["left"] = 280, |
["top"] = 590, |
}, |
["buffActionFrame"] = { |
["visible"] = true, |
["direction"] = 1, |
["left"] = 280, |
["top"] = 390, |
}, |
["tooltipVisibility"] = 1, |
["actionBarBackup"] = { |