add NP_PreserveGreaterDemonAutocast

This commit is contained in:
avitasia
2026-03-02 08:46:07 -08:00
parent e933131ad4
commit 2f0d7294df
3 changed files with 70 additions and 0 deletions
+6
View File
@@ -160,6 +160,9 @@ L:RegisterTranslations("enUS", function()
["Enable GUID Unit Event Filtering"] = true,
["When enabled, suppresses high-frequency GUID events that cause spam in older addons — specifically UNIT_AURA, UNIT_HEALTH, UNIT_MANA, and similar events below UNIT_COMBAT, plus UNIT_NAME_UPDATE, UNIT_PORTRAIT_UPDATE, UNIT_INVENTORY_CHANGED, and PLAYER_GUILD_UPDATE. UNIT_COMBAT_GUID and other less frequent GUID events are still fired. Has no effect if Enable GUID Unit Events is disabled. This is a direct replacement for the 'Filter GUID Events' option in PerfBoost."] = true,
["Preserve Greater Demon Autocast"] = true,
["Whether to remember and restore Felguard/Doomguard autocast preferences when swapping or resummoning those greater demons."] = true,
}
end)
@@ -323,5 +326,8 @@ L:RegisterTranslations("zhCN", function()
["Enable GUID Unit Event Filtering"] = "启用GUID单位事件过滤",
["When enabled, suppresses high-frequency GUID events that cause spam in older addons — specifically UNIT_AURA, UNIT_HEALTH, UNIT_MANA, and similar events below UNIT_COMBAT, plus UNIT_NAME_UPDATE, UNIT_PORTRAIT_UPDATE, UNIT_INVENTORY_CHANGED, and PLAYER_GUILD_UPDATE. UNIT_COMBAT_GUID and other less frequent GUID events are still fired. Has no effect if Enable GUID Unit Events is disabled. This is a direct replacement for the 'Filter GUID Events' option in PerfBoost."] = "启用后,将屏蔽对旧版插件造成刷屏的高频 GUID 事件——具体包括 UNIT_COMBAT 以下的事件(如 UNIT_AURA、UNIT_HEALTH、UNIT_MANA 等),以及 UNIT_NAME_UPDATE、UNIT_PORTRAIT_UPDATE、UNIT_INVENTORY_CHANGED 和 PLAYER_GUILD_UPDATE。UNIT_COMBAT_GUID 及其他低频 GUID 事件仍会正常触发。若已禁用「启用GUID单位事件」,则此设置无效。此选项直接替代 PerfBoost 中的「过滤GUID事件」功能。",
["Preserve Greater Demon Autocast"] = "保留大型恶魔自动施法",
["Whether to remember and restore Felguard/Doomguard autocast preferences when swapping or resummoning those greater demons."] = "切换或重新召唤地狱守卫/末日守卫时,是否记忆并恢复其自动施法设置。",
}
end)
+44
View File
@@ -768,3 +768,47 @@ end
--Nampower:RegisterEvent("UNIT_COMBAT", onUnitCombat)
--Nampower:RegisterEvent("UNIT_COMBAT_GUID", onUnitCombatGuid)
-- SPELL_CAST_EVENT - fires when you (or certain pets) initiate a spell cast
-- Triggered client-side before the cast is sent to the server.
-- Only fires for spells you initiated.
-- Parameters:
-- success (int) - 1 if cast succeeded, 0 if failed
-- spellId (int) - spell ID
-- castType (int) - see Cast Type Constants below
-- targetGuid (string) - guid string like "0xF5300000000000A5"
-- itemId (int) - item ID that triggered the spell, 0 if not item-triggered
-- Cast Type Constants
local CAST_TYPE_NORMAL = 0
local CAST_TYPE_NON_GCD = 1
local CAST_TYPE_ON_SWING = 2
local CAST_TYPE_CHANNEL = 3
local CAST_TYPE_TARGETING = 4
local CAST_TYPE_TARGETING_NON_GCD = 5
local CAST_TYPE_NAMES = {
[0] = "Normal",
[1] = "NonGCD",
[2] = "OnSwing",
[3] = "Channel",
[4] = "Targeting",
[5] = "TargetingNonGCD",
}
function GetCastTypeName(castType)
return CAST_TYPE_NAMES[castType] or "Unknown"
end
local function onSpellCastEvent(success, spellId, castType, targetGuid, itemId)
local spellName = GetSpellRecField and GetSpellRecField(spellId, "name") or spellId
local castTypeName = GetCastTypeName(castType)
local successText = success == 1 and "OK" or "FAILED"
local itemText = itemId ~= 0 and (" | Item: " .. tostring(itemId)) or ""
print(string.format(
"SPELL_CAST_EVENT: [%s] %s (id:%d) | Type: %s | Target: %s%s",
successText, tostring(spellName), spellId, castTypeName, tostring(targetGuid), itemText
))
end
--Nampower:RegisterEvent("SPELL_CAST_EVENT", onSpellCastEvent)
+20
View File
@@ -1074,6 +1074,26 @@ if Nampower:HasMinimumVersion(2, 39, 0) then
}
end
if Nampower:HasMinimumVersion(3, 1, 0) then
Nampower.cmdtable.args.qol_options.args.NP_PreserveGreaterDemonAutocast = {
type = "toggle",
name = L["Preserve Greater Demon Autocast"],
desc = L["Whether to remember and restore Felguard/Doomguard autocast preferences when swapping or resummoning those greater demons."],
order = 25,
get = function()
return GetCVar("NP_PreserveGreaterDemonAutocast") == "1"
end,
set = function(v)
Nampower.db.profile.NP_PreserveGreaterDemonAutocast = v
if v == true then
SetCVar("NP_PreserveGreaterDemonAutocast", "1")
else
SetCVar("NP_PreserveGreaterDemonAutocast", "0")
end
end,
}
end
local deuce = Nampower:NewModule("Nampower Options Menu")
deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar
deuce.consoleCmd = not deuce.hasFuBar