4,951
edits
(herbloreLevel -> level to resolve a bunch of script errors) |
Falterfire (talk | contribs) (added thieving to item sources) |
||
Line 13: | Line 13: | ||
local Shop = require('Module:Shop') | local Shop = require('Module:Shop') | ||
local Monsters = require('Module:Monsters') | local Monsters = require('Module:Monsters') | ||
local GatheringSkills = require('Module:Skills/Gathering') | |||
-- Implements overrides for sources which cannot be obtained from game data | -- Implements overrides for sources which cannot be obtained from game data | ||
Line 438: | Line 439: | ||
--Next: Can we take it from somebody else -without- killing them? | --Next: Can we take it from somebody else -without- killing them? | ||
local thiefItems = GatheringSkills.getThievingSourcesForItem(item.id) | |||
local thiefStr = '' | local thiefStr = '' | ||
if Shared.tableCount(thiefItems) > 0 then | |||
thiefStr = 'Pickpocketing: ' | |||
for i, thiefRow in pairs(thiefItems) do | |||
if thiefRow.npc == 'all' then | |||
--if 'any' is the npc, this is a rare item so just say 'Thieving level 1' | |||
thiefStr = Icons._SkillReq('Thieving', 1) | |||
else | |||
if i > 1 then thiefStr = thiefStr..', ' end | |||
thiefStr = thiefStr..Icons.Icon({thiefRow.npc, type='thieving', notext='true'}) | |||
end | |||
end | |||
end | end | ||
if string.len(thiefStr) > 0 then table.insert(lineArray, thiefStr) end | if string.len(thiefStr) > 0 then table.insert(lineArray, thiefStr) end | ||
Line 526: | Line 527: | ||
if item.type == 'Bar' or Shared.contains(Items.AltMagicProducts, item.name) then | if item.type == 'Bar' or Shared.contains(Items.AltMagicProducts, item.name) then | ||
table.insert(lineArray, Icons.Icon({"Alt. Magic", type='skill'})) | table.insert(lineArray, Icons.Icon({"Alt. Magic", type='skill'})) | ||
end | end | ||
Line 624: | Line 620: | ||
table.insert(rowPart, '\r\n|colspan="2" ') | table.insert(rowPart, '\r\n|colspan="2" ') | ||
else | else | ||
local fraction = Shared.fraction(weight, totalWeight) | |||
if Shared.contains(fraction, '%.') then | |||
--If fraction contains decimals, something screwy happened so just show only percentage | |||
--(happens sometimes with the rare thieving items) | |||
table.insert(rowPart, '\r\ncolspan="2" ') | |||
else | |||
table.insert(rowPart, '\r\n|style="text-align: right;" data-sort-value="' .. chance .. '"| ' .. Shared.fraction(weight, totalWeight) .. '\r\n|') | |||
end | |||
end | |||
if weight == -1 then | |||
--Weight of -1 means this is a weird row that has a variable percentage | |||
table.insert(rowPart, 'style="text-align: right;" data-sort-value="0"|Varies (see Thieving page)') | |||
else | |||
table.insert(rowPart, 'style="text-align: right;" data-sort-value="'.. chance .. '"|'..chance..'%') | |||
end | end | ||
return table.concat(rowPart) | return table.concat(rowPart) | ||
end | end | ||
Line 716: | Line 724: | ||
--Finally, let's try just stealing it | --Finally, let's try just stealing it | ||
local thiefType = Icons.Icon({"Thieving", type='skill'}) | local thiefType = Icons.Icon({"Thieving", type='skill'}) | ||
for i, | local thiefItems = GatheringSkills.getThievingSourcesForItem(item.id) | ||
for i, thiefRow in pairs(thiefItems) do | |||
local sourceTxt = '' | |||
if thiefRow.npc == 'all' then | |||
if | sourceTxt = "Thieving Rare Drop" | ||
else | |||
sourceTxt = Icons.Icon({thiefRow.npc, type='thieving'}) | |||
end | |||
table.insert(dropRows, {source = sourceTxt, type = thiefType, minqty = thiefRow.minQty, qty = thiefRow.maxQty, weight = thiefRow.wt, totalWeight = thiefRow.totalWt}) | |||
end | end | ||