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.
30 lines
2.4 KiB
Python
30 lines
2.4 KiB
Python
"""Run the production flying-area cast check, including explicit aura restrictions."""
|
|
from pathlib import Path
|
|
import subprocess,tempfile
|
|
root=Path(__file__).resolve().parents[2]
|
|
s=(root/"src/server/game/Spells/SpellInfo.cpp").read_text()
|
|
a=s.index(" // continent limitation (virtual continent)",s.index("SpellInfo::CheckLocation"))
|
|
b=s.index(" // raid instance limitation",a)
|
|
code=r'''
|
|
#include <cassert>
|
|
#include <vector>
|
|
using uint32=unsigned;
|
|
enum class AreaMountFlags{None=0,AllowFlyingMounts=2};
|
|
template<class T>struct EnumFlag{int bits;EnumFlag(T v):bits(int(v)){}void operator|=(T v){bits|=int(v);}bool HasFlag(T v){return bits&int(v);}};
|
|
constexpr int SPELL_AURA_MOUNT_RESTRICTIONS=1,SPELL_ATTR4_ONLY_FLYING_AREAS=2,SPELL_FAILED_INCORRECT_AREA=3;
|
|
struct AuraEffect{int mask;int GetMiscValue()const{return mask;}};
|
|
struct Player{bool restrict=false;std::vector<AuraEffect const*> auras;bool HasAuraType(int)const{return restrict;}auto const& GetAuraEffectsByType(int)const{return auras;}};
|
|
struct AreaTableEntry{int flags=13;EnumFlag<AreaMountFlags> GetMountFlags()const{return AreaMountFlags(flags);}} area;
|
|
struct Areas{AreaTableEntry const* LookupEntry(unsigned){return &area;}} sAreaTableStore;
|
|
struct Battlefields{bool war=false;bool IsWintergraspFlightAllowed(unsigned map,unsigned id){return map==571&&(id==4197||id==4538)&&!war;}} battlefield;auto sBattlefieldMgr=&battlefield;
|
|
struct SpellInfo{bool HasAttribute(int)const{return true;}int CheckLocation(unsigned map_id,unsigned area_id,Player const* player){
|
|
'''+s[a:b]+r'''
|
|
return 0;}};
|
|
int main(){SpellInfo s;Player p;assert(s.CheckLocation(571,4197,&p)==0);assert(s.CheckLocation(571,4538,&p)==0);battlefield.war=true;assert(s.CheckLocation(571,4538,&p)==SPELL_FAILED_INCORRECT_AREA);battlefield.war=false;assert(s.CheckLocation(571,4538,&p)==0);assert(s.CheckLocation(571,210,&p)==SPELL_FAILED_INCORRECT_AREA);p.restrict=true;AuraEffect noFlight{1};p.auras={&noFlight};assert(s.CheckLocation(571,4197,&p)==SPELL_FAILED_INCORRECT_AREA);AuraEffect flight{3};p.auras={&flight};assert(s.CheckLocation(571,4197,&p)==0);}
|
|
'''
|
|
with tempfile.TemporaryDirectory(prefix="vcore-wg-mount-cast-") as directory:
|
|
p=Path(directory);(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("Production mount cast: WG/main/subarea peace/war/end, unrelated zone, aura precedence PASS")
|