Anonymous

Module:Skills/Gathering: Difference between revisions

From Melvor Idle
Use printError function
(Migrate tool table code to Module:Shop)
(Use printError function)
(One intermediate revision by the same user not shown)
Line 157: Line 157:
local gemDataKey = validTypes[gemType]
local gemDataKey = validTypes[gemType]
if gemDataKey == nil then
if gemDataKey == nil then
return 'ERROR: No such gem type "' .. gemType .. '"[[Category:Pages with script errors]]'
return Shared.printError('No such gem type "' .. gemType .. '"')
end
end
Line 380: Line 380:


--After normal drops, add in rare drops
--After normal drops, add in rare drops
local rareTxt = '===Possible Rare Drops:===\r\nAny of these can be received after a successful pickpocket'
local rareTxt = '===Possible Rare Drops:===\r\nAny of these can be received after a successful pickpocket:'
rareTxt = rareTxt..'\r\n'..p._getThievingGeneralRareTable(npc.id)
rareTxt = rareTxt..'\r\n'..p._getThievingGeneralRareTable(npc.id)
table.insert(sectionTxt, rareTxt)
table.insert(sectionTxt, rareTxt)
Line 406: Line 406:
areaTxt = areaTxt..txt
areaTxt = areaTxt..txt
end
end
areaTxt = areaTxt..'\r\n|-class="sortbottom" \r\n!colspan="3"|Total:'
areaTxt = areaTxt..'\r\n|style="text-align:right"|'..Shared.fraction(1, 1/(SkillData.Thieving.baseAreaUniqueChance/100))..'||'
areaTxt = areaTxt..'style="text-align:right"|'..Shared.round(SkillData.Thieving.baseAreaUniqueChance, 2, 2)..'%'
areaTxt = areaTxt..'\r\n|}'
areaTxt = areaTxt..'\r\n|}'
table.insert(sectionTxt, areaTxt)
table.insert(sectionTxt, areaTxt)
Line 420: Line 417:
uniqueTxt = uniqueTxt..'\r\nThe unique drop for the '..npc.name..' is '
uniqueTxt = uniqueTxt..'\r\nThe unique drop for the '..npc.name..' is '
if npc.uniqueDrop.quantity > 1 then
if npc.uniqueDrop.quantity > 1 then
uniqueTxt = uniqueTxt..Icons.Icon({thisItem.name, type='item', qty=npc.uniqueDrop.quantity})
uniqueTxt = uniqueTxt..Icons.Icon({thisItem.name, type='item', qty=npc.uniqueDrop.quantity}) .. '.'
else
else
uniqueTxt = uniqueTxt..Icons.Icon({thisItem.name, type='item'})
uniqueTxt = uniqueTxt..Icons.Icon({thisItem.name, type='item'}) .. '.'
end
end
table.insert(sectionTxt, uniqueTxt)
table.insert(sectionTxt, uniqueTxt)
Line 435: Line 432:
local npc = Skills.getThievingNPC(npcName)
local npc = Skills.getThievingNPC(npcName)
if npc == nil then
if npc == nil then
return "ERROR: Invalid Thieving NPC "..npcName.."[[Category:Pages with script errors]]"
return Shared.printError('Invalid Thieving NPC "' .. npcName .. '"')
end
end


Line 530: Line 527:
local category = GameData.getEntityByName(SkillData.Farming.categories, categoryName)
local category = GameData.getEntityByName(SkillData.Farming.categories, categoryName)
if category == nil then
if category == nil then
return 'ERROR: Invalid farming category. Please choose Allotments, Herbs, or Trees[[Category:Pages with script errors]]'
return Shared.printError('Invalid farming category. Please choose Allotments, Herbs, or Trees')
end
end
local seedList = GameData.getEntities(SkillData.Farming.recipes,
local seedList = GameData.getEntities(SkillData.Farming.recipes,
Line 619: Line 616:
local category = GameData.getEntityByName(SkillData.Farming.categories, areaName)
local category = GameData.getEntityByName(SkillData.Farming.categories, areaName)
if category == nil then
if category == nil then
return 'ERROR: Invalid farming category. Please choose Allotments, Herbs, or Trees[[Category:Pages with script errors]]'
return Shared.printError('Invalid farming category. Please choose Allotments, Herbs, or Trees')
end
end
local patches = GameData.getEntities(SkillData.Farming.plots,
local patches = GameData.getEntities(SkillData.Farming.plots,