DarkflameServer/dDatabase/CDClientDatabase/CDClientTables/CDEmoteTable.cpp

27 lines
937 B
C++
Raw Normal View History

#include "CDEmoteTable.h"
void CDEmoteTableTable::LoadValuesFromDatabase() {
2022-07-28 13:39:57 +00:00
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
while (!tableData.eof()) {
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));
2022-07-28 13:39:57 +00:00
tableData.nextRow();
}
tableData.finalize();
}
2022-07-28 13:39:57 +00:00
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
auto itr = entries.find(id);
return itr != entries.end() ? &itr->second : nullptr;
}