Module:Builder/Data/Formatting

--**************************************************** --** Contains information on formatting for        ** --** tooltips, cards, and tables for each element  ** --** element type (i.e., .t value)                 ** --****************************************************

local h = mw.loadData('Module:Builder/Data/Header') -- Element types local t = h.t -- research types --local rt = h.rt -- local stat types --local st = h.st -- local strategic resourse types --local sr = h.sr -- local tip types local tip = h.tip

--**************************************************** --** Tip Defaults by Type                          ** --** Individual elements can override these        ** --** Only need to modify when adding new Types     ** --** to the Builder/Data/Header                    ** --**************************************************** local tipDefaults = { default = { text = '< >', link = '< >', tip = tip.Card}, [t.c] = { text = '< >', link = '< >', tip = tip.Concept}, [t.wm] = { text = '< >', link = 'Weapon_Mods#< >', tip = tip.Card }, [t.sh] = { text = '< >', link = 'Shields', tip = tip.Card}, [t.am] = { text = '< >', link = 'Armor', tip = tip.Card}, [t.b] = { text = '< >', link = 'Weapons#Beam Weapons', tip = tip.Card}, [t.k] = { text = '< >', link = 'Weapons#Kinetic Weapons', tip = tip.Card}, [t.m] = { text = '< >', link = 'Weapons#Missiles', tip = tip.Card}, [t.t] = { text = '< >', link = 'Weapons#Torpedoes', tip = tip.Card}, [t.p] = { text = '< >', link = 'Buildings#< >', tip = tip.Card}, [t.e] = { text = '< >', link = 'Buildings#< >', tip = tip.Card}, [t.w] = { text = '< >', link = 'Buildings#< >', tip = tip.Card}, [t.o] = { text = '< >', link = 'Buildings#< >', tip = tip.Card}, [t.sss] = { text = '< >', link = 'Ship Special Systems#< >', tip = tip.Card}, [t.hull] = { text = '< >', link = 'Ship Design#< >', tip = tip.Card}, [t.sc] = { text = '< >', link = 'Scanners#< >', tip = tip.Card}, [t.tar] = { text = '< >', link = 'Targeting Algorithms#< >', tip = tip.Card}, [t.skill] = { text = '< >', link = 'Leader Secondary Skills#< >', tip = tip.Card, image = false}, [t.trait] = { text = '< >', link = 'Leader Traits#< >', tip = tip.Card, image = false}, -- Add new default tip types here }

--**************************************************** --** Stat Lines for Info Cards                     ** --** For types that use info cards (like  techs),  ** --** defines the line(s) that will appear between  ** --** the Name and Notes. ** --** Values in {!x!} will be replaced by the       ** --** corresponding value in the element, extracting** --** values specific to that type. ** --**************************************************** local statTech = '{!t!} | {!rt!} {!rl!}{!sr!}' local statWM = 'Weapon Mod | {!mn!} | {!sp!} ' local statBeam = '{!md!}} | {!d!}  | {!sp!}  | Mods: {!wm!}' local statWeapon = '{!d!} | {!sp!}  Mods: {!wm!}' local statShield = ': {!ab!} | : {!blk!}' local statArmor = 'Points per Hull Size: {!ap!} | : +{!gcb!}' local statBuilding = '{!cc!} | {!mt!} ' local statHull = 'Size: {!mult!} | {!sp!} | {!cc!}}  | Def: {!def!}' local statTargeting = 'Attack: {!att!}' local statScanner = 'Attack: {!att!} | Range: {!r!}'

--**************************************************** --** Need to assign the Stat Lines defined above   ** --** to specific types here--this is to permit     ** --** multiple types to use the same State Line     ** --**************************************************** local statLines = { default = statTech, [t.wm] = statWM, [t.sh] = statTech .. ' ' .. statShield, [t.am] = statTech .. ' ' .. statArmor, [t.b] = statTech .. ' ' .. statBeam, [t.k] = statTech .. ' ' .. statWeapon, [t.m] = statTech .. ' ' .. statWeapon, [t.b] = statTech .. ' ' .. statWeapon, [t.p] = statTech .. ' | ' .. statBuilding, [t.e] = statTech .. ' | ' .. statBuilding, [t.w] = statTech .. ' | ' .. statBuilding, [t.hull] = statHull, [t.tar] = statTech .. ' | ' .. statTargeting, [t.sc] = statTech .. ' | ' .. statScanner, [t.skill] = '{!leaderType!} Leader Skill | {!skillType!}', [t.trait] = '{!traitType!} Leader Trait' }

