Added quantity checks to trading so you can't trade over your item count
This commit is contained in:
parent
11d46887db
commit
c5f09e846d
@ -9979,6 +9979,8 @@ void Commands::Command_TradeAddItem(Client* client, Seperator* sep)
|
||||
client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You can't trade NO-TRADE items.");
|
||||
else if (result == 3)
|
||||
client->SimpleMessage(CHANNEL_COLOR_YELLOW, "You can't trade HEIRLOOM items.");
|
||||
else if (result == 253)
|
||||
client->Message(CHANNEL_COLOR_YELLOW, "You do not have enough quantity...");
|
||||
else if (result == 254)
|
||||
client->Message(CHANNEL_COLOR_YELLOW, "You are trading with an older client with a %u trade slot restriction...", client->GetPlayer()->trade->MaxSlots());
|
||||
else if (result == 255)
|
||||
|
@ -44,6 +44,8 @@ int8 Trade::AddItemToTrade(Entity* character, Item* item, int8 quantity, int8 sl
|
||||
LogWrite(PLAYER__ERROR, 0, "Trade", "Player (%s) adding item (%u) to slot %u of the trade window", character->GetName(), item->details.item_id, slot);
|
||||
if (slot == 255)
|
||||
slot = GetNextFreeSlot(character);
|
||||
if(!quantity)
|
||||
quantity = 1;
|
||||
|
||||
if (slot < 0) {
|
||||
LogWrite(PLAYER__ERROR, 0, "Trade", "Player (%s) tried to add an item to an invalid trade slot (%u)", character->GetName(), slot);
|
||||
@ -52,6 +54,9 @@ int8 Trade::AddItemToTrade(Entity* character, Item* item, int8 quantity, int8 sl
|
||||
else if(slot >= trade_max_slots) {
|
||||
return 254;
|
||||
}
|
||||
else if(quantity > item->details.count) {
|
||||
return 253;
|
||||
}
|
||||
|
||||
Entity* other = GetTradee(character);
|
||||
int8 result = CheckItem(character, item, other);
|
||||
|
Loading…
x
Reference in New Issue
Block a user