diff --git a/deps/datReader/Exd.h b/deps/datReader/Exd.h index 8cf40658..efde6839 100644 --- a/deps/datReader/Exd.h +++ b/deps/datReader/Exd.h @@ -80,7 +80,7 @@ namespace xiv::exd // Get the vector fields for the given record and preallocate it auto fields = _data[ id ]; fields.reserve( member_count ); - iss.seekg( cacheEntryIt->second.offset + 6 ); + iss.seekg( static_cast< uint64_t >( cacheEntryIt->second.offset + 6 ) ); iss.read( reinterpret_cast( &pSheet.get()->_data ), sizeof( T ) ); diff --git a/src/api/PlayerMinimal.cpp b/src/api/PlayerMinimal.cpp index 023a2e0a..e84e917f 100644 --- a/src/api/PlayerMinimal.cpp +++ b/src/api/PlayerMinimal.cpp @@ -308,10 +308,10 @@ void PlayerMinimal::saveAsNew() createInvDbContainer( InventoryType::ArmoryRing ); createInvDbContainer( InventoryType::ArmoryMain ); createInvDbContainer( InventoryType::ArmorySoulCrystal ); - - createInvDbContainer( InventoryType::Currency ); createInvDbContainer( InventoryType::Crystal ); + createCurrencyDbContainer(); + auto stmtMonsterNote = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_MONSTERNOTE_INS ); stmtMonsterNote->setUInt64( 1, m_characterId ); for( uint8_t i = 1; i <= 12; ++i ) @@ -453,6 +453,14 @@ void PlayerMinimal::createInvDbContainer( uint16_t slot ) const g_charaDb.directExecute( stmtCreateInv ); } +void PlayerMinimal::createCurrencyDbContainer() const +{ + auto stmtCreateCurrency = g_charaDb.getPreparedStatement( Db::CHARA_CURRENCYINV_INS ); + stmtCreateCurrency->setUInt64( 1, m_characterId ); + stmtCreateCurrency->setInt( 2, 2000 ); + g_charaDb.directExecute( stmtCreateCurrency ); +} + uint64_t PlayerMinimal::getNextUId64() const { g_charaDb.directExecute( std::string( "INSERT INTO uniqueiddata( IdName ) VALUES( 'NOT_SET' );" ) ); diff --git a/src/api/PlayerMinimal.h b/src/api/PlayerMinimal.h index 923059bb..8023acbd 100644 --- a/src/api/PlayerMinimal.h +++ b/src/api/PlayerMinimal.h @@ -159,6 +159,8 @@ namespace Sapphire::Api void createInvDbContainer( uint16_t slot ) const; + void createCurrencyDbContainer() const; + uint32_t m_modelEquip[10]; uint64_t getNextUId64() const; diff --git a/src/common/Database/ZoneDbConnection.cpp b/src/common/Database/ZoneDbConnection.cpp index 3fe57e69..be02cea8 100644 --- a/src/common/Database/ZoneDbConnection.cpp +++ b/src/common/Database/ZoneDbConnection.cpp @@ -176,6 +176,11 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements() "INSERT INTO charaiteminventory ( CharacterId, storageId, UPDATE_DATE ) VALUES ( ?, ?, NOW() );", CONNECTION_BOTH ); + /// INVENTORY INFO + prepareStatement(CHARA_CURRENCYINV_INS, + "INSERT INTO charaitemcurrency ( CharacterId, storageId, idx, UPDATE_DATE ) VALUES ( ?, ?, 0, NOW() );", + CONNECTION_BOTH); + /// ITEM GLOBAL prepareStatement( CHARA_ITEMGLOBAL_INS, "INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, stack, UPDATE_DATE ) VALUES ( ?, ?, ?, ?, NOW() );", diff --git a/src/common/Database/ZoneDbConnection.h b/src/common/Database/ZoneDbConnection.h index 7a1c3b41..291454a8 100644 --- a/src/common/Database/ZoneDbConnection.h +++ b/src/common/Database/ZoneDbConnection.h @@ -70,6 +70,7 @@ namespace Sapphire::Db CHARA_CLASS_DEL, CHARA_ITEMINV_INS, + CHARA_CURRENCYINV_INS, CHARA_ITEMGLOBAL_SELECT, CHARA_ITEMGLOBAL_INS,