Prevent pets inventory duplicationSuggestion
This message is for administrators, in case @k1lly0u will not patch this.
With current code players able to dupe whole pets inventory on each plugin reload/server restart. They just should kill the pet, the inventory content will be droped, but after restart the pet will be spawned with restored inventory again. To prevent this, find the code block:
            internal void OnDeath()
            {
                if (owner != null)
                {
                    owner.enabled = false;
                    owner.npcAi = null;
                    UserMessage(owner.player, "ondeath");
                    Destroy(owner);
                }

                Destroy(this);
            }​

and replace it with this one:

            internal void OnDeath()
            {
                if (owner != null)
                {
                    owner.enabled = false;
                    owner.npcAi = null;
                    UserMessage(owner.player, "ondeath");
                    Destroy(owner);
                    PetData info;
                    if (ins.npcSaveList.TryGetValue(owner.player.userID, out info))
                    {
                        ins.npcSaveList.Remove(owner.player.userID);
                    }
                }

                Destroy(this);
            }

Also, when wiping map, don't forget to remove
oxide/data/Pets_data.json​

that will just nuke the entire pet and the inventory

the below fix works by updating the inventory when pet is killed

            private void OnDestroy()
            {
                pets.Remove(npc);
                DropUtil.DropItems(inventory, transform.position);
                PetData info;
                if (npcSaveList.TryGetValue(owner.player.userID, out info))
                {
                    info.inventory = inventory.Save().ToProtoBytes();
                }
                owner.npcAi = null;

                if (npc.health <= 0)
                    return;

                npc.InitializeHealth(npc.Health() / healthModifier, npc.MaxHealth() / healthModifier);

                npc.AttackDamage /= attackModifier;
                npc.Stats.TurnSpeed /= speedModifier;
                npc.Stats.Speed /= speedModifier;

                if (npc.IsDestroyed) return;
                npc.Kill();
            }
nivex

that will just nuke the entire pet and the inventory

the below fix works by updating the inventory when pet is killed

            private void OnDestroy()
            {
                pets.Remove(npc);
                DropUtil.DropItems(inventory, transform.position);
                PetData info;
                if (npcSaveList.TryGetValue(owner.player.userID, out info))
                {
                    info.inventory = inventory.Save().ToProtoBytes();
                }
                owner.npcAi = null;

                if (npc.health <= 0)
                    return;

                npc.InitializeHealth(npc.Health() / healthModifier, npc.MaxHealth() / healthModifier);

                npc.AttackDamage /= attackModifier;
                npc.Stats.TurnSpeed /= speedModifier;
                npc.Stats.Speed /= speedModifier;

                if (npc.IsDestroyed) return;
                npc.Kill();
            }

I tried editing this section with what you put and I get:

Error while compiling: Pets.cs(480,8): error CS0103: The name `npc' does not exist in the current context

@MACHIN3 sorry, replace all npc with entity. I forgot I renamed it. :p

private void OnDestroy()
{
    //pets.Remove(npc);
    DropUtil.DropItems(inventory, transform.position);
    PetData info;
    if (npcSaveList.TryGetValue(owner.player.userID, out info))
    {
        info.inventory = inventory.Save().ToProtoBytes();
    }
    owner.npcAi = null;

    if (entity.health <= 0)
        return;

    entity.InitializeHealth(entity.Health() / healthModifier, entity.MaxHealth() / healthModifier);

    entity.AttackDamage /= attackModifier;
    entity.Stats.TurnSpeed /= speedModifier;
    entity.Stats.Speed /= speedModifier;

    if (entity.IsDestroyed) return;
    entity.Kill();
}​

try this, been a while so idk anymore :p

Thanks, seems the error disapeared. I am trying to update the HuntsRPG mod myself and so far things are going well. Just making sure Pets are working with it still.

EDIT:
Seems i spoke too soon... Now it errors with:

Unable to load Pets. Pets.cs(464,9): error CS0038: Cannot access a nonstatic member of outer type `Oxide.Plugins.Pets' via nested type `Oxide.Plugins.Pets.NpcAI'

@nivex, my logic is as follows: pet was killed, so nuke it and it's inventory from saved datafile. Not sure why player should have infinite pet with continuosly saved inventory, but I don't mind if you have another vision to solve this problem :)