Sync character lockouts when entering dz

This removes the is_pending column from character lockouts table

Synchronizing character lockout timers with the expedition's when zoning
into the dynamic zone simplifies adding missing lockouts to new members.
This also matches live behavior that replaces any character lockout
timers from another expedition with ones from the current expedition
This commit is contained in:
hg
2020-11-08 22:31:41 -05:00
parent fc7d8a82e5
commit 4f9eaf7574
7 changed files with 83 additions and 143 deletions
+7 -11
View File
@@ -9563,16 +9563,18 @@ void Client::UpdateExpeditionInfoAndLockouts()
// this is processed by client after entering a zone
SendDzCompassUpdate();
m_expedition_lockouts = ExpeditionDatabase::LoadCharacterLockouts(CharacterID());
auto expedition = GetExpedition();
if (expedition)
{
expedition->SendClientExpeditionInfo(this);
// live only adds lockouts obtained during the active expedition to new
// live synchronizes lockouts obtained during the active expedition to
// members once they zone into the expedition's dynamic zone instance
if (expedition->GetDynamicZone().IsCurrentZoneDzInstance())
{
ExpeditionDatabase::AssignPendingLockouts(CharacterID(), expedition->GetName());
expedition->SyncCharacterLockouts(CharacterID(), m_expedition_lockouts);
expedition->SetMemberStatus(this, ExpeditionMemberStatus::InDynamicZone);
}
else
@@ -9581,7 +9583,7 @@ void Client::UpdateExpeditionInfoAndLockouts()
}
}
LoadAllExpeditionLockouts();
SendExpeditionLockoutTimers();
// ask world for any pending invite we saved from a previous zone
RequestPendingExpeditionInvite();
@@ -9629,7 +9631,7 @@ void Client::AddExpeditionLockout(const ExpeditionLockoutTimer& lockout, bool up
if (update_db) // for quest api
{
ExpeditionDatabase::InsertCharacterLockouts(CharacterID(), { lockout }, true);
ExpeditionDatabase::InsertCharacterLockouts(CharacterID(), { lockout });
}
SendExpeditionLockoutTimers();
@@ -9662,7 +9664,7 @@ void Client::AddExpeditionLockoutDuration(
if (update_db)
{
ExpeditionDatabase::InsertCharacterLockouts(CharacterID(), { *it }, true);
ExpeditionDatabase::InsertCharacterLockouts(CharacterID(), { *it });
}
SendExpeditionLockoutTimers();
@@ -9753,12 +9755,6 @@ bool Client::HasExpeditionLockout(
return (GetExpeditionLockout(expedition_name, event_name, include_expired) != nullptr);
}
void Client::LoadAllExpeditionLockouts()
{
m_expedition_lockouts = ExpeditionDatabase::LoadCharacterLockouts(CharacterID());
SendExpeditionLockoutTimers();
}
void Client::SendExpeditionLockoutTimers()
{
std::vector<ExpeditionLockoutTimerEntry_Struct> lockout_entries;