Files
Viano-Core/tests/clientless/test_wintergrasp_flight.py
T
Nico a6572242c6 Fix flight departure recovery and Wintergrasp mount permissions
Keep takeoff clearance until actual ascent, blacklist rejected dynamic bridges, and diagnose group ground-path rejection. Synchronize native Wintergrasp client mount permission with battle state and fix duplicate Zangarmarsh graveyard ownership. Add regression tests and generic testbot aura inspection.
2026-11-03 18:56:16 +01:00

26 lines
1.9 KiB
Python

"""Exercise shared Wintergrasp mount permission with actual manager method."""
from pathlib import Path
import subprocess,tempfile
root=Path(__file__).resolve().parents[2]
s=(root/"src/server/game/Battlefield/BattlefieldMgr.cpp").read_text()
a=s.index("bool BattlefieldMgr::IsWintergraspFlightAllowed(")
b=s.index("\nvoid BattlefieldMgr::UpdateWintergraspFlight",a)
code=r'''
#include <cassert>
#include <vector>
#include <map>
#include <memory>
using uint32=unsigned;
struct DBCManager{static bool IsInArea(unsigned a,unsigned z){return a==z||(z==4197&&a==4538);}};
struct Map{unsigned id=571;unsigned GetId()const{return id;}};
struct Battlefield{bool enabled=true,war=false;unsigned zone=4197;unsigned GetZoneId()const{return zone;}bool IsEnabled()const{return enabled;}bool CanFlyIn()const{return !war;}};
struct BattlefieldMgr{std::map<Map const*,std::vector<std::unique_ptr<Battlefield>>> _battlefieldsByMap;bool IsWintergraspFlightAllowed(uint32,uint32)const;};
'''+s[a:b]+r'''
int main(){BattlefieldMgr m;Map map;assert(m.IsWintergraspFlightAllowed(571,4197));assert(m.IsWintergraspFlightAllowed(571,4538));assert(!m.IsWintergraspFlightAllowed(0,4197));assert(!m.IsWintergraspFlightAllowed(571,210));auto bf=std::make_unique<Battlefield>();auto p=bf.get();m._battlefieldsByMap[&map].push_back(std::move(bf));assert(m.IsWintergraspFlightAllowed(571,4538));p->war=true;assert(!m.IsWintergraspFlightAllowed(571,4197));assert(!m.IsWintergraspFlightAllowed(571,4538));p->enabled=false;assert(m.IsWintergraspFlightAllowed(571,4538));p->enabled=true;p->war=false;assert(m.IsWintergraspFlightAllowed(571,4197));}
'''
with tempfile.TemporaryDirectory(prefix="vcore-wg-flight-") as d:
p=Path(d);(p/"test.cpp").write_text(code)
subprocess.run(["c++","-std=c++17",str(p/"test.cpp"),"-o",str(p/"test")],check=True)
subprocess.run([str(p/"test")],check=True)
print("WG main/subarea: absent, disabled, peace, war, end and unrelated areas PASS")