From cdadb7f081312500c5fce12be8dd550269444d33 Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Mon, 9 Feb 2026 15:27:09 +0000 Subject: [PATCH] fix(api): correct healing tools parser to use MaxHeal/MinHeal fields API uses MaxHeal and MinHeal directly in Properties (not nested Heal object). Parser now correctly reads heal amounts and calculates economy. Also added type detection for chips vs FAPs based on item name. --- core/nexus_full_api.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/core/nexus_full_api.py b/core/nexus_full_api.py index 3654dc4..f423f1a 100644 --- a/core/nexus_full_api.py +++ b/core/nexus_full_api.py @@ -215,13 +215,28 @@ class NexusHealingTool(NexusItem): def from_api(cls, data: Dict[str, Any]) -> "NexusHealingTool": """Create from API response.""" props = data.get('Properties', {}) - economy = props.get('Economy', {}) - heal = props.get('Heal', {}) - + economy = props.get('Economy', {}) or {} + decay = safe_decimal(economy.get('Decay')) - heal_amount = safe_decimal(heal.get('Amount')) + # API uses MaxHeal/MinHeal directly in Properties, not nested Heal object + max_heal = safe_decimal(props.get('MaxHeal')) + min_heal = safe_decimal(props.get('MinHeal')) + # Use average of min/max heal, or max if min is 0 + heal_amount = (max_heal + min_heal) / 2 if min_heal > 0 else max_heal + if heal_amount == 0: + heal_amount = max_heal # Fallback to max heal + heal_per_pec = heal_amount / decay if decay > 0 else Decimal('0') - + + # Determine type based on name or properties + name = data.get('Name', '').lower() + if 'chip' in name or 'restoration' in name: + tool_type = 'chip' + elif 'pack' in name or 'fap' in name: + tool_type = 'pack' + else: + tool_type = 'fap' + return cls( id=data.get('Id', 0), name=data.get('Name', 'Unknown'), @@ -230,7 +245,7 @@ class NexusHealingTool(NexusItem): heal_amount=heal_amount, decay=decay, heal_per_pec=heal_per_pec, - type=props.get('Type', 'fap'), + type=tool_type, profession_level=int(props.get('RequiredLevel', 0) or 0), is_limited='(L)' in data.get('Name', ''), )