Editing
Module
:
Abilities/utils
Give feedback
Jump to navigation
Jump to search
Warning:
You are not logged in. Once you make an edit, a temporary account will be created for you.
Learn more
.
Log in
or
create an account
to continue receiving notifications after this account expires, and to access other features.
Anti-spam check. Do
not
fill this in!
local p = {} local commonutils = require "Module:Utilities" local lang = require"Module:Lang" local dictionary_module = require("Module:Dictionary") local data = mw.loadJsonData("Data:AbilityCards.json") -- returns the table of a specific item' function p.get_ability_card_data(hero_key, ability_num) if(hero_key == nil) then return nil end return data[hero_key][tonumber(ability_num)] end function p.get_hero_key(hero_name) for i, hero in pairs(data) do if hero["Name"] == hero_name then return i end end return nil end -- Returns the key of the hero whose ability name is passed as an argument --{{#invoke:Abilities/utils|find_hero_by_ability|ABILITY_NAME}}-- p.find_hero_by_ability = function(frame) local ability_name = frame.args[1] if not ability_name or ability_name == "" then return "Missing Ability Name" end -- Normalize input for case-insensitive comparison local normalized_input = string.lower(ability_name) -- Iterate through all heroes in the data for hero_key, ui_data in pairs(data) do -- Check each ability for this hero for ability_num, ability in pairs(ui_data) do local current_name = lang.get_string(ability.Key) if string.lower(current_name) == normalized_input then return hero_key end end end return "Hero Not Found" end -- Add prefix and postfix labels to a value. Eg. "32" -> "32s" function p.format_value_with_prepost(key, value, frame, exclude_plus) if (exclude_plus == nil) then exclude_plus = false end if (value == nil) then return nil end local prefix = lang.get_string(string.format("%s_prefix",key)) local postfix = lang.get_string(string.format("%s_postfix",key)) -- Default pre/post fix to empty string, as they may not exist if (prefix == nil) then prefix = '' end if (postfix == nil) then postfix = '' end -- If string ends with 'm', then set the postfix to 'm' and remove it if commonutils.string_endswith(tostring(value), 'm') then value = tonumber(value:sub(1, -2)) postfix = 'm' end -- If string ends with 's', then set the postfix to 's' and remove it if commonutils.string_endswith(tostring(value), 's') then value = tonumber(value:sub(1, -2)) postfix = 's' end if (prefix == '{s:sign}') then if value < 0 then prefix = '-' else prefix = '+' end end -- Do not assign a minus sign if value is already negative if (prefix == '-' and value < 0) then prefix = '' end -- some use cases don't require the '+' symbol prefix if exclude_plus == true and prefix == '+' then prefix = '' end value_and_uom = frame:expandTemplate{ title = 'Template:ValueAndUom', args = { prefix..value, postfix, uom_style = 'font-size: 0.8em; color: #9C9C9C' } } return value_and_uom end function p.get_notes_source_page_name(ability_key) local ability_name_localized = lang.get_string(ability_key) local notes_str_localized = dictionary_module.translate('Notes', nil, '') --Determine notes link local notes_source_page local notes_untranslated_msg = '' -- if either "Notes" string or ability_name is not able to be localized, -- use an english link instead, as transcluded content relies on it if (ability_name_localized == '') or (notes_str_localized == '') then notes_source_page = ability_name_en .. '/' .. dictionary_module.translate('Notes', 'en', '') if notes_str_localized=='' then notes_untranslated_msg = '<br>' .. dictionary_module.translate('NotesNeedsTranslation') .. ' [[Template:Translate]]' .. "<br>" end else notes_source_page = ability_name_localized .. '/' .. notes_str_localized end notes_source_page = "User:Sur/" .. notes_source_page --temp return notes_source_page end return p
Summary:
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Deadlock:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Pages included on this page:
Module:Abilities/doc/submodules
(
edit
)
Module:Abilities/utils/doc
(
edit
)
Navigation menu
Personal tools
Create account
Log in
associated-pages
Module
Discussion
English
Views
Read
Edit source
History
Tools
Search
Discord
Discord
Navigation
Main page
About us
Random page
Special pages
Recent changes
Unstable Rift
4h ago
路
~2026-IvyGankStone1157
Haze/Sounds
5h ago
路
Gammaton32
Haze/Voice lines
5h ago
路
Gammaton32
Grey Talon/Voice lines
5h ago
路
Gammaton32
Show more...
Interface Admin
Common CSS
Vector CSS
Minerva CSS
Citizen CSS
Brown theme CSS
Gadgets
Gadgets definition
Editing
How to edit
Style guide
All guides
New files
Unresolved feedback
Tools
What links here
Related changes
Page information