I'm wondering what is the best practice is for managing familiar equipment.
I have various general familiar equipment which can be equipped on any familiar, like Snow Suit, li'l businessman suit, Astral pet sweater, Mayflower bouquet, ittah bittah hookah, sugar shield, little bitty bathysphere, etc.
When I have tried to equip familiar equipment that was on another familiar, it just errors out instead of removing it from the other one first. And when you swap out a familiar, the equipment doesn't get returned to your inventory, it stays with the inactive familiar (or if locked, moves to the new familiar).
Right now, my scripts are removing any generic familiar equipment before swapping familiars, just in case the new familiar should be using that equipment. I do this by equipping "none". But instead of actually removing the equipment, it chooses another one, saying that's a better choice than "none". I've seen it choose Mayflower bouquet as the alternative. So what happens when I take off my snow suit to make it available for others, and it substitutes the Mayflower bouquet, then swap familiars, and now try to equip the mayflower bouquet?
It looks like I can query each familiar's equipment with familiar_equipped_equipment, but I don't see any obvious way to remove equipment from an inactive familiar if another one want to use it. Should I just leave it equipped, and use visit_url("familiar.php?pwd=" + my_hash() + "&action=unequip&famid=" + familiar.to_int()) to remove it when someone else needs it?
But doing that leaves another issue: I can't find a function to iterate all owned familiars. So I need to parse the terrarium page manually, or maintain a list of familiars in my script to check against?
Or I could maintain a list of generic equipment that hopefully everyone has, like the ant tools etc., and use them for swapping in instead of "none". Which would probably work unless the player auto-sells such things. And this whole "unequip before familiar swap" has it's own issues, like unnecessary server hits, and not accounting for equipment that's already tied to an inactive familiar.
How do other scripts deal with this?
I have various general familiar equipment which can be equipped on any familiar, like Snow Suit, li'l businessman suit, Astral pet sweater, Mayflower bouquet, ittah bittah hookah, sugar shield, little bitty bathysphere, etc.
When I have tried to equip familiar equipment that was on another familiar, it just errors out instead of removing it from the other one first. And when you swap out a familiar, the equipment doesn't get returned to your inventory, it stays with the inactive familiar (or if locked, moves to the new familiar).
Right now, my scripts are removing any generic familiar equipment before swapping familiars, just in case the new familiar should be using that equipment. I do this by equipping "none". But instead of actually removing the equipment, it chooses another one, saying that's a better choice than "none". I've seen it choose Mayflower bouquet as the alternative. So what happens when I take off my snow suit to make it available for others, and it substitutes the Mayflower bouquet, then swap familiars, and now try to equip the mayflower bouquet?
It looks like I can query each familiar's equipment with familiar_equipped_equipment, but I don't see any obvious way to remove equipment from an inactive familiar if another one want to use it. Should I just leave it equipped, and use visit_url("familiar.php?pwd=" + my_hash() + "&action=unequip&famid=" + familiar.to_int()) to remove it when someone else needs it?
But doing that leaves another issue: I can't find a function to iterate all owned familiars. So I need to parse the terrarium page manually, or maintain a list of familiars in my script to check against?
Or I could maintain a list of generic equipment that hopefully everyone has, like the ant tools etc., and use them for swapping in instead of "none". Which would probably work unless the player auto-sells such things. And this whole "unequip before familiar swap" has it's own issues, like unnecessary server hits, and not accounting for equipment that's already tied to an inactive familiar.
How do other scripts deal with this?