Refactor resurrection spells

This commit is contained in:
OldManAlpha 2025-11-12 14:19:23 -08:00
parent d907d5f094
commit d0e0106703
6 changed files with 26 additions and 17 deletions

View File

@ -30,14 +30,6 @@ AllUnitsSet = util.AllUnitsSet
AllCustomUnits = util.CustomUnits
AllCustomUnitsSet = util.CustomUnitsSet
ResurrectionSpells = {
["PRIEST"] = "Resurrection",
["PALADIN"] = "Redemption",
["SHAMAN"] = "Ancestral Spirit",
["DRUID"] = "Rebirth"
}
PTLocale.Values(ResurrectionSpells)
local ptBarsPath = util.GetAssetsPath().."textures\\bars\\"
BarStyles = {
["Blizzard"] = "Interface\\TargetingFrame\\UI-StatusBar",
@ -661,7 +653,7 @@ function UnitFrame_OnClick(button, unit, unitFrame)
return
end
local targetCastable = UnitIsConnected(unit) and UnitIsVisible(unit)
local wantToRes = PTOptions.AutoResurrect and util.IsDeadFriend(unit) and ResurrectionSpells[GetClass("player")]
local wantToRes = PTOptions.AutoResurrect and util.IsDeadFriend(unit) and util.ResurrectionSpells[GetClass("player")]
if not binding then
if targetCastable and wantToRes then
RunBinding_Spell(emptySpell, unit)

View File

@ -145,7 +145,7 @@ function SetDefaults()
},
["CastWhen"] = "Mouse Up", -- Mouse Up, Mouse Down
["CastWhenKey"] = "Key Up", -- Key Up, Key Down
["AutoResurrect"] = Puppeteer.ResurrectionSpells[util.GetClass("player")] ~= nil,
["AutoResurrect"] = util.ResurrectionSpells[util.GetClass("player")] ~= nil,
["UseHealPredictions"] = true,
["PVPFlagProtection"] = true,
["SetMouseover"] = true,

View File

@ -431,7 +431,7 @@ PVPProtectMenu:SetOptions({
function ShouldTriggerPVPFlagProtection(unit, spell)
return PTOptions.PVPFlagProtection and not IsInInstance() and UnitIsPVP(unit) and UnitIsPlayer(unit)
and not UnitIsPVP("player") and PVPProtectOverrideTime < GetTime() and not util.ArrayContains(ResurrectionSpells, spell)
and not UnitIsPVP("player") and PVPProtectOverrideTime < GetTime() and not util.ResurrectionSpellsSet[spell]
end
local Sound_Disabled = function() end
@ -488,7 +488,7 @@ function RunBinding_Spell(binding, unit)
and UnitAffectingCombat("player") then
spell = "Revive Champion"
else
spell = ResurrectionSpells[GetClass("player")] or spell
spell = util.ResurrectionSpells[GetClass("player")] or spell
end
end

View File

@ -38,7 +38,7 @@ BindingDisplayCache = nil
DirtyDisplayModifiers = {}
SpecialSpellBindings = {}
for class, spell in pairs(ResurrectionSpells) do
for class, spell in pairs(util.ResurrectionSpells) do
local binding = {
["Type"] = "SPELL",
["Data"] = spell
@ -307,14 +307,14 @@ function ApplySpellsTooltip(attachTo, unit, owner)
local deadFriend = util.IsDeadFriend(unit)
local selfClass = GetClass("player")
local canResurrect = PTOptions.AutoResurrect and deadFriend and ResurrectionSpells[selfClass]
local canResurrect = PTOptions.AutoResurrect and deadFriend and util.ResurrectionSpells[selfClass]
local canReviveChampion = canResurrect and util.GetSpellID(T("Revive Champion")) and
PTUnit.Get(unit):HasBuffIDOrName(45568, T("Holy Champion")) and UnitAffectingCombat("player")
local resEntry
if canReviveChampion then
resEntry = UpdateBindingDisplay(SpecialSpellBindings[T("Revive Champion")], compost:GetTable())
elseif canResurrect then
resEntry = UpdateBindingDisplay(SpecialSpellBindings[ResurrectionSpells[selfClass]], compost:GetTable())
resEntry = UpdateBindingDisplay(SpecialSpellBindings[util.ResurrectionSpells[selfClass]], compost:GetTable())
end
--StartTiming("BindingDisplays")

View File

@ -415,7 +415,7 @@ function CreateTab_Options_Casting(panel)
end
end)
factory:dropdown("Cast When (Keys)", "What key state to start casting spells at", "CastWhenKey", {"Key Up", "Key Down"})
local resSpell = Puppeteer.ResurrectionSpells[util.GetClass("player")]
local resSpell = util.ResurrectionSpells[util.GetClass("player")]
local autoResInfo = not resSpell and "This does nothing for your class" or {"Replaces your bound spells with "..resSpell..
" when clicking on a dead ally", "All other types of binds, such as Actions, will not be replaced"}
factory:checkbox("Auto Resurrect", autoResInfo, "AutoResurrect")

View File

@ -64,6 +64,19 @@ PowerTypeMap = {
[3] = "energy"
}
ResurrectionSpells = {
["PRIEST"] = "Resurrection",
["PALADIN"] = "Redemption",
["SHAMAN"] = "Ancestral Spirit",
["DRUID"] = "Rebirth"
}
ResurrectionSpellsSet = {
["Resurrection"] = "PRIEST",
["Redemption"] = "PALADIN",
["Ancestral Spirit"] = "SHAMAN",
["Rebirth"] = "DRUID"
}
-- The default color Blizzard uses for text
DefaultTextColor = {1, 0.82, 0}
@ -1253,4 +1266,8 @@ function IsTurtleWow()
end
AllUnitsSet = ToSet(AllUnits)
FocusUnitsSet = ToSet(FocusUnits)
FocusUnitsSet = ToSet(FocusUnits)
RunLater(function()
PTLocale.Values(ResurrectionSpells)
PTLocale.Keys(ResurrectionSpellsSet)
end)