Kelsidavis-WoWee/tools/editor/content_pack.hpp
Kelsi 2eec089ef5 fix(editor): harden JSON handling, quest loading, and content validation
- Quest editor: add loadFromFile() with nlohmann/json, chain validation
  with circular reference detection, wire into ADT load and save pipeline
- Project: replace naive substring JSON parsing with nlohmann/json for
  both save() and load(), fix shell injection in gitCommit()
- Content pack: replace manual JSON with nlohmann/json, validate binary
  format magic numbers (WHM1/WOM1/WOB1), add WOB to openFormatScore
  (now scores 0-6), mark invalid files with (!) in summary
2026-05-05 12:48:50 -07:00

51 lines
1.6 KiB
C++

#pragma once
#include <string>
#include <vector>
#include <cstdint>
namespace wowee {
namespace editor {
struct ContentPackInfo {
std::string name;
std::string author;
std::string description;
std::string version = "1.0";
uint32_t mapId = 9000;
std::string format = "wcp-1.0";
struct FileEntry {
std::string path; // path inside pack
std::string category; // terrain, object, creature, quest, texture, model
uint64_t size = 0;
};
std::vector<FileEntry> files;
};
class ContentPacker {
public:
// Pack all zone data from output directory into a .wcp file
static bool packZone(const std::string& outputDir, const std::string& mapName,
const std::string& destPath, const ContentPackInfo& info);
// Unpack a .wcp file to a directory
static bool unpackZone(const std::string& wcpPath, const std::string& destDir);
// Read pack info without extracting
static bool readInfo(const std::string& wcpPath, ContentPackInfo& info);
// Validate that a zone directory has all required open format files
struct ValidationResult {
bool hasWot = false, hasWhm = false, hasZoneJson = false;
bool hasPng = false, hasWom = false, hasWob = false;
bool hasCreatures = false, hasQuests = false, hasObjects = false;
bool whmValid = false, womValid = false, wobValid = false;
int openFormatScore() const;
std::string summary() const;
};
static ValidationResult validateZone(const std::string& zoneDir);
};
} // namespace editor
} // namespace wowee