Added getcharnamebyid(char_id) to Perl/Lua.

This commit is contained in:
Alex
2020-04-05 21:11:21 -04:00
parent 3c71e2c91d
commit ae959be5ac
6 changed files with 49 additions and 0 deletions
+16
View File
@@ -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));
+1
View File
@@ -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 */