1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 14:57:44 +00:00

Finished removing old inventory class and moving stuff into player

This commit is contained in:
Mordred Admin 2018-07-25 09:48:54 +02:00
parent b85c1c244e
commit 1f5a890324
3 changed files with 7 additions and 18 deletions

View file

@ -248,13 +248,9 @@ public:
/*! add amount to the currency of type */
void addCurrency( Common::CurrencyType type, uint32_t amount );
/*! remove amount from the currency of type */
void removeCurrency( uint8_t type, uint32_t amount );
void removeCurrency( Common::CurrencyType type, uint32_t amount );
/*! return the current amount of crystals of type */
uint32_t getCrystal( uint8_t type ) const;
/*! add amount to the crystals of type */
void addCrystal( uint8_t type, uint32_t amount );
/*! remove amount from the crystals of type */
void removeCrystal( uint8_t type, uint32_t amount );
// Class / Job / Exp
//////////////////////////////////////////////////////////////////////////////////////////////////////
@ -638,9 +634,9 @@ public:
/*! return the crystal amount of currency of type */
uint32_t getCrystal( Common::CrystalType type );
/*! add amount to the crystal of type */
bool addCrystal( Common::CrystalType type, uint32_t amount );
void addCrystal( Common::CrystalType type, uint32_t amount );
/*! remove amount from the crystals of type */
bool removeCrystal( Common::CrystalType type, uint32_t amount );
void removeCrystal( Common::CrystalType type, uint32_t amount );
bool isObtainable( uint32_t catalogId, uint8_t quantity );
void updateCrystalDb();

View file

@ -249,7 +249,7 @@ void Core::Entity::Player::removeCurrency( Common::CurrencyType type, uint32_t a
auto currItem = m_inventoryMap[Currency]->getItem( static_cast< uint8_t >( type ) - 1 );
if( !currItem )
return false;
return;
uint32_t currentAmount = currItem->getStackSize();
if( amount > currentAmount )
@ -316,7 +316,7 @@ void Core::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t amo
auto invUpPacket = makeZonePacket< FFXIVIpcUpdateInventorySlot >( getId() );
invUpPacket->data().containerId = Common::InventoryType::Crystal;
invUpPacket->data().catalogId = static_cast< uint8_t >( type ) + 1;
invUpPacket->data().quantity = getCrystal( static_cast< Common::CrystalType >( type ) );
invUpPacket->data().quantity = getCrystal( type );
invUpPacket->data().slot = static_cast< uint8_t >( type ) - 1;
queuePacket( invUpPacket );
@ -333,14 +333,6 @@ bool Core::Entity::Player::tryAddItem( uint16_t catalogId, uint32_t quantity )
return false;
}
/*bool Core::Entity::Player::addItem( uint16_t containerId, uint16_t catalogId, uint32_t quantity )
{
if( addItem( containerId, -1, catalogId, quantity ) != -1 )
return true;
return false;
}*/
void Core::Entity::Player::sendInventory()
{
InventoryMap::iterator it;
@ -863,6 +855,7 @@ uint8_t Core::Entity::Player::getFreeSlotsInBags()
uint8_t slots = 0;
for( uint8_t container : { 0, 1, 2, 3 } )
{
// TODO: this feels hackish at best
slots += 34 - m_inventoryMap[container]->getEntryCount();
}
return slots;

View file

@ -343,7 +343,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
}
else
{
targetPlayer->removeCurrency( 1, param1 );
targetPlayer->removeCurrency( CurrencyType::Gil, param1 );
player.sendNotice( "Removed " + std::to_string( param1 ) +
" Gil from " + targetPlayer->getName() +
"(" + std::to_string( gil ) + " before)" );