17,481
edits
m (Fix attack speed handling) |
(Add two-handed indicator column for weapon tables) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 23: | Line 23: | ||
local slotOverrides = { | local slotOverrides = { | ||
['Enhancement'] = 'melvorD:Enhancement' | ['Enhancement'] = 'melvorD:Enhancement' | ||
} | } | ||
Line 95: | Line 94: | ||
for _, slotLocalID in ipairs(item.validSlots) do | for _, slotLocalID in ipairs(item.validSlots) do | ||
local newSlotID = slotLocalID | local newSlotID = slotLocalID | ||
-- Classify javelins and throwing knives as weapons | -- Classify javelins and throwing knives as weapons | ||
if slotLocalID == 'Quiver' and Shared.contains({'Javelins', 'ThrowingKnives'}, item.ammoType) then | |||
newSlotID = 'Weapon' | newSlotID = 'Weapon' | ||
-- Combine all enhancements | -- Combine all enhancements | ||
elseif Shared.contains({'Enhancement1', 'Enhancement2', ' | elseif Shared.contains({'Enhancement1', 'Enhancement2', 'Enhancement3'}, slotLocalID) then | ||
newSlotID = 'Enhancement' | newSlotID = 'Enhancement' | ||
end | end | ||
equipEntry.slots[newSlotID] = true | equipEntry.slots[newSlotID] = true | ||
end | end | ||
equipEntry.isWeapon = equipEntry.slots['Weapon | equipEntry.isWeapon = equipEntry.slots['Weapon'] or Shared.contains(occupiesSlots, 'Weapon') | ||
-- Determine the style of the item (Melee, Ranged, Magic, Other) | -- Determine the style of the item (Melee, Ranged, Magic, Other) | ||
Line 327: | Line 323: | ||
:toTable() | :toTable() | ||
local isWeapon = (slot == 'Weapon | local isWeapon = (slot == 'Weapon') | ||
local itemColspan = 3 | local itemColspan = (isWeapon and 5) or 3 | ||
local html = mw.html.create('table') | local html = mw.html.create('table') | ||
Line 352: | Line 347: | ||
header1:tag('th'):wikitext('DLC') | header1:tag('th'):wikitext('DLC') | ||
if isWeapon == true then | if isWeapon == true then | ||
header1:tag('th'):wikitext('Two<br>Handed') | |||
header1:tag('th'):wikitext('Attack<br>Speed') | header1:tag('th'):wikitext('Attack<br>Speed') | ||
end | end | ||
Line 388: | Line 384: | ||
:attr('data-sort-value', Icons.getExpansionID(item.id)) | :attr('data-sort-value', Icons.getExpansionID(item.id)) | ||
-- Add attack speed. | -- Add two-handed & attack speed. | ||
if isWeapon == true then | if isWeapon == true then | ||
local twoHandText = (Items._getItemStat(item, 'isTwoHanded') and 'Yes') or 'No' | |||
row:tag('td'):wikitext(twoHandText) | |||
:css('text-align', 'center') | |||
local atkSpeed = Items._getItemStat(item, 'attackSpeed') or 0 | local atkSpeed = Items._getItemStat(item, 'attackSpeed') or 0 | ||
if atkSpeed > 0 then | if atkSpeed > 0 then | ||
Line 468: | Line 468: | ||
return p.getEquipmentTable(itemList) | return p.getEquipmentTable(itemList) | ||
end | end | ||
end | end | ||
Line 630: | Line 584: | ||
local PR = item.providedRunes | local PR = item.providedRunes | ||
table.insert(resultPart, '\r\n|-') | table.insert(resultPart, '\r\n|-') | ||
table.insert(resultPart, '\r\n|style="text-align: | table.insert(resultPart, '\r\n|style="text-align: center;"|'..Icons.Icon({item.name, type='item', size=50, notext=true})) | ||
table.insert(resultPart, '\r\n|' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true})) | table.insert(resultPart, '\r\n|' .. Icons.getExpansionIcon(item.id) .. Icons.Icon({item.name, type='item', noicon=true})) | ||
local runeLines = {} | local runeLines = {} |