Module:SkillInfoCard: Difference between revisions
From Eco - English Wiki
| [checked revision] | [checked revision] |
No edit summary |
No edit summary |
||
| Line 23: | Line 23: | ||
if Sdata.IsRoot == 'False' and Sdata.RootSkill == SkillName then | if Sdata.IsRoot == 'False' and Sdata.RootSkill == SkillName then | ||
if (Sdata.Name[Lang] == "") then SpecialtyName = Sdata.Name.English else SpecialtyName = Sdata.Name[Lang] end | if (Sdata.Name[Lang] == "") then SpecialtyName = Sdata.Name.English else SpecialtyName = Sdata.Name[Lang] end | ||
WikiText = WikiText .. | if (Sdata.Description[Lang] == "") then SpecialtyDescription = Sdata.Description.English else SpecialtyDescription = Sdata.Description[Lang] end | ||
WikiText = WikiText .. '<div class="col d-flex align-items-start">' | |||
if (Utils.checkImage(Sdata.SkillID .. '_Icon.png') == "Y") then IconName = Sdata.SkillID else IconName = 'NoItem' end | |||
WikiText = WikiText .. '[[file:' .. IconName.. '_Icon.png|64px|link='.. SpecialtyName .. '|class=IconGrid]]' | |||
WikiText = WikiText .. '<div><h5 class="fw-bold mb-0 fs-4 text-body-emphasis">[[' .. SpecialtyName .. ']]</h5><p>' .. SpecialtyDescription .. '</p></div>' | |||
WikiText = WikiText .. '</div>' | |||
end | end | ||
end | end | ||
Revision as of 06:20, 10 July 2025
ATTENTION! Data files are generated using game data and are not intended for manual editing.
Warning about use
To prevent multiple call of data array, you must use the function: local SkillInfoCard = mw.loadData("Module:SkillInfoCard")
local p = {}
local Utils = require('Module:Utils')
local IconUtils = require('Module:IconUtils')
local L = require('Module:Localization')
local Lang = Utils.getLanguageName()
function p.main(frame)
local PageName = frame.args[1]
if (Lang == 'English') then SkillName = PageName else SkillName = Utils.SkillSearch(PageName) end
local SkillData = require( "Module:SkillData" )
local Skill = SkillData.skills[SkillName]
local WikiText =''
WikiText = WikiText .. IconUtils.main{name = Skill.Name[Lang], id = Skill.SkillID , size = 32, style = 1} .. ' '
if (Skill.IsRoot == 'True') then WikiText = WikiText .. Skill.Name[Lang] .. ' it is [[Skills|Profession]].<br>' else WikiText = WikiText .. Skill.Name[Lang] .. ' it is [[Skills|Specialty]].<br>' end
WikiText = WikiText .. Skill.Description[Lang] .. '<br>'
if (Skill.IsRoot == 'True') then
WikiText = WikiText .. '<h3>Specialties</h3>'
WikiText = WikiText .. 'The '.. Skill.Name[Lang] .. ' Profession includes the following Specialties:<br>'
for Sname,Sdata in pairs(SkillData.skills) do
if Sdata.IsRoot == 'False' and Sdata.RootSkill == SkillName then
if (Sdata.Name[Lang] == "") then SpecialtyName = Sdata.Name.English else SpecialtyName = Sdata.Name[Lang] end
if (Sdata.Description[Lang] == "") then SpecialtyDescription = Sdata.Description.English else SpecialtyDescription = Sdata.Description[Lang] end
WikiText = WikiText .. '<div class="col d-flex align-items-start">'
if (Utils.checkImage(Sdata.SkillID .. '_Icon.png') == "Y") then IconName = Sdata.SkillID else IconName = 'NoItem' end
WikiText = WikiText .. '[[file:' .. IconName.. '_Icon.png|64px|link='.. SpecialtyName .. '|class=IconGrid]]'
WikiText = WikiText .. '<div><h5 class="fw-bold mb-0 fs-4 text-body-emphasis">[[' .. SpecialtyName .. ']]</h5><p>' .. SpecialtyDescription .. '</p></div>'
WikiText = WikiText .. '</div>'
end
end
else
WikiText = WikiText .. '<h3>How to learn</h3>'
end
return WikiText
end
return p