[Commands] Add #emptyinventory Command. (#1684)

* [Commands] Add #emptyinventory Command.
- Allows you empty you or your target's inventory completely. (Equipment, General, Bank, and Shared Bank)
- Fixed an issue not allowing quest::removeitem(item_id, quanity) to remove 0 charge items.
- Fixed an issue not allowing eq.remove_item(item_id, quanity) to remove 0 charge items.

* Update command.cpp

* Update client.cpp
This commit is contained in:
Kinglykrab
2021-11-06 22:34:04 -04:00
committed by GitHub
parent beb4de0b45
commit bc82b897c5
3 changed files with 71 additions and 3 deletions
+4 -3
View File
@@ -10276,10 +10276,11 @@ void Client::RemoveItem(uint32 item_id, uint32 quantity)
item = GetInv().GetItem(slot_id);
if (item && item->GetID() == item_id) {
int stack_size = item->IsStackable() ? item->GetCharges() : 1;
int charges = item->IsStackable() ? item->GetCharges() : 0;
int stack_size = std::max(charges, 1);
if ((removed_count + stack_size) <= quantity) {
removed_count += stack_size;
DeleteItemInInventory(slot_id, stack_size, true);
DeleteItemInInventory(slot_id, charges, true);
} else {
int amount_left = (quantity - removed_count);
if (amount_left > 0 && stack_size >= amount_left) {
@@ -10808,4 +10809,4 @@ uint16 Client::LearnDisciplines(uint8 min_level, uint8 max_level)
}
return learned_disciplines;
}
}