mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 08:57:44 +00:00
correctly update items and select slot
This commit is contained in:
parent
901168d810
commit
86de3d98a2
1 changed files with 6 additions and 2 deletions
|
@ -536,6 +536,7 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setStackSize( newStackSize );
|
item->setStackSize( newStackSize );
|
||||||
|
writeItem( item );
|
||||||
|
|
||||||
auto slotUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), slot, bag, *item );
|
auto slotUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), slot, bag, *item );
|
||||||
queuePacket( slotUpdate );
|
queuePacket( slotUpdate );
|
||||||
|
@ -544,14 +545,17 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
|
||||||
|
|
||||||
// return existing stack if we have no overflow - items fit into a preexisting stack
|
// return existing stack if we have no overflow - items fit into a preexisting stack
|
||||||
if( quantity == 0 )
|
if( quantity == 0 )
|
||||||
|
{
|
||||||
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ItemObtainIcon, catalogId, originalQuantity ) );
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( !item && !foundFreeSlot )
|
else if( !item && !foundFreeSlot )
|
||||||
{
|
{
|
||||||
freeBagSlot = { bag, slot };
|
freeBagSlot = { bag, slot };
|
||||||
foundFreeSlot = true;
|
foundFreeSlot = true;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue