"""Entrance visits use ordinary location travel, retaining the local MMAP leg.""" from pathlib import Path import subprocess,tempfile root=Path(__file__).resolve().parents[2] s=(root/'src/server/game/World/AdventureBehaviorMgr.cpp').read_text() a=s.index('void AdventureBehaviorMgr::Begin(');b=s.index('\nvoid AdventureBehaviorMgr::Fallback(',a) code=r''' #include #include #include #include #define TC_LOG_INFO(...) ((void)0) struct Player{struct Guid{int GetCounter(){return 26;}};Guid GetGUID(){return {};}}; struct ClientlessIntent{std::string Name;std::unordered_map Parameters;}; struct Location{bool IsArea=false;}location; struct Store{bool exists=true;Location* Find(std::string const&){return exists?&location:nullptr;}}store;auto sAdventureLocationMgr=&store; struct Manager{void ClearIntent(int){}void SetIntent(int,ClientlessIntent){}}manager;auto sClientlessPlayerMgr=&manager; struct AdventureBehaviorMgr{ enum class Phase{Idle,Travel}; struct Record{bool Dirty=true,Enabled=true,Publishing=false,Queued=false;std::string Intent,Location,WantedIntent="instance",WantedLocation="instance_visit_at_101",Detail;Phase State=Phase::Idle;std::unordered_setTried;}; bool mapped=true,allowed=true;int fallback=0;std::string action,parameter,target;bool hard=false; void Begin(Player*,Record&); bool Allowed(Player*,Location const&,std::string const&){return allowed;} void Fallback(Player*,Record&){++fallback;} bool ResolveInstance(Player*,Record&){return mapped;} std::string AreaNode(Player*,Location const&){return "reachable";} void Queue(Player*,Record&,std::string const&a,std::string const&p,std::string const&t,bool h=false){action=a;parameter=p;target=t;hard=h;} }; '''+s[a:b]+r''' int main(){Player p;AdventureBehaviorMgr mgr;AdventureBehaviorMgr::Record r; mgr.Begin(&p,r);assert(mgr.action=="travel_to_location"&&mgr.parameter=="id"&&mgr.target=="instance_visit_at_101"&&mgr.hard); assert(r.State==AdventureBehaviorMgr::Phase::Travel&&!r.Dirty); mgr.mapped=false;mgr.Begin(&p,r);assert(mgr.fallback==1); mgr.mapped=true;r.WantedIntent="social";mgr.Begin(&p,r);assert(mgr.action=="travel_to_location"&&!mgr.hard); location.IsArea=true;mgr.Begin(&p,r);assert(mgr.action=="travel_to_node"&&mgr.target=="reachable"&&mgr.hard); } ''' with tempfile.TemporaryDirectory() as tmp: src=Path(tmp)/'begin.cpp';exe=Path(tmp)/'begin';src.write_text(code) subprocess.run(['g++','-std=c++17',str(src),'-o',str(exe)],check=True) subprocess.run([str(exe)],check=True) print('Production entrance travel uses the existing location planner, requires mapping and retains normal social/area travel.')