Module:Items/SourceTables: Difference between revisions

Add loot sources for Strongholds and Abyss Depths
(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(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(dropRows, {
}
source = Icons.Icon({dungeon.name, type='dungeon'}),  
for entity, dungeons in pairs(dungeonEntities) do
level = '[[Dungeon]]',
local iconType = entity == 'Dungeon' and 'dungeon' or 'combatArea'
minqty = 1,  
for i, dungeon in ipairs(dungeons) do
qty = 1,  
if (dungeon.oneTimeRewardID ~= nil and item.id == dungeon.oneTimeRewardID) or
weight = 1,  
(type(dungeon.rewardItemIDs) == 'table' and Shared.contains(dungeon.rewardItemIDs, item.id)) then
totalWeight = 1,  
table.insert(dropRows, {
expIcon = Icons.getExpansionIcon(dungeon.id)})
source = Icons.Icon({dungeon.name, type=iconType}),  
elseif dungeon.eventID ~= nil then
level = '[['..entity..']]',
-- Is the item dropped from a combat event (e.g. Impending Darkness event)?
minqty = 1,  
local event = GameData.getEntityByID('combatEvents', dungeon.eventID)
qty = 1,  
if type(event) == 'table' and type(event.itemRewardIDs) == 'table' then
weight = 1,  
for eventCycle, itemRewardID in ipairs(event.itemRewardIDs) do
totalWeight = 1,  
if item.id == itemRewardID then
expIcon = Icons.getExpansionIcon(dungeon.id)})
local sourceTxt = Icons.Icon({dungeon.name, type='dungeon'}) .. (eventCycle == Shared.tableCount(event.itemRewardIDs) and '' or ', Cycle ' .. eventCycle)
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 = sourceTxt,  
source = Icons.Icon({stronghold.name, type='combatArea'}),  
level = '[[Dungeon]]',
level = '[[Strongholds|'..tier..']]',
minqty = 1,  
minqty = 1,  
qty = 1,  
qty = 1,  
weight = 1,  
weight = tierData.rewards.chance,  
totalWeight = 1})
totalWeight = 100,
break
expIcon = Icons.getExpansionIcon(stronghold.id)})
end
end
end
end