item name]
* $rarity [label => minimum percent], highest first
* $monsterList name / state ('loot','empty','failed') / file / loot rows
*
* Nothing is read from disk here.
*/
/** The rarity label for a drop chance. */
function znote_loot_rarity(float $chance, array $rarity): string {
foreach ($rarity as $label => $percent) {
if ($chance >= $percent) {
return $label;
}
}
return '';
}
$lootParam = isset($_GET['lootrate']) ? '&lootrate' : '';
?>
= t_default('loot.title', 'Monster Loot') ?>
= htmlspecialchars($monsterLootError, ENT_QUOTES, 'UTF-8') ?>
[+] = htmlspecialchars($monster['name'], ENT_QUOTES, 'UTF-8') ?>
= str_repeat('... ', $drop['level']) ?>
= $drop['count'] ?: 1 ?>
= htmlspecialchars($itemList[$drop['id']] ?? '?', ENT_QUOTES, 'UTF-8') ?>
- = htmlspecialchars(znote_loot_rarity($drop['chance'], $rarity), ENT_QUOTES, 'UTF-8') ?>
(= $drop['chance'] ?>%)
[x] = htmlspecialchars($monster['name'], ENT_QUOTES, 'UTF-8') ?>
= t('loot.failed') ?> = htmlspecialchars($monster['name'], ENT_QUOTES, 'UTF-8') ?>
(= htmlspecialchars($monster['file'], ENT_QUOTES, 'UTF-8') ?>)