Auto-Localization Question

My rotation addon is progressing nicely and I’ve found ways to auto-localize it with regards to Items and Spells and Auras.

I’ve run into something with Shaman that I can’t quite wrap my head around.

This assumes Primal Elementalist talent selected.

Fire Elemental, for example, summons a proper “pet” (there’s a pet control bar) that lasts for a little while.

Earth Elemental does the same thing.

With the English client, I can check UnitName(‘pet’) to match the pet’s name with the Primal Fire Elemental or Primal Earth Elemental easily enough.

But I can’t figure out any way to identify those pets that isn’t by name.

I know, for example, that a Primal Fire Elemental is npc ID 61029, but I don’t know how to use that npc ID to get the localized name of it.

Does anyone have any clue how I might do that?

it might change over time (ie, logouts/dismiss/summon) but try /dump UnitGUID('pet') and see if it always generates the same guid. if it does use that instead.

UnitGUID(‘pet’) for the two elemental pets (assumes you have the Primal Elemental talent) returned the following strings for me:

Creature-0-3882-2374-7021-61029-<some random looking hex string>
and
Creature-0-3883-2374-7021-61056-<different random-looking hex string>

The creature ID values for Primal Fire Elemental and Primal Earth Elemental are 61029 and 61056. @Arkayenro was correct in that the pet IDs can be determined from the GUIDs and from that I can auto-localize the code I’m looking at.

There doesn’t seem to be any relationship between the player GUID and the pet GUID (no overlap between the GUID strings that I could discern).