17,101
edits
Falterfire (talk | contribs) (Fixed Summoning Creation XP) |
(Update for v0.21) |
||
Line 4: | Line 4: | ||
local ItemData = mw.loadData('Module:Items/data') | local ItemData = mw.loadData('Module:Items/data') | ||
local SkillData = mw.loadData('Module:Skills/data') | local SkillData = mw.loadData('Module:Skills/data') | ||
local Constants = require('Module:Constants') | |||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Magic = require('Module:Magic') | local Magic = require('Module:Magic') | ||
Line 82: | Line 82: | ||
skill = 'Herblore' | skill = 'Herblore' | ||
req = item.herbloreReq | req = item.herbloreReq | ||
--Currently using ' | --Currently using 'masteryID' as shorthand to find details, could be a better method | ||
local potionID = item. | local potionID = item.masteryID[2] | ||
local potionData = SkillData.Herblore.ItemData[potionID + 1] | local potionData = SkillData.Herblore.ItemData[potionID + 1] | ||
lvl = potionData.herbloreLevel | lvl = potionData.herbloreLevel | ||
Line 90: | Line 90: | ||
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time)) | table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time)) | ||
end | end | ||
if item. | if item.masteryID ~= nil and item.masteryID[1] == 4 then | ||
skill = 'Mining' | skill = 'Mining' | ||
lvl = SkillData.Mining.Rocks[item.masteryID[2] + 1].level | lvl = SkillData.Mining.Rocks[item.masteryID[2] + 1].level | ||
Line 184: | Line 184: | ||
local item = Items.getItemByID(cost.id) | local item = Items.getItemByID(cost.id) | ||
if item.type ~= 'Shard' then | if item.type ~= 'Shard' then | ||
local sellPrice = item.sellsFor | local sellPrice = math.max(item.sellsFor, 20) | ||
table.insert(nonShardArray, Icons.Icon({item.name, type='item', notext=true, qty=math.max(1, math.floor(recipeGPCost / sellPrice))})) | table.insert(nonShardArray, Icons.Icon({item.name, type='item', notext=true, qty=math.max(1, math.floor(recipeGPCost / sellPrice))})) | ||
end | end | ||
Line 208: | Line 207: | ||
table.insert(tables, p.buildAltMagicTable('Just Learning')) | table.insert(tables, p.buildAltMagicTable('Just Learning')) | ||
elseif item.name == 'Bones' then | elseif item.name == 'Bones' then | ||
table.insert(tables, p.buildAltMagicTable('Bone Offering')) | table.insert(tables, p.buildAltMagicTable('Bone Offering')) | ||
elseif item.name == 'Holy Dust' then | elseif item.name == 'Holy Dust' then | ||
table.insert(tables, p.buildAltMagicTable('Blessed Offering')) | table.insert(tables, p.buildAltMagicTable('Blessed Offering')) | ||
Line 268: | Line 267: | ||
if specialReq ~= nil then result = result..'<br/>'..specialReq end | if specialReq ~= nil then result = result..'<br/>'..specialReq end | ||
if req ~= nil then | if req ~= nil then | ||
result = result..'\r\n|-\r\n!style="text-align: right;"|Materials\r\n|' | result = result..'\r\n|-\r\n!style="text-align: right;"|Materials\r\n|' | ||
if type(req) == 'table' then | if type(req) == 'table' then | ||
Line 302: | Line 301: | ||
return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]" | return "ERROR: No item named "..itemName.." exists in the data module[[Category:Pages with script errors]]" | ||
end | end | ||
return p._getCreationTable(item) | return p._getCreationTable(item) | ||
end | end | ||
Line 346: | Line 345: | ||
--If this is a boss then we actually are completing dungeons for this and need to figure out which one | --If this is a boss then we actually are completing dungeons for this and need to figure out which one | ||
for j, dung in pairs(areaList) do | for j, dung in pairs(areaList) do | ||
if string.len(dungeonStr) > 0 then | if string.len(dungeonStr) > 0 then | ||
dungeonStr = dungeonStr..',' | dungeonStr = dungeonStr..',' | ||
else | else | ||
Line 483: | Line 482: | ||
--MineCheck: | --MineCheck: | ||
if item. | if item.masteryID ~= nil and item.masteryID[1] == 4 then | ||
table.insert(lineArray, Icons._SkillReq("Mining", SkillData.Mining.Rocks[item.masteryID[2] + 1].level)) | table.insert(lineArray, Icons._SkillReq("Mining", SkillData.Mining.Rocks[item.masteryID[2] + 1].level)) | ||
end | end | ||
Line 495: | Line 494: | ||
--HerbCheck: | --HerbCheck: | ||
if item. | if item.masteryID ~= nil and item.masteryID[1] == 19 then | ||
local potionData = SkillData.Herblore.ItemData[item. | local potionData = SkillData.Herblore.ItemData[item.masteryID[2] + 1].herbloreLevel | ||
table.insert(lineArray, Icons._SkillReq("Herblore", potionData)) | table.insert(lineArray, Icons._SkillReq("Herblore", potionData)) | ||
end | end | ||
Line 563: | Line 562: | ||
--Tokens are from the appropriate skill | --Tokens are from the appropriate skill | ||
if item.isToken | if item.isToken and item.skill ~= nil then | ||
table.insert(lineArray, Icons._SkillReq(Constants.getSkillName(item.skill), 1)) | |||
end | end | ||
Line 598: | Line 593: | ||
local asList = false | local asList = false | ||
local addCategories = false | local addCategories = false | ||
if frame.args ~= nil then | if frame.args ~= nil then | ||
asList = frame.args.asList ~= nil and frame.args.asList ~= '' and frame.args.asList ~= 'false' | asList = frame.args.asList ~= nil and frame.args.asList ~= '' and frame.args.asList ~= 'false' | ||
addCategories = frame.args.addCategories ~= nil and frame.args.addCategories ~= '' and frame.args.addCategories ~= 'false' | addCategories = frame.args.addCategories ~= nil and frame.args.addCategories ~= '' and frame.args.addCategories ~= 'false' | ||
Line 769: | Line 764: | ||
if Shared.tableCount(dropRows) == 0 then return '' end | if Shared.tableCount(dropRows) == 0 then return '' end | ||
table.sort(dropRows, function(a, b) | table.sort(dropRows, function(a, b) | ||
if a.weight / a.totalWeight == b.weight / b.totalWeight then | if a.weight / a.totalWeight == b.weight / b.totalWeight then | ||
return a.minqty + a.qty > b.minqty + b.qty | return a.minqty + a.qty > b.minqty + b.qty | ||
Line 897: | Line 892: | ||
local creationTable = p._getCreationTable(item) | local creationTable = p._getCreationTable(item) | ||
if string.len(creationTable) > 0 then | if string.len(creationTable) > 0 then | ||
if string.len(result) > 0 then result = result..'\r\n' end | if string.len(result) > 0 then result = result..'\r\n' end | ||
result = result..'===Creation===\r\n'..creationTable | result = result..'===Creation===\r\n'..creationTable | ||
end | end | ||
Line 936: | Line 931: | ||
result = result..'!colspan="2"|Item\r\n! Passive\r\n' | result = result..'!colspan="2"|Item\r\n! Passive\r\n' | ||
local itemArray = Items.getItems(function(item) return item. | local itemArray = Items.getItems(function(item) return item.validSlots ~= nil and Shared.contains(item.validSlots, 'Passive') end) | ||
table.sort(itemArray, function(a, b) return a.id < b.id end) | table.sort(itemArray, function(a, b) return a.id < b.id end) | ||
Line 945: | Line 940: | ||
result = result..'| '..item.description..'\r\n' | result = result..'| '..item.description..'\r\n' | ||
end | end | ||
result = result..'|}' | result = result..'|}' | ||