62 734
modifications
mAucun résumé des modifications |
Aucun résumé des modifications |
||
(3 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 22 : | Ligne 22 : | ||
end | end | ||
return n | return n | ||
end | |||
function formatChance(chance) | |||
chanceCeil = math.ceil(chance) | |||
if chanceCeil == chance then | |||
return chanceCeil | |||
else | |||
return string.format("%.2f", chance) | |||
end | |||
end | end | ||
Ligne 54 : | Ligne 63 : | ||
else | else | ||
itemChance = item.chance | itemChance = item.chance | ||
end | |||
if not itemChance then | |||
return "<error> item : propriété chance non renseignée" | |||
end | end | ||
itemChance = itemChance * globalChance | itemChance = itemChance * globalChance | ||
local suffix = ' (' | local suffix = ' (' | ||
local itemQuantity = item.quantity | |||
if itemQuantity then | if itemQuantity then | ||
suffix = suffix .. itemQuantity .. ', ' | suffix = suffix .. itemQuantity .. ', ' | ||
elseif itemMax > 1 then | elseif itemMax > 1 then | ||
suffix = suffix .. itemMin .. '-' .. itemMax .. ', ' | suffix = suffix .. itemMin .. '-' .. itemMax .. ', ' | ||
end | |||
suffix = suffix .. formatChance(100 * itemChance) .. ' %' | |||
local itemPlayerLevel = item.level | |||
local itemEvent = item.event | |||
if itemPlayerLevel then | |||
suffix = suffix .. ', disponible au niveau ' .. itemPlayerLevel | |||
if itemEvent then | |||
suffix = suffix .. " et lors de l'événement " .. itemEvent | |||
end | |||
elseif itemEvent then | |||
suffix = suffix .. ", disponible lors de l'événement " .. itemEvent | |||
end | end | ||
suffix = suffix | suffix = suffix .. ')' | ||
if itemType == 'item' then | if itemType == 'item' then |
modifications