Files
Viano-Core/doc/clientless/checkpoints/2026-10-27-profession/vcore-rest-fire-db.py
T

19 lines
1.5 KiB
Python

from pathlib import Path
import os,re,subprocess,sys
config=Path('/home/wow_admin/wow_cata_server/server/debug/etc/worldserver.conf').read_text()
match=re.search(r'^WorldDatabaseInfo\s*=\s*"([^"]+)"',config,re.M)
if not match:raise SystemExit('Test world database configuration not found')
host,port,user,password,database=match.group(1).split(';')
args=['mysql','--protocol=TCP','--host='+host,'--port='+port,'--user='+user,'--database='+database,'--default-character-set=utf8mb4','--batch','--connect-timeout=10']
env=os.environ.copy();env['MYSQL_PWD']=password
query="SELECT a.action_key,a.kind,a.min_seconds,a.max_seconds,a.requirement,i.intent,i.weight FROM vcore_adventure_action a JOIN vcore_adventure_action_intent i USING(action_key) WHERE a.action_key IN ('rest_fire','campfire_rest','social_fire'); SELECT point_key,category,map,position_x,position_y,position_z FROM vcore_clientless_world_point WHERE enabled=1 AND category='rest_ground' LIMIT 10;"
if sys.argv[1:] == ['apply']:
migration=Path('/home/wow_admin/wow_cata_server/source/TrinityCore/sql/custom/world/2026_10_27_01_adventure_rest_fire.sql').read_text()
query='START TRANSACTION;\n'+migration+'\n'+query+'\nCOMMIT;'
elif sys.argv[1:] != ['inspect']:raise SystemExit('Use inspect or apply')
result=subprocess.run(args,input=query,text=True,capture_output=True,env=env)
print(result.stdout,end='')
if result.returncode:
print(result.stderr.replace(password,'[redacted]'),file=sys.stderr,end='')
raise SystemExit(result.returncode)