|
|
|
|
#include "lua/modules/monsters.hpp"
|
|
|
|
|
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
|
|
#include <fmt/format.h>
|
|
|
|
|
#include <sol/sol.hpp>
|
|
|
|
|
|
|
|
|
|
#include "data/file.hpp"
|
|
|
|
|
#include "lua/metadoc.hpp"
|
|
|
|
|
#include "tables/monstdat.h"
|
|
|
|
|
#include "utils/language.h"
|
|
|
|
|
#include "utils/str_split.hpp"
|
|
|
|
|
|
|
|
|
|
namespace devilution {
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
void AddMonsterDataFromTsv(const std::string_view path)
|
|
|
|
|
{
|
|
|
|
|
DataFile dataFile = DataFile::loadOrDie(path);
|
|
|
|
|
LoadMonstDatFromFile(dataFile, path, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AddUniqueMonsterDataFromTsv(const std::string_view path)
|
|
|
|
|
{
|
|
|
|
|
DataFile dataFile = DataFile::loadOrDie(path);
|
|
|
|
|
LoadUniqueMonstDatFromFile(dataFile, path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
sol::table LuaMonstersModule(sol::state_view &lua)
|
|
|
|
|
{
|
|
|
|
|
sol::table table = lua.create_table();
|
|
|
|
|
LuaSetDocFn(table, "addMonsterDataFromTsv", "(path: string)", AddMonsterDataFromTsv);
|
|
|
|
|
LuaSetDocFn(table, "addUniqueMonsterDataFromTsv", "(path: string)", AddUniqueMonsterDataFromTsv);
|
|
|
|
|
return table;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace devilution
|