#!/usr/bin/env python3 from pathlib import Path import subprocess import tempfile root = Path(__file__).resolve().parents[2] source = (root / "src/server/game/World/AdventureGroupMgr.cpp").read_text() # The integration-heavy manager remains native C++, but these assertions keep # its safety boundaries visible when the surrounding group code is refactored. for required in ( "ManagerWindow(plan.Deadline,now)", "ManagerLevelCompatible(member->getLevel(),present->getLevel())", "!BotLed(p)", "Complete(p)", "ProfessionCompatible(leader,member,Activity(targetPlan))", "CanInvite(leader,member)", "NeedsRole(leader,member)", "sourceSize>=targetGroup->GetMembersCount()", "Never hand forced leadership to a real player", "GROUP_MANAGER_TRANSFER", 'op=="preview"', 'op=="run"', ): assert required in source, required code = r''' #include "AdventureGroupPolicy.h" #include int main() { using namespace AdventureGroupPolicy; assert(ManagerLevelCompatible(60, 55)); assert(!ManagerLevelCompatible(60, 54)); assert(ManagerLevelCompatible(84, 79)); assert(!ManagerLevelCompatible(84, 78)); assert(ManagerLevelCompatible(85, 85)); assert(!ManagerLevelCompatible(85, 84)); assert(!ManagerLevelCompatible(80, 85)); assert(ManagerWindow(1600, 1000)); assert(ManagerWindow(1300, 1000)); assert(!ManagerWindow(1601, 1000)); assert(!ManagerWindow(1000, 1000)); assert(!ManagerWindow(999, 1000)); } ''' with tempfile.TemporaryDirectory() as directory: directory = Path(directory) cpp = directory / "test.cpp" exe = directory / "test" cpp.write_text(code) subprocess.run([ "c++", "-std=c++17", "-I" + str(root / "src/server/game/World"), str(cpp), "-o", str(exe) ], check=True) subprocess.run([str(exe)], check=True) print("Formation manager window, level-85 isolation and native safety gates passed.")