Jump to content
Toggle menu
  • 17.3K articles
  • 8.2K files
  • 5 users
  • 280.7K edits
WoW Classic Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

API GetPetHappiness

From WoW Classic Wiki

Returns the pet's happiness, damage percentage, and loyalty gain rate.

happiness, damagePercentage, loyaltyRate = GetPetHappiness()

Parameters

Arguments

none

Returns

happiness, damagePercentage, loyaltyRate
happiness
Number - the numerical happiness value of the pet (1 = unhappy, 2 = content, 3 = happy)
damagePercentage
Number - damage modifier, happiness affects this (unhappy = 75%, content = 100%, happy = 125%)
loyaltyRate
Number - the rate at which your pet is currently gaining loyalty (< 0, losing loyalty, > 0, gaining loyalty)

Example

happiness, damagePercentage, loyaltyRate = GetPetHappiness()
if not happiness then
	DEFAULT_CHAT_FRAME:AddMessage("No Pet")
else
	local happy = ({"Unhappy", "Content", "Happy"})[happiness]
	local loyalty = loyaltyRate > 0 and "gaining" or "losing"
	DEFAULT_CHAT_FRAME:AddMessage("Pet is " .. )
	DEFAULT_CHAT_FRAME:AddMessage("Pet is doing " .. damagePercentage .. "% damage")
	DEFAULT_CHAT_FRAME:AddMessage("Pet is " .. loyalty .. " loyalty")
end