mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Alternate Currency] Convert Load of Alternate Currencies to Repositories (#3993)
# Notes - Convert `LoadAlternateCurrencies()` to repositories.
This commit is contained in:
parent
337b6f38e0
commit
a38fd8f986
@ -66,6 +66,7 @@
|
||||
#include "../common/repositories/npc_emotes_repository.h"
|
||||
#include "../common/serverinfo.h"
|
||||
#include "../common/repositories/merc_stance_entries_repository.h"
|
||||
#include "../common/repositories/alternate_currency_repository.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
@ -2445,21 +2446,25 @@ void Zone::LoadAlternateCurrencies()
|
||||
{
|
||||
AlternateCurrencies.clear();
|
||||
|
||||
AltCurrencyDefinition_Struct current_currency;
|
||||
const auto& l = AlternateCurrencyRepository::All(content_db);
|
||||
|
||||
const std::string query = "SELECT id, item_id FROM alternate_currency";
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
if (l.empty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto row : results) {
|
||||
current_currency.id = Strings::ToUnsignedInt(row[0]);
|
||||
current_currency.item_id = Strings::ToUnsignedInt(row[1]);
|
||||
AlternateCurrencies.push_back(current_currency);
|
||||
}
|
||||
AltCurrencyDefinition_Struct c;
|
||||
|
||||
LogInfo("Loaded [{}] alternate currencies", Strings::Commify(results.RowCount()));
|
||||
for (const auto &e : l) {
|
||||
c.id = e.id;
|
||||
c.item_id = e.item_id;
|
||||
AlternateCurrencies.push_back(c);
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"Loaded [{}] Alternate Currenc{}",
|
||||
Strings::Commify(l.size()),
|
||||
l.size() != 1 ? "ies" : "y"
|
||||
);
|
||||
}
|
||||
|
||||
void Zone::UpdateQGlobal(uint32 qid, QGlobal newGlobal)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user