mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 08:27:46 +00:00
commit
6cb0a7eed2
3 changed files with 7 additions and 7 deletions
|
@ -37,7 +37,7 @@ namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
ItemPtr item;
|
ItemPtr item;
|
||||||
uint32_t amount;
|
uint32_t amount;
|
||||||
uint32_t value;
|
uint32_t pricePerItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Class representing the Player
|
/** Class representing the Player
|
||||||
|
|
|
@ -183,7 +183,7 @@ void Sapphire::Entity::Player::playGilShop( uint32_t eventId, uint32_t flags, ui
|
||||||
break;
|
break;
|
||||||
openGilShopPacket->data().params[ index++ ] = entry.item->getId();
|
openGilShopPacket->data().params[ index++ ] = entry.item->getId();
|
||||||
openGilShopPacket->data().params[ index++ ] = entry.amount;
|
openGilShopPacket->data().params[ index++ ] = entry.amount;
|
||||||
openGilShopPacket->data().params[ index++ ] = entry.value;
|
openGilShopPacket->data().params[ index++ ] = entry.pricePerItem;
|
||||||
index += 2;
|
index += 2;
|
||||||
openGilShopPacket->data().params[ index++ ] = eventId;
|
openGilShopPacket->data().params[ index++ ] = eventId;
|
||||||
index += 2;
|
index += 2;
|
||||||
|
|
|
@ -92,15 +92,15 @@ bool Sapphire::World::Manager::ShopMgr::shopBuyBack( Sapphire::Entity::Player& p
|
||||||
if( buyBackList.size() > index )
|
if( buyBackList.size() > index )
|
||||||
{
|
{
|
||||||
auto& entry = buyBackList[ index ];
|
auto& entry = buyBackList[ index ];
|
||||||
if( player.getCurrency( Common::CurrencyType::Gil ) < entry.value )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto originalStack = entry.item->getStackSize();
|
auto originalStack = entry.item->getStackSize();
|
||||||
|
auto price = entry.pricePerItem * originalStack;
|
||||||
|
if( player.getCurrency( Common::CurrencyType::Gil ) < price )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( !player.addItem( entry.item ) )
|
if( !player.addItem( entry.item ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
player.removeCurrency( Common::CurrencyType::Gil, entry.value );
|
player.removeCurrency( Common::CurrencyType::Gil, price );
|
||||||
|
|
||||||
buyBackList.erase( buyBackList.begin() + index );
|
buyBackList.erase( buyBackList.begin() + index );
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ bool Sapphire::World::Manager::ShopMgr::shopBuyBack( Sapphire::Entity::Player& p
|
||||||
packet->data().unknown2 = 3;
|
packet->data().unknown2 = 3;
|
||||||
packet->data().itemId = entry.item->getId();
|
packet->data().itemId = entry.item->getId();
|
||||||
packet->data().amount = originalStack;
|
packet->data().amount = originalStack;
|
||||||
packet->data().price = entry.value * originalStack;
|
packet->data().price = price;
|
||||||
packet->data().unknown6 = 0;
|
packet->data().unknown6 = 0;
|
||||||
packet->data().unknown7 = 0;
|
packet->data().unknown7 = 0;
|
||||||
player.queuePacket( packet );
|
player.queuePacket( packet );
|
||||||
|
|
Loading…
Add table
Reference in a new issue