From f58dbc90eb61cebe7796dfbd0243c3fe26407ffb Mon Sep 17 00:00:00 2001
From: Joseph Re <overture2112@gmail.com>
Date: Mon, 8 Mar 2021 23:35:19 -0600
Subject: [PATCH] treat >0xFF as infinite quantity instead of >0xFFFF

---
 EQ2/source/WorldServer/World.cpp  | 4 ++--
 EQ2/source/WorldServer/client.cpp | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/EQ2/source/WorldServer/World.cpp b/EQ2/source/WorldServer/World.cpp
index 831c5de9a..d38c9b0a3 100644
--- a/EQ2/source/WorldServer/World.cpp
+++ b/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;
-}
\ No newline at end of file
+}
diff --git a/EQ2/source/WorldServer/client.cpp b/EQ2/source/WorldServer/client.cpp
index 82c718935..9e09e4f1f 100644
--- a/EQ2/source/WorldServer/client.cpp
+++ b/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());
 		}
-}
\ No newline at end of file
+}