10 #include <format/format.h> 11 #include "../clib/cfgelem.h" 12 #include "../clib/cfgfile.h" 13 #include "../clib/fileutil.h" 14 #include "../clib/logfacility.h" 15 #include "../plib/pkg.h" 16 #include "../plib/systemstate.h" 35 for (
int i = 0; table[i].
name; ++i )
37 if ( table[i].name == name )
38 return table[i].
value;
41 tmp <<
"Unable to translate value '" << name <<
"'\n";
42 tmp <<
" Expected one of the following values:\n";
43 for (
int i = 0; table[i].
name; ++i )
45 tmp <<
" " << table[i].
name <<
"\n";
48 throw std::runtime_error(
"Unable to translate value" );
59 : intrinsic_weapon( static_cast<Items::
UWeapon*>(
61 intrinsic_shield( static_cast<Items::
UArmor*>(
66 translate( elem.read_string(
"ALIGNMENT",
"neutral" ), xlate_align ) ) ),
67 method_script( nullptr )
75 if ( elem.
rest()[0] ==
':' )
85 if ( elem.
has_prop(
"MethodScript" ) )
87 std::string temp = elem.
read_string(
"MethodScript" );
111 size +=
name.capacity();
130 while ( cf.
read( elem ) )
146 while ( cf.read( elem ) )
159 return *( ( *itr ).second );
171 throw std::runtime_error( std::string(
"Error reading NPC template name " ) + elem.
rest() );
NpcTemplates npc_templates
size_t estimateSize() const
const Plib::Package * pkg
const NpcTemplate & create_npc_template(const Clib::ConfigElem &elem, const Plib::Package *pkg)
TRANSLATION xlate_align[]
const std::string & name() const
const NpcTemplate & find_npc_template(const Clib::ConfigElem &elem)
const char * rest() const
NpcTemplate(const Clib::ConfigElem &elem, const Plib::Package *pkg)
bool pkgdef_split(const std::string &spec, const Package *inpkg, const Package **outpkg, std::string *path)
void load_npc_templates()
std::string read_string(const char *propname) const
size_t estimateSize() const
bool has_prop(const char *propname) const
std::string GetPackageCfgPath(const Package *pkg, const std::string &filename)
int translate(const std::string &name, TRANSLATION *table)
bool FileExists(const char *filename)
ExportScript * method_script
bool read(ConfigElem &elem)
Equipment * find_intrinsic_equipment(const std::string &name, u8 layer)
Looks up for an existing intrinsic equipment and return it or nullptr if not found.