--**************************************************** --** Definitions for each type used in buildTable** --**                                               ** --**  Row values in {!x!} will be replaced by       ** --** by values in the element with that key. ** --**                                               ** --**  Default sorting is by Research level but can  ** --** be overridden with the sort= key              ** --**************************************************** local tdDefault = {header = {'Tech', 'Tree', 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}{!sr!}', '{!notes!}'} } local tdShield = {header = {'Shield', 'Tree', , }, row = {'{!key!}', '{!rt!} {!rl!}{!sr!}', '{!ab!}', '{!blk!}'}} local tdArmor = {header = {'Armor', 'Tree', , }, row = {'{!key!}', '{!rt!} {!rl!}{!sr!}', '{!ap!}', '{!gcb!}'} } local tdWM = {header = {'Weapon Mod', , , 'Notes'}, row = {'{!n!} ({!key!})', '{!mn!}', '{!sp!}', '{!notes!}'}, sortby = {'mn', 'key' }} local tdBeam = {header = {'Weapon', 'Tree', , , '', 'Mods', 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}{!sr!}', '{!md!}', '{!d!}', '{!sp!}', '{!wm!}', '{!notes!}'} } local tdWeapon = {header = {'Weapon', 'Tree', , , 'Mods', 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}{!sr!}', '{!d!}', '{!sp!}', '{!wm!}', '{!notes!}'} } local tdBuilding = {header = {'Building', 'Tree', , , 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}{!sr!}', '{!cc!}', '{!mt!}', '{!notes!}'}, sortby = {'key'}} local tdWonder = {header = {'Wonder', 'Tree', , , 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}{!sr!}', '{!cc!}', '{!mt!}', '{!notes!}'}, sortby = {'key'}} local tdSpecial = {header = {'Ship Special System', 'Tree', '', 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}{!sr!}', '{!sp!}', '{!notes!}'}, sortby = {'key'}} local tdHull = { header = {'Hull', 'Size', , , 'Def', 'Notes'}, row = {'{!key!}', '{!mult!}', '{!sp!}', '{!cc!}', '{!def!}', '{!notes!}'}, sortby = {'mult'}} local tdTargeting = {header = {'Alogrithm', 'Tree', 'Attack', 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}', '{!att!}', '{!notes!}'} } local tdScanner = {header = {'Scanner', 'Tree', 'Attack', 'Range', 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}', '{!att!}', '{!r!}', '{!notes!}'} } local tdTargetingShort = {header = {'Algorithm', 'Tree', 'Attack', }, row = {'{!short!}', '{!rt!} {!rl!}', '{!att!}'}, subclass = 'igsCenterLast'} local tdScannerShort = {header = {'Scanner', 'Tree', 'Attack', 'Range'}, row = {'{!short!}', '{!rt!} {!rl!}', '{!att!}', '{!r!}'}, subclass = 'igsCenterLast'} local tdStrategic = {header = {'Tech', 'Tree', 'Type', 'Notes'}, row = {'{!key!}', '{!rt!} {!rl!}', '{!t!}', '{!notes!}'} }

--**************************************************** --** Need to assign the Table Defs defined above   ** --** to specific types here--this is to permit     ** --** multiple types to use the same Table Def      ** --**************************************************** local tableDefs = { default = tdDefault, [t.wm] = tdWM, [t.sh] = tdShield, [t.am] = tdArmor, [t.b] = tdBeam, [t.k] = tdWeapon, [t.m] = tdWeapon, [t.t] = tdWeapon, [t.p] = tdBuilding, [t.e] = tdBuilding, [t.w] = tdWonder, [t.sss]= tdSpecial, [t.hull]= tdHull, [t.tar] = tdTargeting, [t.tar .. '-Short'] = tdTargetingShort, [t.sc] = tdScanner, [t.sc .. '-Short'] = tdScannerShort, ['Strategic'] = tdStrategic, }

--**************************************************** --** Definitions for each type used in repeatItem** --**                                               ** --**  Row values in {!x!} will be replaced by       ** --** by values in the element with that key. ** --**                                               ** --**  Default sorting is by Research level but can  ** --** be overridden with the sort= key              ** --**************************************************** local templateSkills = { def = ' ' ..        '  ' ..        ' ' ..        ' {!key!} ' .. '{!leaderType!} Leaders | Type: {!skillType!}' .. '{!notes!}' .. '{!description!}' .. '   ',    sortby = {'key'} }

local templateTraits = { def = ' ' ..        '  ' ..        ' ' ..        ' {!key!} ' .. 'Type: {!traitType!}' .. '{!notes!}' .. '{!description!}' .. '   ',    sortby = {'key'} }

--**************************************************** --** Need to assign the templates defined above    ** --** to specific types here--this is to permit     ** --** multiple types to use the same template       ** --**************************************************** local templates = { ['Skills'] = templateSkills, ['Traits'] = templateTraits }

--**************************************************** --** Just gathers the above into 1 table to pass   ** --** back                                          ** --**************************************************** local p = { statLines = statLines, tableDefs = tableDefs, tipDefaults = tipDefaults, templates = templates }

return p