Module:Skills/Gathering: Difference between revisions
From Melvor Idle
Falterfire (talk | contribs) (changed how rare odds are displayed) |
Falterfire (talk | contribs) (actually finished getThievingNPCStat) |
||
Line 343: | Line 343: | ||
end | end | ||
function p._getThievingNPCStat(npc) | function p._getThievingNPCStat(npc, statName) | ||
local result = nil | |||
if statName == 'level' then | |||
result = Icons._SkillReq('Thieving', npc.level) | |||
elseif statName == 'maxHit' then | |||
result = npc.maxHit * 10 | |||
elseif statName == 'area' then | |||
local area = p.getThievingNPCArea(npc) | |||
result = area.name | |||
else | |||
result = npc[statName] | |||
end | |||
if result == nil then | |||
result = '' | |||
end | |||
return result | |||
end | end | ||
function p.getThievingNPCStat(frame) | function p.getThievingNPCStat(frame) | ||
local npcName = frame.args ~= nil and frame.args[1] or frame | local npcName = frame.args ~= nil and frame.args[1] or frame[1] | ||
local statName = frame.args ~= nil and frame.args[2] or frame[2] | |||
local npc = p.getThievingNPC(npcName) | local npc = p.getThievingNPC(npcName) | ||
if npc == nil then | if npc == nil then | ||
Line 354: | Line 372: | ||
end | end | ||
return p._getThievingNPCStat(npc) | return p._getThievingNPCStat(npc, statName) | ||
end | end | ||