Default.pl for Pet Items?
I am curious if anyone has a decent default.pl for handling an issue with pets. The problem is that I get far too many reports of players accidentally handing in items to their own pet (or someone else's pet) when trying to do quest turn ins. I figure that it is time to try to stomp out that issue for good.
What I am thinking is to have a default.pl that would affect all pets (and all other NPCs without a quest script) so that they no longer accept No Drop items or items with the Quest flag on them, unless they were given to them by a GM.
There are 2 main issues with trying to set this up:
First, any NPC with a sub_EVENT_ITEM will not equip items that are handed to them. I think we can get around this by just doing a quest::addloot($item1) and so on once we verify that it should be able to accept that item.
The second issue will take more work to resolve, but shouldn't be too bad. Basically, I don't see any way for quests to check if an item is no drop, or if it has a certain setting on it. I think we could go about handling this in 1 of 2 possible ways. The easiest way would be to just create a bool in the source code that does a check on the item to see if it is no drop "IsNoDrop()" and maybe another bool that checks if it is a quest item "IsQuestItem()". Then, we could just run those checks and if it fails them, it just returns the item to the player.
The other possibility that might be better in the long run and could be considerably more useful would be to make a function that could get any stat from the database for any item. Or maybe just limit it to certain stats that all use integers (because mixing strings and ints might be tough). But, then you could just do something like "Quest::GetItemStat(NoDrop)" and it would return 0 or 255 or whatever that stat is set to.
The command that can get stats would actually be pretty cool. I was thinking about a custom quest a while back that could definitely use it. Basically, it would be a quest that the player could turn in any 4 items with around the same HP value and in return, they would get an item with slightly better stats. Or, maybe they get a certain amount of credit based on HPs of an item they turn in that they can then spend on from a list of items.
Got a little off-topic there, but the pet issue is my main focus. If anyone has had any success with this, I would be interested to hear. I would almost consider setting pets to not accept no drop items directly in the source code, but I don't know if anyone would have a problem with that. And, it really shouldn't be too hard to get this script going and working flawlessly. Once it is all done, I will share it here for anyone who wants it.
|