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);
305 for (
int module = 0;
modules[module].
name; module++) {
390 {
"-h", 0, 1,
help },
454 while (on_arg < argc) {
483 fprintf(stderr,
"Unknown option: %s\n", argv[on_arg]);
484 fprintf(stderr,
"Type '%s -h' for usage.\n", argv[0]);
534 while (
a->next != NULL) {
546 if (!strncmp(cp,
"name", 4)) {
548 if (mt->
next != NULL) {
555 }
else if (!strncmp(cp,
"description", 11)) {
557 }
else if (sscanf(cp,
"material %d", &
value)) {
559 }
else if (!strncmp(cp,
"saves", 5)) {
560 cp = strchr(cp,
' ')+1;
566 if ((
next = strchr(cp,
',')) != NULL)
568 sscanf(cp,
"%d", &
value);
572 }
else if (!strncmp(cp,
"mods", 4)) {
573 cp = strchr(cp,
' ')+1;
579 if ((
next = strchr(cp,
',')) != NULL)
581 sscanf(cp,
"%d", &
value);
623 if ((fp = fopen(
buf,
"r")) == NULL) {
631 if ((cp = strrchr(
buf,
'\n')) != NULL)
641 if ((cp = strchr(
buf,
' ')) != NULL) {
656 LOG(
llevError,
"load_settings: Unknown value for metaserver_notification: %s\n", cp);
662 LOG(
llevError,
"load_settings: metaserver_server must have a value.\n");
667 LOG(
llevError,
"load_settings: motd must have a value.\n");
672 LOG(
llevError,
"load_settings: metaserver_host must have a value.\n");
678 if (port < 1 || port > 65535)
679 LOG(
llevError,
"load_settings: metaserver_port must be between 1 and 65535, %d is invalid\n", port);
688 LOG(
llevError,
"load_settings: worldmapstartx must be at least 0, %d is invalid\n", size);
695 LOG(
llevError,
"load_settings: worldmapstarty must be at least 0, %d is invalid\n", size);
702 LOG(
llevError,
"load_settings: worldmaptilesx must be greater than 1, %d is invalid\n", size);
709 LOG(
llevError,
"load_settings: worldmaptilesy must be greater than 1, %d is invalid\n", size);
716 LOG(
llevError,
"load_settings: worldmaptilesizex must be greater than 1, %d is invalid\n", size);
723 LOG(
llevError,
"load_settings: worldmaptilesizey must be greater than 1, %d is invalid\n", size);
730 LOG(
llevError,
"load_settings: fastclock must be at least 0, %d is invalid\n", lev);
739 LOG(
llevError,
"load_settings: Unknown value for not_permadeth: %s\n", cp);
747 LOG(
llevError,
"load_settings: Unknown value for resurrection: %s\n", cp);
755 LOG(
llevError,
"load_settings: Unknown value for set_title: %s\n", cp);
763 LOG(
llevError,
"load_settings: Unknown value for search_items: %s\n", cp);
771 LOG(
llevError,
"load_settings: Unknown value for spell_encumbrance: %s\n", cp);
779 LOG(
llevError,
"load_settings: Unknown value for spell_failure_effects: %s\n", cp);
787 LOG(
llevError,
"load_settings: Unknown value for casting_time: %s\n", cp);
795 LOG(
llevError,
"load_settings: Unknown value for real_wiz: %s\n", cp);
803 LOG(
llevError,
"load_settings: Unknown value for recycle_tmp_maps: %s\n", cp);
813 LOG(
llevError,
"load_settings: Unknown value for always_show_hp: %s\n", cp);
830 LOG(
llevError,
"load_settings: Unknown value for spellpoint_level_depend: %s\n", cp);
838 LOG(
llevError,
"load_settings: Unknown value for stat_loss_on_death: %s\n", cp);
841 LOG(
llevError,
"use_permanent_experience is deprecated, usepermenent_experience_percentage instead\n");
842 }
else if (!
strcasecmp(
buf,
"permanent_experience_percentage")) {
844 if (val < 0 || val > 100)
845 LOG(
llevError,
"load_settings: permenent_experience_percentage must be between 0 and 100, %d is invalid\n", val);
850 if (val < 0 || val > 100)
851 LOG(
llevError,
"load_settings: death_penalty_percentage must be between 0 and 100, %d is invalid\n", val);
856 if (val < 0 || val > 255)
857 LOG(
llevError,
"load_settings: death_penalty_levels can not be negative, %d is invalid\n", val);
866 LOG(
llevError,
"load_settings: Unknown value for balanced_stat_loss: %s\n", cp);
874 LOG(
llevError,
"load_settings: Unknown value for simple_exp: %s\n", cp);
877 float tmp = atof(cp);
879 LOG(
llevError,
"load_settings: item_power_factor must be a positive number (%f < 0)\n",
tmp);
883 int16_t val = atoi(cp);
885 if (val < -100 || val > 100)
886 LOG(
llevError,
"load_settings: pk_luck_penalty must be between -100 and 100, %d is invalid\n", val);
892 if (val < 1 || val > 100)
893 LOG(
llevError,
"load_settings: set_friendly_fire must be between 1 an 100, %d is invalid\n", val);
897 int max_e = atoi(cp);
899 LOG(
llevError,
"load_settings: armor_max_enchant is %d\n", max_e);
905 LOG(
llevError,
"load_settings: armor_weight_reduction is %d\n", wr);
914 LOG(
llevError,
"load_settings: unknown value for armor_weight_linear: %s\n", cp);
919 LOG(
llevError,
"load_settings: armor_speed_improvement is %d\n", wr);
928 LOG(
llevError,
"load_settings: unknown value for armor_speed_linear: %s\n", cp);
936 LOG(
llevError,
"load_settings: unknown value for no_player_stealing: %s\n", cp);
944 LOG(
llevError,
"load_settings: unknown value for create_home_portals: %s\n", cp);
952 LOG(
llevError,
"load_settings: unknown value for personalized_blessings: %s\n", cp);
955 int64_t pkme = atoll(cp);
960 int pkmep = atoi(cp);
962 LOG(
llevError,
"load_settings: pk_max_experience_percent should be positive or zero (was \"%s\")\n", cp);
965 }
else if (!
strcasecmp(
buf,
"allow_denied_spells_writing")) {
971 LOG(
llevError,
"load_settings: unknown value for allow_denied_spells_writing: %s\n", cp);
979 LOG(
llevError,
"load_settings: unknown value for allow_broken_converters: %s\n", cp);
987 LOG(
llevError,
"load_settings: unknown value for log_timestamp: %s\n", cp);
996 LOG(
llevError,
"load_settings: starting_stat_min (%d) need to be within %d-%d (%d)\n",
1004 LOG(
llevError,
"load_settings: starting_stat_max (%d) need to be within %d-%d (%d)\n",
1013 LOG(
llevError,
"load_settings: starting_stat_points (%d) need to be within %d-%d\n",
1025 if (val < NUM_STATS * 3 || val >
NUM_STATS * 18)
1026 LOG(
llevError,
"load_settings: roll_stat_points need to be within %d-%d\n",
1036 LOG(
llevError,
"load_settings: unknown value for special_break_map: %s\n", cp);
1038 }
else if (!
strcasecmp(
buf,
"ignore_plugin_compatibility")) {
1044 LOG(
llevError,
"load_settings: unknown value for ignore_plugin_compatibility: %s\n", cp);
1052 LOG(
llevError,
"load_settings: unknown value for account_block_create: %s\n", cp);
1059 if (val != 0 && val != 1) {
1060 LOG(
llevError,
"load_settings: crypt_mode must be 0 or 1\n");
1068 LOG(
llevError,
"load_settings: min_name (%d) need to be within %d-%d\n",
1164 printf(
"Usage: crossfire-server [options]\n\n");
1166 printf(
"Options:\n");
1167 printf(
" -conf Set the directory to find configuration files.\n");
1168 printf(
" -d Turn on extra debugging messages.\n");
1169 printf(
" -data Set the data (share/) directory (archetypes, treasures, etc).\n");
1170 printf(
" -disable-module\n"
1171 " Disable specified module, by its name\n"
1172 " Can be specified multiple times. 'All' disables all modules.\n");
1173 printf(
" -enable-module\n"
1174 " Enable specified module, by its name\n"
1175 " Can be specified multiple times. 'All' enables all modules.\n");
1176 printf(
" -disable-plugin\n"
1177 " Disables specified plugin. Use the name without the extension.\n"
1178 " Can be specified multiple times. 'All' disables all plugins.\n");
1179 printf(
" -dump-anims Dump animations.\n");
1180 printf(
" -h Print this help message.\n");
1181 printf(
" -ignore-assets-errors\n");
1182 printf(
" Allow going on even if there are errors in assets.\n");
1183 printf(
" Warning: this may lead to strange behaviour.\n");
1184 printf(
" -list-modules\n"
1185 " List built-in modules and exit.\n");
1186 printf(
" -local Set the local data (var/) directory.\n");
1187 printf(
" -log <file> Write logging information to the given file.\n");
1188 printf(
" -m List suggested experience for all monsters.\n");
1189 printf(
" -m2 Dump monster abilities.\n");
1190 printf(
" -m3 Dump artifact information.\n");
1191 printf(
" -m4 Dump spell information.\n");
1192 printf(
" -m5 Dump skill information.\n");
1193 printf(
" -m6 Dump race information.\n");
1194 printf(
" -m7 Dump alchemy information.\n");
1195 printf(
" -m8 Dump gods information.\n");
1196 printf(
" -m9 Dump more alchemy information (formula checking).\n");
1197 printf(
" -maps Set the map directory.\n");
1198 printf(
" -mexp Dump the experience table.\n");
1199 printf(
" -mon Turn on monster debugging.\n");
1200 printf(
" -mq Dump the quest list.\n");
1201 printf(
" -mt <name> Dump a list of treasures for a monster.\n");
1202 printf(
" -n Turn off debugging messages if on by default.\n");
1203 printf(
" -p <port> Specifies the port to listen on for incoming connections.\n");
1204 printf(
" -pack-assets <type> <filename>\n");
1205 printf(
" Packs specified assets type to the specified filename.\n");
1206 printf(
" Valid assets type are: archs, treasures, faces, messages, facesets, artifacts, formulae, images, quests.\n");
1207 printf(
" The file format will be tar ('images') or text (everything else).\n");
1208 printf(
" It is possible to combine multiple assets by using '+', for instance 'faces+messages+artifacts'.\n");
1209 printf(
" In this case the file will be in tar format.\n");
1210 printf(
" -playerdir Set the player files directory.\n");
1211 printf(
" -regions Set the region file.\n");
1212 printf(
" -templatedir Set the template map directory.\n");
1213 printf(
" -tmpdir Set the directory for temporary files (mostly maps.)\n");
1214 printf(
" -uniquedir Set the unique items/maps directory.\n");
1215 printf(
" -v Print version information.\n");
1278 #ifdef SHUTDOWN_FILE
1283 if ((fp = fopen(
buf,
"r")) != NULL) {
1301 (
void) signum_unused;
1331 struct sigaction sa;
1333 sa.sa_sigaction = NULL;
1334 sigemptyset(&sa.sa_mask);
1337 sigaction(SIGHUP, &sa, NULL);
1339 signal(SIGPIPE, SIG_IGN);
uint8_t special_break_map
char meta_comment[MAX_BUF]
static void server_pack_assets(const char *assets, const char *filename)
static void list_modules()
char meta_server[MAX_BUF]
static void init_beforeplay(void)
sstring add_string(const char *str)
static void set_localdir(const char *path)
static void set_disable_plugin(const char *name)
int allow_broken_converters
char * log_timestamp_format
uint8_t armor_speed_linear
void random_house_generator_init(Settings *settings)
static void init_startup(void)
uint8_t ignore_plugin_compatibility
uint8_t permanent_exp_ratio
static void set_dumpmon3(void)
static void set_tmpdir(const char *path)
static void call_version(void)
void dump_abilities(void)
static void set_uniquedir(const char *path)
void dump_alchemy_costs(void)
void init_ob_methods(void)
uint8_t starting_stat_min
char * bufferreader_next_line(BufferReader *br)
static void rec_sighup(int i)
EXTERN materialtype_t * materialt
void(* cmdlinefunc_args2)(const char *arg1, const char *arg2)
void load_races(BufferReader *reader, const char *filename)
static void set_templatedir(const char *path)
int64_t pk_max_experience
static void set_dumpmon6(void)
uint8_t spell_encumbrance
uint8_t balanced_stat_loss
static void set_debug(void)
static void set_confdir(const char *path)
int pk_max_experience_percent
static void set_dumpmon8(void)
void citylife_init(Settings *settings)
uint8_t death_penalty_ratio
void random_house_generator_close()
uint16_t set_friendly_fire
uint8_t account_block_create
static void set_dumpmont(const char *name)
static void unset_debug(void)
struct _materialtype * next
static void set_regions(const char *path)
void fatal(enum fatal_error err)
int metaserver2_init(void)
int armor_weight_reduction
static void set_dumpmon1(void)
uint8_t stat_loss_on_death
static void server_dump_faces(void)
static void set_csport(const char *val)
struct linked_char * next
static void set_dumpmon5(void)
void service_unregister()
void assets_finish_archetypes_for_play()
const char * hooks_filename[20]
static void set_playerdir(const char *path)
static void set_ignore_assets_errors()
void(* cmdlinefunc_args0)(void)
uint8_t death_penalty_level
void cfcitybell_init(Settings *settings)
void add_server_collect_hooks()
static void set_dumpmon4(void)
void dump_artifacts(void)
uint8_t spell_failure_effects
uint8_t starting_stat_points
static void set_dumpmon2(void)
int allow_denied_spells_writing
static void set_datadir(const char *path)
linked_char * disabled_plugins
void print_monsters(void)
char who_wiz_format[MAX_BUF]
static void server_dump_animations(void)
uint8_t spellpoint_level_depend
void LOG(LogLevel logLevel, const char *format,...)
static materialtype_t * get_empty_mat(void)
struct module_information module_information
uint8_t personalized_blessings
static void set_enable_module(const char *name)
static void set_disable_module(const char *name)
void dump_animations(void)
void dump_monster_treasure(const char *name)
static void set_mondebug(void)
static module_information modules[]
static struct Command_Line_Options options[]
void init(int argc, char **argv)
static void do_module(const char *name, bool enabled)
uint8_t armor_weight_linear
static void load_materials(BufferReader *reader, const char *filename)
int strcasecmp(const char *s1, const char *s2)
uint32_t worldmaptilesizex
static void signal_shutdown(int signum_unused)
static void free_materials(void)
static void set_dumpmon7(void)
uint32_t worldmaptilesizey
static void load_settings(void)
void assets_pack(const char *what, const char *filename)
void dump_experience(void)
void(* cmdlinefunc_args1)(const char *arg1)
uint8_t no_player_stealing
char * account_trusted_host
static void set_logfile(char *val)
uint8_t create_home_portals
void init_archetype_pointers(void)
int armor_speed_improvement
volatile sig_atomic_t shutdown_flag
static void set_mapdir(const char *path)
static void parse_args(int argc, char *argv[], int pass)
static void set_dumpmon9(void)
uint8_t starting_stat_max