From 95ee9d2c25adbea7643c96272700a84bb8af33ab Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 7 Oct 2025 15:29:26 +0200 Subject: [PATCH] NPCs/Fixup * fix exception when displaying NPC with elemental resistances in base version but not difficulty modes --- endpoints/npc/npc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/endpoints/npc/npc.php b/endpoints/npc/npc.php index 72f4500e..c911aee7 100644 --- a/endpoints/npc/npc.php +++ b/endpoints/npc/npc.php @@ -1006,10 +1006,13 @@ class NpcBaseResponse extends TemplateResponse implements ICache $modes['ranged'][] = sprintf($modeRow, $m, Lang::nf($ranged[0]).' - '.Lang::nf($ranged[1])); } + // todo: resistances can be present/missing in either $stats or $modes + // should be handled separately..? + if ($modes) foreach ($stats as $k => $v) if ($v) - $stats[$k] = sprintf($hint, implode('[/tr][tr]', $modes[$k]), $v, $k); + $stats[$k] = isset($modes[$k]) ? sprintf($hint, implode('[/tr][tr]', $modes[$k]), $v, $k) : $v; return $stats; }