From f1514e2a8df680642f136b3ea3f3658180c477d9 Mon Sep 17 00:00:00 2001 From: Mordred Date: Sun, 24 Mar 2019 23:49:52 +0100 Subject: [PATCH] Added sql table for storing hunting log information --- sql/schema/schema.sql | 18 +++++++++++++++++ src/api/PlayerMinimal.cpp | 7 +++++++ src/common/Database/ZoneDbConnection.cpp | 25 ++++++++++++++++++++++++ src/common/Database/ZoneDbConnection.h | 3 +++ 4 files changed, 53 insertions(+) diff --git a/sql/schema/schema.sql b/sql/schema/schema.sql index 100308c6..56d2c46f 100644 --- a/sql/schema/schema.sql +++ b/sql/schema/schema.sql @@ -584,3 +584,21 @@ CREATE TABLE `landplaceditems` ( ) COLLATE='latin1_swedish_ci' ENGINE=InnoDB; + +CREATE TABLE `charamonsternote` ( + `CharacterId` bigint(20) UNSIGNED DEFAULT NULL, + `Category_0` binary(41) DEFAULT NULL, + `Category_1` binary(41) DEFAULT NULL, + `Category_2` binary(41) DEFAULT NULL, + `Category_3` binary(41) DEFAULT NULL, + `Category_4` binary(41) DEFAULT NULL, + `Category_5` binary(41) DEFAULT NULL, + `Category_6` binary(41) DEFAULT NULL, + `Category_7` binary(41) DEFAULT NULL, + `Category_8` binary(41) DEFAULT NULL, + `Category_9` binary(41) DEFAULT NULL, + `Category_10` binary(41) DEFAULT NULL, + `Category_11` binary(41) DEFAULT NULL, + `UPDATE_DATE` datetime DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY(`CharacterId`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file diff --git a/src/api/PlayerMinimal.cpp b/src/api/PlayerMinimal.cpp index d74fc7b2..d7fb3645 100644 --- a/src/api/PlayerMinimal.cpp +++ b/src/api/PlayerMinimal.cpp @@ -187,6 +187,7 @@ void PlayerMinimal::saveAsNew() std::vector< uint8_t > orchestrion( 40 ); std::vector< uint8_t > modelEquip( 40 ); std::vector< uint8_t > questTracking8( 10 ); + std::vector< uint8_t > monsterNote( 41 ); std::vector< int16_t > questTracking = { -1, -1, -1, -1, -1 }; memset( questComplete.data(), 0, questComplete.size() ); @@ -328,6 +329,12 @@ void PlayerMinimal::saveAsNew() createInvDbContainer( InventoryType::Currency ); createInvDbContainer( InventoryType::Crystal ); + auto stmtMonsterNote = g_charaDb.getPreparedStatement( Db::ZoneDbStatements::CHARA_MONSTERNOTE_INS ); + stmtMonsterNote->setInt( 1, m_id ); + for( uint8_t i = 1; i <= 12; ++i ) + stmtMonsterNote->setBinary( i + 1, monsterNote ); + g_charaDb.directExecute( stmtMonsterNote ); + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// SETUP EQUIPMENT / STARTING GEAR auto classJobInfo = g_exdDataGen.get< Sapphire::Data::ClassJob >( m_class ); diff --git a/src/common/Database/ZoneDbConnection.cpp b/src/common/Database/ZoneDbConnection.cpp index 13f6a885..a5503d0e 100644 --- a/src/common/Database/ZoneDbConnection.cpp +++ b/src/common/Database/ZoneDbConnection.cpp @@ -175,6 +175,31 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements() "INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, stack, UPDATE_DATE ) VALUES ( ?, ?, ?, ?, NOW() );", CONNECTION_SYNC ); + /// CHARA MONSTERNOTE + prepareStatement( CHARA_MONSTERNOTE_INS, + "INSERT INTO charamonsternote ( CharacterId, Category_0, Category_1, Category_2," + " Category_3, Category_4, Category_5, Category_6," + " Category_7, Category_8, Category_9, Category_10," + " Category_11, UPDATE_DATE ) " + " VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW() );", + CONNECTION_SYNC ); + + prepareStatement( CHARA_MONSTERNOTE_UP, "UPDATE charamonsternote " + " SET Category_0 = ?," + " Category_1 = ?," + " Category_2 = ?," + " Category_3 = ?," + " Category_4 = ?," + " Category_5 = ?," + " Category_6 = ?," + " Category_7 = ?," + " Category_8 = ?," + " Category_9 = ?," + " Category_10 = ?," + " Category_11 = ?" + " WHERE CharacterId = ?;", + CONNECTION_ASYNC ); + /// ZONE QUERIES prepareStatement( ZONE_SEL_BNPCTEMPLATES, "SELECT Id, Name, bNPCBaseId, bNPCNameId, mainWeaponModel, " diff --git a/src/common/Database/ZoneDbConnection.h b/src/common/Database/ZoneDbConnection.h index 1c0fde7a..4b094772 100644 --- a/src/common/Database/ZoneDbConnection.h +++ b/src/common/Database/ZoneDbConnection.h @@ -76,6 +76,9 @@ namespace Sapphire::Db CHARA_ITEMGLOBAL_UP, CHARA_ITEMGLOBAL_DELETE, + CHARA_MONSTERNOTE_INS, + CHARA_MONSTERNOTE_UP, + ZONE_SEL_BNPCTEMPLATES, ZONE_SEL_SPAWNGROUPS, ZONE_SEL_SPAWNPOINTS,