239
edits
(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( | local dungeonEntities = { | ||
['Dungeon'] = GameData.rawData.dungeons, | |||
['The Abyss'] = GameData.rawData.abyssDepths | |||
} | |||
for entity, dungeons in pairs(dungeonEntities) do | |||
local iconType = entity == 'Dungeon' and 'dungeon' or 'combatArea' | |||
for i, dungeon in ipairs(dungeons) do | |||
if (dungeon.oneTimeRewardID ~= nil and item.id == dungeon.oneTimeRewardID) or | |||
(type(dungeon.rewardItemIDs) == 'table' and Shared.contains(dungeon.rewardItemIDs, item.id)) then | |||
table.insert(dungeonStrPart, Icons.Icon({dungeon.name, type=iconType, notext=true})) | |||
elseif dungeon.eventID ~= nil then | |||
-- Is the item dropped from a combat event (e.g. Impending Darkness event)? | |||
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 |
edits