From 5e77c90bb7eec3d71ca3404be9d195074c6ba6c1 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 16 Jul 2020 21:02:21 -0400 Subject: [PATCH] adjust tooltip generation - use even numbers of 5 --- mods/ITEMS/mcl_potions/potions.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_potions/potions.lua b/mods/ITEMS/mcl_potions/potions.lua index d69b855600..cfb853843e 100644 --- a/mods/ITEMS/mcl_potions/potions.lua +++ b/mods/ITEMS/mcl_potions/potions.lua @@ -15,10 +15,14 @@ local function time_string(dur) return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60)) end local function perc_string(num) + + local rem = math.floor((num-1.0)*100 + 0.1) % 5 + local out = math.floor((num-1.0)*100 + 0.1) - rem + if (num - 1.0) < 0 then - return math.floor((num-1.0)*100 + 0.1).."%" + return out.."%" else - return "+"..math.floor((num-1.0)*100 + 0.1).."%" + return "+"..out.."%" end end