PDA

View Full Version : Adding Equipment to Pets


bad_captain
01-29-2010, 12:10 AM
I am working on pet focii, and have decided to go ahead and work through adding the equipment that automatically comes equipped on focused pets instead of just leaving it at equations for the pet's stats. This is my first time working with equipment, so I've been having a little trouble figuring out how to actually add the item. Since the item added is a summoned item, I see where the following code is used when a player summons an item gets the item_struct and creates an ItemInst from it.


ItemInst *SummonedItem=NULL;

const Item_Struct *item = database.GetItem(spell.base[i]);
SummonedItem=database.CreateItem(spell.base[i],charges);


However, the code that gives an item to a pet, either only requires the itemIDs (AddItem) or the Item_Struct (AddLootDrop), not the full ItemInst (and it appears the npc only stores the itemID for equipment). Would I be able to just use the itemID or item_struct to equip the pet, or would I need to make an ItemInst for the pet? And which function would be best to take itemIDs loaded from the database and turned into items that are equipped by the pet?

Also, I noticed that npcs (and therefore pets) only have 9 slots for equipment, but in doing research for working on pet focus items, I ran across multiple accounts of pets going rogue (such as after a charm), with the pet dying and showing a list of 15 or 16 items (the usual 9 plus 2 rings, face, waist, neck, back, and shoulders). I know pets can equip face, waist, and back, due to summoned pet equipment for those slots (Muzzle of Mardu, Girdle of Magi'kot, Elemental Defender), but I don't see anywhere those slots are being accounted for. Am I missing something, or do these slots need to be added for pets for them to equip these items?

KLS
01-29-2010, 02:34 AM
NPC inventory is tricky. Behind the scenes they have a loot list but not an inventory; there's one devised from the material slots but it isn't exactly the same as you've noticed. It has a limitation on the visible slots.

It was something I was going to address after I finished up spells.

bad_captain
01-29-2010, 09:43 AM
But do they gain stats, etc. from the items in the loot table? If not, I guess I will work on it with the assumption that while those slots won't work now, they will in the future.

Maybe as a short term fix, something can be worked out so that pets' stats are calculated based on all items in their loot table, not just for those 9 slots.

Otherwise, I guess when loading the items, it just wouldn't find a slot for them.