mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-11 03:23:51 +00:00
feat(pipeline): WAUH auction house config catalog (139th open format)
Novel replacement for the implicit per-faction auction-house
policy vanilla WoW carried in AuctionHouse.dbc + the hard-
coded deposit/cut rate constants in the server's AuctionMgr
(the 5% Alliance/Horde rate vs 15% neutral Booty Bay rate
was hard-coded on AH faction id). Each WAUH entry binds one
auction house instance to its faction-access rules,
deposit-rate (% of vendor sell price held as deposit), AH cut
(% taken from final sale price before crediting seller),
allowed listing durations (min/max hours), per-slot copper
fee, and the auctioneer NPC binding.
Three presets capturing canonical vanilla AH instances:
--gen-auh-stormwind Alliance Stormwind Trade District AH
with 5%/5% deposit/cut rates, 12-48hr
listing tiers, NPC Auctioneer Tricket
(creatureId 8666)
--gen-auh-orgrimmar Horde Orgrimmar Valley of Strength AH
with same vanilla rates as Stormwind,
NPC Auctioneer Tahesh (9856)
--gen-auh-bootybay Neutral Booty Bay AH with the famous
15%/15% penalty rates, NPC Auctioneer
Beardo (9858)
Validator catches: id+name required, factionAccess 0..3,
depositRatePct + cutPct each in 0..10000 (basis points), no
duplicate ahIds, no duplicate (faction,name) pairs (UI tab
dispatch tie), no duplicate npcAuctioneerId (gossip dispatch
tie), maxListingDurationHours > 0 and minListing <= maxListing.
CRITICAL: combined depositRatePct + cutPct < 10000 (else
seller would lose money on every successful sale — economic
trap). Warns on combined > 50% (sellers may abandon AH;
verify intentional like neutral AH penalty).
Format count 138 -> 139. CLI flag count 1445 -> 1452.
This commit is contained in:
parent
e49567da3c
commit
4b63025e4a
10 changed files with 732 additions and 0 deletions
|
|
@ -727,6 +727,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_creature_behavior.cpp
|
||||
src/pipeline/wowee_random_property.cpp
|
||||
src/pipeline/wowee_spell_proc_rules.cpp
|
||||
src/pipeline/wowee_auction_houses.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1617,6 +1618,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_creature_behavior_catalog.cpp
|
||||
tools/editor/cli_random_property_catalog.cpp
|
||||
tools/editor/cli_spell_proc_rules_catalog.cpp
|
||||
tools/editor/cli_auction_houses_catalog.cpp
|
||||
tools/editor/cli_catalog_pluck.cpp
|
||||
tools/editor/cli_catalog_find.cpp
|
||||
tools/editor/cli_catalog_by_name.cpp
|
||||
|
|
@ -1826,6 +1828,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_creature_behavior.cpp
|
||||
src/pipeline/wowee_random_property.cpp
|
||||
src/pipeline/wowee_spell_proc_rules.cpp
|
||||
src/pipeline/wowee_auction_houses.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
131
include/pipeline/wowee_auction_houses.hpp
Normal file
131
include/pipeline/wowee_auction_houses.hpp
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Auction House Configuration catalog
|
||||
// (.wauh) — novel replacement for the implicit
|
||||
// per-faction auction-house policy vanilla WoW
|
||||
// carried in AuctionHouse.dbc + the hard-coded
|
||||
// deposit/cut rate constants in the server's
|
||||
// AuctionMgr (the 5% Alliance/Horde rate vs 15%
|
||||
// neutral Booty Bay rate was hard-coded on AH
|
||||
// faction id). Each WAUH entry binds one auction
|
||||
// house instance to its faction-access rules,
|
||||
// deposit-rate (% of vendor sell price held as
|
||||
// deposit), AH cut (% taken from final sale price
|
||||
// before crediting seller), allowed listing
|
||||
// durations, and the auctioneer NPC binding.
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WCRT: npcAuctioneerId references the WCRT
|
||||
// creature catalog (the actual NPC that
|
||||
// opens the AH UI when right-clicked).
|
||||
// WLOC: AH instances typically live at a POI in
|
||||
// WLOC (Stormwind AH, Orgrimmar AH, Booty
|
||||
// Bay AH).
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WAUH"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// ahId (uint32)
|
||||
// nameLen + name
|
||||
// factionAccess (uint8) — 0=Both /
|
||||
// 1=Alliance /
|
||||
// 2=Horde /
|
||||
// 3=Neutral
|
||||
// pad0 (uint8)
|
||||
// depositRatePct (uint16) — basis points
|
||||
// 0..10000 (% of
|
||||
// vendor sell
|
||||
// price held as
|
||||
// deposit)
|
||||
// cutPct (uint16) — basis points
|
||||
// 0..10000 (AH
|
||||
// cut from final
|
||||
// sale price)
|
||||
// minListingDurationHours (uint16)
|
||||
// maxListingDurationHours (uint16)
|
||||
// pad1 (uint16)
|
||||
// feePerSlot (uint32) — flat copper fee
|
||||
// per listing
|
||||
// slot (0 = no
|
||||
// fee)
|
||||
// npcAuctioneerId (uint32) — WCRT creature
|
||||
// entry
|
||||
struct WoweeAuctionHouses {
|
||||
enum FactionAccess : uint8_t {
|
||||
Both = 0,
|
||||
Alliance = 1,
|
||||
Horde = 2,
|
||||
Neutral = 3,
|
||||
};
|
||||
|
||||
struct Entry {
|
||||
uint32_t ahId = 0;
|
||||
std::string name;
|
||||
uint8_t factionAccess = Both;
|
||||
uint8_t pad0 = 0;
|
||||
uint16_t depositRatePct = 0;
|
||||
uint16_t cutPct = 0;
|
||||
uint16_t minListingDurationHours = 0;
|
||||
uint16_t maxListingDurationHours = 0;
|
||||
uint16_t pad1 = 0;
|
||||
uint32_t feePerSlot = 0;
|
||||
uint32_t npcAuctioneerId = 0;
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t ahId) const;
|
||||
|
||||
// Returns the AH entry an auctioneer NPC opens
|
||||
// when right-clicked. Used by the gossip handler
|
||||
// to dispatch to the correct AH config.
|
||||
const Entry* findByNpc(uint32_t npcId) const;
|
||||
|
||||
// Returns all AH entries accessible to a faction.
|
||||
// Used by the AH-finder UI to suggest reachable
|
||||
// auctioneers.
|
||||
std::vector<const Entry*> findByFaction(uint8_t faction) const;
|
||||
};
|
||||
|
||||
class WoweeAuctionHousesLoader {
|
||||
public:
|
||||
static bool save(const WoweeAuctionHouses& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeAuctionHouses load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-auh* variants.
|
||||
//
|
||||
// makeStormwindAH — Alliance Stormwind AH
|
||||
// with vanilla rates (5%
|
||||
// deposit / 5% cut / 12-48
|
||||
// hr listing).
|
||||
// makeOrgrimmarAH — Horde Orgrimmar AH with
|
||||
// same vanilla rates as
|
||||
// Stormwind. Demonstrates
|
||||
// a paired faction-AH set.
|
||||
// makeBootyBayAH — Neutral Booty Bay AH with
|
||||
// the famous 15% deposit
|
||||
// + 15% cut neutral rates
|
||||
// (penalty for cross-
|
||||
// faction trade).
|
||||
static WoweeAuctionHouses makeStormwindAH(const std::string& catalogName);
|
||||
static WoweeAuctionHouses makeOrgrimmarAH(const std::string& catalogName);
|
||||
static WoweeAuctionHouses makeBootyBayAH(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
236
src/pipeline/wowee_auction_houses.cpp
Normal file
236
src/pipeline/wowee_auction_houses.cpp
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
#include "pipeline/wowee_auction_houses.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'A', 'U', 'H'};
|
||||
constexpr uint32_t kVersion = 1;
|
||||
|
||||
template <typename T>
|
||||
void writePOD(std::ofstream& os, const T& v) {
|
||||
os.write(reinterpret_cast<const char*>(&v), sizeof(T));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool readPOD(std::ifstream& is, T& v) {
|
||||
is.read(reinterpret_cast<char*>(&v), sizeof(T));
|
||||
return is.gcount() == static_cast<std::streamsize>(sizeof(T));
|
||||
}
|
||||
|
||||
void writeStr(std::ofstream& os, const std::string& s) {
|
||||
uint32_t n = static_cast<uint32_t>(s.size());
|
||||
writePOD(os, n);
|
||||
if (n > 0) os.write(s.data(), n);
|
||||
}
|
||||
|
||||
bool readStr(std::ifstream& is, std::string& s) {
|
||||
uint32_t n = 0;
|
||||
if (!readPOD(is, n)) return false;
|
||||
if (n > (1u << 20)) return false;
|
||||
s.resize(n);
|
||||
if (n > 0) {
|
||||
is.read(s.data(), n);
|
||||
if (is.gcount() != static_cast<std::streamsize>(n)) {
|
||||
s.clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string normalizePath(std::string base) {
|
||||
if (base.size() < 5 || base.substr(base.size() - 5) != ".wauh") {
|
||||
base += ".wauh";
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweeAuctionHouses::Entry*
|
||||
WoweeAuctionHouses::findById(uint32_t ahId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.ahId == ahId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const WoweeAuctionHouses::Entry*
|
||||
WoweeAuctionHouses::findByNpc(uint32_t npcId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.npcAuctioneerId == npcId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::vector<const WoweeAuctionHouses::Entry*>
|
||||
WoweeAuctionHouses::findByFaction(uint8_t faction) const {
|
||||
std::vector<const Entry*> out;
|
||||
for (const auto& e : entries) {
|
||||
if (e.factionAccess == Both ||
|
||||
e.factionAccess == Neutral ||
|
||||
(faction != Both && e.factionAccess == faction)) {
|
||||
out.push_back(&e);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeAuctionHousesLoader::save(
|
||||
const WoweeAuctionHouses& cat,
|
||||
const std::string& basePath) {
|
||||
std::ofstream os(normalizePath(basePath), std::ios::binary);
|
||||
if (!os) return false;
|
||||
os.write(kMagic, 4);
|
||||
writePOD(os, kVersion);
|
||||
writeStr(os, cat.name);
|
||||
uint32_t entryCount = static_cast<uint32_t>(cat.entries.size());
|
||||
writePOD(os, entryCount);
|
||||
for (const auto& e : cat.entries) {
|
||||
writePOD(os, e.ahId);
|
||||
writeStr(os, e.name);
|
||||
writePOD(os, e.factionAccess);
|
||||
writePOD(os, e.pad0);
|
||||
writePOD(os, e.depositRatePct);
|
||||
writePOD(os, e.cutPct);
|
||||
writePOD(os, e.minListingDurationHours);
|
||||
writePOD(os, e.maxListingDurationHours);
|
||||
writePOD(os, e.pad1);
|
||||
writePOD(os, e.feePerSlot);
|
||||
writePOD(os, e.npcAuctioneerId);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeAuctionHouses WoweeAuctionHousesLoader::load(
|
||||
const std::string& basePath) {
|
||||
WoweeAuctionHouses out;
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
if (!is) return out;
|
||||
char magic[4];
|
||||
is.read(magic, 4);
|
||||
if (std::memcmp(magic, kMagic, 4) != 0) return out;
|
||||
uint32_t version = 0;
|
||||
if (!readPOD(is, version) || version != kVersion) return out;
|
||||
if (!readStr(is, out.name)) return out;
|
||||
uint32_t entryCount = 0;
|
||||
if (!readPOD(is, entryCount)) return out;
|
||||
if (entryCount > (1u << 20)) return out;
|
||||
out.entries.resize(entryCount);
|
||||
for (auto& e : out.entries) {
|
||||
if (!readPOD(is, e.ahId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.factionAccess) ||
|
||||
!readPOD(is, e.pad0) ||
|
||||
!readPOD(is, e.depositRatePct) ||
|
||||
!readPOD(is, e.cutPct) ||
|
||||
!readPOD(is, e.minListingDurationHours) ||
|
||||
!readPOD(is, e.maxListingDurationHours) ||
|
||||
!readPOD(is, e.pad1) ||
|
||||
!readPOD(is, e.feePerSlot) ||
|
||||
!readPOD(is, e.npcAuctioneerId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeAuctionHousesLoader::exists(
|
||||
const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
WoweeAuctionHouses::Entry makeAH(
|
||||
uint32_t ahId, const char* name,
|
||||
uint8_t factionAccess,
|
||||
uint16_t depositRatePct,
|
||||
uint16_t cutPct,
|
||||
uint16_t minHours, uint16_t maxHours,
|
||||
uint32_t feePerSlot,
|
||||
uint32_t npcAuctioneerId) {
|
||||
WoweeAuctionHouses::Entry e;
|
||||
e.ahId = ahId; e.name = name;
|
||||
e.factionAccess = factionAccess;
|
||||
e.depositRatePct = depositRatePct;
|
||||
e.cutPct = cutPct;
|
||||
e.minListingDurationHours = minHours;
|
||||
e.maxListingDurationHours = maxHours;
|
||||
e.feePerSlot = feePerSlot;
|
||||
e.npcAuctioneerId = npcAuctioneerId;
|
||||
return e;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
WoweeAuctionHouses WoweeAuctionHousesLoader::makeStormwindAH(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeAuctionHouses;
|
||||
WoweeAuctionHouses c;
|
||||
c.name = catalogName;
|
||||
// Stormwind Trade District AH. Vanilla rates:
|
||||
// 5% deposit, 5% cut, 12/24/48 hr tiers, no
|
||||
// per-slot fee. NPC: Auctioneer Tricket
|
||||
// (creatureId 8666).
|
||||
c.entries.push_back(makeAH(
|
||||
1, "Stormwind Trade District AH",
|
||||
A::Alliance,
|
||||
500 /* 5% deposit */,
|
||||
500 /* 5% cut */,
|
||||
12, 48,
|
||||
0,
|
||||
8666 /* Auctioneer Tricket */));
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeAuctionHouses WoweeAuctionHousesLoader::makeOrgrimmarAH(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeAuctionHouses;
|
||||
WoweeAuctionHouses c;
|
||||
c.name = catalogName;
|
||||
// Orgrimmar Valley of Strength AH. Same rates as
|
||||
// Stormwind. NPC: Auctioneer Tahesh
|
||||
// (creatureId 9856).
|
||||
c.entries.push_back(makeAH(
|
||||
2, "Orgrimmar Valley of Strength AH",
|
||||
A::Horde,
|
||||
500 /* 5% deposit */,
|
||||
500 /* 5% cut */,
|
||||
12, 48,
|
||||
0,
|
||||
9856 /* Auctioneer Tahesh */));
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeAuctionHouses WoweeAuctionHousesLoader::makeBootyBayAH(
|
||||
const std::string& catalogName) {
|
||||
using A = WoweeAuctionHouses;
|
||||
WoweeAuctionHouses c;
|
||||
c.name = catalogName;
|
||||
// Booty Bay neutral AH. The famous 15% deposit
|
||||
// + 15% cut rates that made cross-faction
|
||||
// trading expensive. NPC: Auctioneer Beardo
|
||||
// (creatureId 9858).
|
||||
c.entries.push_back(makeAH(
|
||||
3, "Booty Bay Neutral AH",
|
||||
A::Neutral,
|
||||
1500 /* 15% deposit */,
|
||||
1500 /* 15% cut */,
|
||||
12, 48,
|
||||
0,
|
||||
9858 /* Auctioneer Beardo */));
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
@ -425,6 +425,8 @@ const char* const kArgRequired[] = {
|
|||
"--gen-prc-weapon", "--gen-prc-ret", "--gen-prc-rage",
|
||||
"--info-wprc", "--validate-wprc",
|
||||
"--export-wprc-json", "--import-wprc-json",
|
||||
"--gen-auh-stormwind", "--gen-auh-orgrimmar", "--gen-auh-bootybay",
|
||||
"--info-wauh", "--validate-wauh",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
|
|
|||
334
tools/editor/cli_auction_houses_catalog.cpp
Normal file
334
tools/editor/cli_auction_houses_catalog.cpp
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
#include "cli_auction_houses_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_auction_houses.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
namespace {
|
||||
|
||||
std::string stripWauhExt(std::string base) {
|
||||
stripExt(base, ".wauh");
|
||||
return base;
|
||||
}
|
||||
|
||||
const char* factionAccessName(uint8_t f) {
|
||||
using A = wowee::pipeline::WoweeAuctionHouses;
|
||||
switch (f) {
|
||||
case A::Both: return "both";
|
||||
case A::Alliance: return "alliance";
|
||||
case A::Horde: return "horde";
|
||||
case A::Neutral: return "neutral";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweeAuctionHouses& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweeAuctionHousesLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.wauh\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweeAuctionHouses& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.wauh\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" houses : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenStormwind(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "StormwindAH";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWauhExt(base);
|
||||
auto c = wowee::pipeline::WoweeAuctionHousesLoader::
|
||||
makeStormwindAH(name);
|
||||
if (!saveOrError(c, base, "gen-auh-stormwind")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenOrgrimmar(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "OrgrimmarAH";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWauhExt(base);
|
||||
auto c = wowee::pipeline::WoweeAuctionHousesLoader::
|
||||
makeOrgrimmarAH(name);
|
||||
if (!saveOrError(c, base, "gen-auh-orgrimmar")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenBootyBay(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "BootyBayAH";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWauhExt(base);
|
||||
auto c = wowee::pipeline::WoweeAuctionHousesLoader::
|
||||
makeBootyBayAH(name);
|
||||
if (!saveOrError(c, base, "gen-auh-bootybay")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleInfo(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
bool jsonOut = consumeJsonFlag(i, argc, argv);
|
||||
base = stripWauhExt(base);
|
||||
if (!wowee::pipeline::WoweeAuctionHousesLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WAUH not found: %s.wauh\n",
|
||||
base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeAuctionHousesLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wauh"] = base + ".wauh";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"ahId", e.ahId},
|
||||
{"name", e.name},
|
||||
{"factionAccess", e.factionAccess},
|
||||
{"factionAccessName",
|
||||
factionAccessName(e.factionAccess)},
|
||||
{"depositRatePct", e.depositRatePct},
|
||||
{"cutPct", e.cutPct},
|
||||
{"minListingDurationHours",
|
||||
e.minListingDurationHours},
|
||||
{"maxListingDurationHours",
|
||||
e.maxListingDurationHours},
|
||||
{"feePerSlot", e.feePerSlot},
|
||||
{"npcAuctioneerId", e.npcAuctioneerId},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WAUH: %s.wauh\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" houses : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id faction deposit%% cut%% hours fee auctioneer name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
std::printf(" %4u %-8s %5u %5u %2u-%-2u %5u %10u %s\n",
|
||||
e.ahId,
|
||||
factionAccessName(e.factionAccess),
|
||||
e.depositRatePct,
|
||||
e.cutPct,
|
||||
e.minListingDurationHours,
|
||||
e.maxListingDurationHours,
|
||||
e.feePerSlot,
|
||||
e.npcAuctioneerId,
|
||||
e.name.c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleValidate(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
bool jsonOut = consumeJsonFlag(i, argc, argv);
|
||||
base = stripWauhExt(base);
|
||||
if (!wowee::pipeline::WoweeAuctionHousesLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-wauh: WAUH not found: %s.wauh\n",
|
||||
base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeAuctionHousesLoader::load(base);
|
||||
std::vector<std::string> errors;
|
||||
std::vector<std::string> warnings;
|
||||
if (c.entries.empty()) {
|
||||
warnings.push_back("catalog has zero entries");
|
||||
}
|
||||
std::set<uint32_t> idsSeen;
|
||||
std::set<uint32_t> npcsSeen;
|
||||
using Pair = std::pair<uint8_t, std::string>;
|
||||
std::set<Pair> factionNamePairs;
|
||||
for (size_t k = 0; k < c.entries.size(); ++k) {
|
||||
const auto& e = c.entries[k];
|
||||
std::string ctx = "entry " + std::to_string(k) +
|
||||
" (id=" + std::to_string(e.ahId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.ahId == 0)
|
||||
errors.push_back(ctx + ": ahId is 0");
|
||||
if (e.name.empty())
|
||||
errors.push_back(ctx + ": name is empty");
|
||||
if (e.factionAccess > 3) {
|
||||
errors.push_back(ctx + ": factionAccess " +
|
||||
std::to_string(e.factionAccess) +
|
||||
" out of range (0..3)");
|
||||
}
|
||||
if (e.depositRatePct > 10000) {
|
||||
errors.push_back(ctx + ": depositRatePct " +
|
||||
std::to_string(e.depositRatePct) +
|
||||
" exceeds 10000 (100% basis points)");
|
||||
}
|
||||
if (e.cutPct > 10000) {
|
||||
errors.push_back(ctx + ": cutPct " +
|
||||
std::to_string(e.cutPct) +
|
||||
" exceeds 10000 (100% basis points)");
|
||||
}
|
||||
// CRITICAL invariant: deposit + cut combined
|
||||
// must be < 10000 (100%), else seller would
|
||||
// lose money on every successful sale.
|
||||
// Pretty close to 100% (e.g. 50% + 50% = 100%
|
||||
// is valid but unsellable) — error at sum >=
|
||||
// 10000.
|
||||
uint32_t totalRate = static_cast<uint32_t>(
|
||||
e.depositRatePct) +
|
||||
static_cast<uint32_t>(e.cutPct);
|
||||
if (totalRate >= 10000) {
|
||||
errors.push_back(ctx +
|
||||
": depositRatePct=" +
|
||||
std::to_string(e.depositRatePct) +
|
||||
" + cutPct=" + std::to_string(e.cutPct)
|
||||
+ " = " + std::to_string(totalRate) +
|
||||
" basis points — seller would lose "
|
||||
"money on every sale (combined rates "
|
||||
">= 100%)");
|
||||
}
|
||||
// Warn on combined > 50% — economically
|
||||
// viable but harsh enough that listings would
|
||||
// dry up.
|
||||
if (totalRate > 5000 && totalRate < 10000) {
|
||||
warnings.push_back(ctx +
|
||||
": combined deposit+cut=" +
|
||||
std::to_string(totalRate / 100) +
|
||||
"% exceeds 50% — sellers might find "
|
||||
"this AH unprofitable; verify intentional"
|
||||
" (e.g. neutral AH penalty)");
|
||||
}
|
||||
if (e.maxListingDurationHours == 0) {
|
||||
errors.push_back(ctx +
|
||||
": maxListingDurationHours is 0 — no "
|
||||
"duration available, AH would reject "
|
||||
"all listings");
|
||||
}
|
||||
if (e.minListingDurationHours >
|
||||
e.maxListingDurationHours) {
|
||||
errors.push_back(ctx +
|
||||
": minListingDurationHours=" +
|
||||
std::to_string(e.minListingDurationHours) +
|
||||
" > maxListingDurationHours=" +
|
||||
std::to_string(e.maxListingDurationHours)
|
||||
+ " — no valid duration in range");
|
||||
}
|
||||
if (e.npcAuctioneerId == 0) {
|
||||
warnings.push_back(ctx +
|
||||
": npcAuctioneerId is 0 — no NPC bound,"
|
||||
" AH only reachable via direct UI "
|
||||
"(e.g. console command)");
|
||||
}
|
||||
// Same NPC bound to two AH configs would
|
||||
// dispatch ambiguously when right-clicked.
|
||||
if (e.npcAuctioneerId != 0 &&
|
||||
!npcsSeen.insert(e.npcAuctioneerId).second) {
|
||||
errors.push_back(ctx +
|
||||
": npcAuctioneerId " +
|
||||
std::to_string(e.npcAuctioneerId) +
|
||||
" already bound to another AH — gossip "
|
||||
"dispatch would be ambiguous");
|
||||
}
|
||||
// Duplicate (faction, name) — UI tab dispatch
|
||||
// would tie.
|
||||
if (e.factionAccess <= 3 && !e.name.empty()) {
|
||||
Pair p{e.factionAccess, e.name};
|
||||
if (!factionNamePairs.insert(p).second) {
|
||||
errors.push_back(ctx +
|
||||
": duplicate (factionAccess=" +
|
||||
std::to_string(e.factionAccess) +
|
||||
", name=" + e.name +
|
||||
") — AH browser would route "
|
||||
"ambiguously");
|
||||
}
|
||||
}
|
||||
if (!idsSeen.insert(e.ahId).second) {
|
||||
errors.push_back(ctx + ": duplicate ahId");
|
||||
}
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wauh"] = base + ".wauh";
|
||||
j["ok"] = ok;
|
||||
j["errors"] = errors;
|
||||
j["warnings"] = warnings;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
std::printf("validate-wauh: %s.wauh\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu houses, all ahIds + "
|
||||
"(faction,name) + npcAuctioneerId "
|
||||
"unique, factionAccess 0..3, "
|
||||
"depositRatePct + cutPct in 0..10000 "
|
||||
"and combined < 10000, valid "
|
||||
"min<=max listing duration\n",
|
||||
c.entries.size());
|
||||
return 0;
|
||||
}
|
||||
if (!warnings.empty()) {
|
||||
std::printf(" warnings (%zu):\n", warnings.size());
|
||||
for (const auto& w : warnings)
|
||||
std::printf(" - %s\n", w.c_str());
|
||||
}
|
||||
if (!errors.empty()) {
|
||||
std::printf(" ERRORS (%zu):\n", errors.size());
|
||||
for (const auto& e : errors)
|
||||
std::printf(" - %s\n", e.c_str());
|
||||
}
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool handleAuctionHousesCatalog(int& i, int argc, char** argv,
|
||||
int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-auh-stormwind") == 0 &&
|
||||
i + 1 < argc) {
|
||||
outRc = handleGenStormwind(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-auh-orgrimmar") == 0 &&
|
||||
i + 1 < argc) {
|
||||
outRc = handleGenOrgrimmar(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-auh-bootybay") == 0 &&
|
||||
i + 1 < argc) {
|
||||
outRc = handleGenBootyBay(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-wauh") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-wauh") == 0 &&
|
||||
i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
12
tools/editor/cli_auction_houses_catalog.hpp
Normal file
12
tools/editor/cli_auction_houses_catalog.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handleAuctionHousesCatalog(int& i, int argc, char** argv,
|
||||
int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
|
|
@ -183,6 +183,7 @@
|
|||
#include "cli_creature_behavior_catalog.hpp"
|
||||
#include "cli_random_property_catalog.hpp"
|
||||
#include "cli_spell_proc_rules_catalog.hpp"
|
||||
#include "cli_auction_houses_catalog.hpp"
|
||||
#include "cli_catalog_pluck.hpp"
|
||||
#include "cli_catalog_find.hpp"
|
||||
#include "cli_catalog_by_name.hpp"
|
||||
|
|
@ -411,6 +412,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
|||
handleCreatureBehaviorCatalog,
|
||||
handleRandomPropertyCatalog,
|
||||
handleSpellProcRulesCatalog,
|
||||
handleAuctionHousesCatalog,
|
||||
handleCatalogPluck,
|
||||
handleCatalogFind,
|
||||
handleCatalogByName,
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ constexpr FormatMagicEntry kFormats[] = {
|
|||
{{'W','B','H','V'}, ".wbhv", "ai", "--info-wbhv", "Creature behavior catalog"},
|
||||
{{'W','I','R','C'}, ".wirc", "loot", "--info-wirc", "Item random-property pool catalog"},
|
||||
{{'W','P','R','C'}, ".wprc", "spells", "--info-wprc", "Spell proc rules catalog"},
|
||||
{{'W','A','U','H'}, ".wauh", "economy", "--info-wauh", "Auction house config catalog"},
|
||||
{{'W','F','A','C'}, ".wfac", "factions", nullptr, "Faction catalog"},
|
||||
{{'W','L','C','K'}, ".wlck", "locks", nullptr, "Lock catalog"},
|
||||
{{'W','S','K','L'}, ".wskl", "skills", nullptr, "Skill catalog"},
|
||||
|
|
|
|||
|
|
@ -2699,6 +2699,16 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Export binary .wprc to a human-editable JSON sidecar (defaults to <base>.wprc.json; emits triggerEvent as int + name string)\n");
|
||||
std::printf(" --import-wprc-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .wprc.json sidecar back into binary .wprc (triggerEvent int OR \"onhit\"/\"oncrit\"/\"oncast\"/\"ontakedamage\"/\"onheal\"/\"ondodge\"/\"onparry\"/\"onblock\"/\"onkill\" — round-trips proc rule tables byte-identical)\n");
|
||||
std::printf(" --gen-auh-stormwind <wauh-base> [name]\n");
|
||||
std::printf(" Emit .wauh Stormwind Trade District AH (Alliance, vanilla 5%% deposit + 5%% cut + 12-48hr durations, NPC Auctioneer Tricket 8666)\n");
|
||||
std::printf(" --gen-auh-orgrimmar <wauh-base> [name]\n");
|
||||
std::printf(" Emit .wauh Orgrimmar Valley of Strength AH (Horde, same vanilla rates as Stormwind, NPC Auctioneer Tahesh 9856)\n");
|
||||
std::printf(" --gen-auh-bootybay <wauh-base> [name]\n");
|
||||
std::printf(" Emit .wauh Booty Bay Neutral AH (Neutral cross-faction, famous 15%% deposit + 15%% cut penalty rates, NPC Auctioneer Beardo 9858)\n");
|
||||
std::printf(" --info-wauh <wauh-base> [--json]\n");
|
||||
std::printf(" Print WAUH entries (id / faction / depositPct / cutPct / hour range / fee / npcAuctioneerId / name)\n");
|
||||
std::printf(" --validate-wauh <wauh-base> [--json]\n");
|
||||
std::printf(" Static checks: id+name required, factionAccess 0..3, depositRatePct + cutPct each in 0..10000 (basis points), no duplicate ahIds, no duplicate (faction,name) pairs, no duplicate npcAuctioneerId (gossip dispatch tie), maxListingDuration > 0 and minListing <= maxListing; CRITICAL: combined depositRatePct + cutPct < 10000 (else seller loses money on every sale). Warns on combined > 50%% (sellers may abandon AH; verify intentional like neutral AH penalty)\n");
|
||||
std::printf(" --catalog-pluck <wXXX-file> <id> [--json]\n");
|
||||
std::printf(" Extract one entry by id from any registered catalog format. Auto-detects magic, dispatches to the per-format --info-* handler internally, then prints just the matching entry. Primary-key field is auto-detected (first *Id field, or first numeric)\n");
|
||||
std::printf(" --catalog-find <directory> <id> [--magic <WXXX>] [--json]\n");
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ constexpr FormatRow kFormats[] = {
|
|||
{"WBHV", ".wbhv", "ai", "creature_template.AIName + ScriptMgr","Creature behavior catalog (combat AI archetypes + special abilities)"},
|
||||
{"WIRC", ".wirc", "loot", "ItemRandomProperties.dbc + LootMgr", "Item random-property pool catalog (weighted suffix enchants)"},
|
||||
{"WPRC", ".wprc", "spells", "SpellProcEvents + per-spell procFlags","Spell proc rules catalog (event triggers + ICD + self-loop guard)"},
|
||||
{"WAUH", ".wauh", "economy", "AuctionHouse.dbc + AuctionMgr", "Auction house config catalog (deposit/cut rates + duration tiers)"},
|
||||
|
||||
// Additional pipeline catalogs without the alternating
|
||||
// gen/info/validate CLI surface (loaded by the engine
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue