Go to the documentation of this file.
38 static void help(
void);
58 { NULL, NULL,
false, NULL, NULL }
66 for (
int module = 0;
modules[module].
name != NULL; module++) {
82 for (
int module = 0;
modules[module].
name != NULL; module++) {
96 for (
int module = 0;
modules[module].
name != NULL; module++) {
278 int port = atoi(val);
279 if (port <= 0 || port > 65535) {
280 LOG(
llevError,
"%d is an invalid csport number, must be between 1 and 65535.\n", port);
302 for (
int module = 0;
modules[module].
name; module++) {
451 while (on_arg < argc) {
480 fprintf(stderr,
"Unknown option: %s\n", argv[on_arg]);
481 fprintf(stderr,
"Type '%s -h' for usage.\n", argv[0]);
531 if (!strncmp(cp,
"name", 4)) {
536 }
else if (!strncmp(cp,
"description", 11)) {
538 }
else if (sscanf(cp,
"material %d", &
value)) {
540 }
else if (!strncmp(cp,
"saves", 5)) {
541 cp = strchr(cp,
' ')+1;
547 if ((
next = strchr(cp,
',')) != NULL)
549 sscanf(cp,
"%d", &
value);
553 }
else if (!strncmp(cp,
"mods", 4)) {
554 cp = strchr(cp,
' ')+1;
560 if ((
next = strchr(cp,
',')) != NULL)
562 sscanf(cp,
"%d", &
value);
587 static char motd[
MAX_BUF] = { 0 };
599 if ((fp = fopen(
buf,
"r")) == NULL) {
607 if ((cp = strrchr(
buf,
'\n')) != NULL)
617 if ((cp = strchr(
buf,
' ')) != NULL) {
632 LOG(
llevError,
"load_settings: Unknown value for metaserver_notification: %s\n", cp);
638 LOG(
llevError,
"load_settings: metaserver_server must have a value.\n");
644 LOG(
llevError,
"load_settings: motd must have a value.\n");
649 LOG(
llevError,
"load_settings: metaserver_host must have a value.\n");
655 if (port < 1 || port > 65535)
656 LOG(
llevError,
"load_settings: metaserver_port must be between 1 and 65535, %d is invalid\n", port);
665 LOG(
llevError,
"load_settings: worldmapstartx must be at least 0, %d is invalid\n", size);
672 LOG(
llevError,
"load_settings: worldmapstarty must be at least 0, %d is invalid\n", size);
679 LOG(
llevError,
"load_settings: worldmaptilesx must be greater than 1, %d is invalid\n", size);
686 LOG(
llevError,
"load_settings: worldmaptilesy must be greater than 1, %d is invalid\n", size);
693 LOG(
llevError,
"load_settings: worldmaptilesizex must be greater than 1, %d is invalid\n", size);
700 LOG(
llevError,
"load_settings: worldmaptilesizey must be greater than 1, %d is invalid\n", size);
707 LOG(
llevError,
"load_settings: fastclock must be at least 0, %d is invalid\n", lev);
716 LOG(
llevError,
"load_settings: Unknown value for not_permadeth: %s\n", cp);
724 LOG(
llevError,
"load_settings: Unknown value for resurrection: %s\n", cp);
732 LOG(
llevError,
"load_settings: Unknown value for set_title: %s\n", cp);
740 LOG(
llevError,
"load_settings: Unknown value for search_items: %s\n", cp);
748 LOG(
llevError,
"load_settings: Unknown value for spell_encumbrance: %s\n", cp);
756 LOG(
llevError,
"load_settings: Unknown value for spell_failure_effects: %s\n", cp);
764 LOG(
llevError,
"load_settings: Unknown value for casting_time: %s\n", cp);
772 LOG(
llevError,
"load_settings: Unknown value for real_wiz: %s\n", cp);
780 LOG(
llevError,
"load_settings: Unknown value for recycle_tmp_maps: %s\n", cp);
790 LOG(
llevError,
"load_settings: Unknown value for always_show_hp: %s\n", cp);
807 LOG(
llevError,
"load_settings: Unknown value for spellpoint_level_depend: %s\n", cp);
815 LOG(
llevError,
"load_settings: Unknown value for stat_loss_on_death: %s\n", cp);
818 LOG(
llevError,
"use_permanent_experience is deprecated, usepermenent_experience_percentage instead\n");
819 }
else if (!
strcasecmp(
buf,
"permanent_experience_percentage")) {
821 if (val < 0 || val > 100)
822 LOG(
llevError,
"load_settings: permenent_experience_percentage must be between 0 and 100, %d is invalid\n", val);
827 if (val < 0 || val > 100)
828 LOG(
llevError,
"load_settings: death_penalty_percentage must be between 0 and 100, %d is invalid\n", val);
833 if (val < 0 || val > 255)
834 LOG(
llevError,
"load_settings: death_penalty_levels can not be negative, %d is invalid\n", val);
843 LOG(
llevError,
"load_settings: Unknown value for balanced_stat_loss: %s\n", cp);
851 LOG(
llevError,
"load_settings: Unknown value for simple_exp: %s\n", cp);
854 float tmp = atof(cp);
856 LOG(
llevError,
"load_settings: item_power_factor must be a positive number (%f < 0)\n",
tmp);
860 int16_t val = atoi(cp);
862 if (val < -100 || val > 100)
863 LOG(
llevError,
"load_settings: pk_luck_penalty must be between -100 and 100, %d is invalid\n", val);
869 if (val < 1 || val > 100)
870 LOG(
llevError,
"load_settings: set_friendly_fire must be between 1 an 100, %d is invalid\n", val);
874 int max_e = atoi(cp);
876 LOG(
llevError,
"load_settings: armor_max_enchant is %d\n", max_e);
882 LOG(
llevError,
"load_settings: armor_weight_reduction is %d\n", wr);
891 LOG(
llevError,
"load_settings: unknown value for armor_weight_linear: %s\n", cp);
896 LOG(
llevError,
"load_settings: armor_speed_improvement is %d\n", wr);
905 LOG(
llevError,
"load_settings: unknown value for armor_speed_linear: %s\n", cp);
913 LOG(
llevError,
"load_settings: unknown value for no_player_stealing: %s\n", cp);
917 #ifdef TRY_BROKEN_TOWN_PORTALS
920 LOG(
llevError,
"load_settings: create_home_portals is currently broken. It results in town portals that prematurely reset when the apartment is swapped.\n");
925 LOG(
llevError,
"load_settings: unknown value for create_home_portals: %s\n", cp);
933 LOG(
llevError,
"load_settings: unknown value for personalized_blessings: %s\n", cp);
936 int64_t pkme = atoll(cp);
941 int pkmep = atoi(cp);
943 LOG(
llevError,
"load_settings: pk_max_experience_percent should be positive or zero (was \"%s\")\n", cp);
946 }
else if (!
strcasecmp(
buf,
"allow_denied_spells_writing")) {
952 LOG(
llevError,
"load_settings: unknown value for allow_denied_spells_writing: %s\n", cp);
960 LOG(
llevError,
"load_settings: unknown value for allow_broken_converters: %s\n", cp);
968 LOG(
llevError,
"load_settings: unknown value for log_timestamp: %s\n", cp);
977 LOG(
llevError,
"load_settings: starting_stat_min (%d) need to be within %d-%d (%d)\n",
985 LOG(
llevError,
"load_settings: starting_stat_max (%d) need to be within %d-%d (%d)\n",
994 LOG(
llevError,
"load_settings: starting_stat_points (%d) need to be within %d-%d\n",
1006 if (val < NUM_STATS * 3 || val >
NUM_STATS * 18)
1007 LOG(
llevError,
"load_settings: roll_stat_points need to be within %d-%d\n",
1017 LOG(
llevError,
"load_settings: unknown value for special_break_map: %s\n", cp);
1019 }
else if (!
strcasecmp(
buf,
"ignore_plugin_compatibility")) {
1025 LOG(
llevError,
"load_settings: unknown value for ignore_plugin_compatibility: %s\n", cp);
1033 LOG(
llevError,
"load_settings: unknown value for account_block_create: %s\n", cp);
1040 if (val != 0 && val != 1) {
1041 LOG(
llevError,
"load_settings: crypt_mode must be 0 or 1\n");
1049 LOG(
llevError,
"load_settings: min_name (%d) need to be within %d-%d\n",
1139 printf(
"Usage: crossfire-server [options]\n\n");
1141 printf(
"Options:\n");
1142 printf(
" -conf Set the directory to find configuration files.\n");
1143 printf(
" -d Turn on extra debugging messages.\n");
1144 printf(
" -data Set the data (share/) directory (archetypes, treasures, etc).\n");
1145 printf(
" -disable-module\n"
1146 " Disable specified module, by its name\n"
1147 " Can be specified multiple times. 'All' disables all modules.\n");
1148 printf(
" -enable-module\n"
1149 " Enable specified module, by its name\n"
1150 " Can be specified multiple times. 'All' enables all modules.\n");
1151 printf(
" -disable-plugin\n"
1152 " Disables specified plugin. Use the name without the extension.\n"
1153 " Can be specified multiple times. 'All' disables all plugins.\n");
1154 printf(
" -dump-anims Dump animations.\n");
1155 printf(
" -h Print this help message.\n");
1156 printf(
" -ignore-assets-errors\n");
1157 printf(
" Allow going on even if there are errors in assets.\n");
1158 printf(
" Warning: this may lead to strange behaviour.\n");
1159 printf(
" -list-modules\n"
1160 " List built-in modules and exit.\n");
1161 printf(
" -local Set the local data (var/) directory.\n");
1162 printf(
" -log <file> Write logging information to the given file.\n");
1163 printf(
" -m List suggested experience for all monsters.\n");
1164 printf(
" -m2 Dump monster abilities.\n");
1165 printf(
" -m3 Dump artifact information.\n");
1166 printf(
" -m4 Dump spell information.\n");
1167 printf(
" -m5 Dump skill information.\n");
1168 printf(
" -m6 Dump race information.\n");
1169 printf(
" -m7 Dump alchemy information.\n");
1170 printf(
" -m8 Dump gods information.\n");
1171 printf(
" -m9 Dump more alchemy information (formula checking).\n");
1172 printf(
" -maps Set the map directory.\n");
1173 printf(
" -mexp Dump the experience table.\n");
1174 printf(
" -mon Turn on monster debugging.\n");
1175 printf(
" -mq Dump the quest list.\n");
1176 printf(
" -mt <name> Dump a list of treasures for a monster.\n");
1177 printf(
" -n Turn off debugging messages if on by default.\n");
1178 printf(
" -p <port> Specifies the port to listen on for incoming connections.\n");
1179 printf(
" -pack-assets <type> <filename>\n");
1180 printf(
" Packs specified assets type to the specified filename.\n");
1181 printf(
" Valid assets type are: archs, treasures, faces, messages, facesets, artifacts, formulae, images, quests.\n");
1182 printf(
" The file format will be tar ('images') or text (everything else).\n");
1183 printf(
" It is possible to combine multiple assets by using '+', for instance 'faces+messages+artifacts'.\n");
1184 printf(
" In this case the file will be in tar format.\n");
1185 printf(
" -playerdir Set the player files directory.\n");
1186 printf(
" -regions Set the region file.\n");
1187 printf(
" -templatedir Set the template map directory.\n");
1188 printf(
" -tmpdir Set the directory for temporary files (mostly maps.)\n");
1189 printf(
" -uniquedir Set the unique items/maps directory.\n");
1190 printf(
" -v Print version information.\n");
1263 #ifdef SHUTDOWN_FILE
1268 if ((fp = fopen(
buf,
"r")) != NULL) {
1286 (
void) signum_unused;
1316 struct sigaction sa;
1318 sa.sa_sigaction = NULL;
1319 sigemptyset(&sa.sa_mask);
1322 sigaction(SIGHUP, &sa, NULL);
1324 signal(SIGPIPE, SIG_IGN);
uint8_t special_break_map
char meta_comment[MAX_BUF]
char meta_server[MAX_BUF]
static struct Command_Line_Options options[]
void init(int argc, char **argv)
static void init_beforeplay(void)
void LOG(LogLevel logLevel, const char *format,...)
int allow_broken_converters
char * log_timestamp_format
uint8_t armor_speed_linear
void random_house_generator_init(Settings *settings)
void dump_alchemy_costs(void)
uint8_t ignore_plugin_compatibility
uint8_t permanent_exp_ratio
static void set_datadir(const char *path)
static void load_materials(BufferReader *reader, const char *filename)
static void set_mapdir(const char *path)
static void set_dumpmon7(void)
static void rec_sighup(int i)
static void list_modules()
static materialtype_t * get_empty_mat(void)
static void set_dumpmont(const char *name)
void init_ob_methods(void)
static void set_dumpmon6(void)
uint8_t starting_stat_min
#define FREE_AND_COPY_IF(sv, nv)
static void set_mondebug(void)
static void server_dump_animations(void)
static void set_playerdir(const char *path)
std::vector< materialtype_t * > materials
void load_races(BufferReader *reader, const char *filename)
static void set_dumpmon2(void)
static void set_dumpmon4(void)
int64_t pk_max_experience
static void server_dump_faces(void)
static void parse_args(int argc, char *argv[], int pass)
uint8_t spell_encumbrance
void dump_experience(void)
void add_hook(const char *name, collectorHook hook)
static module_information modules[]
uint8_t balanced_stat_loss
static void load_settings(void)
void init_archetype_pointers(void)
int pk_max_experience_percent
sstring add_refcount(sstring str)
void citylife_init(Settings *settings)
uint8_t death_penalty_ratio
static void set_dumpmon3(void)
void random_house_generator_close()
uint16_t set_friendly_fire
uint8_t account_block_create
sstring add_string(const char *str)
static void set_enable_module(const char *name)
static void set_dumpmon1(void)
int metaserver2_init(void)
int armor_weight_reduction
uint8_t stat_loss_on_death
std::vector< char * > disabled_plugins
static void signal_shutdown(int signum_unused)
static void set_logfile(char *val)
void service_unregister()
void assets_finish_archetypes_for_play()
static void set_tmpdir(const char *path)
void dump_abilities(void)
static void set_uniquedir(const char *path)
uint8_t death_penalty_level
void cfcitybell_init(Settings *settings)
void fatal(enum fatal_error err)
static void set_dumpmon9(void)
static void set_confdir(const char *path)
void(* cmdlinefunc_args2)(const char *arg1, const char *arg2)
static void set_dumpmon8(void)
uint8_t spell_failure_effects
uint8_t starting_stat_points
int allow_denied_spells_writing
static void set_regions(const char *path)
char who_wiz_format[MAX_BUF]
uint8_t spellpoint_level_depend
void(* cmdlinefunc_args1)(const char *arg1)
static void free_materials(void)
uint8_t personalized_blessings
void print_monsters(void)
static void unset_debug(void)
void(* cmdlinefunc_args0)(void)
static void set_debug(void)
static void set_ignore_assets_errors()
void dump_monster_treasure(const char *name)
void dump_animations(void)
void add_server_collect_hooks()
uint8_t armor_weight_linear
static void set_dumpmon5(void)
int strcasecmp(const char *s1, const char *s2)
uint32_t worldmaptilesizex
static void call_version(void)
static void set_csport(const char *val)
static void init_startup(void)
static void set_disable_plugin(const char *name)
uint32_t worldmaptilesizey
static void set_localdir(const char *path)
void assets_pack(const char *what, const char *filename)
static void set_disable_module(const char *name)
uint8_t no_player_stealing
char * account_trusted_host
void dump_artifacts(void)
static void set_templatedir(const char *path)
uint8_t create_home_portals
int armor_speed_improvement
static void server_pack_assets(const char *assets, const char *filename)
volatile sig_atomic_t shutdown_flag
static void do_module(const char *name, bool enabled)
uint8_t starting_stat_max
char * bufferreader_next_line(BufferReader *br)