- Created with Docbunto
See Also
Code
--This will eventually contain data for various weapons
--For use in automating assorted wiki functions and to reduce the number of updates needed
--But starting with Melee Stances
local p = {}
local WeaponModule = require( 'Module:Weapons' )
local Icon = require( "Module:Icon" )
local Shared = require( "Module:Shared" )
local function buildItemText(Item)
if(Item == nil) then
return " "
end
if(Item.Type == "Resource") then
return Icon._Resource(Item.Name, nil, 'x32').."<br/>"..Shared.formatnum(Item.Count)
end
end
function p.buildWeaponCostBox(frame)
local WeaponName = frame.args ~= nil and frame.args[1] or frame
local Weapon = WeaponModule.getWeapon(WeaponName)
if(Weapon == nil) then
return "ERROR: "..WeaponName.." not found"
elseif(Weapon.Cost == nil) then
return "ERROR: "..WeaponName.." does not have Cost data"
end
local rowStart = '\n| rowspan="2" style="height:50px; width:50px;" |'
local smallPart = '\n| style="text-align:left; padding: 0em 0.25em;" |'
local lowRow = '\n| colspan="3" |<small>'
if(Weapon.Cost.Parts ~= nil) then
local foundryTable = '{| class="foundrytable" style="float:left;margin:auto"'
foundryTable = foundryTable..'\n!colspan=6|[[Foundry|Manufacturing]] Requirements'
foundryTable = foundryTable..'\n|-'
foundryTable = foundryTable..rowStart
if(Weapon.Cost.Credits ~= nil) then
foundryTable = foundryTable..Icon._Item("Credits").."<br/>"..Shared.formatnum(Weapon.Cost.Credits)
else
foundryTable = foundryTable..'N/A'
end
for i=1, 4 do
foundryTable = foundryTable..rowStart..buildItemText(Weapon.Cost.Parts[i])
end
foundryTable = foundryTable..smallPart
if(Weapon.Cost.Time ~= nil) then
foundryTable = foundryTable.."Time: "..Weapon.Cost.Time.." hrs"
else
foundryTable = foundryTable..'N/A'
end
foundryTable = foundryTable..'\n|-'..smallPart
if(Weapon.Cost.Rush ~= nil) then
foundryTable = foundryTable..'Rush: '..Icon._Item("Platinum",nil, 20)..' '..Weapon.Cost.Rush
else
foundryTable = foundryTable..'N/A'
end
foundryTable = foundryTable..'\n|-'..lowRow..Icon._Item("Market", "text", 22)..' Price: '..Icon._Item("Platinum", nil, 20)..' '
if(Weapon.Cost.MarketCost ~= nil) then
foundryTable = foundryTable..Weapon.Cost.MarketCost
else
foundryTable = foundryTable.."N/A"
end
foundryTable = foundryTable..'</small>'..lowRow..Icon._Item("Blueprint", "text", 22)..' Price: '..Icon._Item("Credits", nil, 22)..' '
if(Weapon.Cost.BPCost ~= nil) then
foundryTable = foundryTable..Shared.formatnum(Weapon.Cost.BPCost)
else
foundryTable = foundryTable.."N/A"
end
foundryTable = foundryTable..'</small>\n|}<div style="clear:left; margin:0; padding:0;"></div>'
return foundryTable
end
end
return p