Skip to content

Commit

Permalink
remove passive effect rows on users who /reset; remove passive effect…
Browse files Browse the repository at this point in the history
…s on users who respawn from start
  • Loading branch information
braindigitalis committed Jul 22, 2024
1 parent 3a7dad3 commit 54767c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,7 @@ dpp::task<void> game_nav(const dpp::button_click_t& event) {
co_await db::co_query("DELETE FROM timed_flags WHERE user_id = ?", { event.command.usr.id });
co_await db::co_query("DELETE FROM kv_store WHERE user_id = ?", { event.command.usr.id });
co_await db::co_query("DELETE FROM criticals WHERE user_id = ?", { event.command.usr.id });
co_await db::co_query("DELETE FROM passive_effect_status WHERE user_id = ?", { event.command.usr.id });
update_live_player(event, new_p);
new_p.save(event.command.usr.id);
co_await achievement_check("RESPAWN", event, p, {});
Expand Down
1 change: 1 addition & 0 deletions src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ dpp::task<void> delete_live_player(const dpp::interaction_create_t& event) {
co_await db::co_query("DELETE FROM timed_flags WHERE user_id = ?", { event.command.usr.id });
co_await db::co_query("DELETE FROM potion_drops WHERE user_id = ?", { event.command.usr.id });
co_await db::co_query("DELETE FROM kv_store WHERE user_id = ?", { event.command.usr.id });
co_await db::co_query("DELETE FROM passive_effect_status WHERE user_id = ?", { event.command.usr.id });
co_return;
}

Expand Down
4 changes: 4 additions & 0 deletions src/game_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ dpp::task<void> check_effects(dpp::cluster& bot) {
co_await db::co_query("DELETE FROM passive_effect_status WHERE id = ?", {row.at("id")});
bot.log(dpp::ll_debug, "Passive effect " + row.at("type") + "/" + row.at("requirements") + " on player " + event.command.usr.id.str() + " ended");
}
} else {
/* If the player /reset's and abandons the game, while still having passive effects active, this clears their passive effects */
co_await db::co_query("DELETE FROM passive_effect_status WHERE id = ?", {row.at("id")});
bot.log(dpp::ll_debug, "Passive effect " + row.at("type") + "/" + row.at("requirements") + " on deleted player " + event.command.usr.id.str());
}
}
co_return;
Expand Down

0 comments on commit 54767c6

Please sign in to comment.