mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-11 03:23:51 +00:00
feat(pipeline): add WBNK (Wowee Bag / Bank Slot) catalog
61st open format — replaces ItemBag.dbc plus the bank-storage and special-purpose container tables. Defines every slot the player has access to: equipped bags, bank bags, keyring, soul shard bag, quiver, reagent bag, hunter pet stable. 8 bag kinds (Inventory / Bank / Keyring / Quiver / SoulShard / Stable / Reagent / Wallet) cover the canonical container surface. Each entry has a fixed capacity (or 0 = variable, size set by equipped bag), a display order in the inventory UI, an unlock state with optional gold cost (bank bags ramp through 10s / 1g / 10g / 25g / 50g / 100g matching canonical WoW prices), and an accepts-bag-subclass mask gating which container kinds may be equipped (generic / herb / enchanting / engineer / gem / mining / leather / inscription / quiver / ammo pouch). Cross-references with prior formats — fixedBagItemId points at WIT.itemId for the bag item that always occupies a fixed slot (0 = player-equipable variable slot). CLI: --gen-bnk (5 inventory slots — 16-slot fixed main backpack + 4 player-equippable bag slots accepting generic containers + herb + enchanting bags), --gen-bnk-bank (8 bank bag slots with the canonical WoW unlock cost ramp), --gen-bnk-special (4 special-purpose: 32-slot Keyring fixed, warlock SoulShardBag, hunter ArrowQuiver, hunter HuntersStable for 5 pets), --info-wbnk, --validate-wbnk with --json variants. Validator catches id+name required, kind 0..7, locked-with-zero-cost (slot can never be unlocked), fixed-slot-with-non-zero-mask (equippable bag would be ignored), variable slot with empty mask (no bag can fit), and ambiguous (bagKind, displayOrder) tuples (UI sort would flicker). Format graph: 60 → 61 binary formats. CLI flag count: 833 → 840.
This commit is contained in:
parent
791c8b5dd6
commit
1c3470d1d7
10 changed files with 673 additions and 0 deletions
|
|
@ -649,6 +649,7 @@ set(WOWEE_SOURCES
|
|||
src/pipeline/wowee_macros.cpp
|
||||
src/pipeline/wowee_char_features.cpp
|
||||
src/pipeline/wowee_pvp.cpp
|
||||
src/pipeline/wowee_bags.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/dbc_layout.cpp
|
||||
|
||||
|
|
@ -1452,6 +1453,7 @@ add_executable(wowee_editor
|
|||
tools/editor/cli_macros_catalog.cpp
|
||||
tools/editor/cli_char_features_catalog.cpp
|
||||
tools/editor/cli_pvp_catalog.cpp
|
||||
tools/editor/cli_bags_catalog.cpp
|
||||
tools/editor/cli_quest_objective.cpp
|
||||
tools/editor/cli_quest_reward.cpp
|
||||
tools/editor/cli_clone.cpp
|
||||
|
|
@ -1579,6 +1581,7 @@ add_executable(wowee_editor
|
|||
src/pipeline/wowee_macros.cpp
|
||||
src/pipeline/wowee_char_features.cpp
|
||||
src/pipeline/wowee_pvp.cpp
|
||||
src/pipeline/wowee_bags.cpp
|
||||
src/pipeline/custom_zone_discovery.cpp
|
||||
src/pipeline/terrain_mesh.cpp
|
||||
|
||||
|
|
|
|||
124
include/pipeline/wowee_bags.hpp
Normal file
124
include/pipeline/wowee_bags.hpp
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
// Wowee Open Bag / Bank Slot catalog (.wbnk) — novel
|
||||
// replacement for Blizzard's ItemBag.dbc plus the bank-
|
||||
// storage and special-purpose container tables. Defines
|
||||
// every slot the player has access to: equipped bags,
|
||||
// bank bags, the keyring, soul shard bag, quiver, reagent
|
||||
// bag, hunter pet stable, etc.
|
||||
//
|
||||
// Each entry describes ONE container slot — its kind, its
|
||||
// fixed capacity (or whether it accepts a player-equipped
|
||||
// bag for variable capacity), its display order in the
|
||||
// inventory UI, and the unlock state (some bank bags
|
||||
// require a gold purchase to open).
|
||||
//
|
||||
// Cross-references with previously-added formats:
|
||||
// WBNK.entry.fixedBagItemId → WIT.itemId
|
||||
// (the bag item that this
|
||||
// slot ALWAYS contains —
|
||||
// 0 = player-equipped slot)
|
||||
//
|
||||
// Binary layout (little-endian):
|
||||
// magic[4] = "WBNK"
|
||||
// version (uint32) = current 1
|
||||
// nameLen + name (catalog label)
|
||||
// entryCount (uint32)
|
||||
// entries (each):
|
||||
// bagSlotId (uint32)
|
||||
// nameLen + name
|
||||
// descLen + description
|
||||
// bagKind (uint8) / containerSize (uint8) /
|
||||
// displayOrder (uint8) / isUnlocked (uint8)
|
||||
// fixedBagItemId (uint32)
|
||||
// unlockCostCopper (uint32)
|
||||
// acceptsBagSubclassMask (uint32)
|
||||
struct WoweeBagSlot {
|
||||
enum BagKind : uint8_t {
|
||||
Inventory = 0, // base inventory bag slots
|
||||
Bank = 1, // bank window bags
|
||||
Keyring = 2, // keyring (fixed, classic-only)
|
||||
Quiver = 3, // arrow quiver — hunter only
|
||||
SoulShard = 4, // soul shard bag — warlock only
|
||||
Stable = 5, // hunter pet stable slot
|
||||
Reagent = 6, // reagent bag (post-Cata)
|
||||
Wallet = 7, // currency wallet (token-style)
|
||||
};
|
||||
|
||||
// acceptsBagSubclassMask bits — only bags whose item
|
||||
// subclass matches at least one bit may be equipped here.
|
||||
// Bit 0 = generic container, bit 1 = soul shard bag,
|
||||
// bit 2 = herb bag, bit 3 = enchanting bag, bit 4 = engineer
|
||||
// bag, bit 5 = gem bag, bit 6 = mining bag, bit 7 = leather
|
||||
// bag, bit 8 = inscription bag, bit 9 = quiver, bit 10 =
|
||||
// ammo pouch.
|
||||
static constexpr uint32_t kAcceptsAnyContainer = 1u << 0;
|
||||
static constexpr uint32_t kAcceptsSoulShard = 1u << 1;
|
||||
static constexpr uint32_t kAcceptsHerb = 1u << 2;
|
||||
static constexpr uint32_t kAcceptsEnchanting = 1u << 3;
|
||||
static constexpr uint32_t kAcceptsEngineer = 1u << 4;
|
||||
static constexpr uint32_t kAcceptsGem = 1u << 5;
|
||||
static constexpr uint32_t kAcceptsMining = 1u << 6;
|
||||
static constexpr uint32_t kAcceptsLeather = 1u << 7;
|
||||
static constexpr uint32_t kAcceptsInscription = 1u << 8;
|
||||
static constexpr uint32_t kAcceptsQuiver = 1u << 9;
|
||||
static constexpr uint32_t kAcceptsAmmoPouch = 1u << 10;
|
||||
static constexpr uint32_t kAcceptsAll = 0xFFFFFFFFu;
|
||||
|
||||
struct Entry {
|
||||
uint32_t bagSlotId = 0;
|
||||
std::string name;
|
||||
std::string description;
|
||||
uint8_t bagKind = Inventory;
|
||||
uint8_t containerSize = 16; // slots within the bag
|
||||
uint8_t displayOrder = 0;
|
||||
uint8_t isUnlocked = 1; // 0 = needs purchase
|
||||
uint32_t fixedBagItemId = 0; // WIT cross-ref or 0
|
||||
uint32_t unlockCostCopper = 0; // gold to unlock (0 = free)
|
||||
uint32_t acceptsBagSubclassMask = kAcceptsAnyContainer;
|
||||
};
|
||||
|
||||
std::string name;
|
||||
std::vector<Entry> entries;
|
||||
|
||||
bool isValid() const { return !entries.empty(); }
|
||||
|
||||
const Entry* findById(uint32_t bagSlotId) const;
|
||||
|
||||
static const char* bagKindName(uint8_t k);
|
||||
};
|
||||
|
||||
class WoweeBagSlotLoader {
|
||||
public:
|
||||
static bool save(const WoweeBagSlot& cat,
|
||||
const std::string& basePath);
|
||||
static WoweeBagSlot load(const std::string& basePath);
|
||||
static bool exists(const std::string& basePath);
|
||||
|
||||
// Preset emitters used by --gen-bnk* variants.
|
||||
//
|
||||
// makeStarter — 5 inventory slots: 16-slot main backpack
|
||||
// (fixed) + 4 player-equipped bag slots
|
||||
// (variable, accept generic containers).
|
||||
// makeBank — 8 bank bag slots — slots 0..1 free, slots
|
||||
// 2..7 require ascending gold purchases
|
||||
// (10g, 1g, 10g, 25g, 50g, 100g — matches
|
||||
// the WoW bank bag costs).
|
||||
// makeSpecial — 4 special-purpose slots (Keyring fixed
|
||||
// with no equippable bag, SoulShard
|
||||
// warlock-only, Quiver hunter-only,
|
||||
// HuntersStable for pet storage).
|
||||
static WoweeBagSlot makeStarter(const std::string& catalogName);
|
||||
static WoweeBagSlot makeBank(const std::string& catalogName);
|
||||
static WoweeBagSlot makeSpecial(const std::string& catalogName);
|
||||
};
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
256
src/pipeline/wowee_bags.cpp
Normal file
256
src/pipeline/wowee_bags.cpp
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
#include "pipeline/wowee_bags.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kMagic[4] = {'W', 'B', 'N', 'K'};
|
||||
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) != ".wbnk") {
|
||||
base += ".wbnk";
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const WoweeBagSlot::Entry*
|
||||
WoweeBagSlot::findById(uint32_t bagSlotId) const {
|
||||
for (const auto& e : entries)
|
||||
if (e.bagSlotId == bagSlotId) return &e;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* WoweeBagSlot::bagKindName(uint8_t k) {
|
||||
switch (k) {
|
||||
case Inventory: return "inventory";
|
||||
case Bank: return "bank";
|
||||
case Keyring: return "keyring";
|
||||
case Quiver: return "quiver";
|
||||
case SoulShard: return "soul-shard";
|
||||
case Stable: return "stable";
|
||||
case Reagent: return "reagent";
|
||||
case Wallet: return "wallet";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
bool WoweeBagSlotLoader::save(const WoweeBagSlot& 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.bagSlotId);
|
||||
writeStr(os, e.name);
|
||||
writeStr(os, e.description);
|
||||
writePOD(os, e.bagKind);
|
||||
writePOD(os, e.containerSize);
|
||||
writePOD(os, e.displayOrder);
|
||||
writePOD(os, e.isUnlocked);
|
||||
writePOD(os, e.fixedBagItemId);
|
||||
writePOD(os, e.unlockCostCopper);
|
||||
writePOD(os, e.acceptsBagSubclassMask);
|
||||
}
|
||||
return os.good();
|
||||
}
|
||||
|
||||
WoweeBagSlot WoweeBagSlotLoader::load(const std::string& basePath) {
|
||||
WoweeBagSlot 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.bagSlotId)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readStr(is, e.name) || !readStr(is, e.description)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
if (!readPOD(is, e.bagKind) ||
|
||||
!readPOD(is, e.containerSize) ||
|
||||
!readPOD(is, e.displayOrder) ||
|
||||
!readPOD(is, e.isUnlocked) ||
|
||||
!readPOD(is, e.fixedBagItemId) ||
|
||||
!readPOD(is, e.unlockCostCopper) ||
|
||||
!readPOD(is, e.acceptsBagSubclassMask)) {
|
||||
out.entries.clear(); return out;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool WoweeBagSlotLoader::exists(const std::string& basePath) {
|
||||
std::ifstream is(normalizePath(basePath), std::ios::binary);
|
||||
return is.good();
|
||||
}
|
||||
|
||||
WoweeBagSlot WoweeBagSlotLoader::makeStarter(
|
||||
const std::string& catalogName) {
|
||||
WoweeBagSlot c;
|
||||
c.name = catalogName;
|
||||
{
|
||||
// Main backpack — 16-slot fixed, item id 0 = built-in.
|
||||
WoweeBagSlot::Entry e;
|
||||
e.bagSlotId = 1;
|
||||
e.name = "MainBackpack";
|
||||
e.description = "Built-in 16-slot starter backpack — "
|
||||
"always present, never empty.";
|
||||
e.bagKind = WoweeBagSlot::Inventory;
|
||||
e.containerSize = 16;
|
||||
e.displayOrder = 0;
|
||||
e.isUnlocked = 1;
|
||||
e.acceptsBagSubclassMask = 0; // no equippable bag here
|
||||
c.entries.push_back(e);
|
||||
}
|
||||
auto addBagSlot = [&](uint32_t id, uint8_t order) {
|
||||
WoweeBagSlot::Entry e;
|
||||
e.bagSlotId = id;
|
||||
e.name = std::string("BagSlot") + std::to_string(order);
|
||||
e.description = std::string("Player-equippable bag slot ") +
|
||||
std::to_string(order) +
|
||||
" — accepts any generic container.";
|
||||
e.bagKind = WoweeBagSlot::Inventory;
|
||||
e.containerSize = 0; // size determined by equipped bag
|
||||
e.displayOrder = order;
|
||||
e.isUnlocked = 1;
|
||||
e.acceptsBagSubclassMask =
|
||||
WoweeBagSlot::kAcceptsAnyContainer |
|
||||
WoweeBagSlot::kAcceptsHerb |
|
||||
WoweeBagSlot::kAcceptsEnchanting;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
addBagSlot(2, 1);
|
||||
addBagSlot(3, 2);
|
||||
addBagSlot(4, 3);
|
||||
addBagSlot(5, 4);
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeBagSlot WoweeBagSlotLoader::makeBank(
|
||||
const std::string& catalogName) {
|
||||
WoweeBagSlot c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, uint8_t order, uint8_t unlocked,
|
||||
uint32_t cost) {
|
||||
WoweeBagSlot::Entry e;
|
||||
e.bagSlotId = id;
|
||||
e.name = std::string("BankBag") + std::to_string(order);
|
||||
e.description = std::string("Bank bag slot ") +
|
||||
std::to_string(order) +
|
||||
(unlocked
|
||||
? " — free, unlocked at character creation."
|
||||
: " — requires gold purchase to unlock.");
|
||||
e.bagKind = WoweeBagSlot::Bank;
|
||||
e.containerSize = 0;
|
||||
e.displayOrder = order;
|
||||
e.isUnlocked = unlocked;
|
||||
e.unlockCostCopper = cost;
|
||||
e.acceptsBagSubclassMask =
|
||||
WoweeBagSlot::kAcceptsAnyContainer |
|
||||
WoweeBagSlot::kAcceptsHerb |
|
||||
WoweeBagSlot::kAcceptsEnchanting |
|
||||
WoweeBagSlot::kAcceptsEngineer |
|
||||
WoweeBagSlot::kAcceptsGem |
|
||||
WoweeBagSlot::kAcceptsMining |
|
||||
WoweeBagSlot::kAcceptsLeather |
|
||||
WoweeBagSlot::kAcceptsInscription;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
// Bank bag costs match canonical WoW bank bag costs:
|
||||
// slots 0+1 are free, then 10s, 1g, 10g, 25g, 50g, 100g.
|
||||
// 1g = 10000c; 1s = 100c.
|
||||
add(100, 0, 1, 0);
|
||||
add(101, 1, 1, 0);
|
||||
add(102, 2, 0, 1000); // 10 silver
|
||||
add(103, 3, 0, 10000); // 1 gold
|
||||
add(104, 4, 0, 100000); // 10 gold
|
||||
add(105, 5, 0, 250000); // 25 gold
|
||||
add(106, 6, 0, 500000); // 50 gold
|
||||
add(107, 7, 0, 1000000); // 100 gold
|
||||
return c;
|
||||
}
|
||||
|
||||
WoweeBagSlot WoweeBagSlotLoader::makeSpecial(
|
||||
const std::string& catalogName) {
|
||||
WoweeBagSlot c;
|
||||
c.name = catalogName;
|
||||
auto add = [&](uint32_t id, const char* name, uint8_t kind,
|
||||
uint8_t size, uint32_t mask, const char* desc) {
|
||||
WoweeBagSlot::Entry e;
|
||||
e.bagSlotId = id; e.name = name; e.description = desc;
|
||||
e.bagKind = kind;
|
||||
e.containerSize = size;
|
||||
e.acceptsBagSubclassMask = mask;
|
||||
c.entries.push_back(e);
|
||||
};
|
||||
add(200, "Keyring", WoweeBagSlot::Keyring, 32, 0,
|
||||
"Fixed 32-slot keyring — accepts only key-class items "
|
||||
"(no equippable bag).");
|
||||
add(201, "SoulShardBag", WoweeBagSlot::SoulShard, 0,
|
||||
WoweeBagSlot::kAcceptsSoulShard,
|
||||
"Warlock-only soul shard bag slot — accepts only "
|
||||
"Soul Shard Bag containers.");
|
||||
add(202, "ArrowQuiver", WoweeBagSlot::Quiver, 0,
|
||||
WoweeBagSlot::kAcceptsQuiver | WoweeBagSlot::kAcceptsAmmoPouch,
|
||||
"Hunter-only ranged ammo slot — accepts quivers and "
|
||||
"ammo pouches (boost ranged attack speed).");
|
||||
add(203, "HuntersStable", WoweeBagSlot::Stable, 5, 0,
|
||||
"5 hunter pet stable slots — only hunters can use this.");
|
||||
return c;
|
||||
}
|
||||
|
||||
} // namespace pipeline
|
||||
} // namespace wowee
|
||||
|
|
@ -185,6 +185,8 @@ const char* const kArgRequired[] = {
|
|||
"--gen-pvp", "--gen-pvp-alliance", "--gen-pvp-arena",
|
||||
"--info-wpvp", "--validate-wpvp",
|
||||
"--export-wpvp-json", "--import-wpvp-json",
|
||||
"--gen-bnk", "--gen-bnk-bank", "--gen-bnk-special",
|
||||
"--info-wbnk", "--validate-wbnk",
|
||||
"--gen-weather-temperate", "--gen-weather-arctic",
|
||||
"--gen-weather-desert", "--gen-weather-stormy",
|
||||
"--gen-zone-atmosphere",
|
||||
|
|
|
|||
263
tools/editor/cli_bags_catalog.cpp
Normal file
263
tools/editor/cli_bags_catalog.cpp
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
#include "cli_bags_catalog.hpp"
|
||||
#include "cli_arg_parse.hpp"
|
||||
#include "cli_box_emitter.hpp"
|
||||
|
||||
#include "pipeline/wowee_bags.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
namespace {
|
||||
|
||||
std::string stripWbnkExt(std::string base) {
|
||||
stripExt(base, ".wbnk");
|
||||
return base;
|
||||
}
|
||||
|
||||
bool saveOrError(const wowee::pipeline::WoweeBagSlot& c,
|
||||
const std::string& base, const char* cmd) {
|
||||
if (!wowee::pipeline::WoweeBagSlotLoader::save(c, base)) {
|
||||
std::fprintf(stderr, "%s: failed to save %s.wbnk\n",
|
||||
cmd, base.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void printGenSummary(const wowee::pipeline::WoweeBagSlot& c,
|
||||
const std::string& base) {
|
||||
std::printf("Wrote %s.wbnk\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" slots : %zu\n", c.entries.size());
|
||||
}
|
||||
|
||||
int handleGenStarter(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "StarterBags";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWbnkExt(base);
|
||||
auto c = wowee::pipeline::WoweeBagSlotLoader::makeStarter(name);
|
||||
if (!saveOrError(c, base, "gen-bnk")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenBank(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "BankBags";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWbnkExt(base);
|
||||
auto c = wowee::pipeline::WoweeBagSlotLoader::makeBank(name);
|
||||
if (!saveOrError(c, base, "gen-bnk-bank")) return 1;
|
||||
printGenSummary(c, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handleGenSpecial(int& i, int argc, char** argv) {
|
||||
std::string base = argv[++i];
|
||||
std::string name = "SpecialBags";
|
||||
if (parseOptArg(i, argc, argv)) name = argv[++i];
|
||||
base = stripWbnkExt(base);
|
||||
auto c = wowee::pipeline::WoweeBagSlotLoader::makeSpecial(name);
|
||||
if (!saveOrError(c, base, "gen-bnk-special")) 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 = stripWbnkExt(base);
|
||||
if (!wowee::pipeline::WoweeBagSlotLoader::exists(base)) {
|
||||
std::fprintf(stderr, "WBNK not found: %s.wbnk\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeBagSlotLoader::load(base);
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wbnk"] = base + ".wbnk";
|
||||
j["name"] = c.name;
|
||||
j["count"] = c.entries.size();
|
||||
nlohmann::json arr = nlohmann::json::array();
|
||||
for (const auto& e : c.entries) {
|
||||
arr.push_back({
|
||||
{"bagSlotId", e.bagSlotId},
|
||||
{"name", e.name},
|
||||
{"description", e.description},
|
||||
{"bagKind", e.bagKind},
|
||||
{"bagKindName", wowee::pipeline::WoweeBagSlot::bagKindName(e.bagKind)},
|
||||
{"containerSize", e.containerSize},
|
||||
{"displayOrder", e.displayOrder},
|
||||
{"isUnlocked", e.isUnlocked},
|
||||
{"fixedBagItemId", e.fixedBagItemId},
|
||||
{"unlockCostCopper", e.unlockCostCopper},
|
||||
{"acceptsBagSubclassMask", e.acceptsBagSubclassMask},
|
||||
});
|
||||
}
|
||||
j["entries"] = arr;
|
||||
std::printf("%s\n", j.dump(2).c_str());
|
||||
return 0;
|
||||
}
|
||||
std::printf("WBNK: %s.wbnk\n", base.c_str());
|
||||
std::printf(" catalog : %s\n", c.name.c_str());
|
||||
std::printf(" slots : %zu\n", c.entries.size());
|
||||
if (c.entries.empty()) return 0;
|
||||
std::printf(" id kind size order unlock cost(c) accepts-mask fixedBag name\n");
|
||||
for (const auto& e : c.entries) {
|
||||
std::printf(" %4u %-10s %3u %3u %u %7u 0x%08x %5u %s\n",
|
||||
e.bagSlotId,
|
||||
wowee::pipeline::WoweeBagSlot::bagKindName(e.bagKind),
|
||||
e.containerSize, e.displayOrder, e.isUnlocked,
|
||||
e.unlockCostCopper, e.acceptsBagSubclassMask,
|
||||
e.fixedBagItemId, 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 = stripWbnkExt(base);
|
||||
if (!wowee::pipeline::WoweeBagSlotLoader::exists(base)) {
|
||||
std::fprintf(stderr,
|
||||
"validate-wbnk: WBNK not found: %s.wbnk\n", base.c_str());
|
||||
return 1;
|
||||
}
|
||||
auto c = wowee::pipeline::WoweeBagSlotLoader::load(base);
|
||||
std::vector<std::string> errors;
|
||||
std::vector<std::string> warnings;
|
||||
if (c.entries.empty()) {
|
||||
warnings.push_back("catalog has zero entries");
|
||||
}
|
||||
std::vector<uint32_t> idsSeen;
|
||||
// displayOrder values within the same bagKind should be
|
||||
// unique — duplicates would cause UI shuffle ambiguity.
|
||||
std::set<std::string> orderSeen;
|
||||
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.bagSlotId);
|
||||
if (!e.name.empty()) ctx += " " + e.name;
|
||||
ctx += ")";
|
||||
if (e.bagSlotId == 0)
|
||||
errors.push_back(ctx + ": bagSlotId is 0");
|
||||
if (e.name.empty())
|
||||
errors.push_back(ctx + ": name is empty");
|
||||
if (e.bagKind > wowee::pipeline::WoweeBagSlot::Wallet) {
|
||||
errors.push_back(ctx + ": bagKind " +
|
||||
std::to_string(e.bagKind) + " not in 0..7");
|
||||
}
|
||||
// A slot that's not unlocked but has unlockCostCopper=0
|
||||
// can never be unlocked through normal gameplay — flag.
|
||||
if (e.isUnlocked == 0 && e.unlockCostCopper == 0) {
|
||||
warnings.push_back(ctx +
|
||||
": isUnlocked=0 with unlockCostCopper=0 "
|
||||
"(slot can never be unlocked in-game)");
|
||||
}
|
||||
// A fixed-bag slot (containerSize > 0, fixedBagItemId
|
||||
// = 0) with a non-zero acceptsBagSubclassMask is
|
||||
// contradictory — fixed slots don't accept equippable
|
||||
// bags. The starter MainBackpack illustrates this:
|
||||
// size=16, mask=0.
|
||||
if (e.containerSize > 0 && e.fixedBagItemId == 0 &&
|
||||
e.acceptsBagSubclassMask != 0) {
|
||||
warnings.push_back(ctx +
|
||||
": fixed-size slot (containerSize=" +
|
||||
std::to_string(e.containerSize) +
|
||||
") with non-zero acceptsBagSubclassMask "
|
||||
"(equippable bag would be ignored)");
|
||||
}
|
||||
// A variable slot (containerSize=0) with mask=0 can
|
||||
// never accept any bag.
|
||||
if (e.containerSize == 0 && e.acceptsBagSubclassMask == 0 &&
|
||||
e.bagKind != wowee::pipeline::WoweeBagSlot::Stable) {
|
||||
errors.push_back(ctx +
|
||||
": variable slot (containerSize=0) with "
|
||||
"acceptsBagSubclassMask=0 — no bag can fit here");
|
||||
}
|
||||
// (bagKind, displayOrder) tuple uniqueness — within
|
||||
// the same kind the UI sorts by displayOrder, so
|
||||
// duplicates would cause ambiguous ordering.
|
||||
std::string tuple =
|
||||
std::to_string(e.bagKind) + "/" +
|
||||
std::to_string(e.displayOrder);
|
||||
if (orderSeen.count(tuple)) {
|
||||
warnings.push_back(ctx +
|
||||
": duplicate (bagKind=" +
|
||||
wowee::pipeline::WoweeBagSlot::bagKindName(e.bagKind) +
|
||||
", displayOrder=" +
|
||||
std::to_string(e.displayOrder) +
|
||||
") — UI sort order is ambiguous");
|
||||
}
|
||||
orderSeen.insert(tuple);
|
||||
for (uint32_t prev : idsSeen) {
|
||||
if (prev == e.bagSlotId) {
|
||||
errors.push_back(ctx + ": duplicate bagSlotId");
|
||||
break;
|
||||
}
|
||||
}
|
||||
idsSeen.push_back(e.bagSlotId);
|
||||
}
|
||||
bool ok = errors.empty();
|
||||
if (jsonOut) {
|
||||
nlohmann::json j;
|
||||
j["wbnk"] = base + ".wbnk";
|
||||
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-wbnk: %s.wbnk\n", base.c_str());
|
||||
if (ok && warnings.empty()) {
|
||||
std::printf(" OK — %zu slots, all bagSlotIds unique, no order ambiguity\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 handleBagsCatalog(int& i, int argc, char** argv, int& outRc) {
|
||||
if (std::strcmp(argv[i], "--gen-bnk") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenStarter(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-bnk-bank") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenBank(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--gen-bnk-special") == 0 && i + 1 < argc) {
|
||||
outRc = handleGenSpecial(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--info-wbnk") == 0 && i + 1 < argc) {
|
||||
outRc = handleInfo(i, argc, argv); return true;
|
||||
}
|
||||
if (std::strcmp(argv[i], "--validate-wbnk") == 0 && i + 1 < argc) {
|
||||
outRc = handleValidate(i, argc, argv); return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
11
tools/editor/cli_bags_catalog.hpp
Normal file
11
tools/editor/cli_bags_catalog.hpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
bool handleBagsCatalog(int& i, int argc, char** argv, int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
|
|
@ -96,6 +96,7 @@
|
|||
#include "cli_macros_catalog.hpp"
|
||||
#include "cli_char_features_catalog.hpp"
|
||||
#include "cli_pvp_catalog.hpp"
|
||||
#include "cli_bags_catalog.hpp"
|
||||
#include "cli_quest_objective.hpp"
|
||||
#include "cli_quest_reward.hpp"
|
||||
#include "cli_clone.hpp"
|
||||
|
|
@ -233,6 +234,7 @@ constexpr DispatchFn kDispatchTable[] = {
|
|||
handleMacrosCatalog,
|
||||
handleCharFeaturesCatalog,
|
||||
handlePVPCatalog,
|
||||
handleBagsCatalog,
|
||||
handleQuestObjective,
|
||||
handleQuestReward,
|
||||
handleClone,
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ constexpr FormatMagicEntry kFormats[] = {
|
|||
{{'W','M','A','C'}, ".wmac", "ui", "--info-wmac", "Macro / slash command catalog"},
|
||||
{{'W','C','H','F'}, ".wchf", "chars", "--info-wchf", "Character hair / face customization catalog"},
|
||||
{{'W','P','V','P'}, ".wpvp", "pvp", "--info-wpvp", "PvP honor rank + arena tier catalog"},
|
||||
{{'W','B','N','K'}, ".wbnk", "items", "--info-wbnk", "Bag / bank slot 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"},
|
||||
|
|
|
|||
|
|
@ -1587,6 +1587,16 @@ void printUsage(const char* argv0) {
|
|||
std::printf(" Export binary .wpvp to a human-editable JSON sidecar (defaults to <base>.wpvp.json)\n");
|
||||
std::printf(" --import-wpvp-json <json-path> [out-base]\n");
|
||||
std::printf(" Import a .wpvp.json sidecar back into binary .wpvp (accepts rankKind int OR name string; bracket level defaults to 1..80)\n");
|
||||
std::printf(" --gen-bnk <wbnk-base> [name]\n");
|
||||
std::printf(" Emit .wbnk starter: 5 inventory slots (16-slot main backpack + 4 player-equippable bag slots)\n");
|
||||
std::printf(" --gen-bnk-bank <wbnk-base> [name]\n");
|
||||
std::printf(" Emit .wbnk 8 bank bag slots — first 2 free, then 6 with ascending gold costs (10s/1g/10g/25g/50g/100g)\n");
|
||||
std::printf(" --gen-bnk-special <wbnk-base> [name]\n");
|
||||
std::printf(" Emit .wbnk 4 special slots (Keyring fixed, Soul Shard warlock-only, Quiver hunter-only, Hunters Stable for pets)\n");
|
||||
std::printf(" --info-wbnk <wbnk-base> [--json]\n");
|
||||
std::printf(" Print WBNK entries (id / kind / size / display order / unlock status + cost / accept-mask / fixed bag item / name)\n");
|
||||
std::printf(" --validate-wbnk <wbnk-base> [--json]\n");
|
||||
std::printf(" Static checks: id+name required, kind 0..7, locked-with-zero-cost warning, fixed-slot-with-mask conflict, ambiguous (kind,order)\n");
|
||||
std::printf(" --gen-weather-temperate <wow-base> [zoneName]\n");
|
||||
std::printf(" Emit .wow weather schedule: clear-dominant + occasional rain + fog (forest / grassland)\n");
|
||||
std::printf(" --gen-weather-arctic <wow-base> [zoneName]\n");
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ constexpr FormatRow kFormats[] = {
|
|||
{"WMAC", ".wmac", "ui", "(client-side macro storage)", "Macro / slash command catalog"},
|
||||
{"WCHF", ".wchf", "chars", "CharHairGeosets + CharFacialHair", "Character hair / face customization catalog"},
|
||||
{"WPVP", ".wpvp", "pvp", "honor / arena rank tables", "PvP honor rank + arena tier catalog"},
|
||||
{"WBNK", ".wbnk", "items", "ItemBag.dbc + bank slots", "Bag / bank / special slot catalog"},
|
||||
|
||||
// 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