PHP код:
local parentns = ...
local oUF ns.oUF

local Update 
= function(selfeventunit)
    if(
self.unit ~= unitthen return end

    local happ 
self.Happiness
    
if(happthen
        local happiness 
GetPetHappiness()
        
local _hunterPet HasPetUI()

        if(
not (happiness or hunterPet)) then
            
return happ:Hide()
        
end

        happ
:Show()
        if(
happiness == 1then
            happ
:SetTexCoord(0.3750.562500.359375)
        elseif(
happiness == 2then
            happ
:SetTexCoord(0.18750.37500.359375)
        elseif(
happiness == 3then
            happ
:SetTexCoord(00.187500.359375)
        
end

        
if(happ.PostUpdatethen
            
return happ:PostUpdate(unithappiness)
        
end
    end
end

local Enable 
= function(self)
    
local happiness self.Happiness
    
if(happinessthen
        self
:RegisterEvent("UNIT_HAPPINESS"happiness.Update or Update)

        if(
happiness:IsObjectType"Texture" and not happiness:GetTexture()) then
            happiness
:SetTexture[[Interface\PetPaperDollFrame\UI-PetHappiness]]
        
end

        
return true
    end
end

local Disable 
= function(self)
    
local happiness self.Happiness
    
if(happinessthen
        self
:UnregisterEvent("UNIT_HAPPINESS"happiness.Update or Update)
    
end
end

oUF
:AddElement('Happiness'UpdateEnableDisable