2021-12-05 17:54:36 +00:00
|
|
|
#include "CDItemSetsTable.h"
|
|
|
|
|
2023-08-11 04:27:40 +00:00
|
|
|
void CDItemSetsTable::LoadValuesFromDatabase() {
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// First, get the size of the table
|
2024-01-09 07:54:14 +00:00
|
|
|
uint32_t size = 0;
|
2021-12-05 17:54:36 +00:00
|
|
|
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemSets");
|
|
|
|
while (!tableSize.eof()) {
|
|
|
|
size = tableSize.getIntField(0, 0);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
tableSize.nextRow();
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
tableSize.finalize();
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// Reserve the size
|
|
|
|
this->entries.reserve(size);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// Now get the data
|
|
|
|
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSets");
|
|
|
|
while (!tableData.eof()) {
|
|
|
|
CDItemSets entry;
|
2023-01-07 09:48:59 +00:00
|
|
|
entry.setID = tableData.getIntField("setID", -1);
|
|
|
|
entry.locStatus = tableData.getIntField("locStatus", -1);
|
|
|
|
entry.itemIDs = tableData.getStringField("itemIDs", "");
|
|
|
|
entry.kitType = tableData.getIntField("kitType", -1);
|
|
|
|
entry.kitRank = tableData.getIntField("kitRank", -1);
|
|
|
|
entry.kitImage = tableData.getIntField("kitImage", -1);
|
|
|
|
entry.skillSetWith2 = tableData.getIntField("skillSetWith2", -1);
|
|
|
|
entry.skillSetWith3 = tableData.getIntField("skillSetWith3", -1);
|
|
|
|
entry.skillSetWith4 = tableData.getIntField("skillSetWith4", -1);
|
|
|
|
entry.skillSetWith5 = tableData.getIntField("skillSetWith5", -1);
|
|
|
|
entry.skillSetWith6 = tableData.getIntField("skillSetWith6", -1);
|
|
|
|
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
|
|
|
|
entry.gate_version = tableData.getStringField("gate_version", "");
|
|
|
|
entry.kitID = tableData.getIntField("kitID", -1);
|
|
|
|
entry.priority = tableData.getFloatField("priority", -1.0f);
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
this->entries.push_back(entry);
|
|
|
|
tableData.nextRow();
|
|
|
|
}
|
|
|
|
|
|
|
|
tableData.finalize();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> predicate) {
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
std::vector<CDItemSets> data = cpplinq::from(this->entries)
|
|
|
|
>> cpplinq::where(predicate)
|
|
|
|
>> cpplinq::to_vector();
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2023-08-11 04:27:40 +00:00
|
|
|
const std::vector<CDItemSets>& CDItemSetsTable::GetEntries() const {
|
2021-12-05 17:54:36 +00:00
|
|
|
return this->entries;
|
|
|
|
}
|
2023-01-07 09:48:59 +00:00
|
|
|
|