Editing Module:Infobox Skill
From Eco - English Wiki
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 p = {} | local p = {} | ||
-- Grabs args from the parent frame | -- Grabs args from the parent frame | ||
Line 48: | Line 47: | ||
-- checks if skill and assigns correct modules based on check | -- checks if skill and assigns correct modules based on check | ||
if check == 'skill' then | if check == 'skill' then | ||
skillData = require( "Module: | skillData = require( "Module:TestSkills" ) | ||
skillTable = skillData.skills[skills] | skillTable = skillData.skills[skills] | ||
else | else | ||
Line 58: | Line 57: | ||
if skillTable == {} then | if skillTable == {} then | ||
if check == 'skill' then | if check == 'skill' then | ||
return skills .. ' could not be found in Module: | return skills .. ' could not be found in Module:TestSkills.' | ||
else | else | ||
return skills .. ' could not be found in Module:TalentData.' | return skills .. ' could not be found in Module:TalentData.' | ||
Line 85: | Line 84: | ||
-- Skill or Talent Image | -- Skill or Talent Image | ||
local | local checkImage = {'_Icon.png','_Icon.jpg'} | ||
local image = '' | |||
local skillsimagename = string.gsub(skills, ' ', '') | |||
for i,v in ipairs(checkImage) do | |||
image = skillsimagename .. checkImage[i] | |||
if mw.title.makeTitle('File', image).file.exists then | |||
break | |||
end | |||
if table.getn(checkImage) == i then | |||
image = 'NoImage.png' | |||
if check == 'Skill' then | |||
image = image .. '|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. skillsimagename .. '_Icon.png|[[Category:Pages_with_missing_skill]]' | |||
end | |||
if check == 'Talent' then | |||
image = image .. '|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. skillsimagename .. '_Icon.png|[[Category:Pages_with_missing_talent]]' | |||
end | |||
end | |||
end | end | ||
-- 'Description' section header | infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | [[File:' .. image .. '|center|border|250x250px]]\n' | ||
-- 'Description' section header | |||
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Description\'\'\'\n' | infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Description\'\'\'\n' | ||
Line 123: | Line 138: | ||
-- Leads to childSkills | -- Leads to childSkills | ||
if skillTable.childSkills ~= nil then | |||
infobox = infobox .. '|-\n| Leads to:\n| style=\"text-align: right; padding: 3px;\" | ' .. skillTable.childSkills .. '\n' | |||
end | |||
end | |||
-- Related Talents | -- Related Talents (ADD THIS DATA) | ||
if skillTable.talents ~= nil then | if skillTable.talents ~= nil then | ||
local listTalents3 = '' | local listTalents3 = '' | ||
Line 145: | Line 149: | ||
local talent6 = skillTable.talents.level6 | local talent6 = skillTable.talents.level6 | ||
-- for each item in the listTalents3 (b is position, c is value) | -- for each item in the listTalents3 (b is position, c is value) | ||
for b,c in ipairs(talent3) do | for b,c in ipairs(talent3) do | ||
--if not these tags listed here | --if not these tags listed here | ||
Line 156: | Line 159: | ||
if (c ~= talent3[#talent3]) then | if (c ~= talent3[#talent3]) then | ||
-- add a comma | -- add a comma | ||
listTalents3 = listTalents3 .. ', | listTalents3 = listTalents3 .. ', ' | ||
end | end | ||
end | end | ||
-- for each item in the listTalents6 (e is position, d is value) | -- for each item in the listTalents6 (e is position, d is value) | ||
for e,d in ipairs(talent6) do | for e,d in ipairs(talent6) do | ||
--if not these tags listed here | --if not these tags listed here | ||
Line 171: | Line 172: | ||
if (d ~= talent6[#talent6]) then | if (d ~= talent6[#talent6]) then | ||
-- add a comma | -- add a comma | ||
listTalents6 = listTalents6 .. ', | listTalents6 = listTalents6 .. ', ' | ||
end | end | ||
end | end | ||
-- Now the list is made add it to the table | |||
-- | infobox = infobox .. '|-\n| Related Talents:\n| style=\"text-align: right; padding: 3px;\" | ' .. listTalents3 .. ' and ' .. listTalents6 .. ' \n' | ||
infobox = infobox .. '|- | |||
end | end | ||
-- maxlevel .maxLevel | |||
if skillTable.maxLevel ~= nil then | |||
infobox = infobox .. '|-\n| Max Level:\n| style=\"text-align: right; padding: 3px;\" | Level ' .. skillTable.maxLevel .. '\n' | |||
end | |||
-- items given .itemsGiven | |||
if skillTable.itemsGiven ~= nil then | |||
infobox = infobox .. '|-\n| Items Given:\n| style=\"text-align: right; padding: 3px;\" | ' .. skillTable.itemsGiven .. '\n' | |||
end | |||
-- 'IDs' section header | -- 'IDs' section header | ||
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'IDs\'\'\'\n' | infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'IDs\'\'\'\n' | ||
Line 186: | Line 194: | ||
-- skill id (type) | -- skill id (type) | ||
infobox = infobox .. '|- valign=\"center\"\n| Item ID:\n| style=\"text-align: right; padding: 3px;\" | ' .. skillTable.skillID .. '\n' | infobox = infobox .. '|- valign=\"center\"\n| Item ID:\n| style=\"text-align: right; padding: 3px;\" | ' .. skillTable.skillID .. '\n' | ||
-- id number (type id) | |||
infobox = infobox .. '|- valign=\"center\"\n| ID Number:\n| style=\"text-align: right; padding: 3px;\" | ' .. skillTable.skillIDNum .. '\n' | |||
end | end | ||
--TALENT | --TALENT | ||
Line 208: | Line 220: | ||
end | end | ||
end | end | ||
infobox = infobox .. '|}' | infobox = infobox .. '|}' | ||
return infobox | return infobox | ||
end | end | ||
return p | return p |