2021-12-05 17:54:36 +00:00
|
|
|
#include "CDEmoteTable.h"
|
|
|
|
|
|
|
|
//! Constructor
|
|
|
|
CDEmoteTableTable::CDEmoteTableTable(void) {
|
2022-07-28 13:39:57 +00:00
|
|
|
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
|
|
|
|
while (!tableData.eof()) {
|
|
|
|
CDEmoteTable* entry = new CDEmoteTable();
|
2023-01-07 09:48:59 +00:00
|
|
|
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", "");
|
2022-07-28 13:39:57 +00:00
|
|
|
|
|
|
|
entries.insert(std::make_pair(entry->ID, entry));
|
|
|
|
tableData.nextRow();
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
tableData.finalize();
|
|
|
|
}
|
|
|
|
|
|
|
|
//! Destructor
|
|
|
|
CDEmoteTableTable::~CDEmoteTableTable(void) {
|
2022-07-28 13:39:57 +00:00
|
|
|
for (auto e : entries) {
|
|
|
|
if (e.second) delete e.second;
|
|
|
|
}
|
|
|
|
|
|
|
|
entries.clear();
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//! Returns the table's name
|
|
|
|
std::string CDEmoteTableTable::GetName(void) const {
|
2022-07-28 13:39:57 +00:00
|
|
|
return "Emotes";
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
|
|
|
|
for (auto e : entries) {
|
|
|
|
if (e.first == id) return e.second;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
2023-01-07 09:48:59 +00:00
|
|
|
|