Editing Module:AbilityData/hero

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.
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 1: Line 1:
local ability_module = require("Module:Abilities/card")
local ability_module = require("Module:AbilityData")
local dictionary_module = require("Module:Dictionary")
local dictionary_module = require("Module:Dictionary")
local lang_module = require("Module:Lang")
local lang_module = require("Module:Lang")
local util_module = require("Module:Utilities")
local util_module = require("Module:Utilities")
local ability_util_module = require("Module:Abilities/utils")
local heroes_data = mw.loadJsonData("Data:HeroData.json")
local heroes_data = mw.loadJsonData("Data:HeroData.json")


local p = {}
local p = {}


--collapsible list
-- Write each of the hero's ability cards in a tab of a tabber
function p.write_hero_abilities(frame)
function p.write_hero_abilities(frame)
local hero_key = frame.args[1]
local hero_key = frame.args[1]
Line 21: Line 20:
for ability_num, ability_data in pairs(abilities_data) do
for ability_num, ability_data in pairs(abilities_data) do
local ability_key = ability_data["Key"]
local ability_key = ability_data["Key"]
local ability_name_en = ability_data["Name"]
local ability_name_localized = lang_module.get_string(ability_key)
local ability_name_localized = lang_module.get_string(ability_key)
local tab_name = "<h3>" .. ability_name_localized .. "</h3>\n"
local notes_str_localized = dictionary_module.translate('Notes', nil, '')
local notes_source_page = ability_util_module.get_notes_source_page_name(ability_key)
local tab_name = "|-|(" .. ability_num .. ") " .. ability_name_en .. "="
--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 = dictionary_module.translate('NotesNeedsTranslation') .. ' [[Template:Translation]]' .. "<br>"
end
else
notes_source_page = ability_name_localized .. '/' .. notes_str_localized
end
notes_source_page = "User:Sur/" .. notes_source_page --temp
--Determine tab content
--Determine tab content
local notes_content = '{{'..notes_source_page..'}}'
local tab_content = "<i>" .. dictionary_module.translate_embed(
local tab_content = ability_module.get_ability_card_from_key(
'TranscludedNotesFrom',
'https://en.wikipedia.org/wiki/Help:Transclusion',
'[['..notes_source_page..']]',
'https://deadlocked.wiki/index.php?title='..util_module.url_encode(notes_source_page)..'&action=edit'
) .. "</i><br>" .. notes_untranslated_msg
local tab_content = tab_content .. ability_module.get_ability_card_from_key(
hero_key,  
hero_key,  
ability_num,  
ability_num,  
'true',
'true',
frame:preprocess(notes_content),
'{{'..notes_source_page..'}}'
notes_source_page
)
)
ret = ret .. tab_name .. tab_content .. '\n'
ret = ret .. tab_name .. tab_content
end
end
 
ret = "<tabber>" .. ret .. "</tabber>"
return frame:preprocess(ret)
return frame:preprocess(ret)
end
end


return p
return p
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

Page included on this page: