2021-12-05 17:54:36 +00:00
|
|
|
#include "CDRewardsTable.h"
|
|
|
|
|
2023-07-25 08:26:52 +00:00
|
|
|
void CDRewardsTable::LoadValuesFromDatabase() {
|
2021-12-05 17:54:36 +00:00
|
|
|
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Rewards");
|
|
|
|
while (!tableData.eof()) {
|
2023-07-25 08:26:52 +00:00
|
|
|
CDRewards entry;
|
2023-07-26 04:44:45 +00:00
|
|
|
uint32_t id = tableData.getIntField("id", -1);
|
2023-07-25 08:26:52 +00:00
|
|
|
entry.levelID = tableData.getIntField("LevelID", -1);
|
|
|
|
entry.missionID = tableData.getIntField("MissionID", -1);
|
|
|
|
entry.rewardType = tableData.getIntField("RewardType", -1);
|
|
|
|
entry.value = tableData.getIntField("value", -1);
|
|
|
|
entry.count = tableData.getIntField("count", -1);
|
|
|
|
|
2023-07-26 04:44:45 +00:00
|
|
|
m_entries.push_back(entry);
|
2021-12-05 17:54:36 +00:00
|
|
|
tableData.nextRow();
|
|
|
|
}
|
|
|
|
|
|
|
|
tableData.finalize();
|
|
|
|
}
|
|
|
|
|
2023-07-25 08:26:52 +00:00
|
|
|
std::vector<CDRewards> CDRewardsTable::GetByLevelID(uint32_t levelID) {
|
2023-07-26 04:44:45 +00:00
|
|
|
std::vector<CDRewards> result;
|
|
|
|
for (const auto& levelData : m_entries) {
|
|
|
|
if (levelData.levelID == levelID) result.push_back(levelData);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
return result;
|
|
|
|
}
|
2023-01-07 09:48:59 +00:00
|
|
|
|