diff --git a/CommandManager.lua b/CommandManager.lua index f866d71..3e8d938 100644 --- a/CommandManager.lua +++ b/CommandManager.lua @@ -270,10 +270,22 @@ CM:Register({"set", "s"}, PM.Access.Groups.Admin.Level, function(args, sender, i return false, "CM_ERR_NOCHAT" end args[2] = args[2]:lower() - if args[2]:match("^[eay]") then -- Enable + if args[2]:match("^[eay].*rel") then -- Enable release + return C.DeathManager:EnableRelease() + elseif args[2]:match("^[dn].*rel") then -- Disable release + return C.DeathManager:DisableRelease() + elseif args[2]:match("^[eay].*r") then -- Enable ress + return C.DeathManager:EnableResurrect() + elseif args[2]:match("^[dn].*r") then -- Disable ress + return C.DeathManager:DisableResurrect() + elseif args[2]:match("^[eay]") then -- Enable return C.DeathManager:Enable() elseif args[2]:match("^[dn]") then -- Disable return C.DeathManager:Disable() + elseif args[2]:match("^t.*rel") then -- Toggle release + return C.DeathManager:ToggleRelease() + elseif args[2]:match("^t.*r") then -- Toggle resurrect + return C.DeathManager:ToggleResurrect() elseif args[2]:match("^t") then -- Toggle return C.DeathManager:Toggle() end @@ -897,14 +909,14 @@ CM:Register({"raiddifficulty", "raiddiff", "rd", "raidmode", "rm"}, PM.Access.Gr end, "CM_RAIDMODE_HELP") CM:Register({"release", "rel"}, PM.Access.Groups.Op.Level, function(args, sender, isChat) - if not DM:IsEnabled() then + if not DM:IsEnabled() or not DM:IsReleaseEnabled() then return false, "CM_ERR_DISABLED" end return DM:Release() end, "CM_RELEASE_HELP") CM:Register({"resurrect", "ressurrect", "ress", "res"}, PM.Access.Groups.User.Level, function(args, sender, isChat) - if not DM:IsEnabled() then + if not DM:IsEnabled() or not DM:IsResurrectEnabled() then return false, "CM_ERR_DISABLED" end return DM:Resurrect() diff --git a/DeathManager.lua b/DeathManager.lua index c692136..7c899d4 100644 --- a/DeathManager.lua +++ b/DeathManager.lua @@ -61,6 +61,12 @@ function DM:LoadSavedVars() if type(self.Settings.ENABLED) ~= "boolean" then self.Settings.ENABLED = false end + if type(self.Settings.RELEASE_ENABLED) ~= "boolean" then + self.Settings.RELEASE_ENABLED = true + end + if type(self.Settings.RESURRECT_ENABLED) ~= "boolean" then + self.Settings.RESURRECT_ENABLED = true + end end function DM:OnDeath() @@ -73,13 +79,13 @@ function DM:OnDeath() CM:SendMessage(L("DM_ONDEATH_REINCARNATE"), "SMART") elseif t == SelfRessType.Card then CM:SendMessage(L("DM_ONDEATH_CARD"), "SMART") - else + elseif self.Settings.RELEASE_ENABLED then CM:SendMessage(L("DM_ONDEATH"), "SMART") end end function DM:OnResurrect(resser) - if not self.Settings.ENABLED then return end + if not self.Settings.ENABLED or not self.Settings.RESURRECT_ENABLED then return end self.Resurrection = true CM:SendMessage(L("DM_ONRESS"):format(resser), "SMART") end @@ -171,3 +177,45 @@ function DM:Toggle() end return self:Enable() end + +function DM:IsReleaseEnabled() + return self.Settings.RELEASE_ENABLED +end + +function DM:EnableRelease() + self.Settings.RELEASE_ENABLED = true + return "DM_RELEASE_ENABLED" +end + +function DM:DisableRelease() + self.Settings.RELEASE_ENABLED = false + return "DM_RELEASE_DISABLED" +end + +function DM:ToggleRelease() + if self:IsReleaseEnabled() then + return self:DisableRelease() + end + return self:EnableRelease() +end + +function DM:IsResurrectEnabled() + return self.Settings.RESURRECT_ENABLED +end + +function DM:EnableResurrect() + self.Settings.RESURRECT_ENABLED = true + return "DM_RESURRECT_ENABLED" +end + +function DM:DisableResurrect() + self.Settings.RESURRECT_ENABLED = false + return "DM_RESURRECT_DISABLED" +end + +function DM:ToggleResurrect() + if self:IsResurrectEnabled() then + return self:DisableResurrect() + end + return self:EnableResurrect() +end diff --git a/locales/enUS.lua b/locales/enUS.lua index 7fb1c93..e198fce 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -447,6 +447,10 @@ local L = { DM_ENABLED = "DeathManager has been enabled.", DM_DISABLED = "DeathManager has been disabled.", + DM_RELEASE_ENABLED = "DeathManager (Release) has been enabled.", + DM_RELEASE_DISABLED = "DeathManager (Release) has been disabled.", + DM_RESURRECT_ENABLED = "DeathManager (Resurrect) has been enabled.", + DM_RESURRECT_DISABLED = "DeathManager (Resurrect) has been disabled.", DM_ONDEATH = "I have died! Type !release to make me release spirit.", DM_ONDEATH_SOULSTONE = "Died with active soulstone, type !ress to make me ress!", diff --git a/locales/svSE.lua b/locales/svSE.lua index e2d6642..af5ee9c 100644 --- a/locales/svSE.lua +++ b/locales/svSE.lua @@ -447,6 +447,10 @@ local L = { DM_ENABLED = "DeathManager has been enabled.", DM_DISABLED = "DeathManager has been disabled.", + DM_RELEASE_ENABLED = "DeathManager (Release) has been enabled.", + DM_RELEASE_DISABLED = "DeathManager (Release) has been disabled.", + DM_RESURRECT_ENABLED = "DeathManager (Resurrect) has been enabled.", + DM_RESURRECT_DISABLED = "DeathManager (Resurrect) has been disabled.", DM_ONDEATH = "I have died! Type !release to make me release spirit.", DM_ONDEATH_SOULSTONE = "Died with active soulstone, type !ress to make me ress!",