View Single Post
03-08-21, 06:16 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Replace everything you have here with the following:

Lua Code:
  1. local f=CreateFrame("frame")
  2. f:RegisterEvent("PLAYER_LOGIN")
  3. f.update=function(frame)
  4.     if frame and frame.unit=="player" and frame.portrait then
  5.         if frame.onHateList then
  6.             for i=1,GetNumShapeshiftForms() do
  7.                 local _,active,_,spellid=GetShapeshiftFormInfo(i)
  8.                 local _,_,icon=GetSpellInfo(spellid)
  9.                 if active and icon then
  10.                     SetPortraitToTexture(frame.portrait,icon)
  11.                     return
  12.                 end
  13.             end
  14.         end
  15.         SetPortraitTexture(frame.portrait,"player")
  16.     end
  17. end
  18. f:SetScript("OnEvent",function(self,event)
  19.     if event=="PLAYER_LOGIN" then
  20.         local _,class=UnitClass("player")
  21.         if class~="WARRIOR" then return end
  22.         self:RegisterEvent("PLAYER_REGEN_DISABLED")
  23.         self:RegisterEvent("PLAYER_REGEN_ENABLED")
  24.         self:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
  25.         hooksecurefunc("UnitFramePortrait_Update",self.update)
  26.     end
  27.     self.update(PlayerFrame)
  28. end)

Last edited by Kanegasi : 03-08-21 at 06:19 PM.
  Reply With Quote