Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ProducerZekServer committed May 15, 2021
2 parents 73d7ae1 + 9d2b079 commit 47d544d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 3 additions & 6 deletions zone/client_packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13030,9 +13030,9 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)

int16 freeslotid = INVALID_INDEX;
int16 charges = 0;
if (item->Stackable || item->MaxCharges > 1)
if (item->Stackable || tmpmer_used)
charges = mp->quantity;
else
else if ( item->MaxCharges > 1)
charges = item->MaxCharges;

EQ::ItemInstance* inst = database.CreateItem(item, charges);
Expand Down Expand Up @@ -13278,12 +13278,9 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
LogMerchant(this, vendor, mp->quantity, price, item, false);

int charges = mp->quantity;
//Hack workaround so usable items with 0 charges aren't simply deleted
if (charges == 0 && item->ItemType != 11 && item->ItemType != 17 && item->ItemType != 19 && item->ItemType != 21)
charges = 1;

int freeslot = 0;
if (charges > 0 && (freeslot = zone->SaveTempItem(vendor->CastToNPC()->MerchantType, vendor->GetNPCTypeID(), itemid, charges, true)) > 0) {
if ((freeslot = zone->SaveTempItem(vendor->CastToNPC()->MerchantType, vendor->GetNPCTypeID(), itemid, charges, true)) > 0) {
EQ::ItemInstance* inst2 = inst->Clone();

while (true) {
Expand Down
7 changes: 3 additions & 4 deletions zone/zone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,11 @@ int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charg
if (!ml.origslot) {
ml.origslot = ml.slot;
}

if (charges > 0) {
bool IsStackable = database.GetItem(item)->Stackable;
if ((IsStackable && charges > 0) || (!IsStackable && sold)) {
database.SaveMerchantTemp(npcid, ml.origslot, item, ml.charges);
tmp_merlist.push_back(ml);
}
else {
} else {
database.DeleteMerchantTemp(npcid, ml.origslot);
}
}
Expand Down

0 comments on commit 47d544d

Please sign in to comment.