- Home
- Downloads
-
Addons & Mods
Featured
World of Warcraft
6,102 Addons
-
Popular Downloads
- Top World of Warcraft Addons
- Top Minecraft Server Mods
- Top Rift Addons
- Top Skyrim Mods
- Top World of Tanks Skins
- Top StarCraft II Maps
- Top Terraria Maps
- Top Runes of Magic Addons
- Top Warhammer Online Addons
- Top The Secret World Mods
- Top Age of Conan Addons
-
- Curse Client
- Premium
- News
- Giveaways
- Forums
- Store
LibPetJournal-2.0
- 0 Likes
- World of Warcraft
- 1,047 Monthly Downloads
- Supports: 5.2.0
- 7,627 Total Downloads
- Updated 05/04/2013
- Created 09/03/2012
- 5 Favorites
- Project Site
- Release Type: Release
- License: MIT License
- Newest File: 2.0.26
About LibPetJournal-2.0
Requires: LibStub, CallbackHandler-1.0
With 5.0 a new C_PetJournal API was introduced, and unfortunately the old GetCompanionInfo API no longer works properly (it does not, for example, know anything about non-combat pets obtained before the account-wide merge, and you also can no longer summon non-combat pets using it).
This library provides the list of player owned pet ids and all species ids, which can be used with C_PetJournal.GetPetInfoByPetID() and C_PetJournal.GetPetInfoBySpeciesID().
It primarily deals with two problems with scanning the pet journal:
- Filters: The Pet Journal filters are cleared and then restored, as they affect the return values given from C_PetJournal.GetPetInfoByIndex()
- Updating in response to event: Manipulating the Pet Journal filters causes PET_JOURNAL_LIST_UPDATE to fire, which is also the only event that always fires when you lose or gain a pet. Filter manipulation is detected and we never try to rescan pets in response. When this is not the case, a CallbackHandler event is fired which can be used to safely detect changes to the pet list.
Links
Getting Started
API Documentation
WoWAce Thread
Example
local LibPetJournal = LibStub("LibPetJournal-2.0") local function ScanPets() for _,petid in LibPetJournal:IteratePetIDs() do local speciesID, customName, level, xp, maxXp, displayID, isFavorite, name, icon, petType, creatureID, sourceText, description, isWild, canBattle, tradable, unique = C_PetJournal.GetPetInfoByPetID(petid) if name == "Feline Familiar" then print("Player has a cat in a hat.") end end end ScanPets()
If you wanted to automatically scan for little cats in hats when the pet list changes, you could register a callback, such as:
LibPetJournal.RegisterCallback(addon, "PetListUpdated", ScanPets)
Obviously you would normally use the speciesID or creatureID return values from C_PetJournal.GetPetInfoByPetID() to find a particular pet, but this is just a silly example.
2013-05-04 Robin Schoonover <robin@cornhooves.org>
[b741c809b7bd] [2.0.26]
* LibPetJournal-2.0.lua
Bump minor.
| File Name | Release Type | Game Version | Downloads | Date |
|---|---|---|---|---|
| 2.0.26 | Release | 5.2.0 | 905 | 05/04/2013 |
| 2.0.25 | Release | 5.2.0 | 1,365 | 03/05/2013 |
| 2.0.24.1 | Release | 5.1.0 | 1,206 | 12/30/2012 |
| 2.0.24 | Release | 5.0.5 | 1,325 | 10/26/2012 |
| 2.0.23 | Release | 5.0.5 | 381 | 10/25/2012 |
| 2.0.22 | Release | 5.0.5 | 739 | 10/10/2012 |
| 2.0.21 | Release | 5.0.5 | 605 | 09/28/2012 |
| 2.0.20 | Release | 5.0.5 | 386 | 09/23/2012 |
| 2.0.19 | Release | 5.0.5 | 4 | 09/23/2012 |
| 2.0.18 | Release | 5.0.5 | 81 | 09/19/2012 |
| 2.0.17 | Release | 5.0.5 | 13 | 09/19/2012 |
| 2.0.16 | Release | 5.0.5 | 65 | 09/16/2012 |
| 2.0.15 | Release | 5.0.5 | 64 | 09/13/2012 |
| 2.0.14 | Release | 5.0.4 | 66 | 09/11/2012 |
Top Downloads
-
- Deadly Boss Mods
- Combat, PvP, and Boss Encounters
- 999,752 Monthly Downloads
-
- Bagnon
- Bags & Inventory
- 466,028 Monthly Downloads
-
- Auctioneer
- Mail, Tooltip, Bags & Inventory, Professions, and Auction & Economy
- 340,607 Monthly Downloads
-
- Recount
- Combat
- 314,809 Monthly Downloads
-
- HealBot Continued
- Healer and Unit Frames
- 293,027 Monthly Downloads