#include "python_runtime.h" #include "nonplayer_data.h" #include #include #include #include int main(int argc,char** argv) { if(argc!=2) return 2; const auto bundle=std::filesystem::temp_directory_path()/"ava2-pack-mount-regression"; try { std::filesystem::remove_all(bundle); std::filesystem::create_directories(bundle/"root/locale/en"); std::filesystem::create_directories(bundle/"locale/common"); std::ofstream(bundle/"asset_manifest.json")<<"{}"; std::ofstream(bundle/"root/locale/en/priority.txt")<<"script"; std::filesystem::create_directories(bundle/"locale/en"); std::ofstream(bundle/"locale/en/priority.txt")<<"asset"; std::ofstream(bundle/"locale/common/npc_wear.txt")<<"61000\tall\t0\t40654\t34100\t527\t86069\t0\t65006\t65106\t0\t0\t0\t0\t0\n"; { ava2::PythonRuntime python(argv[1],bundle/"root"); python.execute("import pack\nassert pack.Exist('locale/common/npc_wear.txt')\nassert pack.Get('LOCALE/en/priority.txt')=='script'\nassert not pack.Exist('../asset_manifest.json')\n"); auto& npc=ava2::NonPlayerData::Instance(); npc.loadNPCWear(ava2::ReadPackedText("locale/common/npc_wear.txt")); if(npc.getNPCWear(61000,0,"map")!=0 || npc.getNPCWear(61000,2,"map")!=34100) throw std::runtime_error("bundle NPC outfit missing"); // A map-specific outfit takes precedence over the shared row. npc.loadNPCWear("61000\tmap\t4\t0\t34101\t0\t0\t0\t0\t0\t0\t0\t0\t0\t0\n"); if(npc.getNPCWear(61000,0,"map")!=4 || npc.getNPCWear(61000,0,"other")!=0) throw std::runtime_error("map outfit precedence changed"); } std::filesystem::remove_all(bundle); std::cout<<"AVA2 bundle pack mount and NPC appearance passed\n"; } catch(const std::exception& e) {std::filesystem::remove_all(bundle);std::cerr<