View Single Post
01-25-23, 08:32 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,333
The PvP and Prestige icons are two different things, though the later replaces the former when applicable. Here's code for two different options.



Restore PVP Icon:
Lua Code:
  1. local OpposingFactions={Horde="Alliance",Alliance="Horde"};
  2. local function UpdatePVPIcon(icon,unit,showmercenary)
  3.     local faction=UnitFactionGroup(unit);
  4.     local opposite=faction and OpposingFactions[faction];
  5.  
  6.     if UnitIsPVPFreeForAll(unit) then
  7.         icon:SetAtlas("UI-HUD-UnitFrame-Player-PVP-FFAIcon",TextureKitConstants.UseAtlasSize);
  8.         icon:Show();
  9.     elseif UnitIsPVP(unit) and opposite then
  10.         icon:SetAtlas(("UI-HUD-UnitFrame-Player-PVP-%sIcon"):format((showmercenary and UnitIsMercenary(unit)) and opposite or faction),TextureKitConstants.UseAtlasSize);
  11.         icon:Show();
  12.     else icon:Hide(); end
  13. end
  14.  
  15. hooksecurefunc("PlayerFrame_UpdatePvPStatus",function()
  16.     local parent=PlayerFrame.PlayerFrameContent.PlayerFrameContentContextual;
  17.  
  18.     UpdatePVPIcon(parent.PVPIcon,"player",true);
  19.     parent.PrestigePortrait:Hide();
  20.     parent.PrestigeBadge:Hide();
  21. end);
  22.  
  23. local function TargetFrame_CheckFaction(self)
  24.     local parent=self.TargetFrameContent.TargetFrameContentContextual;
  25.  
  26.     UpdatePVPIcon(parent.PvpIcon,self.unit,false);
  27.     parent.PrestigePortrait:Hide();
  28.     parent.PrestigeBadge:Hide();
  29. end
  30.  
  31. hooksecurefunc(TargetFrame,"CheckFaction",TargetFrame_CheckFaction);
  32. hooksecurefunc(FocusFrame,"CheckFaction",TargetFrame_CheckFaction);



Disable both:
Lua Code:
  1. hooksecurefunc("PlayerFrame_UpdatePvPStatus",function()
  2.     local parent=PlayerFrame.PlayerFrameContent.PlayerFrameContentContextual;
  3.     parent.PrestigePortrait:Hide();
  4.     parent.PrestigeBadge:Hide();
  5.     parent.PVPIcon:Hide();
  6.     PlayerPVPTimerText:Hide();
  7.     PlayerPVPTimerText.timeLeft=nil;
  8. end);
  9.  
  10. local function TargetFrame_CheckFaction(self)
  11.     local parent=self.TargetFrameContent.TargetFrameContentContextual;
  12.     parent.PrestigePortrait:Hide();
  13.     parent.PrestigeBadge:Hide();
  14.     parent.PvpIcon:Hide();
  15. end
  16.  
  17. hooksecurefunc(TargetFrame,"CheckFaction",TargetFrame_CheckFaction);
  18. hooksecurefunc(FocusFrame,"CheckFaction",TargetFrame_CheckFaction);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote