N0ctrnl
07-17-2015, 10:47 PM
So I'm not much of a programmer. Let me just add that up front...
I've had reports of rogues being able to pickpocket weapons right off an NPC. In an effort to try to fix it, I've come up with the following in zone/npc.cpp:
bool is_arrow = (item->ItemType == ItemTypeArrow) ? true : false;
int slot_id = thief->GetInv().FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow);
bool is_weapon = ((item->ItemType == ItemType1HSlash) == true) || ((item->ItemType == ItemType2HSlash) == true) || ((item->ItemType == ItemType1HPiercing) == true) || ((item->ItemType == ItemType1HBlunt) == true) || ((item->ItemType == ItemType2HBlunt) == true) || ((item->ItemType == ItemType2HPiercing) == true);
if (/*!Equipped(item->ID) &&*/
!item->Magic && item->NoDrop != 0 && !inst->IsType(ItemClassContainer) && slot_id != INVALID_INDEX && is_weapon == false
Now, I realize it's entirely likely I haven't done anything but add useless lines of code here. Can somebody with more than zero skills let me know if what I put here will work?
Also, I'm sure there's a better way than checking against all the weapon types, so if there's something more efficient please do tell.
Thanks! :)
I've had reports of rogues being able to pickpocket weapons right off an NPC. In an effort to try to fix it, I've come up with the following in zone/npc.cpp:
bool is_arrow = (item->ItemType == ItemTypeArrow) ? true : false;
int slot_id = thief->GetInv().FindFreeSlot(false, true, inst->GetItem()->Size, is_arrow);
bool is_weapon = ((item->ItemType == ItemType1HSlash) == true) || ((item->ItemType == ItemType2HSlash) == true) || ((item->ItemType == ItemType1HPiercing) == true) || ((item->ItemType == ItemType1HBlunt) == true) || ((item->ItemType == ItemType2HBlunt) == true) || ((item->ItemType == ItemType2HPiercing) == true);
if (/*!Equipped(item->ID) &&*/
!item->Magic && item->NoDrop != 0 && !inst->IsType(ItemClassContainer) && slot_id != INVALID_INDEX && is_weapon == false
Now, I realize it's entirely likely I haven't done anything but add useless lines of code here. Can somebody with more than zero skills let me know if what I put here will work?
Also, I'm sure there's a better way than checking against all the weapon types, so if there's something more efficient please do tell.
Thanks! :)