From 1c24693a7c086922e58d346a480af557467c9da2 Mon Sep 17 00:00:00 2001 From: RoddyGitHub Date: Sat, 25 Jul 2026 09:31:40 +0200 Subject: [PATCH] refactor: replace inline elite validation with _validate_elite_for_profession call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _decode_agent now calls the existing _validate_elite_for_profession helper instead of duplicating the validation inline (5 lines → 1 line). - This makes the legacy path consistent with _decode_agent_2025 which already uses the same helper. - Updated the stale comment that still referenced _LEGACY_ELITE_OVERRIDE. Signed-off-by: RoddyGitHub --- libs/gw2_evtc_parser/src/gw2_evtc_parser/parser.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libs/gw2_evtc_parser/src/gw2_evtc_parser/parser.py b/libs/gw2_evtc_parser/src/gw2_evtc_parser/parser.py index aa43df53..652896e5 100644 --- a/libs/gw2_evtc_parser/src/gw2_evtc_parser/parser.py +++ b/libs/gw2_evtc_parser/src/gw2_evtc_parser/parser.py @@ -1695,15 +1695,10 @@ def _decode_agent(data: bytes, offset: int) -> Agent: except ValueError: profession = Profession.UNKNOWN - # v0.16.3-api: map legacy elite ID via override, then validate - # against the profession. If the override fails validation, try - # the raw value (handles collision IDs 55 and 63 where the raw - # value IS the API ID for one profession). - valid_set = _VALID_ELITE_BY_PROFESSION.get(int(prof_raw)) - if valid_set is not None and int(elite_raw) in valid_set: - elite = EliteSpec(int(elite_raw)) - else: - elite = EliteSpec.BASE + # v0.16.3-api: cross-validate elite ID against the agent's + # profession using the canonical helper (handles shared + # collision IDs 55, 63, 73, 74, 75, 77). + elite = _validate_elite_for_profession(int(prof_raw), int(elite_raw)) return Agent( id=aid,