914
edits
(_getItemSourceTables, _getItemSources: Support Township trading sources) |
m (Add custom separator for ItemSources) |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local Constants = require('Module:Constants') | local Constants = require('Module:Constants') | ||
Line 12: | Line 11: | ||
local Monsters = require('Module:Monsters') | local Monsters = require('Module:Monsters') | ||
local Skills = require('Module:Skills') | local Skills = require('Module:Skills') | ||
local SourceOverrides = { | |||
['melvorAoD:EarthGolem'] = 'Earth Golem (AoD)' | |||
} | |||
function p._getCreationTable(item) | function p._getCreationTable(item) | ||
Line 43: | Line 46: | ||
['Summoning'] = { } | ['Summoning'] = { } | ||
} | } | ||
} | |||
-- Gathering skills | -- Gathering skills | ||
Line 60: | Line 63: | ||
local category = GameData.getEntityByID(skillData.categories, recipe.categoryID) | local category = GameData.getEntityByID(skillData.categories, recipe.categoryID) | ||
qty = 5 * category.harvestMultiplier | qty = 5 * category.harvestMultiplier | ||
end | end | ||
-- Action time | -- Action time | ||
Line 150: | Line 150: | ||
req = req .. '<br/>' .. (costLen == 1 and '' or 'and one of the following:<br/>') .. table.concat(otherCostArray, "<br/>'''OR''' ") | req = req .. '<br/>' .. (costLen == 1 and '' or 'and one of the following:<br/>') .. table.concat(otherCostArray, "<br/>'''OR''' ") | ||
end | end | ||
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time)) | specialReq = 'At least 1 ' .. Icons.Icon({'Summoning%23Summoning Marks', item.name, img=item.name, type='mark'}) .. ' mark discovered' | ||
table.insert(tables, p.buildCreationTable(skill, lvl, xp, req, qty, time, nil, specialReq)) | |||
-- Some items (such as Arrow shafts) have multiple recipes | -- Some items (such as Arrow shafts) have multiple recipes | ||
elseif type(recipe.alternativeCosts) == 'table' then | elseif type(recipe.alternativeCosts) == 'table' then | ||
Line 291: | Line 292: | ||
end | end | ||
function p._getItemSources(item, asList, addCategories) | function p._getItemSources(item, asList, addCategories, separator) | ||
local lineArray = {} | local lineArray = {} | ||
local categoryArray = {} | local categoryArray = {} | ||
local sep = separator or ',' | |||
--Alright, time to go through all the ways you can get an item... | --Alright, time to go through all the ways you can get an item... | ||
Line 302: | Line 304: | ||
if monster.bones ~= nil and monster.bones.itemID == item.id and Monsters._getMonsterBones(monster) ~= nil then | if monster.bones ~= nil and monster.bones.itemID == item.id and Monsters._getMonsterBones(monster) ~= nil then | ||
-- Item is a bone, and is either a shard from God dungeons or dropped by a non-boss monster with a loot table | -- Item is a bone, and is either a shard from God dungeons or dropped by a non-boss monster with a loot table | ||
isDrop = true | |||
elseif monster.barrierPercent ~= nil and 'melvorAoD:Barrier_Dust' == item.id and not Monsters._isDungeonOnlyMonster(monster) then | |||
-- Item is Barrier Dust and is not a dungeon exclusive monster | |||
isDrop = true | isDrop = true | ||
elseif monster.lootTable ~= nil then | elseif monster.lootTable ~= nil then | ||
Line 317: | Line 322: | ||
if isDrop then | if isDrop then | ||
-- Item drops when the monster is killed | -- Item drops when the monster is killed | ||
table.insert(killStrPart, Icons.Icon({ | local iconName = monster.name | ||
if SourceOverrides[monster.id] ~= nil then | |||
iconName = SourceOverrides[monster.id] | |||
end | |||
table.insert(killStrPart, Icons.Icon({iconName, type='monster', notext=true})) | |||
end | end | ||
end | end | ||
Line 342: | Line 351: | ||
if not Shared.tableIsEmpty(dungeonStrPart) then | if not Shared.tableIsEmpty(dungeonStrPart) then | ||
table.insert(lineArray, 'Completing: ' .. table.concat(dungeonStrPart, | table.insert(lineArray, 'Completing: ' .. table.concat(dungeonStrPart, sep)) | ||
end | end | ||
if not Shared.tableIsEmpty(killStrPart) then | if not Shared.tableIsEmpty(killStrPart) then | ||
table.insert(lineArray, 'Killing: ' .. table.concat(killStrPart, | table.insert(lineArray, 'Killing: ' .. table.concat(killStrPart, sep)) | ||
end | end | ||
Line 362: | Line 371: | ||
if not Shared.tableIsEmpty(lootPart) then | if not Shared.tableIsEmpty(lootPart) then | ||
table.insert(lineArray, 'Opening: ' .. table.concat(lootPart, | table.insert(lineArray, 'Opening: ' .. table.concat(lootPart, sep)) | ||
end | end | ||
Line 387: | Line 396: | ||
end | end | ||
local typeText = (catName == 'up' and 'Upgrading') or 'Downgrading' | local typeText = (catName == 'up' and 'Upgrading') or 'Downgrading' | ||
table.insert(lineArray, typeText .. ': ' .. table.concat(parts, | table.insert(lineArray, typeText .. ': ' .. table.concat(parts, sep)) | ||
end | end | ||
end | end | ||
Line 406: | Line 415: | ||
end | end | ||
if not Shared.tableIsEmpty(thiefPart) then | if not Shared.tableIsEmpty(thiefPart) then | ||
table.insert(lineArray, 'Pickpocketing: ' .. table.concat(thiefPart, | table.insert(lineArray, 'Pickpocketing: ' .. table.concat(thiefPart, sep)) | ||
end | end | ||
end | end | ||
Line 416: | Line 425: | ||
end | end | ||
if not Shared.tableIsEmpty(castPart) then | if not Shared.tableIsEmpty(castPart) then | ||
table.insert(lineArray, 'Casting: ' .. table.concat(castPart, | table.insert(lineArray, 'Casting: ' .. table.concat(castPart, sep)) | ||
end | end | ||
Line 436: | Line 445: | ||
['Summoning'] = { } | ['Summoning'] = { } | ||
} | } | ||
} | |||
-- Gathering skills | -- Gathering skills | ||
Line 498: | Line 507: | ||
if found then | if found then | ||
break | break | ||
end | |||
end | |||
-- Archaeology sources | |||
-- Digsites | |||
for i, digsite in ipairs(SkillData.Archaeology.digSites) do | |||
local found = false | |||
for artefactType, artefactItems in pairs(digsite.artefacts) do | |||
for j, itemDef in ipairs(artefactItems) do | |||
if itemDef.itemID == item.id then | |||
table.insert(lineArray, Icons._SkillReq(SkillData.Archaeology.name, digsite.level)) | |||
found = true | |||
break | |||
end | |||
end | |||
if found then | |||
break | |||
end | |||
end | |||
if found then | |||
break | |||
end | |||
end | |||
-- Museum rewards | |||
for i, museumReward in ipairs(SkillData.Archaeology.museumRewards) do | |||
if type(museumReward.items) == 'table' and Shared.contains(museumReward.items, item.id) then | |||
table.insert(lineArray, Icons.Icon('Museum')) | |||
break | |||
end | |||
end | |||
-- Cartography | |||
-- Paper | |||
for i, recipe in ipairs(SkillData.Cartography.paperRecipes) do | |||
if recipe.productId == item.id then | |||
table.insert(lineArray, Icons.Icon({SkillData.Cartography.name, type='skill'})) | |||
break | |||
end | |||
end | |||
-- POI discovery rewards | |||
for i, worldMap in ipairs(SkillData.Cartography.worldMaps) do | |||
local found = false | |||
for j, poi in ipairs(worldMap.pointsOfInterest) do | |||
if type(poi.discoveryRewards) == 'table' and type(poi.discoveryRewards.items) == 'table' then | |||
for k, itemDef in ipairs(poi.discoveryRewards.items) do | |||
if itemDef.id == item.id then | |||
-- Find level for POI hex | |||
local level = 1 | |||
local poiHex = nil | |||
local skillID = SkillData.Cartography.skillID | |||
for m, hex in ipairs(worldMap.hexes) do | |||
if hex.coordinates.q == poi.coords.q and hex.coordinates.r == poi.coords.r then | |||
for n, req in ipairs(hex.requirements) do | |||
if req.type == 'SkillLevel' and req.skillID == skillID then | |||
level = req.level | |||
break | |||
end | |||
end | |||
break | |||
end | |||
end | |||
table.insert(lineArray, Icons._SkillReq(SkillData.Cartography.name, level)) | |||
found = true | |||
break | |||
end | |||
end | |||
if found then | |||
break | |||
end | |||
end | |||
end | |||
if found then | |||
break | |||
end | |||
end | |||
-- Travel events | |||
for i, event in ipairs(SkillData.Cartography.travelEvents) do | |||
local found = false | |||
if type(event.rewards) == 'table' and type(event.rewards.items) == 'table' then | |||
for j, itemDef in ipairs(event.rewards.items) do | |||
if itemDef.id == item.id and itemDef.quantity > 0 then | |||
table.insert(lineArray, Icons.Icon({SkillData.Cartography.name, type='skill'})) | |||
found = true | |||
break | |||
end | |||
end | |||
if found then | |||
break | |||
end | |||
end | end | ||
end | end | ||
Line 558: | Line 656: | ||
end | end | ||
-- | -- General rare drops for non-combat skills | ||
-- | -- Includes items like Circlet/Jewel of Rhaelyx, Mysterious stones, Signet ring half (a), | ||
-- relics (for Ancient Relics mode) | |||
local skillIconList, subText = {}, '' | |||
for i, skillDataAll in ipairs(GameData.rawData.skillData) do | |||
local skillData = skillDataAll.data | |||
local skillName, displaySkillName = skillData.name, false | |||
local | -- All general rare drops within the Magic are for Alt. Magic | ||
if skillDataAll.skillID == 'melvorD:Magic' then | |||
skillName, displaySkillName = 'Alt. Magic', true | |||
end | end | ||
if type(skillData.rareDrops) == 'table' then | |||
for j, rareDrop in ipairs(skillData.rareDrops) do | |||
local isAltItem = (rareDrop.altItemID ~= nil and rareDrop.altItemID == item.id) | |||
if isAltItem or rareDrop.itemID == item.id then | |||
if Shared.tableIsEmpty(skillIconList) then | |||
-- Initialize subText | |||
if isAltItem then | |||
local wornItem = Items.getItemByID(rareDrop.itemID) | |||
subText = ' while wearing ' .. Icons.Icon({wornItem.name, type='item'}) | |||
elseif rareDrop.altItemID ~= nil then | |||
-- There exists an alt item, but we are not searching for it | |||
local altItem = Items.getItemByID(rareDrop.altItemID) | |||
subText = ' if not worn (Instead of ' .. Icons.Icon({altItem.name, type='item'}) .. ')' | |||
elseif rareDrop.itemID == 'melvorD:Mysterious_Stone' then | |||
local foundItem = Items.getItemByID('melvorD:Crown_of_Rhaelyx') | |||
subText = '<br/>after finding ' .. Icons.Icon({foundItem.name, type='item'}) | |||
end | |||
if type(rareDrop.gamemodes) == 'table' then | |||
local gamemodeText = {} | |||
for k, gamemodeID in ipairs(rareDrop.gamemodes) do | |||
local gamemode = GameData.getEntityByID('gamemodes', gamemodeID) | |||
if gamemode ~= nil then | |||
table.insert(gamemodeText, gamemode.name) | |||
end | |||
end | |||
if not Shared.tableIsEmpty(gamemodeText) then | |||
subText = subText .. ' (' .. table.concat(gamemodeText, ', ') .. ' only)' | |||
end | |||
end | |||
end | |||
local skillText = Icons.Icon({skillName, type='skill', notext=true}) | |||
if displaySkillName then | |||
skillText = skillText .. ' (' .. Icons.Icon({skillName, type='skill', noicon=true}) .. ')' | |||
end | |||
table.insert(skillIconList, skillText) | |||
end | |||
end | end | ||
end | end | ||
table.insert(lineArray, 'Any action in: ' .. table.concat( | end | ||
if not Shared.tableIsEmpty(skillIconList) then | |||
table.insert(lineArray, 'Any action in: ' .. table.concat(skillIconList, ', ') .. subText) | |||
skillIconList, subText = {}, '' | |||
end | |||
-- Supplementary stuff on top of general rare drops | |||
if item.id == 'melvorD:Gold_Topaz_Ring' then | |||
table.insert(lineArray, 'Killing any monster if not worn (Instead of '..Icons.Icon({"Signet Ring Half (b)", type="item"})..')') | |||
elseif item.id == 'melvorD:Signet_Ring_Half_B' then | |||
table.insert(lineArray, 'Killing any monster while wearing '..Icons.Icon({'Gold Topaz Ring', type='item'})) | |||
elseif item.id == 'melvorTotH:Deadly_Toxins_Potion' then | |||
--Adding a special override for Deadly Toxins potions | |||
table.insert(lineArray, 'Brewing [[Lethal Toxins Potion]]s while wearing '..Icons.Icon({'Toxic Maker Gloves', type='item'})) | |||
end | end | ||
Line 611: | Line 748: | ||
if Shared.contains(Items.EventItems, item.name) then | if Shared.contains(Items.EventItems, item.name) then | ||
table.insert(lineArray, '[[Events]]') | table.insert(lineArray, '[[Events]]') | ||
end | end | ||
Line 667: | Line 790: | ||
table.insert(resultPart, '{| class="wikitable sortable stickyHeader"') | table.insert(resultPart, '{| class="wikitable sortable stickyHeader"') | ||
table.insert(resultPart, '\r\n|- class="headerRow-0"') | table.insert(resultPart, '\r\n|- class="headerRow-0"') | ||
table.insert(resultPart, '\r\n!Source!! | table.insert(resultPart, '\r\n!Source!!Level!!Quantity!!colspan="2"|Chance') | ||
--Set up function for adding rows | --Set up function for adding rows | ||
local buildRow = function(source, | local buildRow = function(source, level, levelNum, minqty, qty, weight, totalWeight, expIcon) | ||
if minqty == nil then minqty = 1 end | if minqty == nil then minqty = 1 end | ||
if expIcon == nil then expIcon = '' end | if expIcon == nil then expIcon = '' end | ||
if level == nil then level = 'N/A' end | |||
local rowPart = {} | local rowPart = {} | ||
table.insert(rowPart, '\r\n|-') | table.insert(rowPart, '\r\n|-') | ||
table.insert(rowPart, '\r\n|style="text-align: left;"|'..source) | table.insert(rowPart, '\r\n|style="text-align: left;"|'..source) | ||
-- | -- Retrieve numeric level value for sorting, or remove anything between [[]] | ||
local | local levelValue = '' | ||
if | if levelNum ~= nil then | ||
levelValue = tostring(levelNum) | |||
table.insert(rowPart, '\r\n|style="text-align: left;" data-sort-value="'.. | else | ||
levelValue = level:match('%[%[.-%]%]%s*(%w+)$') or '' | |||
end | |||
table.insert(rowPart, '\r\n|style="text-align: left;" data-sort-value="'..levelValue..'"|'..expIcon.. level) | |||
table.insert(rowPart, '\r\n|style="text-align: right;" data-sort-value="'..qty..'"|'..Shared.formatnum(minqty)) | table.insert(rowPart, '\r\n|style="text-align: right;" data-sort-value="'..qty..'"|'..Shared.formatnum(minqty)) | ||
if qty ~= minqty then table.insert(rowPart, ' - '..Shared.formatnum(qty)) end | if qty ~= minqty then table.insert(rowPart, ' - '..Shared.formatnum(qty)) end | ||
Line 716: | Line 842: | ||
for i, drop in ipairs(p._getItemMonsterSources(item)) do | for i, drop in ipairs(p._getItemMonsterSources(item)) do | ||
local monster = GameData.getEntityByID('monsters', drop.id) | local monster = GameData.getEntityByID('monsters', drop.id) | ||
local iconName = monster.name | |||
if SourceOverrides[drop.id] ~= nil then | |||
iconName = SourceOverrides[drop.id] | |||
end | |||
if monster ~= nil then | if monster ~= nil then | ||
table.insert(dropRows, {source = Icons.Icon({monster.name, type=' | local monsterLevel = Monsters._getMonsterCombatLevel(monster) | ||
table.insert(dropRows, { | |||
source = Icons.Icon({iconName, type='monster'}), | |||
level = Icons.Icon({'Monsters', img='Combat', notext=true}) .. ' Level ' .. Shared.formatnum(monsterLevel), | |||
levelNum = monsterLevel, | |||
minqty = drop.minQty, | |||
qty = drop.maxQty, | |||
weight = drop.dropWt, | |||
totalWeight = drop.totalWt, | |||
expIcon = Icons.getExpansionIcon(drop.id)}) | |||
end | |||
end | |||
--Patching in here because it uses the same format | |||
--Can we find this in an Archaeology digsite? | |||
for i, drop in ipairs(p._getItemArchSources(item)) do | |||
if drop.name ~= nil then | |||
table.insert(dropRows, { | |||
source = Icons.Icon({drop.name, type='poi'}), | |||
level = Icons._SkillReq('Archaeology', drop.level) .. ' ('..drop.size..')', | |||
levelNum = drop.level, | |||
minqty = drop.minQty, | |||
qty = drop.maxQty, | |||
weight = drop.dropWt, | |||
totalWeight = drop.totalWt, | |||
expIcon = Icons.getExpansionIcon(drop.id)}) | |||
end | end | ||
end | end | ||
Line 725: | Line 881: | ||
if (dungeon.oneTimeRewardID ~= nil and item.id == dungeon.oneTimeRewardID) or | if (dungeon.oneTimeRewardID ~= nil and item.id == dungeon.oneTimeRewardID) or | ||
(type(dungeon.rewardItemIDs) == 'table' and Shared.contains(dungeon.rewardItemIDs, item.id)) then | (type(dungeon.rewardItemIDs) == 'table' and Shared.contains(dungeon.rewardItemIDs, item.id)) then | ||
table.insert(dropRows, {source = Icons.Icon({dungeon.name, type='dungeon'}), | table.insert(dropRows, { | ||
source = Icons.Icon({dungeon.name, type='dungeon'}), | |||
level = '[[Dungeon]]', | |||
minqty = 1, | |||
qty = 1, | |||
weight = 1, | |||
totalWeight = 1, | |||
expIcon = Icons.getExpansionIcon(dungeon.id)}) | |||
elseif dungeon.eventID ~= nil then | elseif dungeon.eventID ~= nil then | ||
-- Is the item dropped from a combat event (e.g. Impending Darkness event)? | -- Is the item dropped from a combat event (e.g. Impending Darkness event)? | ||
Line 733: | Line 896: | ||
if item.id == itemRewardID then | if item.id == itemRewardID then | ||
local sourceTxt = Icons.Icon({dungeon.name, type='dungeon'}) .. (eventCycle == Shared.tableCount(event.itemRewardIDs) and '' or ', Cycle ' .. eventCycle) | local sourceTxt = Icons.Icon({dungeon.name, type='dungeon'}) .. (eventCycle == Shared.tableCount(event.itemRewardIDs) and '' or ', Cycle ' .. eventCycle) | ||
table.insert(dropRows, {source = sourceTxt, | table.insert(dropRows, { | ||
source = sourceTxt, | |||
level = '[[Dungeon]]', | |||
minqty = 1, | |||
qty = 1, | |||
weight = 1, | |||
totalWeight = 1}) | |||
break | break | ||
end | end | ||
Line 756: | Line 925: | ||
if wt > 0 then | if wt > 0 then | ||
local sourceTxt = Icons.Icon({item2.name, type='item'}) | local sourceTxt = Icons.Icon({item2.name, type='item'}) | ||
table.insert(dropRows, {source = sourceTxt, | table.insert(dropRows, { | ||
source = sourceTxt, | |||
level = '[[Chest]]', | |||
minqty = minQty, | |||
qty = maxQty, | |||
weight = wt, | |||
totalWeight = totalWt, | |||
expIcon = Icons.getExpansionIcon(item2.id)}) | |||
end | end | ||
end | end | ||
Line 770: | Line 946: | ||
sourceTxt = Icons.Icon({thiefRow.npc, type='thieving'}) | sourceTxt = Icons.Icon({thiefRow.npc, type='thieving'}) | ||
end | end | ||
table.insert(dropRows, {source = sourceTxt, | table.insert(dropRows, { | ||
source = sourceTxt, | |||
level = Icons._SkillReq("Thieving", thiefRow.level), | |||
levelNum = thiefRow.level, | |||
minqty = thiefRow.minQty, | |||
qty = thiefRow.maxQty, | |||
weight = thiefRow.wt, | |||
totalWeight = thiefRow.totalWt, | |||
expIcon = Icons.getExpansionIcon(thiefRow.npcID)}) | |||
end | end | ||
Line 778: | Line 962: | ||
local fishType = Icons.Icon({'Fishing', type='skill'}) | local fishType = Icons.Icon({'Fishing', type='skill'}) | ||
local fishTotWeight = Shared.tableCount(SkillData.Fishing.JunkItems) | local fishTotWeight = Shared.tableCount(SkillData.Fishing.JunkItems) | ||
table.insert(dropRows, {source = fishSource, | table.insert(dropRows, { | ||
source = fishSource, | |||
level = Icons._SkillReq("Fishing", 1), | |||
levelNum = 1, | |||
minqty = 1, | |||
qty = 1, | |||
weight = 1, | |||
totalWeight = fishTotWeight}) | |||
else | else | ||
local fishTotWeight, fishItem = 0, nil | local fishTotWeight, fishItem = 0, nil | ||
Line 790: | Line 981: | ||
local fishSource = '[[Fishing#Special|Special]]' | local fishSource = '[[Fishing#Special|Special]]' | ||
local fishType = Icons.Icon({SkillData.Fishing.name, type='skill'}) | local fishType = Icons.Icon({SkillData.Fishing.name, type='skill'}) | ||
table.insert(dropRows, {source = fishSource, | table.insert(dropRows, { | ||
source = fishSource, | |||
level = Icons._SkillReq("Fishing", 1), | |||
levelNum = 1, | |||
minqty = fishItem.minQuantity, | |||
qty = fishItem.maxQuantity, | |||
weight = fishItem.weight, | |||
totalWeight = fishTotWeight}) | |||
end | end | ||
end | end | ||
Line 806: | Line 1,004: | ||
end | end | ||
if thisGem ~= nil then | if thisGem ~= nil then | ||
local expIcon = '' | local expIcon = '' | ||
local sourceTxt | local sourceTxt | ||
local lv = nil | |||
if item.type == 'Superior Gem' then | if item.type == 'Superior Gem' then | ||
expIcon = Icons.TotH() | expIcon = Icons.TotH() | ||
sourceTxt = '[[Mining#Superior Gems|Superior Gem]]' | sourceTxt = '[[Mining#Superior Gems|Superior Gem]]' | ||
-- Superior gems can only be found with Mining 100 or above | |||
lv = 100 | |||
else | else | ||
sourceTxt = '[[Mining#Gems|Gem]]' | sourceTxt = '[[Mining#Gems|Gem]]' | ||
-- Gems can only be found with any Mining level | |||
lv = 1 | |||
end | end | ||
table.insert(dropRows, {source = sourceTxt, | table.insert(dropRows, { | ||
source = sourceTxt, | |||
level = Icons._SkillReq('Mining', lv), | |||
levelNum = lv, | |||
minqty = thisGem.minQuantity, | |||
qty = thisGem.maxQuantity, | |||
weight = thisGem.weight, | |||
totalWeight = totalGemWeight, | |||
expIcon = expIcon}) | |||
-- Check for Alt. Magic spells also | -- Check for Alt. Magic spells also | ||
local producesKey = (gemKey == 'randomGems' and 'RandomGem') or 'RandomSuperiorGem' | local producesKey = (gemKey == 'randomGems' and 'RandomGem') or 'RandomSuperiorGem' | ||
for j, spell in ipairs(Magic.getSpellsBySpellBook('altMagic')) do | for j, spell in ipairs(Magic.getSpellsBySpellBook('altMagic')) do | ||
if spell.produces ~= nil and spell.produces == producesKey then | if spell.produces ~= nil and spell.produces == producesKey then | ||
table.insert(dropRows, {source = Icons.Icon({spell.name, type=Magic._getSpellIconType(spell)}), type = | table.insert(dropRows, { | ||
source = Icons.Icon({spell.name, type=Magic._getSpellIconType(spell)}), | |||
level = Icons.Icon({'Alternative Magic', type='skill', img='Magic', notext=true}) .. ' Level ' .. spell.level, | |||
levelNum = spell.level, | |||
minqty = thisGem.minQuantity, | |||
qty = thisGem.maxQuantity, | |||
weight = thisGem.weight, | |||
totalWeight = totalGemWeight, | |||
expIcon = Icons.getExpansionIcon(spell.id)}) | |||
end | end | ||
end | end | ||
Line 835: | Line 1,052: | ||
if a.weight / a.totalWeight == b.weight / b.totalWeight then | if a.weight / a.totalWeight == b.weight / b.totalWeight then | ||
if a.minqty + a.qty == b.minqty + b.qty then | if a.minqty + a.qty == b.minqty + b.qty then | ||
return (a. | return (a.level == b.level and a.source < b.source) or a.level < b.level | ||
else | else | ||
return a.minqty + a.qty > b.minqty + b.qty | return a.minqty + a.qty > b.minqty + b.qty | ||
Line 844: | Line 1,061: | ||
end) | end) | ||
for i, data in ipairs(dropRows) do | for i, data in ipairs(dropRows) do | ||
table.insert(resultPart, buildRow(data.source, data. | table.insert(resultPart, buildRow(data.source, data.level, data.levelNum, data.minqty, data.qty, data.weight, data.totalWeight, data.expIcon)) | ||
end | end | ||
Line 947: | Line 1,164: | ||
end | end | ||
--Add the table end and add the table to the result string | |||
table.insert(superheatTable, '\r\n|}') | table.insert(superheatTable, '\r\n|}') | ||
return table.concat(superheatTable) | return table.concat(superheatTable) | ||
Line 1,068: | Line 1,285: | ||
chance = 1 | chance = 1 | ||
weight = 1 | weight = 1 | ||
elseif monster.barrierPercent ~= nil and 'melvorAoD:Barrier_Dust' == item.id and not Monsters._isDungeonOnlyMonster(monster) then | |||
-- Item is Barrier Dust and is not a dungeon exclusive monster | |||
maxQty = math.max(math.floor(Monsters._getMonsterStat(monster, 'Barrier') / 10 / 20), 1) | |||
minQty = maxQty | |||
chance = 1 | |||
elseif monster.lootTable ~= nil and not Monsters._isDungeonOnlyMonster(monster) then | elseif monster.lootTable ~= nil and not Monsters._isDungeonOnlyMonster(monster) then | ||
-- If the monster has a loot table, check if the item we are looking for is in there | -- If the monster has a loot table, check if the item we are looking for is in there | ||
Line 1,097: | Line 1,319: | ||
local item = Items.getItem(itemName) | local item = Items.getItem(itemName) | ||
return p._getItemMonsterSources(item) | return p._getItemMonsterSources(item) | ||
end | |||
function p._getItemArchSources(item) | |||
local check = false | |||
local itemID = item.id | |||
local resultArray = {} | |||
for i, digSite in pairs(SkillData.Archaeology.digSites) do | |||
for sizeName, size in pairs(digSite.artefacts) do | |||
local found = nil | |||
local sizeWeight = 0 | |||
for k, artefact in pairs(size) do | |||
sizeWeight = sizeWeight + artefact.weight | |||
if artefact.itemID == itemID then | |||
found = artefact | |||
end | |||
end | |||
if found ~= nil then | |||
local min = found.minQuantity | |||
local max = found.maxQuantity | |||
table.insert(resultArray, { | |||
id = digSite.id, | |||
name = digSite.name, | |||
level = digSite.level, | |||
size = sizeName, | |||
minQty = min, | |||
maxQty = max, | |||
dropWt = found.weight, | |||
totalWt = sizeWeight}) | |||
end | |||
end | |||
end | |||
return resultArray | |||
end | |||
function p.getItemArchSources(itemName) | |||
local item = Items.getItem(itemName) | |||
return p._getItemArchSources(item) | |||
end | end | ||
Line 1,104: | Line 1,367: | ||
function p.test() | function p.test() | ||
local checkItems = { | local checkItems = { | ||
"Circlet of Rhaelyx", | |||
"Jewel of Rhaelyx", | |||
"Signet Ring Half (a)", | |||
"Signet Ring Half (b)", | |||
"Gold Topaz Ring", | |||
"Astrology Lesser Relic", | |||
"Mysterious Stone", | |||
"Gold Bar", | |||
"Raw Shrimp", | |||
"Coal Ore", | |||
"Rune Platebody", | |||
"Arrow Shafts", | |||
"Yew Longbow", | |||
"Water Rune", | |||
"Steam Rune", | |||
"Controlled Heat Potion II", | |||
"Wolf", | |||
"Cyclops", | |||
"Leprechaun", | |||
"Redwood Logs", | |||
"Carrot Cake", | |||
"Carrot Cake (Perfect)", | |||
"Mantalyme Herb", | |||
"Carrot", | |||
"Topaz", | |||
"Rune Essence", | |||
"Sanguine Blade", | |||
"Ring of Power", | |||
"Infernal Claw", | |||
"Chapeau Noir", | |||
"Stardust", | |||
"Rope", | |||
"Ancient Ring of Mastery", | |||
"Mastery Token (Cooking)", | |||
"Gem Gloves", | |||
"Thief's Moneysack", | "Thief's Moneysack", | ||
"Golden Stardust", | "Golden Stardust", | ||
"Golden Star", | "Golden Star", | ||
"Slayer Deterer" | "Slayer Deterer", | ||
"Paper", | |||
"Lemon", | |||
"Aranite Brush", | |||
"Barrier Dust" | |||
} | } | ||
local checkFuncs = { | local checkFuncs = { |
edits