NPCs/Fixup

* fix exception when displaying NPC with elemental resistances in base
   version but not difficulty modes
This commit is contained in:
Sarjuuk
2025-10-07 15:29:26 +02:00
parent d79742d599
commit 95ee9d2c25

View File

@@ -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;
}