#317 Fix for infinite quantity items on merchants

Merged
image merged 1 commits from TesterOrg/merchantfixes into devn00b/master 3 years ago
2 changed files with 5 additions and 5 deletions
  1. 2 2
      EQ2/source/WorldServer/World.cpp
  2. 3 3
      EQ2/source/WorldServer/client.cpp

+ 2 - 2
EQ2/source/WorldServer/World.cpp

@@ -1225,7 +1225,7 @@ int32 World::GetInventoryID(int32 merchant_id, int32 item_id){
 
 void World::DecreaseMerchantQuantity(int32 merchant_id, int32 item_id, int16 amount){
 	int16 total_left = GetMerchantItemQuantity(merchant_id, item_id);
-	if(total_left > 0 && total_left < 0xFFFF){
+	if(total_left > 0 && total_left < 0xFF){
 		int32 inventory_id = GetInventoryID(merchant_id, item_id);
 		if(inventory_id > 0){
 			MMerchantList.lock();
@@ -2478,4 +2478,4 @@ Map* World::GetMap(std::string zoneFile, int32 client_version)
 
 	MWorldMaps.releasereadlock();
 	return nullptr;
-}
+}

+ 3 - 3
EQ2/source/WorldServer/client.cpp

@@ -6589,7 +6589,7 @@ void Client::BuyItem(int32 item_id, int16 quantity) {
 							Message(CHANNEL_MERCHANT_BUY_SELL, "You buy %s from %s for%s.", master_item->CreateItemLink(GetVersion()).c_str(), spawn->GetName(), GetCoinMessage(total_buy_price).c_str());
 						AddItem(item);
 						CheckPlayerQuestsItemUpdate(item);
-						if (item && total_available < 0xFFFF) {
+						if (item && total_available < 0xFF) {
 							world.DecreaseMerchantQuantity(spawn->GetMerchantID(), item_id, quantity);
 							SendBuyMerchantList();
 						}
@@ -6687,7 +6687,7 @@ void Client::BuyItem(int32 item_id, int16 quantity) {
 								Message(CHANNEL_MERCHANT_BUY_SELL, "You buy %s from %s for%s.", master_item->CreateItemLink(GetVersion()).c_str(), spawn->GetName(), GetCoinMessage(ItemInfo->price_coins * quantity).c_str());
 							AddItem(item);
 							CheckPlayerQuestsItemUpdate(item);
-							if (item && total_available < 0xFFFF) {
+							if (item && total_available < 0xFF) {
 								world.DecreaseMerchantQuantity(spawn->GetMerchantID(), item_id, quantity);
 								SendBuyMerchantList();
 							}
@@ -10218,4 +10218,4 @@ void Client::AwardCoins(int64 total_coins, std::string reason)
 		int8 type = CHANNEL_LOOT;
 		SimpleMessage(type, message.c_str());
 		}
-}
+}