From 0a9f6371239bdeedaf083f244403cd2d1fe6a257 Mon Sep 17 00:00:00 2001 From: dongresource Date: Mon, 21 Dec 2020 01:54:38 +0100 Subject: [PATCH] Do not give the Lightning Gun and Buttercup Nano to new Academy players And do not mark the two missions from the old Tutorial as completed. --- src/Database.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Database.cpp b/src/Database.cpp index ab35019..b5d8ba9 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -577,19 +577,27 @@ bool Database::finishTutorial(int playerID, int accountID) { const char* sql = R"( UPDATE Players SET TutorialFlag = 1, - Nano1 = 1, + Nano1 = ?, Quests = ? WHERE PlayerID = ? AND AccountID = ? AND TutorialFlag = 0; )"; sqlite3_stmt* stmt; sqlite3_prepare_v2(db, sql, -1, &stmt, NULL); - // save missions nr 1 & 2 unsigned char questBuffer[128] = { 0 }; + +#ifndef ACADEMY + // save missions nr 1 & 2; equip Buttercup questBuffer[0] = 3; - sqlite3_bind_blob(stmt, 1, questBuffer, sizeof(questBuffer), NULL); - sqlite3_bind_int(stmt, 2, playerID); - sqlite3_bind_int(stmt, 3, accountID); + sqlite3_bind_int(stmt, 1, 1); +#else + // no, none of that + sqlite3_bind_int(stmt, 1, 0); +#endif + + sqlite3_bind_blob(stmt, 2, questBuffer, sizeof(questBuffer), NULL); + sqlite3_bind_int(stmt, 3, playerID); + sqlite3_bind_int(stmt, 4, accountID); if (sqlite3_step(stmt) != SQLITE_DONE) { sqlite3_finalize(stmt); @@ -599,6 +607,7 @@ bool Database::finishTutorial(int playerID, int accountID) { sqlite3_finalize(stmt); +#ifndef ACADEMY // Lightning Gun sql = R"( INSERT INTO Inventory @@ -634,6 +643,7 @@ bool Database::finishTutorial(int playerID, int accountID) { sqlite3_exec(db, "ROLLBACK TRANSACTION;", NULL, NULL, NULL); return false; } +#endif sqlite3_exec(db, "COMMIT;", NULL, NULL, NULL); return true;