跟随版本 0.8.19
This commit is contained in:
124
Tweaks.lua
124
Tweaks.lua
@@ -7,6 +7,7 @@
|
||||
-- 5. Dark UI - darken the entire interface
|
||||
-- 6. WorldMap Window - turn fullscreen map into a movable/scalable window
|
||||
-- 7. Auto Dismount - cancel shapeshift/mount when casting incompatible spells
|
||||
-- 8. Hunter Aspect Guard - auto switch to Hawk when taking damage with Cheetah/Pack
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
SFrames.Tweaks = SFrames.Tweaks or {}
|
||||
@@ -17,7 +18,8 @@ SFrames.castdb = SFrames.castdb or {}
|
||||
local function GetTweaksCfg()
|
||||
if not SFramesDB or type(SFramesDB.Tweaks) ~= "table" then
|
||||
return { autoStance = true, superWoW = true, turtleCompat = true,
|
||||
cooldownNumbers = true, darkUI = false, worldMapWindow = false }
|
||||
cooldownNumbers = true, darkUI = false, worldMapWindow = false,
|
||||
hunterAspectGuard = true }
|
||||
end
|
||||
return SFramesDB.Tweaks
|
||||
end
|
||||
@@ -80,6 +82,7 @@ end
|
||||
--------------------------------------------------------------------------------
|
||||
local function InitAutoDismount()
|
||||
local dismount = CreateFrame("Frame", "NanamiAutoDismount")
|
||||
local _, playerClass = UnitClass("player")
|
||||
|
||||
local scanner = CreateFrame("GameTooltip", "NanamiDismountScan", nil, "GameTooltipTemplate")
|
||||
scanner:SetOwner(WorldFrame, "ANCHOR_NONE")
|
||||
@@ -93,7 +96,7 @@ local function InitAutoDismount()
|
||||
"^Augmente la vitesse de (.+)%%",
|
||||
"^Скорость увеличена на (.+)%%",
|
||||
"^이동 속도 (.+)%%만큼 증가",
|
||||
"^速度提高(.+)%%",
|
||||
"^速度提高(.+)%%", "^移动速度提高(.+)%%",
|
||||
"speed based on", "Slow and steady...", "Riding",
|
||||
"Lento y constante...", "Aumenta la velocidad según tu habilidad de Montar.",
|
||||
"根据您的骑行技能提高速度。", "根据骑术技能提高速度。", "又慢又稳......",
|
||||
@@ -106,9 +109,15 @@ local function InitAutoDismount()
|
||||
"ability_druid_treeoflife", "ability_druid_stagform",
|
||||
}
|
||||
|
||||
local hunterAspectIcons = {
|
||||
"ability_mount_jungletiger",
|
||||
"ability_mount_packhorse",
|
||||
}
|
||||
|
||||
local errorStrings = {}
|
||||
local errorGlobals = {
|
||||
"SPELL_FAILED_NOT_MOUNTED", "ERR_ATTACK_MOUNTED", "ERR_TAXIPLAYERALREADYMOUNTED",
|
||||
"ERR_NOT_WHILE_MOUNTED",
|
||||
"SPELL_FAILED_NOT_SHAPESHIFT", "SPELL_FAILED_NO_ITEMS_WHILE_SHAPESHIFTED",
|
||||
"SPELL_NOT_SHAPESHIFTED", "SPELL_NOT_SHAPESHIFTED_NOSPACE",
|
||||
"ERR_CANT_INTERACT_SHAPESHIFTED", "ERR_NOT_WHILE_SHAPESHIFTED",
|
||||
@@ -134,24 +143,43 @@ local function InitAutoDismount()
|
||||
if not matched then return end
|
||||
|
||||
for i = 0, 31 do
|
||||
scanner:ClearLines()
|
||||
scanner:SetPlayerBuff(i)
|
||||
for line = 1, scanner:NumLines() do
|
||||
local text = getfenv(0)["NanamiDismountScanTextLeft" .. line]
|
||||
if text and text:GetText() then
|
||||
for _, str in pairs(mountStrings) do
|
||||
if string.find(text:GetText(), str) then
|
||||
local buff = GetPlayerBuffTexture(i)
|
||||
if buff then
|
||||
local lowerBuff = string.lower(buff)
|
||||
|
||||
local skip = false
|
||||
if playerClass == "HUNTER" then
|
||||
for _, tex in pairs(hunterAspectIcons) do
|
||||
if string.find(lowerBuff, tex) then
|
||||
skip = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not skip then
|
||||
scanner:ClearLines()
|
||||
scanner:SetPlayerBuff(i)
|
||||
for line = 1, scanner:NumLines() do
|
||||
local text = getfenv(0)["NanamiDismountScanTextLeft" .. line]
|
||||
if text and text:GetText() then
|
||||
for _, str in pairs(mountStrings) do
|
||||
if string.find(text:GetText(), str) then
|
||||
CancelPlayerBuff(i)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, icon in pairs(shapeshiftIcons) do
|
||||
if string.find(lowerBuff, icon) then
|
||||
CancelPlayerBuff(i)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local buff = GetPlayerBuffTexture(i)
|
||||
if buff then
|
||||
for _, icon in pairs(shapeshiftIcons) do
|
||||
if string.find(string.lower(buff), icon) then
|
||||
if string.find(lowerBuff, "ability_mount_") then
|
||||
CancelPlayerBuff(i)
|
||||
return
|
||||
end
|
||||
@@ -167,7 +195,7 @@ end
|
||||
-- Data stored in SFrames.castdb[guid] for consumption by castbar features.
|
||||
--------------------------------------------------------------------------------
|
||||
local function InitSuperWoW()
|
||||
if not GetPlayerBuffID or not CombatLogAdd or not SpellInfo then return end
|
||||
if not SpellInfo and not UnitGUID and not SUPERWOW_VERSION then return end
|
||||
|
||||
local castdb = SFrames.castdb
|
||||
|
||||
@@ -1031,6 +1059,63 @@ local function InitDarkUI()
|
||||
end)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Hunter Aspect Guard
|
||||
-- When a Hunter takes damage with Aspect of the Cheetah or Aspect of the Pack
|
||||
-- active, automatically cancel the aspect to prevent repeated dazing.
|
||||
--------------------------------------------------------------------------------
|
||||
local function InitHunterAspectGuard()
|
||||
local _, playerClass = UnitClass("player")
|
||||
if playerClass ~= "HUNTER" then return end
|
||||
|
||||
local CHEETAH_TEX = "ability_mount_jungletiger"
|
||||
local PACK_TEX = "ability_mount_packhorse"
|
||||
|
||||
local function CancelDangerousAspect()
|
||||
for i = 0, 31 do
|
||||
local buffIdx = GetPlayerBuff(i, "HELPFUL")
|
||||
if buffIdx and buffIdx >= 0 then
|
||||
local tex = GetPlayerBuffTexture(buffIdx)
|
||||
if tex then
|
||||
local lower = string.lower(tex)
|
||||
if string.find(lower, CHEETAH_TEX) or string.find(lower, PACK_TEX) then
|
||||
CancelPlayerBuff(buffIdx)
|
||||
SFrames:Print("受到伤害,已自动取消守护")
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local lastHP = UnitHealth("player") or 0
|
||||
local lastCancel = 0
|
||||
local elapsed = 0
|
||||
local frame = CreateFrame("Frame", "NanamiHunterAspectGuard")
|
||||
frame:SetScript("OnUpdate", function()
|
||||
elapsed = elapsed + (arg1 or 0)
|
||||
if elapsed < 0.1 then return end
|
||||
elapsed = 0
|
||||
|
||||
local hp = UnitHealth("player")
|
||||
if hp <= 0 then
|
||||
lastHP = 0
|
||||
return
|
||||
end
|
||||
|
||||
if lastHP > 0 and hp < lastHP then
|
||||
if GetTime() - lastCancel >= 1.0 then
|
||||
if CancelDangerousAspect() then
|
||||
lastCancel = GetTime()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
lastHP = hp
|
||||
end)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Module API
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -1088,6 +1173,13 @@ function Tweaks:Initialize()
|
||||
end
|
||||
end
|
||||
|
||||
if cfg.hunterAspectGuard ~= false then
|
||||
local ok, err = pcall(InitHunterAspectGuard)
|
||||
if not ok then
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff4444Nanami-UI: HunterAspectGuard init failed: " .. tostring(err) .. "|r")
|
||||
end
|
||||
end
|
||||
|
||||
if cfg.darkUI then
|
||||
local ok, err = pcall(InitDarkUI)
|
||||
if not ok then
|
||||
|
||||
Reference in New Issue
Block a user