mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- added the ability to duplicate an existing custom bar
This commit is contained in:
@ -195,11 +195,13 @@ end
|
|||||||
function IceCore.prototype:AddNewDynamicModule(module, hasSettings)
|
function IceCore.prototype:AddNewDynamicModule(module, hasSettings)
|
||||||
if not hasSettings then
|
if not hasSettings then
|
||||||
self.settings.modules[module.elementName] = module:GetDefaultSettings()
|
self.settings.modules[module.elementName] = module:GetDefaultSettings()
|
||||||
|
elseif type(hasSettings) == "table" then
|
||||||
|
self.settings.modules[module.elementName] = IceHUD.deepcopy(hasSettings)
|
||||||
end
|
end
|
||||||
|
|
||||||
module:SetDatabase(self.settings)
|
module:SetDatabase(self.settings)
|
||||||
|
|
||||||
if not hasSettings then
|
if not hasSettings or type(hasSettings) == "table" then
|
||||||
local numExisting = self:GetNumCustomModules(module, module:GetDefaultSettings().customBarType)
|
local numExisting = self:GetNumCustomModules(module, module:GetDefaultSettings().customBarType)
|
||||||
self:RenameDynamicModule(module, "MyCustom"..module:GetDefaultSettings().customBarType..(numExisting+1))
|
self:RenameDynamicModule(module, "MyCustom"..module:GetDefaultSettings().customBarType..(numExisting+1))
|
||||||
end
|
end
|
||||||
|
58
IceHUD.lua
58
IceHUD.lua
@ -9,7 +9,7 @@ local AceSerializer = LibStub("AceSerializer-3.0", 1)
|
|||||||
|
|
||||||
local pendingModuleLoads = {}
|
local pendingModuleLoads = {}
|
||||||
local bReadyToRegisterModules = false
|
local bReadyToRegisterModules = false
|
||||||
local lastCustomModule = 1
|
local lastCustomModule = "Bar"
|
||||||
|
|
||||||
IceHUD.CurrTagVersion = 3
|
IceHUD.CurrTagVersion = 3
|
||||||
IceHUD.debugging = false
|
IceHUD.debugging = false
|
||||||
@ -17,7 +17,7 @@ IceHUD.debugging = false
|
|||||||
IceHUD.WowVer = select(4, GetBuildInfo())
|
IceHUD.WowVer = select(4, GetBuildInfo())
|
||||||
|
|
||||||
IceHUD.validBarList = { "Bar", "HiBar", "RoundBar", "ColorBar", "RivetBar", "RivetBar2", "CleanCurves", "GlowArc", "BloodGlaives", "ArcHUD", "FangRune" }
|
IceHUD.validBarList = { "Bar", "HiBar", "RoundBar", "ColorBar", "RivetBar", "RivetBar2", "CleanCurves", "GlowArc", "BloodGlaives", "ArcHUD", "FangRune" }
|
||||||
IceHUD.validCustomModules = {"Buff/Debuff watcher", "Buff/Debuff stack counter", "Ability cooldown bar", "Health bar", "Mana bar"}
|
IceHUD.validCustomModules = {Bar="Buff/Debuff watcher", Counter="Buff/Debuff stack counter", CD="Ability cooldown bar", Health="Health bar", Mana="Mana bar"}
|
||||||
|
|
||||||
local function deepcopy(object)
|
local function deepcopy(object)
|
||||||
local lookup_table = {}
|
local lookup_table = {}
|
||||||
@ -37,6 +37,8 @@ local function deepcopy(object)
|
|||||||
return _copy(object)
|
return _copy(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
IceHUD.deepcopy = deepcopy
|
||||||
|
|
||||||
IceHUD.Location = "Interface\\AddOns\\IceHUD"
|
IceHUD.Location = "Interface\\AddOns\\IceHUD"
|
||||||
IceHUD.options =
|
IceHUD.options =
|
||||||
{
|
{
|
||||||
@ -599,30 +601,7 @@ Expand "|cffffdc42Module Settings|r", expand PlayerInfo (or TargetInfo for targe
|
|||||||
name = "Create",
|
name = "Create",
|
||||||
desc = "Creates the selected custom module",
|
desc = "Creates the selected custom module",
|
||||||
func = function()
|
func = function()
|
||||||
local v = lastCustomModule
|
IceHUD:CreateCustomModuleAndNotify(lastCustomModule)
|
||||||
local newMod = nil
|
|
||||||
local popupMsg
|
|
||||||
if v == 1 then -- custom bar
|
|
||||||
newMod = IceCustomBar:new()
|
|
||||||
popupMsg = "ICEHUD_CUSTOM_BAR_CREATED"
|
|
||||||
elseif v == 2 then -- custom counter
|
|
||||||
newMod = IceCustomCount:new()
|
|
||||||
popupMsg = "ICEHUD_CUSTOM_COUNTER_CREATED"
|
|
||||||
elseif v == 3 then -- cooldown bar
|
|
||||||
newMod = IceCustomCDBar:new()
|
|
||||||
popupMsg = "ICEHUD_CUSTOM_CD_CREATED"
|
|
||||||
elseif v == 4 then -- custom health bar
|
|
||||||
newMod = IceCustomHealth:new()
|
|
||||||
popupMsg = "ICEHUD_CUSTOM_HEALTH_CREATED"
|
|
||||||
elseif v == 5 then -- custom mana bar
|
|
||||||
newMod = IceCustomMana:new()
|
|
||||||
popupMsg = "ICEHUD_CUSTOM_MANA_CREATED"
|
|
||||||
end
|
|
||||||
if newMod ~= nil then
|
|
||||||
IceHUD.IceCore:AddNewDynamicModule(newMod)
|
|
||||||
ConfigDialog:SelectGroup("IceHUD", "modules", newMod.elementName)
|
|
||||||
StaticPopup_Show(popupMsg)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
order = 94.6,
|
order = 94.6,
|
||||||
},
|
},
|
||||||
@ -1292,3 +1271,30 @@ function IceHUD:UpdateMedia(event, mediatype, key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function IceHUD:CreateCustomModuleAndNotify(moduleKey, settings)
|
||||||
|
local newMod = nil
|
||||||
|
local popupMsg
|
||||||
|
if moduleKey == "Bar" then -- custom bar
|
||||||
|
newMod = IceCustomBar:new()
|
||||||
|
popupMsg = "ICEHUD_CUSTOM_BAR_CREATED"
|
||||||
|
elseif moduleKey == "Counter" then -- custom counter
|
||||||
|
newMod = IceCustomCount:new()
|
||||||
|
popupMsg = "ICEHUD_CUSTOM_COUNTER_CREATED"
|
||||||
|
elseif moduleKey == "CD" then -- cooldown bar
|
||||||
|
newMod = IceCustomCDBar:new()
|
||||||
|
popupMsg = "ICEHUD_CUSTOM_CD_CREATED"
|
||||||
|
elseif moduleKey == "Health" then -- custom health bar
|
||||||
|
newMod = IceCustomHealth:new()
|
||||||
|
popupMsg = "ICEHUD_CUSTOM_HEALTH_CREATED"
|
||||||
|
elseif moduleKey == "Mana" then -- custom mana bar
|
||||||
|
newMod = IceCustomMana:new()
|
||||||
|
popupMsg = "ICEHUD_CUSTOM_MANA_CREATED"
|
||||||
|
end
|
||||||
|
|
||||||
|
if newMod ~= nil then
|
||||||
|
IceHUD.IceCore:AddNewDynamicModule(newMod, settings)
|
||||||
|
ConfigDialog:SelectGroup("IceHUD", "modules", newMod.elementName)
|
||||||
|
StaticPopup_Show(popupMsg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -161,6 +161,16 @@ function IceCustomBar.prototype:GetOptions()
|
|||||||
order = 20.1,
|
order = 20.1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts["duplicateme"] = {
|
||||||
|
type = 'execute',
|
||||||
|
name = 'Duplicate me',
|
||||||
|
desc = 'Creates a new module of this same type and with all the same settings.',
|
||||||
|
func = function()
|
||||||
|
IceHUD:CreateCustomModuleAndNotify(self.moduleSettings.customBarType, self.moduleSettings)
|
||||||
|
end,
|
||||||
|
order = 20.2,
|
||||||
|
}
|
||||||
|
|
||||||
opts["name"] = {
|
opts["name"] = {
|
||||||
type = 'input',
|
type = 'input',
|
||||||
name = 'Bar name',
|
name = 'Bar name',
|
||||||
|
@ -148,6 +148,16 @@ function IceCustomCDBar.prototype:GetOptions()
|
|||||||
order = 20.1,
|
order = 20.1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts["duplicateme"] = {
|
||||||
|
type = 'execute',
|
||||||
|
name = 'Duplicate me',
|
||||||
|
desc = 'Creates a new module of this same type and with all the same settings.',
|
||||||
|
func = function()
|
||||||
|
IceHUD:CreateCustomModuleAndNotify(self.moduleSettings.customBarType, self.moduleSettings)
|
||||||
|
end,
|
||||||
|
order = 20.2,
|
||||||
|
}
|
||||||
|
|
||||||
opts["name"] = {
|
opts["name"] = {
|
||||||
type = 'input',
|
type = 'input',
|
||||||
name = 'Bar name',
|
name = 'Bar name',
|
||||||
|
@ -37,6 +37,16 @@ function IceCustomCount.prototype:GetOptions()
|
|||||||
order = 20.1,
|
order = 20.1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts["duplicateme"] = {
|
||||||
|
type = 'execute',
|
||||||
|
name = 'Duplicate me',
|
||||||
|
desc = 'Creates a new module of this same type and with all the same settings.',
|
||||||
|
func = function()
|
||||||
|
IceHUD:CreateCustomModuleAndNotify(self.moduleSettings.customBarType, self.moduleSettings)
|
||||||
|
end,
|
||||||
|
order = 20.2,
|
||||||
|
}
|
||||||
|
|
||||||
opts["name"] = {
|
opts["name"] = {
|
||||||
type = 'input',
|
type = 'input',
|
||||||
name = 'Counter name',
|
name = 'Counter name',
|
||||||
|
@ -52,6 +52,16 @@ function IceCustomHealth.prototype:GetOptions()
|
|||||||
order = 20.1,
|
order = 20.1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts["duplicateme"] = {
|
||||||
|
type = 'execute',
|
||||||
|
name = 'Duplicate me',
|
||||||
|
desc = 'Creates a new module of this same type and with all the same settings.',
|
||||||
|
func = function()
|
||||||
|
IceHUD:CreateCustomModuleAndNotify(self.moduleSettings.customBarType, self.moduleSettings)
|
||||||
|
end,
|
||||||
|
order = 20.2,
|
||||||
|
}
|
||||||
|
|
||||||
opts["name"] = {
|
opts["name"] = {
|
||||||
type = 'input',
|
type = 'input',
|
||||||
name = 'Bar name',
|
name = 'Bar name',
|
||||||
|
@ -53,6 +53,16 @@ function IceCustomMana.prototype:GetOptions()
|
|||||||
order = 20.1,
|
order = 20.1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts["duplicateme"] = {
|
||||||
|
type = 'execute',
|
||||||
|
name = 'Duplicate me',
|
||||||
|
desc = 'Creates a new module of this same type and with all the same settings.',
|
||||||
|
func = function()
|
||||||
|
IceHUD:CreateCustomModuleAndNotify(self.moduleSettings.customBarType, self.moduleSettings)
|
||||||
|
end,
|
||||||
|
order = 20.2,
|
||||||
|
}
|
||||||
|
|
||||||
opts["name"] = {
|
opts["name"] = {
|
||||||
type = 'input',
|
type = 'input',
|
||||||
name = 'Bar name',
|
name = 'Bar name',
|
||||||
|
Reference in New Issue
Block a user