Add PVP Flag Protection

This commit is contained in:
OldManAlpha 2025-09-06 15:53:32 -07:00
parent 93a0594410
commit ad54a21b6a
5 changed files with 68 additions and 3 deletions

View File

@ -325,10 +325,13 @@ end
function PTUnitFrame:UpdatePVP()
if UnitIsPVP(self.unit) and (not IsInInstance() or not UnitIsVisible(self.unit)) then
if UnitFactionGroup(self.unit) == "Alliance" then
local faction = UnitFactionGroup(self.unit)
if faction == "Alliance" then
self.pvpIcon.icon:SetTexture("Interface\\TargetingFrame\\UI-PVP-Alliance")
else
elseif faction == "Horde" then
self.pvpIcon.icon:SetTexture("Interface\\TargetingFrame\\UI-PVP-Horde")
else
self.pvpIcon.icon:SetTexture("Interface\\TargetingFrame\\UI-PVP-FFA")
end
self.pvpIcon.frame:Show()
else

View File

@ -1,5 +1,5 @@
## Interface: 11200
## Version: 1.0.4
## Version: 1.0.4-postdev
## Title: Puppeteer
## Notes: Unit frames addon tailored for healers
## Author: OldManAlpha, Richard Truax(i2ichardt)

View File

@ -140,6 +140,7 @@ function SetDefaults()
["CastWhenKey"] = "Key Up", -- Key Up, Key Down
["AutoResurrect"] = Puppeteer.ResurrectionSpells[util.GetClass("player")] ~= nil,
["UseHealPredictions"] = true,
["PVPFlagProtection"] = true,
["SetMouseover"] = true,
["LFTAutoRole"] = true, -- Turtle WoW
["TestUI"] = false,

View File

@ -315,6 +315,55 @@ function GenerateDefaultBindings()
end
end
PVPProtectOverrideTime = 0
PVPProtectMenu = PTGuiLib.Get("dropdown", UIParent)
PVPProtectMenu:SetOptions({
{
text = colorize("PVP Flag Protection", 0.3, 1, 0.3),
textHeight = 11,
notCheckable = true,
disabled = true
},
{
notCheckable = true,
disabled = true
},
{
text = colorize("Whoops, thanks for the save!", 0.8, 1, 0.8),
notCheckable = true,
func = function()
if UIErrorsFrame then
UIErrorsFrame:AddMessage(colorize("No problem, stay safe", 0.2, 1, 0.2))
end
end
},
{
notCheckable = true,
disabled = true
},
{
text = colorize("Disable protection for 5 min", 1, 0.8, 0.8),
notCheckable = true,
func = function()
PVPProtectOverrideTime = GetTime() + (5 * 60)
if UIErrorsFrame then
UIErrorsFrame:AddMessage(colorize("Protection disabled for 5 min", 1, 0, 0))
end
end
},
{
text = colorize("Disable protection this session", 1, 0.6, 0.6),
notCheckable = true,
func = function()
PVPProtectOverrideTime = GetTime() + (1000 * 60)
if UIErrorsFrame then
UIErrorsFrame:AddMessage(colorize("Protection disabled this session", 1, 0, 0))
end
end
}
})
local Sound_Disabled = function() end
function RunTargetedAction(binding, unit, actionFunc, mustTempTarget)
@ -568,6 +617,15 @@ function RunBinding(binding, unit, unitFrame)
local bindingType = binding.Type
if bindingType == "SPELL" then
if targetCastable then
if PTOptions.PVPFlagProtection and not IsInInstance() and UnitIsPVP(unit) and UnitIsPlayer(unit)
and not UnitIsPVP("player") and PVPProtectOverrideTime < GetTime() then
PVPProtectMenu:SetToggleState(false)
local frame = unitFrame:GetRootContainer()
PVPProtectMenu:SetToggleState(true, frame, frame:GetWidth(), frame:GetHeight())
PVPProtectMenu:SetKeepOpen(true)
PlaySound("igMainMenuOpen")
return
end
RunBinding_Spell(binding, unit)
end
elseif bindingType == "ACTION" then

View File

@ -393,6 +393,9 @@ function CreateTab_Options_Casting(panel)
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")
factory:checkbox("PVP Flag Protection", {"Stops you from casting spells on PVP flagged players if you're not flagged",
"Attempting to cast will prompt you to make an exception",
"Only stops you from using Spell bindings"}, "PVPFlagProtection")
factory:checkbox("Target While Casting", {"Target the unit while most bindings run",
"Note that these binding types override this rule:",
"Spell - Always targets unless using SuperWoW",