4,951
edits
Falterfire (talk | contribs) (Removed the now superfluous Clone code which is on Shared) |
Falterfire (talk | contribs) (Added special override for the stupid spider jerks with the same name) |
||
Line 10: | Line 10: | ||
function p.getMonster(name) | function p.getMonster(name) | ||
local result = nil | local result = nil | ||
if name == 'Spider (lv. 51)' then | |||
return p.getMonsterByID(50) | |||
elseif name == 'Spider (lv. 52)' or name == 'Spider2' then | |||
return p.getMonsterByID(51) | |||
end | |||
for i, monster in pairs(MonsterData) do | for i, monster in pairs(MonsterData) do | ||
if(monster.name == name) then | if(monster.name == name) then | ||
Line 15: | Line 21: | ||
--Make sure every monster has an ID, and account for the 1-based indexing of Lua | --Make sure every monster has an ID, and account for the 1-based indexing of Lua | ||
result.id = i - 1 | result.id = i - 1 | ||
end | |||
end | |||
return result | |||
end | |||
function p.getMonsterByID(ID) | |||
local result = nil | |||
for i, monster in pairs(MonsterData) do | |||
if(monster.id == ID) then | |||
result = Shared.clone(monster) | |||
end | end | ||
end | end |