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/repositories/npc_emotes_repository.h"
|
||||||
#include "../common/serverinfo.h"
|
#include "../common/serverinfo.h"
|
||||||
#include "../common/repositories/merc_stance_entries_repository.h"
|
#include "../common/repositories/merc_stance_entries_repository.h"
|
||||||
|
#include "../common/repositories/alternate_currency_repository.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@ -2445,21 +2446,25 @@ void Zone::LoadAlternateCurrencies()
|
|||||||
{
|
{
|
||||||
AlternateCurrencies.clear();
|
AlternateCurrencies.clear();
|
||||||
|
|
||||||
AltCurrencyDefinition_Struct current_currency;
|
const auto& l = AlternateCurrencyRepository::All(content_db);
|
||||||
|
|
||||||
const std::string query = "SELECT id, item_id FROM alternate_currency";
|
if (l.empty()) {
|
||||||
auto results = content_db.QueryDatabase(query);
|
|
||||||
if (!results.Success()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto row : results) {
|
AltCurrencyDefinition_Struct c;
|
||||||
current_currency.id = Strings::ToUnsignedInt(row[0]);
|
|
||||||
current_currency.item_id = Strings::ToUnsignedInt(row[1]);
|
for (const auto &e : l) {
|
||||||
AlternateCurrencies.push_back(current_currency);
|
c.id = e.id;
|
||||||
|
c.item_id = e.item_id;
|
||||||
|
AlternateCurrencies.push_back(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo("Loaded [{}] alternate currencies", Strings::Commify(results.RowCount()));
|
LogInfo(
|
||||||
|
"Loaded [{}] Alternate Currenc{}",
|
||||||
|
Strings::Commify(l.size()),
|
||||||
|
l.size() != 1 ? "ies" : "y"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zone::UpdateQGlobal(uint32 qid, QGlobal newGlobal)
|
void Zone::UpdateQGlobal(uint32 qid, QGlobal newGlobal)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user