mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Added getcharnamebyid(char_id) to Perl/Lua.
This commit is contained in:
@@ -925,6 +925,22 @@ void Database::GetCharName(uint32 char_id, char* name) {
|
||||
}
|
||||
}
|
||||
|
||||
const char* Database::GetCharNameByID(uint32 char_id) {
|
||||
std::string query = fmt::format("SELECT `name` FROM `character_data` WHERE id = {}", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
return row[0];
|
||||
}
|
||||
|
||||
bool Database::LoadVariables() {
|
||||
auto results = QueryDatabase(StringFormat("SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache.last_update));
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ public:
|
||||
|
||||
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
||||
void GetCharName(uint32 char_id, char* name);
|
||||
const char *GetCharNameByID(uint32 char_id);
|
||||
void LoginIP(uint32 AccountID, const char* LoginIP);
|
||||
|
||||
/* Instancing */
|
||||
|
||||
Reference in New Issue
Block a user