12,808
edits
(getMasteryTokenTable: Correct values for change in game logic & extend to display both base game and TotH values) |
(getThievingSourcesForItem: Expose further information in return value) |
||
(One intermediate revision by the same user not shown) | |||
Line 142: | Line 142: | ||
if drop.id == itemID then | if drop.id == itemID then | ||
for k, npcID in ipairs(area.npcIDs) do | for k, npcID in ipairs(area.npcIDs) do | ||
areaNPCs[npcID] = drop.quantity | areaNPCs[npcID] = { qty = drop.quantity, area = area } | ||
end | end | ||
break | break | ||
Line 162: | Line 162: | ||
end | end | ||
if dropWt > 0 then | if dropWt > 0 then | ||
table.insert(resultArray, {npc = npc.name, minQty = dropQty.min, maxQty = dropQty.max, wt = dropWt * SkillData.Thieving.itemChance, totalWt = totalWt * 100, level = npc.level, npcID = npc.id}) | table.insert(resultArray, {npc = npc.name, minQty = dropQty.min, maxQty = dropQty.max, wt = dropWt * SkillData.Thieving.itemChance, totalWt = totalWt * 100, level = npc.level, npcID = npc.id, type = 'npc'}) | ||
end | end | ||
--Chance of -1 on unique drops is to indicate variable chance | --Chance of -1 on unique drops is to indicate variable chance | ||
if npc.uniqueDrop ~= nil and npc.uniqueDrop.id == itemID then | if npc.uniqueDrop ~= nil and npc.uniqueDrop.id == itemID then | ||
table.insert(resultArray, {npc = npc.name, minQty = npc.uniqueDrop.quantity, maxQty = npc.uniqueDrop.quantity, wt = -1, totalWt = -1, level = npc.level, npcID = npc.id}) | table.insert(resultArray, {npc = npc.name, minQty = npc.uniqueDrop.quantity, maxQty = npc.uniqueDrop.quantity, wt = -1, totalWt = -1, level = npc.level, npcID = npc.id, type = 'npcUnique'}) | ||
end | end | ||
local areaNPC = areaNPCs[npc.id] | |||
table.insert(resultArray, {npc = npc.name, minQty = | if areaNPC ~= nil then | ||
table.insert(resultArray, {npc = npc.name, minQty = areaNPC.qty, maxQty = areaNPC.qty, wt = SkillData.Thieving.baseAreaUniqueChance, totalWt = 100, level = npc.level, npcID = npc.id, area = areaNPC.area, type = 'areaUnique'}) | |||
end | end | ||
end | end | ||
Line 178: | Line 179: | ||
if drop.itemID == itemID then | if drop.itemID == itemID then | ||
if drop.npcs == nil then | if drop.npcs == nil then | ||
table.insert(resultArray, {npc = 'all', minQty = 1, maxQty = 1, wt = 1, totalWt = Shared.round2(1/(drop.chance/100), 0), level = 1, npcID = itemID}) | table.insert(resultArray, {npc = 'all', minQty = 1, maxQty = 1, wt = 1, totalWt = Shared.round2(1/(drop.chance/100), 0), level = 1, npcID = itemID, type = 'generalRare'}) | ||
else | else | ||
for j, npcID in ipairs(drop.npcs) do | for j, npcID in ipairs(drop.npcs) do | ||
local npc = p.getThievingNPCByID(npcID) | local npc = p.getThievingNPCByID(npcID) | ||
if npc ~= nil then | if npc ~= nil then | ||
table.insert(resultArray, {npc = npc.name, minQty = 1, maxQty = 1, wt = 1, totalWt = Shared.round2(1/(drop.chance/100), 0), level = npc.level, npcID = npc.id}) | table.insert(resultArray, {npc = npc.name, minQty = 1, maxQty = 1, wt = 1, totalWt = Shared.round2(1/(drop.chance/100), 0), level = npc.level, npcID = npc.id, type = 'generalRare'}) | ||
end | end | ||
end | end |