2021-12-05 17:54:36 +00:00
|
|
|
#include "CDEmoteTable.h"
|
|
|
|
|
2023-08-11 04:27:40 +00:00
|
|
|
void CDEmoteTableTable::LoadValuesFromDatabase() {
|
2021-12-05 17:54:36 +00:00
|
|
|
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
|
2024-02-09 13:37:58 +00:00
|
|
|
auto& entries = GetEntriesMutable();
|
2021-12-05 17:54:36 +00:00
|
|
|
while (!tableData.eof()) {
|
2023-08-11 04:27:40 +00:00
|
|
|
CDEmoteTable entry;
|
|
|
|
entry.ID = tableData.getIntField("id", -1);
|
|
|
|
entry.animationName = tableData.getStringField("animationName", "");
|
|
|
|
entry.iconFilename = tableData.getStringField("iconFilename", "");
|
|
|
|
entry.channel = tableData.getIntField("channel", -1);
|
|
|
|
entry.locked = tableData.getIntField("locked", -1) != 0;
|
|
|
|
entry.localize = tableData.getIntField("localize", -1) != 0;
|
|
|
|
entry.locState = tableData.getIntField("locStatus", -1);
|
|
|
|
entry.gateVersion = tableData.getStringField("gate_version", "");
|
|
|
|
|
|
|
|
entries.insert(std::make_pair(entry.ID, entry));
|
2021-12-05 17:54:36 +00:00
|
|
|
tableData.nextRow();
|
|
|
|
}
|
|
|
|
|
|
|
|
tableData.finalize();
|
|
|
|
}
|
|
|
|
|
2024-01-09 07:54:14 +00:00
|
|
|
CDEmoteTable* CDEmoteTableTable::GetEmote(int32_t id) {
|
2024-02-09 13:37:58 +00:00
|
|
|
auto& entries = GetEntriesMutable();
|
2023-08-11 04:27:40 +00:00
|
|
|
auto itr = entries.find(id);
|
|
|
|
return itr != entries.end() ? &itr->second : nullptr;
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|