Module:Monsters: Difference between revisions

From Melvor Idle
(Added 'getMonsterStyleIcon')
(Changed getByID functions to key off of index to match how the game does things)
Line 28: Line 28:


function p.getMonsterByID(ID)
function p.getMonsterByID(ID)
   local result = nil
   return MonsterData.Monsters[ID + 1]
  for i, monster in pairs(MonsterData.Monsters) do
    if(monster.id == ID) then
      result = Shared.clone(monster)
    end
  end
  return result
end
end


Line 51: Line 45:


function p.getSpecialAttackByID(ID)
function p.getSpecialAttackByID(ID)
   local result = nil
   return MonsterData.SpecialAttacks[ID + 1]
  for i, attack in pairs(MonsterData.SpecialAttacks) do
    if attack.id == ID then
      result = Shared.clone(attack)
    end
  end
  return result
end
end