Anonymous

Module:Items/SourceTables/Sandbox: Difference between revisions

From Melvor Idle
m
Clean up chance data
(Add missing Firemaking and Cartography input data)
m (Clean up chance data)
Line 173: Line 173:
time = 5
time = 5
end
end
-- Item chance data
-- Item chance and recipe costs
if itemID == 'melvorF:Ash' then
qty = time
chance = '20%'
elseif itemID == 'melvorItA:Withered_Ash' then
qty = math.max(math.floor(recipe.abyssalLevel / 10), 1)
chance = '20%'
elseif itemID == 'melvorD:Generous_Fire_Spirit' then
chance = '0.1%'
elseif itemID == 'melvorF:Stardust' then
chance = '100%'
elseif itemID == 'melvorD:Coal_Ore' then
chance = (localSkillID == 'Firemaking' and '40%' or '100%')
end
-- Item cost data
if localSkillID == 'Firemaking' then
if localSkillID == 'Firemaking' then
local itemChanceData = GameData.getEntityByProperty(SkillData.Firemaking.primaryProducts, 'itemID', itemID)
if itemChanceData ~= nil then
chance = itemChanceData.chance .. '%'
elseif itemID == 'melvorD:Generous_Fire_Spirit' then
chance = '0.1%'
end
local costItem = Items.getItemByID(recipe.logID)
local costItem = Items.getItemByID(recipe.logID)
costs = Icons.Icon({costItem.name, type='item', qty=1})
costs = Icons.Icon({costItem.name, type='item', qty=1})
if itemID == 'melvorF:Ash' then
qty = time
elseif itemID == 'melvorItA:Withered_Ash' then
qty = math.max(math.floor(recipe.abyssalLevel / 10), 1)
end
elseif localSkillID == 'Cartography' then
elseif localSkillID == 'Cartography' then
local costItem = Items.getItemByID(recipe.costs.items[1].id)
local costItem = Items.getItemByID(recipe.costs.items[1].id)
costs = Icons.Icon({costItem.name, type='item', qty=1})
costs = Icons.Icon({costItem.name, type='item', qty=1})
elseif itemID == 'melvorD:Coal_Ore' then
chance = '100%'
end
end
-- Special requirements
-- Special requirements
Line 383: Line 384:
-- Add in Astrology creation items manually since each constellation has (mostly)
-- Add in Astrology creation items manually since each constellation has (mostly)
-- the same creation information so looping through them is not necessary
-- the same creation information so looping through them is not necessary
if Shared.contains({ 'melvorF:Stardust', 'melvorF:Golden_Stardust', 'melvorItA:Abyssal_Stardust', 'melvorItA:Eternal_Stardust' }, itemID) then
local stardustChanceData = GameData.getEntityByProperty(SkillData.Astrology.baseRandomItemChances, 'itemID', itemID)
local namespace, localID = Shared.getLocalID(itemID)
if stardustChanceData ~= nil then
local namespace, localID = Shared.getLocalID(stardustChanceData.itemID)
local isAbyssal = namespace == 'melvorItA'
local isAbyssal = namespace == 'melvorItA'
local chance = nil
local chance = nil
for i, itemChanceData in ipairs(SkillData.Astrology.baseRandomItemChances) do
if itemChanceData.itemID == itemID then
chance = itemChanceData.chance .. '%'
break
end
end
table.insert(tableData, {
table.insert(tableData, {
['skill'] = 'Astrology',
['skill'] = 'Astrology',
Line 400: Line 396:
['source'] = Icons.Icon({ 'Astrology', type='skill', class=(isAbyssal and 'abyss-icon' or '')}),
['source'] = Icons.Icon({ 'Astrology', type='skill', class=(isAbyssal and 'abyss-icon' or '')}),
['time'] = 3,
['time'] = 3,
['chance'] = chance
['chance'] = stardustChanceData.chance .. '%'
})
})
end
end
Line 546: Line 542:


if showOutputs then recipeRow:tag('td'):wikitext(Icons.Icon({item.name, type='item', notext=true, qty=data.qty})):addClass('center') end
if showOutputs then recipeRow:tag('td'):wikitext(Icons.Icon({item.name, type='item', notext=true, qty=data.qty})):addClass('center') end
if showXP then recipeRow:tag('td'):wikitext(Icons.Icon({data.skill, (Num.formatnum(data.xp) .. (data.isAbyssal and ' AXP' or ' XP')), nolink=true, type='skill'})):addClass('center') end
if showXP then recipeRow:tag('td'):wikitext(Icons.Icon({data.skill, (Num.formatnum(data.xp) .. (data.isAbyssal and ' AXP' or ' XP')), nolink=true, type='skill'})) end
if showTime then recipeRow:tag('td'):wikitext(Shared.timeString(data.time, true)):addClass('center') end
if showTime then recipeRow:tag('td'):wikitext(Shared.timeString(data.time, true)):addClass('center') end
if showChance then recipeRow:tag('td'):wikitext(data.chance):addClass('center') end
if showChance then recipeRow:tag('td'):wikitext(data.chance):addClass('center') end