Module:Inventory: Difference between revisions

295 bytes added ,  20:20, 5 October 2021
support 'piercing' PV arrow in inventory list
mNo edit summary
(support 'piercing' PV arrow in inventory list)
Line 25: Line 25:
end
end


local result = cargo.query('ItemsTable=IT,GeneralData=GD',
local result = cargo.query('ItemsTable=IT,GeneralData=GD,MissileWeaponData=MWD',
'PlainName,Vibro,MaxPV,BasePV,Damage,GD.JoinKey=Page',
'PlainName,Vibro,MaxPV,BasePV,Damage,PenetratingAmmo,GD.JoinKey=Page',
{ where='(GD._pageNamespace="0" OR GD._pageNamespace="10002") AND GD.ObjectID="' .. objname .. '"',
{ where='(GD._pageNamespace="0" OR GD._pageNamespace="10002") AND GD.ObjectID="' .. objname .. '"',
default='0',
default='0',
limit='1',
limit='1',
join='GD.JoinKey=IT.JoinKey'} )
join='GD.JoinKey=IT.JoinKey,GD.JoinKey=MWD.JoinKey'} )


if not next(result) then
if not next(result) then
Line 42: Line 42:
--[If damage, return weapon html that specifies damage, PV and max PV]--
--[If damage, return weapon html that specifies damage, PV and max PV]--


local damage= result[1]['Damage']
local damage = result[1]['Damage']
local piercingTemplate = ''
if result[1]['PenetratingAmmo'] ~= nil and result[1]['PenetratingAmmo'] == '1' then
  piercingTemplate = frame:expandTemplate{title='PV', args={'pierce'}}
else
  piercingTemplate = frame:expandTemplate{title='PV'}
end


if damage ~= nil and damage ~= ''  then
if damage ~= nil and damage ~= ''  then
Line 63: Line 69:
                   :addClass('qud-inline-damage')
                   :addClass('qud-inline-damage')
                   :wikitext(frame:expandTemplate{title='Heart'} .. '<span class="qud-inline-damage">' ..  
                   :wikitext(frame:expandTemplate{title='Heart'} .. '<span class="qud-inline-damage">' ..  
                     damage .. '</span>'..frame:expandTemplate{title='PV'} ..  
                     damage .. '</span> '.. piercingTemplate  ..  
                     '<span class="qud-inline-pv">' .. pv ..'</span>' .. pvstr) )
                     '<span class="qud-inline-pv">' .. pv ..'</span>' .. pvstr) )
end
end