mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-30 17:58:16 +00:00
[Bug Fix] Fix issue with #suspend (#4314)
* [Bug Fix] Fix issue with #suspend * Add suspension clearing * Update character_data_repository.h * Final push.
This commit is contained in:
+12
-2
@@ -206,9 +206,19 @@ void Database::LoginIP(uint32 account_id, const std::string& login_ip)
|
||||
QueryDatabase(query);
|
||||
}
|
||||
|
||||
int16 Database::CheckStatus(uint32 account_id)
|
||||
int16 Database::GetAccountStatus(uint32 account_id)
|
||||
{
|
||||
return AccountRepository::GetAccountStatus(*this, account_id);
|
||||
auto e = AccountRepository::FindOne(*this, account_id);
|
||||
|
||||
if (e.suspendeduntil > 0 && e.suspendeduntil < std::time(nullptr)) {
|
||||
e.status = 0;
|
||||
e.suspendeduntil = 0;
|
||||
e.suspend_reason = "";
|
||||
|
||||
AccountRepository::UpdateOne(*this, e);
|
||||
}
|
||||
|
||||
return e.status;
|
||||
}
|
||||
|
||||
uint32 Database::CreateAccount(
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ public:
|
||||
bool SetAccountStatus(const std::string& account_name, int16 status);
|
||||
bool SetLocalPassword(uint32 account_id, const std::string& password);
|
||||
bool UpdateLiveChar(const std::string& name, uint32 account_id);
|
||||
int16 CheckStatus(uint32 account_id);
|
||||
int16 GetAccountStatus(uint32 account_id);
|
||||
void SetAccountCRCField(uint32 account_id, const std::string& field_name, uint64 checksum);
|
||||
uint32 CheckLogin(const std::string& name, const std::string& password, const std::string& loginserver, int16* status = 0);
|
||||
uint32 CreateAccount(
|
||||
|
||||
@@ -64,6 +64,22 @@ public:
|
||||
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
static CharacterData FindByName(
|
||||
Database& db,
|
||||
const std::string& character_name
|
||||
)
|
||||
{
|
||||
auto l = CharacterDataRepository::GetWhere(
|
||||
db,
|
||||
fmt::format(
|
||||
"`name` = '{}' LIMIT 1",
|
||||
Strings::Escape(character_name)
|
||||
)
|
||||
);
|
||||
|
||||
return l.empty() ? CharacterDataRepository::NewEntity() : l.front();
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_CHARACTER_DATA_REPOSITORY_H
|
||||
|
||||
Reference in New Issue
Block a user