mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-28 16:32:26 +00:00
Implement ClientListEntry::LoadTaskLockouts
This commit is contained in:
parent
bc0f705227
commit
408ce4650f
@ -23,6 +23,7 @@ CREATE TABLE `task_replay_groups` (
|
|||||||
CREATE TABLE `character_task_lockouts` (
|
CREATE TABLE `character_task_lockouts` (
|
||||||
`charid` INT NOT NULL,
|
`charid` INT NOT NULL,
|
||||||
`replay_group` INT NOT NULL,
|
`replay_group` INT NOT NULL,
|
||||||
|
`original_id` INT NOT NULL,
|
||||||
`timestamp` INT NOT NULL,
|
`timestamp` INT NOT NULL,
|
||||||
PRIMARY KEY(`charid`, `replay_group`)
|
PRIMARY KEY(`charid`, `replay_group`)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1221,6 +1221,7 @@ void Client::EnterWorld(bool TryBootup) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cle->SetChar(charid, char_name);
|
cle->SetChar(charid, char_name);
|
||||||
|
cle->LoadTaskLockouts();
|
||||||
database.UpdateLiveChar(char_name, GetAccountID());
|
database.UpdateLiveChar(char_name, GetAccountID());
|
||||||
|
|
||||||
Log(Logs::General, Logs::World_Server,
|
Log(Logs::General, Logs::World_Server,
|
||||||
|
|||||||
@ -377,3 +377,41 @@ int ClientListEntry::GetTaskLockoutTimeLeft(int id) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cleans up expired lockouts from the DB
|
||||||
|
*/
|
||||||
|
bool ClientListEntry::CleanExpiredTaskLockouts() const
|
||||||
|
{
|
||||||
|
std::string query =
|
||||||
|
StringFormat("DELETE FROM `character_task_lockouts` WHERE `charid` = %i AND `timestamp` > %i", pcharid,
|
||||||
|
Timer::GetCurrentTime());
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
|
return results.Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Loads task lockouts
|
||||||
|
*/
|
||||||
|
bool ClientListEntry::LoadTaskLockouts()
|
||||||
|
{
|
||||||
|
CleanExpiredTaskLockouts();
|
||||||
|
std::string query = StringFormat(
|
||||||
|
"SELECT `replay_group`, `original_id`, `timestamp` FROM `character_task_lockouts` WHERE `charid` = %i",
|
||||||
|
pcharid);
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
|
if (!results.Success())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (results.RowCount() > 0) {
|
||||||
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
TaskTimer t;
|
||||||
|
t.ID = atoi(row[0]);
|
||||||
|
t.original_id = atoi(row[1]);
|
||||||
|
t.expires = atoi(row[2]);
|
||||||
|
m_task_replay_timers.push_back(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,6 +91,8 @@ public:
|
|||||||
void ProcessTellQueue();
|
void ProcessTellQueue();
|
||||||
|
|
||||||
// shared task stuff
|
// shared task stuff
|
||||||
|
bool CleanExpiredTaskLockouts() const;
|
||||||
|
bool LoadTaskLockouts();
|
||||||
int GetTaskLockoutExpire(int id) const;
|
int GetTaskLockoutExpire(int id) const;
|
||||||
int GetTaskLockoutTimeLeft(int id) const;
|
int GetTaskLockoutTimeLeft(int id) const;
|
||||||
inline int GetCurrentSharedTaskID() const { return shared_task_id; }
|
inline int GetCurrentSharedTaskID() const { return shared_task_id; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user