Module:Items: Difference between revisions

Formatting fixes
(Fixed thing with p.getEquipmentTable)
(Formatting fixes)
Line 395: Line 395:
   --One header row down, one to go
   --One header row down, one to go
   result = result..'\r\n|-class="headerRow-1"'
   result = result..'\r\n|-class="headerRow-1"'
   result = result..'!style="padding:0 1em 0 0.5em;"|Item'
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|Item'
   --Weapons have Attack Speed here
   --Weapons have Attack Speed here
   if isWeaponType then
   if isWeaponType then
     result = result..'!style="padding:0 1em 0 0.5em;"|Attack Speed'
     result = result..'\r\n!style="padding:0 1em 0 0.5em;"|Attack Speed'
   end
   end
   --Attack bonuses
   --Attack bonuses
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Attack', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Attack', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Strength', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Strength', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})
   --Strength bonuses
   --Strength bonuses
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Strength', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Strength', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})
   --Defence bonuses
   --Defence bonuses
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})
   --Damage Reduction/Defence Req for armor, 2-handed/Attack Req for weapons
   --Damage Reduction/Defence Req for armor, 2-handed/Attack Req for weapons
   if isWeaponType then
   if isWeaponType then
     result = result..'!style="padding:0 1em 0 0.5em;"|Two Handed?'
     result = result..'\r\n!style="padding:0 1em 0 0.5em;"|Two Handed?'
     result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Attack', type='skill', notext='true'})
     result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Attack', type='skill', notext='true'})
   else
   else
     result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})
     result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})
     result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})
     result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Defence', type='skill', notext='true'})
   end
   end
   --Then Ranged/Magic requirements
   --Then Ranged/Magic requirements
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Ranged', type='skill', notext='true'})
   result = result..'!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|'..Icons.Icon({'Magic', type='skill', notext='true'})
   --And finally Sources
   --And finally Sources
   result = result..'!style="padding:0 1em 0 0.5em;"|Sources'
   result = result..'\r\n!style="padding:0 1em 0 0.5em;"|Sources'


   --And with all the header out of the way, finally time to actually build the table itself.
   --And with all the header out of the way, finally time to actually build the table itself.
Line 437: Line 437:
         result = result..'\r\n|-'
         result = result..'\r\n|-'
         result = result..'\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|'..Icons.Icon({item.name, type='item'})
         result = result..'\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|'..Icons.Icon({item.name, type='item'})
         result = result..'| style ="text-align: right;padding: 0 0.5em 0 0;" |'..Shared.formatnum(item.attackSpeed)
         result = result..'\r\n| style ="text-align: right;padding: 0 0.5em 0 0;" |'..Shared.formatnum(item.attackSpeed)
         for j, statName in pairs(statColumns) do
         for j, statName in pairs(statColumns) do
           local statValue = p._getItemStat(item, statName, true)
           local statValue = p._getItemStat(item, statName, true)
Line 465: Line 465:
         end
         end
         --Finally, the Sources
         --Finally, the Sources
         result = result..'| style ="text-align: right;white-space: nowrap;padding: 0 0.5em 0 0.5em;" |'
         result = result..'\r\n| style ="text-align: right;white-space: nowrap;padding: 0 0.5em 0 0.5em;" |'
         result = result..p._getItemSources(item)
         result = result..p._getItemSources(item)
       end
       end
Line 481: Line 481:
           result = result..'\r\n| style ="text-align: right;padding: 0 0.5em 0 0;'
           result = result..'\r\n| style ="text-align: right;padding: 0 0.5em 0 0;'
           if statValue > 0 then
           if statValue > 0 then
             result = result..'color:lightgreen;'
             result = result..'background-color:lightgreen;'
           elseif statValue < 0 then
           elseif statValue < 0 then
             result = result..'color:lightpink;'
             result = result..'background-color:lightpink;'
           end
           end
           result = result..'"|'..Shared.formatnum(statValue)
           result = result..'"|'..Shared.formatnum(statValue)
Line 501: Line 501:
         end
         end
         --Finally, the Sources
         --Finally, the Sources
         result = result..'| style ="text-align: right;white-space: nowrap;padding: 0 0.5em 0 0.5em;" |'
         result = result..'\r\n| style ="text-align: right;white-space: nowrap;padding: 0 0.5em 0 0.5em;" |'
         result = result..p._getItemSources(item)
         result = result..p._getItemSources(item)
       end
       end