petId (string|nil): the PetId string from the player's profile or nil
Example:
DismissPetFor
Description: Force-dismiss the specified player's summoned pet. Optionally pushes a journal update to their UI.
Signature:
HideFollowerPetFor
Description: Temporarily hides the player's follower pet by moving it to a hidden routing bucket so other players won't see it.
Signature:
UnhideFollowerPetFor
Description: Restore a previously hidden follower pet back into the player's routing bucket so it becomes visible again.
Signature:
AddBattlePetToPlayer
Description: Programmatically add a new battle pet record to a player's profile. Accepts raw tables or battle pet instances — the persistence module will normalize and persist the pet.
Signature:
Returns:
ok (boolean): true when add/save succeeded
Example:
RemoveBattlePetFromPlayer
Description: Remove a battle pet from a player's profile by PetId (permanent removal).
Signature:
Returns:
ok (boolean): true on success
Example:
GetPlayerProfile
Description: Return the server-side cached profile object for a player (pets, team order, active pet id, TrainerWins, etc.). Useful for server logic that needs read/write access to a player's pet data.
Signature:
Returns:
profile (table): the raw profile table stored/cached for the player
Example:
GetPetInstance
Description: Return a server-side Class.BattlePet instance (if available) for the given player + PetId. Useful when you need class helpers / methods for a pet.
Signature:
Returns:
inst (table|nil): Class.BattlePet instance or nil when unavailable
Example:
SavePlayerProfile
Description: Persist the provided profile back to storage (JSON or MySQL depending on configuration). Updates caches accordingly.
Signature:
Returns:
ok (boolean): true on successful save
HasBeatenTrainer
Description: Check whether a player has already defeated the given trainer (one-time completion flag).
Signature:
Returns:
beaten (boolean): true when the trainer id is recorded as beaten for the player
Example:
MarkTrainerBeaten
Description: Mark a trainer as beaten for the player and persist the change.
Signature:
Returns:
ok (boolean): true if the state changed and the profile saved