Anonymous

Module:Items/UseTables: Difference between revisions

From Melvor Idle
_getItemUses: Ensure 'All skills' is displayed before any skills
(Add stealth and releasable souls)
(_getItemUses: Ensure 'All skills' is displayed before any skills)
 
Line 132: Line 132:
end
end


if skillID == nil and not otherUses[useName] then
if skillID == nil and not otherUses[useName] then
otherUses[useName] = true
otherUses[useName] = true
end
end
end
end
local hasUse = function(useName)
local hasUse = function(useName)
local skillID = Constants.getSkillID(useName) or (Constants.getSkillName(useName) ~= nil and useName)
local skillID = Constants.getSkillID(useName)
if skillID == nil and Constants.getSkillName(useName) ~= nil then
skillID = useName
end
if skillID ~= nil then
if skillID ~= nil then
return (skillUses[skillID] ~= nil) or false
return (skillUses[skillID] ~= nil) or false
Line 407: Line 410:
local useArray = {}
local useArray = {}
local prefix, delim = asList and '* ' or '', asList and '\r\n' or '<br/>'
local prefix, delim = asList and '* ' or '', asList and '\r\n' or '<br/>'
-- Always place 'All skills' use before any skills
if hasUse('AllSkills') then
table.insert(useArray, prefix .. (otherUseText.AllSkills or 'AllSkills'))
otherUses.AllSkills = nil
end
for skillID, skillName in Shared.spairs(skillUses, function(t, a, b) return t[a] < t[b] end) do
for skillID, skillName in Shared.spairs(skillUses, function(t, a, b) return t[a] < t[b] end) do
table.insert(useArray, prefix .. Icons.Icon({skillName, type='skill'}))
table.insert(useArray, prefix .. Icons.Icon({skillName, type='skill'}))