Make adding replay timers to new members optional

Not all expeditions with a replay timer lockout add it to newly
added members automatically

This adds the Expedition::SetReplayLockoutOnMemberJoin(bool) method
to the quest api so it can be disabled
This commit is contained in:
hg
2020-05-23 22:48:29 -04:00
parent 3bf7ea0d05
commit 11eacf25f0
10 changed files with 95 additions and 14 deletions
+17
View File
@@ -62,6 +62,7 @@ MySQLRequestResult ExpeditionDatabase::LoadExpedition(uint32_t expedition_id)
expedition_details.min_players,
expedition_details.max_players,
expedition_details.has_replay_timer,
expedition_details.add_replay_on_join,
character_data.name leader_name,
expedition_lockouts.event_name,
UNIX_TIMESTAMP(expedition_lockouts.expire_time),
@@ -93,6 +94,7 @@ MySQLRequestResult ExpeditionDatabase::LoadAllExpeditions()
expedition_details.min_players,
expedition_details.max_players,
expedition_details.has_replay_timer,
expedition_details.add_replay_on_join,
character_data.name leader_name,
expedition_lockouts.event_name,
UNIX_TIMESTAMP(expedition_lockouts.expire_time),
@@ -656,3 +658,18 @@ void ExpeditionDatabase::UpdateMemberRemoved(uint32_t expedition_id, uint32_t ch
LogExpeditions("Failed to remove [{}] from expedition [{}]", character_id, expedition_id);
}
}
void ExpeditionDatabase::UpdateReplayLockoutOnJoin(uint32_t expedition_id, bool add_on_join)
{
LogExpeditionsDetail("Updating replay lockout on join [{}] for expedition [{}]", add_on_join, expedition_id);
auto query = fmt::format(SQL(
UPDATE expedition_details SET add_replay_on_join = {} WHERE id = {};
), add_on_join, expedition_id);
auto results = database.QueryDatabase(query);
if (!results.Success())
{
LogExpeditions("Failed to update expedition [{}] replay timer setting", expedition_id);
}
}