Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
Add depths and stronghold source for ItemBox
(Amend link for combat icon)
(Add depths and stronghold source for ItemBox)
 
Line 327: Line 327:
-- Is the item dropped from any dungeon?
-- Is the item dropped from any dungeon?
local dungeonStrPart = {}
local dungeonStrPart = {}
for i, dungeon in ipairs(GameData.rawData.dungeons) do
local dungeonEntities = {
if (dungeon.oneTimeRewardID ~= nil and item.id == dungeon.oneTimeRewardID) or
['Dungeon'] = GameData.rawData.dungeons,
(type(dungeon.rewardItemIDs) == 'table' and Shared.contains(dungeon.rewardItemIDs, item.id)) then
['The Abyss'] = GameData.rawData.abyssDepths
table.insert(dungeonStrPart, Icons.Icon({dungeon.name, type='dungeon', notext=true}))
}
elseif dungeon.eventID ~= nil then
for entity, dungeons in pairs(dungeonEntities) do
-- Is the item dropped from a combat event (e.g. Impending Darkness event)?
local iconType = entity == 'Dungeon' and 'dungeon' or 'combatArea'
local event = GameData.getEntityByID('combatEvents', dungeon.eventID)
for i, dungeon in ipairs(dungeons) do
if type(event) == 'table' and type(event.itemRewardIDs) == 'table' then
if (dungeon.oneTimeRewardID ~= nil and item.id == dungeon.oneTimeRewardID) or
for eventCycle, itemRewardID in ipairs(event.itemRewardIDs) do
(type(dungeon.rewardItemIDs) == 'table' and Shared.contains(dungeon.rewardItemIDs, item.id)) then
if item.id == itemRewardID then
table.insert(dungeonStrPart, Icons.Icon({dungeon.name, type=iconType, notext=true}))
local dungPrefix = (eventCycle == Shared.tableCount(event.itemRewardIDs) and '' or eventCycle .. (eventCycle == 1 and ' cycle' or ' cycles') .. ' of ')
elseif dungeon.eventID ~= nil then
table.insert(dungeonStrPart, dungPrefix .. Icons.Icon({dungeon.name, type='dungeon', notext=true}))
-- Is the item dropped from a combat event (e.g. Impending Darkness event)?
break
local event = GameData.getEntityByID('combatEvents', dungeon.eventID)
if type(event) == 'table' and type(event.itemRewardIDs) == 'table' then
for eventCycle, itemRewardID in ipairs(event.itemRewardIDs) do
if item.id == itemRewardID then
local dungPrefix = (eventCycle == Shared.tableCount(event.itemRewardIDs) and '' or eventCycle .. (eventCycle == 1 and ' cycle' or ' cycles') .. ' of ')
table.insert(dungeonStrPart, dungPrefix .. Icons.Icon({dungeon.name, type=iconType, notext=true}))
break
end
end
end
end
end
end
for i, stronghold in ipairs(GameData.rawData.strongholds) do
for tier, tierData in pairs(stronghold.tiers) do
if type(tierData.rewards) == 'table' and type(tierData.rewards.items) == 'table' then
for i, reward in ipairs(tierData.rewards.items) do
if reward.id == item.id then
table.insert(dungeonStrPart, Icons.Icon({stronghold.name, type='combatArea', notext=true}))
end
end
end
end
239

edits