mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-13 15:02:25 +00:00
[Bug Fix] Fix for charges not being sold correctly (#1357)
* fix for charges not being sold correctly https://github.com/EQEmu/Server/issues/1350 this fixes this issue * Update client_packet.cpp * Update zone.cpp this completes the fix for all charge items being sold to merchants * code opmizations could probably be fixed up better but this is a little cleaner * Update snake_casing Co-authored-by: Chris Miles <akkadius1@gmail.com>
This commit is contained in:
parent
e14acd6802
commit
542ec38660
@ -12990,9 +12990,9 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
int16 freeslotid = INVALID_INDEX;
|
int16 freeslotid = INVALID_INDEX;
|
||||||
int16 charges = 0;
|
int16 charges = 0;
|
||||||
if (item->Stackable || item->MaxCharges > 1)
|
if (item->Stackable || tmpmer_used)
|
||||||
charges = mp->quantity;
|
charges = mp->quantity;
|
||||||
else
|
else if ( item->MaxCharges > 1)
|
||||||
charges = item->MaxCharges;
|
charges = item->MaxCharges;
|
||||||
|
|
||||||
EQ::ItemInstance* inst = database.CreateItem(item, charges);
|
EQ::ItemInstance* inst = database.CreateItem(item, charges);
|
||||||
@ -13238,12 +13238,9 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app)
|
|||||||
LogMerchant(this, vendor, mp->quantity, price, item, false);
|
LogMerchant(this, vendor, mp->quantity, price, item, false);
|
||||||
|
|
||||||
int charges = mp->quantity;
|
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;
|
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();
|
EQ::ItemInstance* inst2 = inst->Clone();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|||||||
@ -419,12 +419,11 @@ int Zone::SaveTempItem(uint32 merchantid, uint32 npcid, uint32 item, int32 charg
|
|||||||
if (!ml.origslot) {
|
if (!ml.origslot) {
|
||||||
ml.origslot = ml.slot;
|
ml.origslot = ml.slot;
|
||||||
}
|
}
|
||||||
|
bool is_stackable = database.GetItem(item)->Stackable;
|
||||||
if (charges > 0) {
|
if ((is_stackable && charges > 0) || (!is_stackable && sold)) {
|
||||||
database.SaveMerchantTemp(npcid, ml.origslot, item, ml.charges);
|
database.SaveMerchantTemp(npcid, ml.origslot, item, ml.charges);
|
||||||
tmp_merlist.push_back(ml);
|
tmp_merlist.push_back(ml);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
database.DeleteMerchantTemp(npcid, ml.origslot);
|
database.DeleteMerchantTemp(npcid, ml.origslot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user