Anonymous

Module:Items/ComparisonTables/Sandbox: Difference between revisions

From Melvor Idle
no edit summary
(Amended for gameData changes around resistance stats)
No edit summary
Line 13: Line 13:


local weaponTypes = {'Magic Staff', 'Magic Wand', 'Ranged Weapon', 'Weapon'}
local weaponTypes = {'Magic Staff', 'Magic Wand', 'Ranged Weapon', 'Weapon'}
local twoHandedWeaponID = '2hWeapons'


local function getAttackSpeed(item)
local function getAttackSpeed(item)
Line 22: Line 23:


local function getSlotID(slot)
local function getSlotID(slot)
-- If slot is a slot name, convert it to the slot ID instead
local slotID = Shared.getNamespacedID('melvorD', slot)
local slotID = Shared.getNamespacedID('melvorD', slot)
local slotData = GameData.getEntityByID('equipmentSlots', slotID)
local slotData = GameData.getEntityByID('equipmentSlots', slotID)
-- Validate slotID
 
if slotData == nil then
if slotData == nil then
-- Special case for 2h weapons. Assume 1h weapons otherwise.
if slot == twoHandedWeaponID then
return 'melvorD:' .. twoHandedWeaponID
end
-- slotID invalid, check if user provided a slot name
-- slotID invalid, check if user provided a slot name
slotData = GameData.getEntityByProperty('equipmentSlots', 'emptyName', slot)
slotData = GameData.getEntityByProperty('equipmentSlots', 'emptyName', slot)
Line 38: Line 43:


local function getItems(slotID)
local function getItems(slotID)
local slotNS, slotLocalID = Shared.getLocalID(slotID)
local _, slotLocalID = Shared.getLocalID(slotID)
local sortFunc = function(item)
local sortFunc = function(item)
Line 48: Line 53:
if item.golbinRaidExclusive ~= nil and item.golbinRaidExclusive then
if item.golbinRaidExclusive ~= nil and item.golbinRaidExclusive then
return false
return false
end
if not Shared.contains(item.validSlots, slotLocalID) or slotLocalID ~= twoHandedWeaponID then
return false
end
end
local isMatch = true
if slotLocalID == twoHandedWeaponID then
local sID = slotLocalID
return Items._getItemStat(item, 'isTwoHanded')
if not Shared.contains(item.validSlots, sID) then
isMatch = false
end
end
if isMatch and other ~= nil then
if slotLocalID == 'Weapon' then --For quiver slot or weapon slot, 'other' is the ammo type
if slot == 'Cape' then
return other == item.ammoTypeRequired
-- TODO Would be more reliable if based on items appearing within the relevant shop categories instead
elseif slotLocalID == 'Quiver' then
local isSkillcape = Shared.contains(item.name, 'Skillcape') or Shared.contains(item.name, 'Cape of Completion')
if other == 'Thrown' and Shared.contains({'Javelins', 'ThrowingKnives'}, item.ammoType) then
if other == 'Skillcapes' then
return true
isMatch = isSkillcape
else
elseif other == 'No Skillcapes' then
return other == item.ammoType
isMatch = not isSkillcape
end
end
if slotLocalID == 'Weapon' then --For quiver slot or weapon slot, 'other' is the ammo type
isMatch = other == item.ammoTypeRequired
elseif slotLocalID == 'Quiver' then
if other == 'Thrown' and Shared.contains({'Javelins', 'ThrowingKnives'}, item.ammoType) then
isMatch = true
else
isMatch = other == item.ammoType
end
end
end
end
end
return isMatch
 
return false
end
end


Line 210: Line 207:
header0:tag('th'):attr('colspan', 3)
header0:tag('th'):attr('colspan', 3)
:wikitext("Defence Bonus")
:wikitext("Defence Bonus")
 
-- TODO: if abyssal switch text
header0:tag('th'):wikitext("DR/AR")
header0:tag('th'):wikitext("DR/AR")
header0:tag('th') -- Empty row above "Equip Req"
local header1 = html:tag('tr'):addClass('headerRow-1')
local header1 = html:tag('tr'):addClass('headerRow-1')
2,875

edits