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.
This commit is contained in:
dongresource 2020-12-21 01:54:38 +01:00 committed by Gent S
parent 027f513a23
commit 0a9f637123
1 changed files with 15 additions and 5 deletions

View File

@ -577,19 +577,27 @@ bool Database::finishTutorial(int playerID, int accountID) {
const char* sql = R"( const char* sql = R"(
UPDATE Players SET UPDATE Players SET
TutorialFlag = 1, TutorialFlag = 1,
Nano1 = 1, Nano1 = ?,
Quests = ? Quests = ?
WHERE PlayerID = ? AND AccountID = ? AND TutorialFlag = 0; WHERE PlayerID = ? AND AccountID = ? AND TutorialFlag = 0;
)"; )";
sqlite3_stmt* stmt; sqlite3_stmt* stmt;
sqlite3_prepare_v2(db, sql, -1, &stmt, NULL); sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
// save missions nr 1 & 2
unsigned char questBuffer[128] = { 0 }; unsigned char questBuffer[128] = { 0 };
#ifndef ACADEMY
// save missions nr 1 & 2; equip Buttercup
questBuffer[0] = 3; questBuffer[0] = 3;
sqlite3_bind_blob(stmt, 1, questBuffer, sizeof(questBuffer), NULL); sqlite3_bind_int(stmt, 1, 1);
sqlite3_bind_int(stmt, 2, playerID); #else
sqlite3_bind_int(stmt, 3, accountID); // 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) { if (sqlite3_step(stmt) != SQLITE_DONE) {
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
@ -599,6 +607,7 @@ bool Database::finishTutorial(int playerID, int accountID) {
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
#ifndef ACADEMY
// Lightning Gun // Lightning Gun
sql = R"( sql = R"(
INSERT INTO Inventory INSERT INTO Inventory
@ -634,6 +643,7 @@ bool Database::finishTutorial(int playerID, int accountID) {
sqlite3_exec(db, "ROLLBACK TRANSACTION;", NULL, NULL, NULL); sqlite3_exec(db, "ROLLBACK TRANSACTION;", NULL, NULL, NULL);
return false; return false;
} }
#endif
sqlite3_exec(db, "COMMIT;", NULL, NULL, NULL); sqlite3_exec(db, "COMMIT;", NULL, NULL, NULL);
return true; return true;