mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-14 20:28:21 +00:00
rewards
This commit is contained in:
parent
eebf484c4e
commit
84708b860a
@ -4,14 +4,14 @@ void CDRewardsTable::LoadValuesFromDatabase() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Rewards");
|
||||
while (!tableData.eof()) {
|
||||
CDRewards entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
uint32_t id = tableData.getIntField("id", -1);
|
||||
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);
|
||||
|
||||
m_entries.insert(std::make_pair(entry.id, entry));
|
||||
m_entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
@ -19,9 +19,9 @@ void CDRewardsTable::LoadValuesFromDatabase() {
|
||||
}
|
||||
|
||||
std::vector<CDRewards> CDRewardsTable::GetByLevelID(uint32_t levelID) {
|
||||
std::vector<CDRewards> result{};
|
||||
for (const auto& e : m_entries) {
|
||||
if (e.second.levelID == levelID) result.push_back(e.second);
|
||||
std::vector<CDRewards> result;
|
||||
for (const auto& levelData : m_entries) {
|
||||
if (levelData.levelID == levelID) result.push_back(levelData);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <string>
|
||||
|
||||
struct CDRewards {
|
||||
int32_t id;
|
||||
int32_t levelID;
|
||||
int32_t missionID;
|
||||
int32_t rewardType;
|
||||
@ -14,10 +13,7 @@ struct CDRewards {
|
||||
class CDRewardsTable : public CDTable<CDRewardsTable> {
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
static const std::string GetTableName() { return "Rewards"; };
|
||||
std::vector<CDRewards> GetByLevelID(uint32_t levelID);
|
||||
|
||||
private:
|
||||
std::map<uint32_t, CDRewards> m_entries;
|
||||
std::vector<CDRewards> m_entries;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user