#pragma once #include #include #include #include /** * The vanity NPC files (build/vanity/*.xml), read by the world servers (VanityUtilities) and edited by the dashboard: * * (root.xml: which other files load) * * 6802, 2519 * ... * custom_script_client=0:scripts\... (LDF: key=type:value) * * * * Pure (text in, text out) so it can be unit tested. */ namespace VanityXml { struct Location { uint32_t zone{}; float x{}, y{}, z{}; float rw{ 1 }, rx{}, ry{}, rz{}; std::optional chance; // 0-1: how likely the NPC appears here std::optional scale; }; struct Object { std::string name; int32_t lot{ -1 }; // LOT_NULL when the file's lot isn't a number std::vector equipment; std::vector phrases; std::vector config; // LDF lines, as written std::vector locations; // only the complete ones }; struct FileEntry { std::string name; bool enabled{}; }; struct Document { std::vector files; // only root.xml has these, normally std::vector objects; std::vector warnings; // parts that were skipped, e.g. a location without a position }; // The file's includes and objects, or nullopt and error if it isn't XML std::optional Read(const std::string& xml, std::string& error); std::string Write(const Document& document); }