Class Facades.PetJournal
Facade for the PetJournal API.
Although C_PetJournal is available in the classic clients, this facade is not instantiable there considering that its functions are not entirely functional. For that reason, StormwindLibrary won't hold a default instance of this class like it does for other facades. Instead, addons must create their own instances of this class when needed.
Methods
facades.petjournal:getSummonedPetSpeciesId () | Gets the species id of the pet currently summoned by the player. |
facades.petjournal:playerOwnsPet (speciesId) | Determines whether the player has at least one pet from a given species. |
Metamethods
facades.petjournal:__construct () | PetJournal constructor. |
Methods
- facades.petjournal:getSummonedPetSpeciesId ()
-
Gets the species id of the pet currently summoned by the player.
If the player has no pet summoned, this method returns nil.
Note that this method doesn't return the pet identifier, or GUID, which means the returned id is the species id of the pet, not the pet itself.
Returns:
-
integer or nil
The currently summoned pet species id, or nil if no pet is summoned
- facades.petjournal:playerOwnsPet (speciesId)
-
Determines whether the player has at least one pet from a given species.
The C_PetJournal.GetOwnedBattlePetString() API method returns a colored string containing the number of pets owned by the player for a given species. Example: "|cFFFFD200Collected (1/3)"
This method just checks if the string is not nil, which means the player has at least one pet from the given species.
Parameters:
- speciesId integer The species ID of the pet to check
Returns:
-
boolean
Whether the player owns at least one pet from the given species