add alternate quickcast mode and some helper functions

This commit is contained in:
avitasia
2025-12-09 13:30:29 -08:00
parent fde85304cb
commit 9ef892775c
4 changed files with 202 additions and 46 deletions
+12
View File
@@ -47,12 +47,18 @@ L:RegisterTranslations("enUS", function()
["Cooldown Queue Window (ms)"] = true, ["Cooldown Queue Window (ms)"] = true,
["The window in ms before a spell coming off cooldown finishes where the next will get queued"] = true, ["The window in ms before a spell coming off cooldown finishes where the next will get queued"] = true,
["Cast Options"] = true,
["Options for controlling casting behavior"] = true,
["Advanced options"] = true, ["Advanced options"] = true,
["Collection of various advanced options"] = true, ["Collection of various advanced options"] = true,
["Double Cast to End Channel Early"] = true, ["Double Cast to End Channel Early"] = true,
["Whether to allow double casting a spell within 350ms to end channeling on the next tick. Takes into account your ChannelLatencyReductionPercentage."] = true, ["Whether to allow double casting a spell within 350ms to end channeling on the next tick. Takes into account your ChannelLatencyReductionPercentage."] = true,
["Quickcast Targeting Spells on Double Cast"] = true,
["Allows casting targeting spells by attempting to cast them twice as opposed to the default client behavior which cancels the targeting indicator"] = true,
["Interrupt Channels Outside Queue Window"] = true, ["Interrupt Channels Outside Queue Window"] = true,
["Whether to allow interrupting channels (the original client behavior) when trying to cast a spell outside the channeling queue window"] = true, ["Whether to allow interrupting channels (the original client behavior) when trying to cast a spell outside the channeling queue window"] = true,
@@ -161,12 +167,18 @@ L:RegisterTranslations("zhCN", function()
["Cooldown Queue Window (ms)"] = "冷却结束队列窗口(ms", ["Cooldown Queue Window (ms)"] = "冷却结束队列窗口(ms",
["The window in ms before a spell coming off cooldown finishes where the next will get queued"] = "法术冷却结束前多少毫秒(ms)可将该法术加入队列", ["The window in ms before a spell coming off cooldown finishes where the next will get queued"] = "法术冷却结束前多少毫秒(ms)可将该法术加入队列",
["Cast Options"] = "施法选项",
["Options for controlling casting behavior"] = "控制施法行为的选项",
["Advanced options"] = "高级选项", ["Advanced options"] = "高级选项",
["Collection of various advanced options"] = "各类高级选项集合", ["Collection of various advanced options"] = "各类高级选项集合",
["Double Cast to End Channel Early"] = "双重施法提前结束引导", ["Double Cast to End Channel Early"] = "双重施法提前结束引导",
["Whether to allow double casting a spell within 350ms to end channeling on the next tick. Takes into account your ChannelLatencyReductionPercentage."] = "是否允许350毫秒内双重施法以在下一个伤害周期提前结束引导。受引导延迟削减比例影响。", ["Whether to allow double casting a spell within 350ms to end channeling on the next tick. Takes into account your ChannelLatencyReductionPercentage."] = "是否允许350毫秒内双重施法以在下一个伤害周期提前结束引导。受引导延迟削减比例影响。",
["Quickcast Targeting Spells on Double Cast"] = "双重施法快速施放目标区域法术",
["Allows casting targeting spells by attempting to cast them twice as opposed to the default client behavior which cancels the targeting indicator"] = "允许通过双次尝试施法来释放目标区域法术,而非默认客户端行为(取消目标指示器)",
["Interrupt Channels Outside Queue Window"] = "队列窗口外允许打断引导", ["Interrupt Channels Outside Queue Window"] = "队列窗口外允许打断引导",
["Whether to allow interrupting channels (the original client behavior) when trying to cast a spell outside the channeling queue window"] = "在引导法术队列窗口外尝试施法时,是否允许打断引导(默认客户端行为)", ["Whether to allow interrupting channels (the original client behavior) when trying to cast a spell outside the channeling queue window"] = "在引导法术队列窗口外尝试施法时,是否允许打断引导(默认客户端行为)",
+1
View File
@@ -22,3 +22,4 @@ libs\FuBarPlugin\FuBarPlugin-2.0.lua
Localization.lua Localization.lua
settings.lua settings.lua
helper.lua
+110
View File
@@ -0,0 +1,110 @@
if not Nampower:HasMinimumVersion(2, 14, 0) then
return
end
local function GetSpellMod(num)
local modifierTypes = {
[0] = "DAMAGE",
[1] = "DURATION",
[2] = "THREAT",
[3] = "ATTACK_POWER",
[4] = "CHARGES",
[5] = "RANGE",
[6] = "RADIUS",
[7] = "CRITICAL_CHANCE",
[8] = "ALL_EFFECTS",
[9] = "NOT_LOSE_CASTING_TIME",
[10] = "CASTING_TIME",
[11] = "COOLDOWN",
[12] = "SPEED",
[14] = "COST",
[15] = "CRIT_DAMAGE_BONUS",
[16] = "RESIST_MISS_CHANCE",
[17] = "JUMP_TARGETS",
[18] = "CHANCE_OF_SUCCESS",
[19] = "ACTIVATION_TIME",
[20] = "EFFECT_PAST_FIRST",
[21] = "CASTING_TIME_OLD",
[22] = "DOT",
[23] = "HASTE",
[24] = "SPELL_BONUS_DAMAGE",
[27] = "MULTIPLE_VALUE",
[28] = "RESIST_DISPEL_CHANCE"
}
return modifierTypes[num] or "UNKNOWN"
end
function PrintTable(tbl, indent)
indent = indent or 0
local prefix = string.rep(" ", indent)
for k, v in pairs(tbl) do
if type(v) == "table" then
print(prefix .. tostring(k) .. ":")
PrintTable(v, indent + 1)
else
print(prefix .. tostring(k) .. ": " .. tostring(v))
end
end
end
if CombatLogAdd then
function PrintTableToCombatLog(tbl, indent)
indent = indent or 0
local prefix = string.rep(" ", indent)
for k, v in pairs(tbl) do
if type(v) == "table" then
CombatLogAdd(prefix .. tostring(k) .. ":")
PrintTableToCombatLog(v, indent + 1)
else
CombatLogAdd(prefix .. tostring(k) .. ": " .. tostring(v))
end
end
end
function LogUnitData(unit)
local data = GetUnitData(unit)
if data then
PrintTableToCombatLog(data)
else
print("No unit data available")
end
end
function LogSpellData(spellId)
local data = GetSpellRec(spellId)
if data then
PrintTableToCombatLog(data)
else
print("No spell data available")
end
end
end
function PrintUnitData(unit)
local data = GetUnitData(unit)
if data then
PrintTable(data)
else
print("No unit data available")
end
end
function PrintSpellMods(spellId)
for i = 0, 28 do
local flatMod, percentMod, ret = GetSpellModifiers(spellId, i)
if ret > 0 then
print(GetSpellMod(i) .. " (" .. tostring(i) .. "): flat:" .. tostring(flatMod) .. " percent:" .. tostring(percentMod))
end
end
end
function PrintSpellData(spellId)
local data = GetSpellRec(spellId)
if data then
PrintTable(data)
else
print("No spell data available")
end
end
+79 -46
View File
@@ -1,8 +1,7 @@
local L = AceLibrary("AceLocale-2.2"):new("NampowerSettings") local L = AceLibrary("AceLocale-2.2"):new("NampowerSettings")
-- No Nampower v2, no need for settings -- No Nampower v2, no need for settings
local has_v2_nampower = pcall(GetCVar, "NP_QueueCastTimeSpells") if not GetNampowerVersion then
if not has_v2_nampower then
DEFAULT_CHAT_FRAME:AddMessage(L["|cffffcc00Nampower v2|cffffaaaa not present hiding settings."]) DEFAULT_CHAT_FRAME:AddMessage(L["|cffffcc00Nampower v2|cffffaaaa not present hiding settings."])
return return
end end
@@ -394,17 +393,34 @@ Nampower.cmdtable = {
name = " ", name = " ",
order = 50, order = 50,
}, },
advanced_options = { cast_options = {
type = "group", type = "group",
name = L["Advanced options"], name = L["Cast Options"],
desc = L["Collection of various advanced options"], desc = L["Options for controlling casting behavior"],
order = 60, order = 55,
args = { args = {
NP_QuickcastTargetingSpells = {
type = "toggle",
name = L["Quickcast Targeting Spells"],
desc = L["Whether to enable quick casting for ALL spells with terrain targeting"],
order = 5,
get = function()
return GetCVar("NP_QuickcastTargetingSpells") == "1"
end,
set = function(v)
Nampower.db.profile.NP_QuickcastTargetingSpells = v
if v == true then
SetCVar("NP_QuickcastTargetingSpells", "1")
else
SetCVar("NP_QuickcastTargetingSpells", "0")
end
end,
},
NP_DoubleCastToEndChannelEarly = { NP_DoubleCastToEndChannelEarly = {
type = "toggle", type = "toggle",
name = L["Double Cast to End Channel Early"], name = L["Double Cast to End Channel Early"],
desc = L["Whether to allow double casting a spell within 350ms to end channeling on the next tick. Takes into account your ChannelLatencyReductionPercentage."], desc = L["Whether to allow double casting a spell within 350ms to end channeling on the next tick. Takes into account your ChannelLatencyReductionPercentage."],
order = 33, order = 15,
get = function() get = function()
return GetCVar("NP_DoubleCastToEndChannelEarly") == "1" return GetCVar("NP_DoubleCastToEndChannelEarly") == "1"
end, end,
@@ -417,6 +433,19 @@ Nampower.cmdtable = {
end end
end, end,
}, },
},
},
spacerc2 = {
type = "header",
name = " ",
order = 58,
},
advanced_options = {
type = "group",
name = L["Advanced options"],
desc = L["Collection of various advanced options"],
order = 60,
args = {
NP_InterruptChannelsOutsideQueueWindow = { NP_InterruptChannelsOutsideQueueWindow = {
type = "toggle", type = "toggle",
name = L["Interrupt Channels Outside Queue Window"], name = L["Interrupt Channels Outside Queue Window"],
@@ -451,23 +480,6 @@ Nampower.cmdtable = {
end end
end, end,
}, },
NP_QuickcastTargetingSpells = {
type = "toggle",
name = L["Quickcast Targeting Spells"],
desc = L["Whether to enable quick casting for ALL spells with terrain targeting"],
order = 105,
get = function()
return GetCVar("NP_QuickcastTargetingSpells") == "1"
end,
set = function(v)
Nampower.db.profile.NP_QuickcastTargetingSpells = v
if v == true then
SetCVar("NP_QuickcastTargetingSpells", "1")
else
SetCVar("NP_QuickcastTargetingSpells", "0")
end
end,
},
NP_ReplaceMatchingNonGcdCategory = { NP_ReplaceMatchingNonGcdCategory = {
type = "toggle", type = "toggle",
name = L["Replace Matching Non GCD Category"], name = L["Replace Matching Non GCD Category"],
@@ -649,28 +661,11 @@ Nampower.cmdtable = {
}, },
}, },
}, },
spacer6 = { spacerd = {
type = "header", type = "header",
name = " ", name = " ",
order = 90, order = 90,
}, },
NP_PreventRightClickTargetChange = {
type = "toggle",
name = L["Prevent Right Click Target Change"],
desc = L["Whether to prevent right-clicking from changing your current target when in combat. If you don't have a target right click will still change your target even with this on. This is mainly to prevent accidentally changing targets in combat when trying to adjust your camera."],
order = 100,
get = function()
return GetCVar("NP_PreventRightClickTargetChange") == "1"
end,
set = function(v)
Nampower.db.profile.NP_PreventRightClickTargetChange = v
if v == true then
SetCVar("NP_PreventRightClickTargetChange", "1")
else
SetCVar("NP_PreventRightClickTargetChange", "0")
end
end,
},
}, },
} }
@@ -693,12 +688,30 @@ if Nampower:HasMinimumVersion(2, 8, 6) then
} }
end end
Nampower.cmdtable.args.advanced_options.args.NP_PreventRightClickTargetChange = {
type = "toggle",
name = L["Prevent Right Click Target Change"],
desc = L["Whether to prevent right-clicking from changing your current target when in combat. If you don't have a target right click will still change your target even with this on. This is mainly to prevent accidentally changing targets in combat when trying to adjust your camera."],
order = 140,
get = function()
return GetCVar("NP_PreventRightClickTargetChange") == "1"
end,
set = function(v)
Nampower.db.profile.NP_PreventRightClickTargetChange = v
if v == true then
SetCVar("NP_PreventRightClickTargetChange", "1")
else
SetCVar("NP_PreventRightClickTargetChange", "0")
end
end,
}
if Nampower:HasMinimumVersion(2, 11, 0) then if Nampower:HasMinimumVersion(2, 11, 0) then
Nampower.cmdtable.args.NP_SpamProtectionEnabled = { Nampower.cmdtable.args.advanced_options.args.NP_SpamProtectionEnabled = {
type = "toggle", type = "toggle",
name = L["Spam Protection"], name = L["Spam Protection"],
desc = L["Whether to enable spam protection functionality that blocks spamming spells while waiting for the server to respond to your initial cast due to issues spamming can cause"], desc = L["Whether to enable spam protection functionality that blocks spamming spells while waiting for the server to respond to your initial cast due to issues spamming can cause"],
order = 120, order = 135,
get = function() get = function()
return GetCVar("NP_SpamProtectionEnabled") == "1" return GetCVar("NP_SpamProtectionEnabled") == "1"
end, end,
@@ -712,11 +725,11 @@ if Nampower:HasMinimumVersion(2, 11, 0) then
end, end,
} }
Nampower.cmdtable.args.NP_PreventRightClickPvPAttack = { Nampower.cmdtable.args.advanced_options.args.NP_PreventRightClickPvPAttack = {
type = "toggle", type = "toggle",
name = L["Prevent Right Click PvP Attack"], name = L["Prevent Right Click PvP Attack"],
desc = L["Whether to prevent right-clicking on PvP flagged players to avoid accidental PvP attacks"], desc = L["Whether to prevent right-clicking on PvP flagged players to avoid accidental PvP attacks"],
order = 130, order = 145,
get = function() get = function()
return GetCVar("NP_PreventRightClickPvPAttack") == "1" return GetCVar("NP_PreventRightClickPvPAttack") == "1"
end, end,
@@ -733,6 +746,26 @@ else
DEFAULT_CHAT_FRAME:AddMessage(L["|cffffcc00Nampower dll update available.|cffffcc00 Some settings may be hidden until you update."]) DEFAULT_CHAT_FRAME:AddMessage(L["|cffffcc00Nampower dll update available.|cffffcc00 Some settings may be hidden until you update."])
end end
if Nampower:HasMinimumVersion(2, 15, 0) then
Nampower.cmdtable.args.cast_options.args.NP_QuickcastOnDoubleCast = {
type = "toggle",
name = L["Quickcast Targeting Spells on Double Cast"],
desc = L["Allows casting targeting spells by attempting to cast them twice as opposed to the default client behavior which cancels the targeting indicator"],
order = 10,
get = function()
return GetCVar("NP_QuickcastOnDoubleCast") == "1"
end,
set = function(v)
Nampower.db.profile.NP_QuickcastOnDoubleCast = v
if v == true then
SetCVar("NP_QuickcastOnDoubleCast", "1")
else
SetCVar("NP_QuickcastOnDoubleCast", "0")
end
end,
}
end
local deuce = Nampower:NewModule("Nampower Options Menu") local deuce = Nampower:NewModule("Nampower Options Menu")
deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar
deuce.consoleCmd = not deuce.hasFuBar deuce.consoleCmd = not deuce.hasFuBar