mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 15:58:36 +00:00
[Feature] Add Min/Max Status to Merchants (#2806)
# Notes - Allows operators to set a minimum and maximum status that an item will show for players. - Allows operators to have items on a merchant that only a GM can see. - Some servers may use status for different things, so having a minimum and a maximum will allow for more functionality. - Default of `min_status` is `0` (Player) and default of `max_status` is `255` (Max).
This commit is contained in:
+38
-44
@@ -59,6 +59,7 @@
|
||||
#include "zone_reload.h"
|
||||
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||
#include "../common/repositories/content_flags_repository.h"
|
||||
#include "../common/repositories/merchantlist_repository.h"
|
||||
#include "../common/repositories/rule_sets_repository.h"
|
||||
#include "../common/repositories/zone_points_repository.h"
|
||||
#include "../common/serverinfo.h"
|
||||
@@ -611,45 +612,34 @@ void Zone::LoadNewMerchantData(uint32 merchantid) {
|
||||
|
||||
std::list<MerchantList> merchant_list;
|
||||
|
||||
auto query = fmt::format(
|
||||
SQL(
|
||||
SELECT
|
||||
item,
|
||||
slot,
|
||||
faction_required,
|
||||
level_required,
|
||||
alt_currency_cost,
|
||||
classes_required,
|
||||
probability,
|
||||
bucket_name,
|
||||
bucket_value,
|
||||
bucket_comparison
|
||||
FROM merchantlist
|
||||
WHERE merchantid = {} {}
|
||||
ORDER BY slot
|
||||
),
|
||||
merchantid,
|
||||
ContentFilterCriteria::apply()
|
||||
const auto& l = MerchantlistRepository::GetWhere(
|
||||
content_db,
|
||||
fmt::format(
|
||||
"merchantid = {} {} ORDER BY slot",
|
||||
merchantid,
|
||||
ContentFilterCriteria::apply()
|
||||
)
|
||||
);
|
||||
|
||||
auto results = content_db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
if (l.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto row : results) {
|
||||
for (const auto& e : l) {
|
||||
MerchantList ml;
|
||||
ml.id = merchantid;
|
||||
ml.item = std::stoul(row[0]);
|
||||
ml.slot = std::stoul(row[1]);
|
||||
ml.faction_required = static_cast<int16>(std::stoi(row[2]));
|
||||
ml.level_required = static_cast<uint8>(std::stoul(row[3]));
|
||||
ml.alt_currency_cost = static_cast<uint16>(std::stoul(row[4]));
|
||||
ml.classes_required = std::stoul(row[5]);
|
||||
ml.probability = static_cast<uint8>(std::stoul(row[6]));
|
||||
ml.bucket_name = row[7];
|
||||
ml.bucket_value = row[8];
|
||||
ml.bucket_comparison = static_cast<uint8>(std::stoul(row[9]));
|
||||
ml.id = merchantid;
|
||||
ml.item = e.item;
|
||||
ml.slot = e.slot;
|
||||
ml.faction_required = e.faction_required;
|
||||
ml.level_required = e.level_required;
|
||||
ml.min_status = e.min_status;
|
||||
ml.max_status = e.max_status;
|
||||
ml.alt_currency_cost = e.alt_currency_cost;
|
||||
ml.classes_required = e.classes_required;
|
||||
ml.probability = e.probability;
|
||||
ml.bucket_name = e.bucket_name;
|
||||
ml.bucket_value = e.bucket_value;
|
||||
ml.bucket_comparison = e.bucket_comparison;
|
||||
merchant_list.push_back(ml);
|
||||
}
|
||||
|
||||
@@ -665,6 +655,8 @@ void Zone::GetMerchantDataForZoneLoad() {
|
||||
item,
|
||||
faction_required,
|
||||
level_required,
|
||||
min_status,
|
||||
max_status,
|
||||
alt_currency_cost,
|
||||
classes_required,
|
||||
probability,
|
||||
@@ -725,16 +717,18 @@ void Zone::GetMerchantDataForZoneLoad() {
|
||||
continue;
|
||||
}
|
||||
|
||||
mle.slot = std::stoul(row[1]);
|
||||
mle.item = std::stoul(row[2]);
|
||||
mle.faction_required = static_cast<int16>(std::stoi(row[3]));
|
||||
mle.level_required = static_cast<uint8>(std::stoul(row[4]));
|
||||
mle.alt_currency_cost = static_cast<uint16>(std::stoul(row[5]));
|
||||
mle.classes_required = std::stoul(row[6]);
|
||||
mle.probability = static_cast<uint8>(std::stoul(row[7]));
|
||||
mle.bucket_name = row[8];
|
||||
mle.bucket_value = row[9];
|
||||
mle.bucket_comparison = static_cast<uint8>(std::stoul(row[10]));
|
||||
mle.slot = std::stoul(row[1]);
|
||||
mle.item = std::stoul(row[2]);
|
||||
mle.faction_required = static_cast<int16>(std::stoi(row[3]));
|
||||
mle.level_required = static_cast<uint8>(std::stoul(row[4]));
|
||||
mle.min_status = static_cast<uint8>(std::stoul(row[5]));
|
||||
mle.max_status = static_cast<uint8>(std::stoul(row[6]));
|
||||
mle.alt_currency_cost = static_cast<uint16>(std::stoul(row[7]));
|
||||
mle.classes_required = std::stoul(row[8]);
|
||||
mle.probability = static_cast<uint8>(std::stoul(row[9]));
|
||||
mle.bucket_name = row[10];
|
||||
mle.bucket_value = row[11];
|
||||
mle.bucket_comparison = static_cast<uint8>(std::stoul(row[12]));
|
||||
|
||||
merchant_list->second.push_back(mle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user