Editing Module:Abilities/utilsGive feedback
Jump to navigation
Jump to search
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 2: | Line 2: | ||
local commonutils = require "Module:Utilities" | local commonutils = require "Module:Utilities" | ||
local lang = require"Module:Lang" | local lang = require"Module:Lang" | ||
local data = mw.loadJsonData("Data:AbilityCards.json") | local data = mw.loadJsonData("Data:AbilityCards.json") | ||
| Line 19: | Line 18: | ||
end | end | ||
return nil | return nil | ||
end | end | ||
-- Add prefix and postfix labels to a value. Eg. "32" -> "32s" | -- Add prefix and postfix labels to a value. Eg. "32" -> "32s" | ||
function p.format_value_with_prepost(key, value, frame, exclude_plus) | function p.format_value_with_prepost(key, value, frame, exclude_plus) | ||
if (value == nil) then return nil end | if (value == nil) then return nil end | ||
| Line 63: | Line 35: | ||
value = tonumber(value:sub(1, -2)) | value = tonumber(value:sub(1, -2)) | ||
postfix = 'm' | postfix = 'm' | ||
end | end | ||
| Line 77: | Line 43: | ||
prefix = '+' | prefix = '+' | ||
end | end | ||
-- if no prefix on positive value, add a '+' | |||
else | |||
-- | if value > 0 then | ||
if | prefix = '+' | ||
end | |||
end | end | ||
| Line 94: | Line 60: | ||
prefix..value, | prefix..value, | ||
postfix, | postfix, | ||
uom_style = 'font-size: | uom_style = 'font-size: 12px;' | ||
} | } | ||
} | } | ||
| Line 102: | Line 68: | ||
function p.get_notes_source_page_name(ability_key) | function p.get_notes_source_page_name(ability_key) | ||
local ability_name_localized = | local ability_name_en = data["Name"] | ||
local ability_name_localized = lang_module.get_string(ability_key) | |||
local notes_str_localized = dictionary_module.translate('Notes', nil, '') | local notes_str_localized = dictionary_module.translate('Notes', nil, '') | ||