Load character lockouts without looping

This commit is contained in:
hg 2020-08-04 20:35:38 -04:00
parent d6ab87e2c4
commit 779fc6265e
2 changed files with 4 additions and 14 deletions

View File

@ -9614,8 +9614,7 @@ Expedition* Client::GetExpedition() const
return nullptr;
}
void Client::AddExpeditionLockout(
const ExpeditionLockoutTimer& lockout, bool update_db, bool update_client)
void Client::AddExpeditionLockout(const ExpeditionLockoutTimer& lockout, bool update_db)
{
// todo: support for account based lockouts like live AoC expeditions
@ -9633,10 +9632,7 @@ void Client::AddExpeditionLockout(
ExpeditionDatabase::InsertCharacterLockouts(CharacterID(), { lockout }, true);
}
if (update_client)
{
SendExpeditionLockoutTimers();
}
SendExpeditionLockoutTimers();
}
void Client::AddNewExpeditionLockout(
@ -9730,13 +9726,7 @@ bool Client::HasExpeditionLockout(
void Client::LoadAllExpeditionLockouts()
{
m_expedition_lockouts.clear();
auto lockouts = ExpeditionDatabase::LoadCharacterLockouts(CharacterID());
for (const auto& lockout : lockouts)
{
AddExpeditionLockout(lockout, false, false);
}
m_expedition_lockouts = ExpeditionDatabase::LoadCharacterLockouts(CharacterID());
SendExpeditionLockoutTimers();
}

View File

@ -1117,7 +1117,7 @@ public:
Client* client, const std::string& client_name, uint16_t chat_type,
uint32_t string_id, const std::initializer_list<std::string>& arguments = {});
void AddExpeditionLockout(const ExpeditionLockoutTimer& lockout, bool update_db = false, bool update_client = true);
void AddExpeditionLockout(const ExpeditionLockoutTimer& lockout, bool update_db = false);
void AddNewExpeditionLockout(
const std::string& expedition_name, const std::string& event_name, uint32_t duration, std::string uuid = {});
Expedition* CreateExpedition(DynamicZone& dz_instance, ExpeditionRequest& request);