3,987
edits
(Attempt to fix issue with '&' in page names) |
(Added soul points to ItemBox) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 27: | Line 27: | ||
-- List of item IDs that should typically not be included within outputs, usually | -- List of item IDs that should typically not be included within outputs, usually | ||
-- because they are not fully implemented despite existing within the game data | -- because they are not fully implemented despite existing within the game data | ||
p.HiddenItems = {'melvorTotH:Meteorite_Dust'} | p.HiddenItems = {} | ||
local function populateHiddenItems() | |||
local hiddenItems = GameData.getEntities('items', | |||
function(item) | |||
return item.name == nil or Shared.contains({'melvorTotH:Meteorite_Dust'}, item.id) | |||
end | |||
) | |||
for _, item in ipairs(hiddenItems) do | |||
table.insert(p.HiddenItems, item.id) | |||
end | |||
end | |||
populateHiddenItems() | |||
function p.getItemByID(ID) | function p.getItemByID(ID) | ||
Line 39: | Line 51: | ||
function p.getItems(checkFunc) | function p.getItems(checkFunc) | ||
return GameData.getEntities('items', checkFunc) | return GameData.getEntities('items', | ||
function(obj) | |||
return not Shared.contains(p.HiddenItems, obj.id) and checkFunc(obj) | |||
end | |||
) | |||
end | end | ||
Line 191: | Line 207: | ||
end | end | ||
local result = p._getItemStat(item, StatName, ZeroIfNil) | local result = p._getItemStat(item, StatName, ZeroIfNil) | ||
if formatNum then result = | if formatNum then result = Num.formatnum(result) end | ||
return result | return result | ||
end | end | ||
Line 378: | Line 394: | ||
val1, val2 = levelReqs[1][skillID] or 0, levelReqs[2][skillID] or 0 | val1, val2 = levelReqs[1][skillID] or 0, levelReqs[2][skillID] or 0 | ||
if val1 ~= val2 then | if val1 ~= val2 then | ||
table.insert(changeArray, | table.insert(changeArray, Num.numStrWithSign(val1 - val2) .. ' ' .. Icons.Icon({skillData.data.name, type='skill', notext=true}) .. (statDef.suffix or '')) | ||
end | end | ||
end | end | ||
Line 385: | Line 401: | ||
val1, val2 = equipStats[1][statDef.stat] or 0, equipStats[2][statDef.stat] or 0 | val1, val2 = equipStats[1][statDef.stat] or 0, equipStats[2][statDef.stat] or 0 | ||
if val1 ~= val2 then | if val1 ~= val2 then | ||
table.insert(changeArray, | table.insert(changeArray, Num.numStrWithSign(val1 - val2) .. (statDef.suffix or '')) | ||
end | end | ||
end | end | ||
Line 457: | Line 473: | ||
-- For Summoning combat familiars, show the max hit | -- For Summoning combat familiars, show the max hit | ||
if item.equipmentStats ~= nil and item.equipmentStats.summoningMaxhit ~= nil then | if item.equipmentStats ~= nil and item.equipmentStats.summoningMaxhit ~= nil then | ||
table.insert(resultPart, "\r\n|-\r\n|'''Max Hit:''' " .. | table.insert(resultPart, "\r\n|-\r\n|'''Max Hit:''' " .. Num.formatnum(item.equipmentStats.summoningMaxhit * 10)) | ||
end | end | ||
--For potions, show the number of charges | --For potions, show the number of charges | ||
Line 470: | Line 486: | ||
if item.prayerPoints ~= nil then | if item.prayerPoints ~= nil then | ||
table.insert(resultPart, "\r\n|-\r\n|'''"..Icons.Icon({'Prayer', type='skill'}).." Points:''' "..item.prayerPoints) | table.insert(resultPart, "\r\n|-\r\n|'''"..Icons.Icon({'Prayer', type='skill'}).." Points:''' "..item.prayerPoints) | ||
end | |||
if item.soulPoints ~= nil then | |||
table.insert(resultPart, "\r\n|-\r\n|'''"..Icons.Icon({'Prayer', 'Soul', type='item', img='Lesser Soul'}).." Points:''' "..item.soulPoints) | |||
end | end | ||
--For items that provide runes, show which runes are provided | --For items that provide runes, show which runes are provided | ||
Line 629: | Line 648: | ||
result = '\r\n!style="text-align:right;"| '..skillIcon..pre..' Level Required' | result = '\r\n!style="text-align:right;"| '..skillIcon..pre..' Level Required' | ||
result = result..'\r\n|style="text-align:right;"| '..req.level | result = result..'\r\n|style="text-align:right;"| '..req.level | ||
elseif req.type == "DungeonCompletion" then | elseif (req.type == "DungeonCompletion" or req.type == "AbyssDepthCompletion") then | ||
local | local reqDefns = { | ||
["DungeonCompletion"] = { | |||
["dataKey"] = 'dungeons', | |||
["IDKey"] = 'dungeonID', | |||
["imgType"] = 'dungeon' | |||
}, | |||
["AbyssDepthCompletion"] = { | |||
["dataKey"] = 'abyssDepths', | |||
["IDKey"] = 'depthID', | |||
["imgType"] = 'combatArea' | |||
} | |||
} | |||
local reqDefn = reqDefns[req.type] | |||
if reqDefn ~= nil then | |||
local area = GameData.getEntityByID(reqDefn.dataKey, req[reqDefn.IDKey]) | |||
if area == nil then | |||
result = '\r\n!style="text-align:right;" colspan=2|' .. Shared.printError('Invalid area for requirement type "' .. req.type .. '"') | |||
else | |||
local areaIcon = Icons.Icon({area.name, type=reqDefn.imgType, notext=true}) | |||
result = '\r\n!style="text-align:right;"| '..areaIcon..' Completions' | |||
result = result..'\r\n|style="text-align:right;"| '..Num.formatnum(req.count) | |||
end | |||
end | |||
elseif req.type == "Completion" then | elseif req.type == "Completion" then | ||
local ns = GameData.getEntityByName('namespaces', req.namespace) | local ns = GameData.getEntityByName('namespaces', req.namespace) | ||
Line 674: | Line 712: | ||
table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"| Attack Speed') | table.insert(resultPart, '\r\n|-\r\n!style="text-align:right;"| Attack Speed') | ||
table.insert(resultPart, '\r\n|style="text-align:right;"| ' .. | table.insert(resultPart, '\r\n|style="text-align:right;"| ' .. Num.round(p._getItemStat(item, 'attackSpeed', true) / 1000, 3, 1) .. 's') | ||
table.insert(resultPart, '\r\n!style="text-align:right;"| ' .. ico['Defence'] .. ' Defence Bonus') | table.insert(resultPart, '\r\n!style="text-align:right;"| ' .. ico['Defence'] .. ' Defence Bonus') | ||
table.insert(resultPart, '\r\n|style="text-align:right;"| ' .. p._getItemStat(item, 'meleeDefenceBonus', true)) | table.insert(resultPart, '\r\n|style="text-align:right;"| ' .. p._getItemStat(item, 'meleeDefenceBonus', true)) |