turtle-wow: add trueshot to custom casts

This commit is contained in:
shagu
2023-10-03 13:39:58 +02:00
parent 7778e55eb6
commit 07edd4c72c
+49 -2
View File
@@ -4,8 +4,10 @@ if not TargetHPText or not TargetHPPercText then return end
pfUI:RegisterModule("turtle-wow", "vanilla", function ()
local delay = CreateFrame("Frame")
delay:SetScript("OnUpdate", function()
this:Hide()
-- while pfUI map is loaded, disable turtle wows window-implementation
if pfUI.map then
-- while pfUI map is loaded, disable turtle wows window-implementation
_G.WorldMapFrame_Maximize()
pfUI.map.loader:GetScript("OnEvent")()
@@ -22,6 +24,51 @@ pfUI:RegisterModule("turtle-wow", "vanilla", function ()
WorldMapFrameTitle:Hide()
end
this:Hide()
-- add turtle wow custom trueshot cast to castbars recognition.
if not libcast.customcast["trueshot"] then
-- add trueshot to pfUI's custom casts
local player = UnitName("player")
libcast.customcast["trueshot"] = function(begin, duration)
if begin then
local duration = duration or 1000
for i=1,32 do
if UnitBuff("player", i) == "Interface\\Icons\\Racial_Troll_Berserk" then
local berserk = 0.3
if((UnitHealth("player")/UnitHealthMax("player")) >= 0.40) then
berserk = (1.30 - (UnitHealth("player") / UnitHealthMax("player"))) / 3
end
duration = duration / (1 + berserk)
elseif UnitBuff("player", i) == "Interface\\Icons\\Ability_Hunter_RunningShot" then
duration = duration / 1.4
elseif UnitBuff("player", i) == "Interface\\Icons\\Ability_Warrior_InnerRage" then
duration = duration / 1.3
elseif UnitBuff("player", i) == "Interface\\Icons\\Inv_Trinket_Naxxramas04" then
duration = duration / 1.2
end
end
local _,_, lag = GetNetStats()
local start = GetTime() + lag/1000
-- add cast action to the database
libcast.db[player].cast = "Trueshot"
libcast.db[player].rank = lastrank
libcast.db[player].start = start
libcast.db[player].casttime = duration
libcast.db[player].icon = "Interface\\Icons\\Inv_spear_07"
libcast.db[player].channel = nil
else
-- remove cast action to the database
libcast.db[player].cast = nil
libcast.db[player].rank = nil
libcast.db[player].start = nil
libcast.db[player].casttime = nil
libcast.db[player].icon = nil
libcast.db[player].channel = nil
end
end
end
end)
end)