Anonymous

Module:Sandbox/GauTest/Township: Difference between revisions

From Melvor Idle
no edit summary
(Part 1 of p.GetTaskTable)
No edit summary
Line 775: Line 775:
table.insert(ret, '\r\n!'..task.name)
table.insert(ret, '\r\n!'..task.name)
-- Requirements
-- Requirements
table.insert(ret, '\r\n|<ul>')
table.insert(ret, '\r\n|')
if task.description ~= nil then
table.insert(ret, task.description..'<br>')
end
table.insert(ret, '<ul>')
for _, item in ipairs(task.goals.items) do
for _, item in ipairs(task.goals.items) do
table.insert(ret, '<li>'..Shared.formatnum(item.quantity)..' '..Icons.Icon({Items.getItemByID(item.id), type='item'})..'</li>')
table.insert(ret, '<li>'..Shared.formatnum(item.quantity)..' '..Icons.Icon({Items.getItemByID(item.id), type='item'})..'</li>')
Line 791: Line 795:
end
end
table.insert(ret, '</ul>')
table.insert(ret, '</ul>')
-- Rewards
table.insert(ret, '\r\n|<ul>')
if task.rewards.gp ~= 0 then
table.insert(ret, '<li>'..Shared.formatnum(item.quantity)..' '..Icons.GP(task.rewards.gp)..'</li>')
end
if task.rewards.slayerCoins ~= 0 then
table.insert(ret, '<li>'..Shared.formatnum(item.quantity)..' '..Icons.SC(task.rewards.slayerCoins)..'</li>')
end
for _, item in ipairs(task.rewards.items) do
table.insert(ret, '<li>'..Shared.formatnum(item.quantity)..' '..Icons.Icon({Items.getItemByID(item.id), type='item'})..'</li>')
end
for _, skill in ipairs(task.rewards.skillXP) do
local skillname = GameData.getSkillData(skill.id).name
table.insert(ret, '<li>'..Shared.formatnum(skill.quantity)..' '..Icons.Icon({skillname, type='skill'})..'XP </li>')
end
for _, townshipResource in ipairs(task.goals.townshipResources) do
local resourcename = p._GetResourceByID(townshipResource.id).name
table.insert(ret, '<li>'..Shared.formatnum(building.quantity)..' '..Icons.Icon({resourcename, type='resource'})..'</li>')
end
table.insert(ret, '</ul>')
-- Debug
if task.requirements ~= nil then
mw.log(_)
mw.log(task.name)
mw.logObject(task.requirements)
end
end
end
end
end
572

edits