mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Quest API] Add HasItemOnCorpse() to Perl/Lua (#3824)
# Perl - Add `$client->HasItemOnCorpse(item_id)`. # Lua - Add `client:HasItemOnCorpse(item_id)`. # Notes - Allows operators to see if a player has an item on any of their corpses. - May need to address having to allocate and deallocate memory for every corpse that could possibly exist for a player.
This commit is contained in:
@@ -4789,3 +4789,31 @@ void Client::SummonItemIntoInventory(
|
||||
slot_id
|
||||
);
|
||||
}
|
||||
|
||||
bool Client::HasItemOnCorpse(uint32 item_id)
|
||||
{
|
||||
const uint32 corpse_count = GetCorpseCount();
|
||||
if (!corpse_count) {
|
||||
return EQ::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
for (int i = 0; i < corpse_count; i++) {
|
||||
const uint32 corpse_id = GetCorpseID(i);
|
||||
|
||||
for (int16 slot_id = EQ::invslot::POSSESSIONS_BEGIN; slot_id < EQ::invslot::POSSESSIONS_END; slot_id++) {
|
||||
const uint32 current_item_id = GetCorpseItemAt(corpse_id, slot_id);
|
||||
if (current_item_id && current_item_id == item_id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int16 slot_id = EQ::invbag::GENERAL_BAGS_BEGIN; slot_id < EQ::invbag::GENERAL_BAGS_END; slot_id++) {
|
||||
const uint32 current_item_id = GetCorpseItemAt(corpse_id, slot_id);
|
||||
if (current_item_id && current_item_id == item_id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user