Skip to content

Commit

Permalink
Add check for synthesis when selling
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaver-DaRed committed Sep 1, 2024
1 parent 140fff6 commit 8c14c48
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/map/packet_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5043,26 +5043,29 @@ void SmallPacket0x085(map_session_data_t* const PSession, CCharEntity* const PCh
CItem* gil = PChar->getStorage(LOC_INVENTORY)->GetItem(0);
CItem* PItem = PChar->getStorage(LOC_INVENTORY)->GetItem(slotID);

if ((PItem != nullptr) && ((gil != nullptr) && gil->isType(ITEM_CURRENCY)))
if (PItem != nullptr && (gil != nullptr && gil->isType(ITEM_CURRENCY)))
{
if (PChar->animation == ANIMATION_SYNTH)
{
ShowWarning("SmallPacket0x085: Player %s trying to sell while in the middle of a synth!", PChar->getName());
return;
}

if (quantity < 1 || quantity > PItem->getStackSize()) // Possible exploit
{
ShowWarning("SmallPacket0x085: Player %s trying to sell invalid quantity %u of itemID %u [to VENDOR] ",
PChar->getName(), quantity, PItem->getID());
ShowWarning("SmallPacket0x085: Player %s trying to sell invalid quantity %u of itemID %u [to VENDOR] ", PChar->getName(), quantity, PItem->getID());
return;
}

if (PItem->isSubType(ITEM_LOCKED)) // Possible exploit
{
ShowWarning("SmallPacket0x085: Player %s trying to sell %u of a LOCKED item! ID %i [to VENDOR] ",
PChar->getName(), quantity, PItem->getID());
ShowWarning("SmallPacket0x085: Player %s trying to sell %u of a LOCKED item! ID %i [to VENDOR] ", PChar->getName(), quantity, PItem->getID());
return;
}

if (PItem->getReserve() > 0) // Usually caused by bug during synth, trade, etc. reserving the item. We don't want such items sold in this state.
{
ShowError("SmallPacket0x085: Player %s trying to sell %u of a RESERVED(%u) item! ID %i [to VENDOR] ",
PChar->getName(), quantity, PItem->getReserve(), PItem->getID());
ShowError("SmallPacket0x085: Player %s trying to sell %u of a RESERVED(%u) item! ID %i [to VENDOR] ", PChar->getName(), quantity, PItem->getReserve(), PItem->getID());
return;
}

Expand Down

0 comments on commit 8c14c48

Please sign in to comment.