Anonymous

Module:Items: Difference between revisions

From Melvor Idle
Fixed check for WeaponAttackType for throwing knives and javelins
(Fixed a slight issue with placement of negatives)
(Fixed check for WeaponAttackType for throwing knives and javelins)
(2 intermediate revisions by 2 users not shown)
Line 25: Line 25:
p.junkCount = 8
p.junkCount = 8
--Items (aside from bars & gems) which can be created via Alt Magic
--Items (aside from bars & gems) which can be created via Alt Magic
local AltMagicProducts = {'Rune Essence', 'Bones', 'Holy Dust'}
p.AltMagicProducts = {'Rune Essence', 'Bones', 'Holy Dust'}
--The kinds of gloves with cost & charges
--The kinds of gloves with cost & charges
p.GloveTable = {['Cooking Gloves'] = {cost=50000, charges=500},
p.GloveTable = {['Cooking Gloves'] = {cost=50000, charges=500},
Line 215: Line 215:


function p._getWeaponAttackType(item)
function p._getWeaponAttackType(item)
   if item.isEquipment == true and item.validSlots ~= nil and Shared.contains(item.validSlots, 'Weapon') then
   if item.isEquipment == true and (item.validSlots ~= nil and Shared.contains(item.validSlots, 'Weapon')) or
  (item.occupiesSlots ~= nil  and Shared.contains(item.occupiesSlots, 'Weapon')) then
     if Shared.contains({'melee', 'ranged', 'magic'}, item.attackType) then
     if Shared.contains({'melee', 'ranged', 'magic'}, item.attackType) then
       local iconType = item.attackType ~= 'melee' and 'skill' or nil
       local iconType = item.attackType ~= 'melee' and 'skill' or nil
Line 250: Line 251:
     if potion ~= nil then
     if potion ~= nil then
       table.insert(resultPart, '\r\n|-')
       table.insert(resultPart, '\r\n|-')
       table.insert(resultPart, '\r\n|'..Icons.Icon({tierName, type='item', notext='true', size='60'}))
       table.insert(resultPart, '\r\n|'..Icons.Icon({tierName, type='item', notext=true, size='60'}))
       table.insert(resultPart, '||'..'[['..tierName..'|'..tier..']]')
       table.insert(resultPart, '||'..Icons.Icon({tierName, tier, type='item', noicon=true}))
       table.insert(resultPart, '||'..potion.potionCharges..'||'..potion.description)
       table.insert(resultPart, '||'..potion.potionCharges..'||'..potion.description)
     end
     end
Line 361: Line 362:
   table.insert(resultPart, '!Skillcape!!Name!!Effect')
   table.insert(resultPart, '!Skillcape!!Name!!Effect')
   table.insert(resultPart, '\r\n|-\r\n|'..Icons.Icon({cape.name, type='item', size='60', notext=true}))
   table.insert(resultPart, '\r\n|-\r\n|'..Icons.Icon({cape.name, type='item', size='60', notext=true}))
   table.insert(resultPart, '||[['..cape.name..']]||'..cape.description)
   table.insert(resultPart, '||'..Icons.Icon({cape.name, type='item', noicon=true})..'||'..cape.description)
   table.insert(resultPart, '\r\n|}')
   table.insert(resultPart, '\r\n|}')
   return table.concat(resultPart)
   return table.concat(resultPart)