4,670
edits
(Fix Stardust itembox sources) |
(Add loot sources for Strongholds and Abyss Depths) |
||
Line 881: | Line 881: | ||
-- Is the item dropped from any dungeon? | -- Is the item dropped from any dungeon? | ||
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(dropRows, { | |||
source = Icons.Icon({dungeon.name, type=iconType}), | |||
level = '[['..entity..']]', | |||
minqty = 1, | |||
qty = 1, | |||
weight = 1, | |||
totalWeight = 1, | |||
expIcon = Icons.getExpansionIcon(dungeon.id)}) | |||
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 sourceTxt = Icons.Icon({dungeon.name, type=iconType}) .. (eventCycle == Shared.tableCount(event.itemRewardIDs) and '' or ', Cycle ' .. eventCycle) | |||
table.insert(dropRows, { | |||
source = sourceTxt, | |||
level = '[['..entity..']]', | |||
minqty = 1, | |||
qty = 1, | |||
weight = 1, | |||
totalWeight = 1}) | |||
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(dropRows, { | table.insert(dropRows, { | ||
source = | source = Icons.Icon({stronghold.name, type='combatArea'}), | ||
level = '[[ | level = '[[Strongholds|'..tier..']]', | ||
minqty = 1, | minqty = 1, | ||
qty = 1, | qty = 1, | ||
weight = | weight = tierData.rewards.chance, | ||
totalWeight = | totalWeight = 100, | ||
expIcon = Icons.getExpansionIcon(stronghold.id)}) | |||
end | end | ||
end | end |