Files
WoW-Hybrid-gateway/ops/spell_item_mana_regen_compat.py
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

38 lines
3.4 KiB
Python

"""Named existing-parent constant mana-per-five-second item aura policy."""
from pathlib import Path
import hashlib,re
from octo_client_data import canonical_sha256
import spell_item_static_compat as static
POLICY=static.MANA_REGEN_POLICY
PINS={'source_aura': 'ed7f67babe916cbbf91f7a1f1a9a9af694a2469d2e07eb10e94f0ae883678cb8', 'target_aura': '1784b495ea9704bbe12223c2ad42d9d5fea7d320f0dc6c0055cd090cb7e5498b', 'source_attributes': 'fd1c65c0266b77a310c066bc3ccce86fe39f73a6cd10f67192d419009f95ead1', 'target_attributes': '9b0e2ad90eea77c961b00f1fc482e9d9e521aa85c58b63863a35d3a338a31799', 'source_power': '635d63c4f0e969cb7029e2989f9861e4b90e9fc444580220025d657c5e1dd8b2', 'source_stats': 'b6eb7f28ac53c1b1d9b2e2328562110fd3a684af334268ccec0b1b5fa7271ba2', 'target_stats': '291a06e8fc5e285e3b7311e46f276472f19d7447167c149424b5f2051af7360a'}
def contract():
return dict(policy=POLICY,input_sha256=PINS,source_aura=85,target_aura=85,source_name='SPELL_AURA_MOD_POWER_REGEN',target_name='SPELL_AURA_MOD_POWER_REGEN',source_power=0,target_power=0,power_name='POWER_MANA',units='mana-per-five-seconds',source_attribute_words=[448,0,0,0,0],native_extra_attribute_flags_cleared=False,new_parent_definitions=False)
def namespace(paths):
if set(paths)!=set(PINS):raise ValueError('Complete named mana regeneration semantics required')
texts={}
for role,path in paths.items():
raw=Path(path).read_bytes()
if hashlib.sha256(raw).hexdigest()!=PINS[role]:raise ValueError('Mana regeneration input changed: '+role)
texts[role]=raw.decode()
names=[('source_aura','SPELL_AURA_MOD_POWER_REGEN',85),('target_aura','SPELL_AURA_MOD_POWER_REGEN',85),('source_power','POWER_MANA',0),('target_attributes','POWER_MANA',0)]
for role,name,value in names:
if not re.search(r'\b'+name+r'\s*=\s*'+str(value)+r'\s*,',texts[role]):raise ValueError('Named mana regeneration enum differs')
flags=[('source_attributes','SPELL_ATTR_PASSIVE',64),('source_attributes','SPELL_ATTR_HIDDEN_CLIENTSIDE',128),('source_attributes','SPELL_ATTR_HIDE_IN_COMBAT_LOG',256),('target_attributes','SPELL_ATTR0_PASSIVE',64),('target_attributes','SPELL_ATTR0_DO_NOT_DISPLAY_SPELLBOOK_AURA_ICON_COMBAT_LOG',128),('target_attributes','SPELL_ATTR0_DO_NOT_LOG',256)]
for role,name,value in flags:
found=re.search(r'\b'+name+r'\s*=\s*(0x[0-9a-fA-F]+|[0-9]+)\s*,',texts[role])
if not found or int(found.group(1),0)!=value:raise ValueError('Named hidden/passive/no-log mana flag differs')
for role,fragment in [('source_stats','GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) / 5.0f'),('target_stats','GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, AsUnderlyingType(power)) / 5.f')]:
if fragment not in texts[role]:raise ValueError('Mana-per-five-second consumer differs')
return contract()
def validate_source(source,semantics):
if not isinstance(semantics,dict)or canonical_sha256(semantics)!=canonical_sha256(contract()):raise ValueError('Named mana regeneration contract required')
return static.validate_source(source,mana_regen=True)
def component(sources,native,schemas,maxima,registry,*,semantics,duration_reference=None):
for source in sources:validate_source(source,semantics)
result=static.component(sources,native,schemas,maxima,registry,mana_regen=True,duration_reference=duration_reference)
result['semantic_contract']=contract()
return result