WoW API < GetPetHappiness

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

happiness, damagePercentage, loyaltyRate = GetPetHappiness()

Parameters Edit

Arguments Edit


Returns Edit

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

Example Edit

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

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.