More NoDrop-related hack abatement

This commit is contained in:
Uleat 2016-12-18 20:20:27 -05:00
parent 06279b18a3
commit 648078d76c
4 changed files with 10 additions and 15 deletions

View File

@ -293,18 +293,13 @@ bool EQEmu::InventoryProfile::DeleteItem(int16 slot_id, uint8 quantity)
} }
// Checks All items in a bag for No Drop // Checks All items in a bag for No Drop
bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id) { bool EQEmu::InventoryProfile::CheckNoDrop(int16 slot_id, bool recurse)
{
ItemInstance* inst = GetItem(slot_id); ItemInstance* inst = GetItem(slot_id);
if (!inst) return false; if (!inst)
if (!inst->GetItem()->NoDrop) return true; return false;
if (inst->GetItem()->ItemClass == 1) {
for (uint8 i = inventory::containerBegin; i < inventory::ContainerCount; i++) { return (!inst->IsDroppable(recurse));
ItemInstance* bagitem = GetItem(InventoryProfile::CalcSlotId(slot_id, i));
if (bagitem && !bagitem->GetItem()->NoDrop)
return true;
}
}
return false;
} }
// Remove item from bucket without memory delete // Remove item from bucket without memory delete

View File

@ -133,7 +133,7 @@ namespace EQEmu
bool DeleteItem(int16 slot_id, uint8 quantity = 0); bool DeleteItem(int16 slot_id, uint8 quantity = 0);
// Checks All items in a bag for No Drop // Checks All items in a bag for No Drop
bool CheckNoDrop(int16 slot_id); bool CheckNoDrop(int16 slot_id, bool recurse = true);
// Remove item from inventory (and take control of memory) // Remove item from inventory (and take control of memory)
ItemInstance* PopItem(int16 slot_id); ItemInstance* PopItem(int16 slot_id);

View File

@ -825,7 +825,7 @@ public:
bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = EQEmu::inventory::slotCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0); bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, uint32 aug6 = 0, bool attuned = false, uint16 to_slot = EQEmu::inventory::slotCursor, uint32 ornament_icon = 0, uint32 ornament_idfile = 0, uint32 ornament_hero_model = 0);
void SetStats(uint8 type,int16 set_val); void SetStats(uint8 type,int16 set_val);
void IncStats(uint8 type,int16 increase_val); void IncStats(uint8 type,int16 increase_val);
void DropItem(int16 slot_id); void DropItem(int16 slot_id, bool recurse = true);
int GetItemLinkHash(const EQEmu::ItemInstance* inst); // move to ItemData..or make use of the pre-calculated database field int GetItemLinkHash(const EQEmu::ItemInstance* inst); // move to ItemData..or make use of the pre-calculated database field

View File

@ -594,9 +594,9 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2,
} }
// Drop item from inventory to ground (generally only dropped from SLOT_CURSOR) // Drop item from inventory to ground (generally only dropped from SLOT_CURSOR)
void Client::DropItem(int16 slot_id) void Client::DropItem(int16 slot_id, bool recurse)
{ {
if(GetInv().CheckNoDrop(slot_id) && RuleI(World, FVNoDropFlag) == 0 || if(GetInv().CheckNoDrop(slot_id, recurse) && RuleI(World, FVNoDropFlag) == 0 ||
RuleI(Character, MinStatusForNoDropExemptions) < Admin() && RuleI(World, FVNoDropFlag) == 2) { RuleI(Character, MinStatusForNoDropExemptions) < Admin() && RuleI(World, FVNoDropFlag) == 2) {
database.SetHackerFlag(this->AccountName(), this->GetCleanName(), "Tried to drop an item on the ground that was nodrop!"); database.SetHackerFlag(this->AccountName(), this->GetCleanName(), "Tried to drop an item on the ground that was nodrop!");
GetInv().DeleteItem(slot_id); GetInv().DeleteItem(slot_id);