 |
Crossfire Server, Trunk
1.75.0
|
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++) {
460 while (on_arg < argc) {
489 fprintf(stderr,
"Unknown option: %s\n", argv[on_arg]);
490 fprintf(stderr,
"Type '%s -h' for usage.\n", argv[0]);
529 char *
buf, *cp, *next;
540 if (!strncmp(cp,
"name", 4)) {
545 }
else if (!strncmp(cp,
"description", 11)) {
547 }
else if (sscanf(cp,
"material %d", &value)) {
549 }
else if (!strncmp(cp,
"saves", 5)) {
550 cp = strchr(cp,
' ')+1;
556 if ((next = strchr(cp,
',')) != NULL)
558 sscanf(cp,
"%d", &value);
559 mt->
save[i] = (int8_t)value;
562 }
else if (!strncmp(cp,
"mods", 4)) {
563 cp = strchr(cp,
' ')+1;
569 if ((next = strchr(cp,
',')) != NULL)
571 sscanf(cp,
"%d", &value);
572 mt->
mod[i] = (int8_t)value;
608 if ((fp = fopen(
buf,
"r")) == NULL) {
616 if ((cp = strrchr(
buf,
'\n')) != NULL)
626 if ((cp = strchr(
buf,
' ')) != NULL) {
641 LOG(
llevError,
"load_settings: Unknown value for metaserver_notification: %s\n", cp);
647 LOG(
llevError,
"load_settings: metaserver_server must have a value.\n");
653 LOG(
llevError,
"load_settings: motd must have a value.\n");
658 LOG(
llevError,
"load_settings: metaserver_host must have a value.\n");
664 if (port < 1 || port > 65535)
665 LOG(
llevError,
"load_settings: metaserver_port must be between 1 and 65535, %d is invalid\n", port);
674 LOG(
llevError,
"load_settings: worldmapstartx must be at least 0, %d is invalid\n", size);
681 LOG(
llevError,
"load_settings: worldmapstarty must be at least 0, %d is invalid\n", size);
688 LOG(
llevError,
"load_settings: worldmaptilesx must be greater than 1, %d is invalid\n", size);
695 LOG(
llevError,
"load_settings: worldmaptilesy must be greater than 1, %d is invalid\n", size);
702 LOG(
llevError,
"load_settings: worldmaptilesizex must be greater than 1, %d is invalid\n", size);
709 LOG(
llevError,
"load_settings: worldmaptilesizey must be greater than 1, %d is invalid\n", size);
716 LOG(
llevError,
"load_settings: fastclock must be at least 0, %d is invalid\n", lev);
725 LOG(
llevError,
"load_settings: Unknown value for not_permadeth: %s\n", cp);
733 LOG(
llevError,
"load_settings: Unknown value for resurrection: %s\n", cp);
741 LOG(
llevError,
"load_settings: Unknown value for set_title: %s\n", cp);
749 LOG(
llevError,
"load_settings: Unknown value for search_items: %s\n", cp);
757 LOG(
llevError,
"load_settings: Unknown value for spell_encumbrance: %s\n", cp);
765 LOG(
llevError,
"load_settings: Unknown value for spell_failure_effects: %s\n", cp);
773 LOG(
llevError,
"load_settings: Unknown value for casting_time: %s\n", cp);
781 LOG(
llevError,
"load_settings: Unknown value for real_wiz: %s\n", cp);
789 LOG(
llevError,
"load_settings: Unknown value for recycle_tmp_maps: %s\n", cp);
799 LOG(
llevError,
"load_settings: Unknown value for always_show_hp: %s\n", cp);
816 LOG(
llevError,
"load_settings: Unknown value for spellpoint_level_depend: %s\n", cp);
824 LOG(
llevError,
"load_settings: Unknown value for stat_loss_on_death: %s\n", cp);
827 LOG(
llevError,
"use_permanent_experience is deprecated, usepermenent_experience_percentage instead\n");
828 }
else if (!
strcasecmp(
buf,
"permanent_experience_percentage")) {
830 if (val < 0 || val > 100)
831 LOG(
llevError,
"load_settings: permenent_experience_percentage must be between 0 and 100, %d is invalid\n", val);
836 if (val < 0 || val > 100)
837 LOG(
llevError,
"load_settings: death_penalty_percentage must be between 0 and 100, %d is invalid\n", val);
842 if (val < 0 || val > 255)
843 LOG(
llevError,
"load_settings: death_penalty_levels can not be negative, %d is invalid\n", val);
852 LOG(
llevError,
"load_settings: Unknown value for balanced_stat_loss: %s\n", cp);
860 LOG(
llevError,
"load_settings: Unknown value for simple_exp: %s\n", cp);
863 float tmp = atof(cp);
865 LOG(
llevError,
"load_settings: item_power_factor must be a positive number (%f < 0)\n", tmp);
869 int16_t val = atoi(cp);
871 if (val < -100 || val > 100)
872 LOG(
llevError,
"load_settings: pk_luck_penalty must be between -100 and 100, %d is invalid\n", val);
878 if (val < 1 || val > 100)
879 LOG(
llevError,
"load_settings: set_friendly_fire must be between 1 an 100, %d is invalid\n", val);
883 int max_e = atoi(cp);
885 LOG(
llevError,
"load_settings: armor_max_enchant is %d\n", max_e);
891 LOG(
llevError,
"load_settings: armor_weight_reduction is %d\n", wr);
900 LOG(
llevError,
"load_settings: unknown value for armor_weight_linear: %s\n", cp);
905 LOG(
llevError,
"load_settings: armor_speed_improvement is %d\n", wr);
914 LOG(
llevError,
"load_settings: unknown value for armor_speed_linear: %s\n", cp);
922 LOG(
llevError,
"load_settings: unknown value for no_player_stealing: %s\n", cp);
926 #ifdef TRY_BROKEN_TOWN_PORTALS
929 LOG(
llevError,
"load_settings: create_home_portals is currently broken. It results in town portals that prematurely reset when the apartment is swapped.\n");
934 LOG(
llevError,
"load_settings: unknown value for create_home_portals: %s\n", cp);
942 LOG(
llevError,
"load_settings: unknown value for personalized_blessings: %s\n", cp);
945 int64_t pkme = atoll(cp);
950 int pkmep = atoi(cp);
952 LOG(
llevError,
"load_settings: pk_max_experience_percent should be positive or zero (was \"%s\")\n", cp);
955 }
else if (!
strcasecmp(
buf,
"allow_denied_spells_writing")) {
961 LOG(
llevError,
"load_settings: unknown value for allow_denied_spells_writing: %s\n", cp);
969 LOG(
llevError,
"load_settings: unknown value for allow_broken_converters: %s\n", cp);
977 LOG(
llevError,
"load_settings: unknown value for log_timestamp: %s\n", cp);
986 LOG(
llevError,
"load_settings: starting_stat_min (%d) need to be within %d-%d (%d)\n",
994 LOG(
llevError,
"load_settings: starting_stat_max (%d) need to be within %d-%d (%d)\n",
1003 LOG(
llevError,
"load_settings: starting_stat_points (%d) need to be within %d-%d\n",
1015 if (val < NUM_STATS * 3 || val >
NUM_STATS * 18)
1016 LOG(
llevError,
"load_settings: roll_stat_points need to be within %d-%d\n",
1026 LOG(
llevError,
"load_settings: unknown value for special_break_map: %s\n", cp);
1028 }
else if (!
strcasecmp(
buf,
"ignore_plugin_compatibility")) {
1034 LOG(
llevError,
"load_settings: unknown value for ignore_plugin_compatibility: %s\n", cp);
1042 LOG(
llevError,
"load_settings: unknown value for account_block_create: %s\n", cp);
1049 if (val != 0 && val != 1) {
1050 LOG(
llevError,
"load_settings: crypt_mode must be 0 or 1\n");
1058 LOG(
llevError,
"load_settings: min_name (%d) need to be within %d-%d\n",
1148 printf(
"Usage: crossfire-server [options]\n\n");
1150 printf(
"Options:\n");
1151 printf(
" -conf Set the directory to find configuration files.\n");
1152 printf(
" -d Turn on extra debugging messages.\n");
1153 printf(
" -data Set the data (share/) directory (archetypes, treasures, etc).\n");
1154 printf(
" -disable-module\n"
1155 " Disable specified module, by its name\n"
1156 " Can be specified multiple times. 'All' disables all modules.\n");
1157 printf(
" -enable-module\n"
1158 " Enable specified module, by its name\n"
1159 " Can be specified multiple times. 'All' enables all modules.\n");
1160 printf(
" -disable-plugin\n"
1161 " Disables specified plugin. Use the name without the extension.\n"
1162 " Can be specified multiple times. 'All' disables all plugins.\n");
1163 printf(
" -dump-anims Dump animations.\n");
1164 printf(
" -h Print this help message.\n");
1165 printf(
" -ignore-assets-errors\n");
1166 printf(
" Allow going on even if there are errors in assets.\n");
1167 printf(
" Warning: this may lead to strange behaviour.\n");
1168 printf(
" -list-modules\n"
1169 " List built-in modules and exit.\n");
1170 printf(
" -local Set the local data (var/) directory.\n");
1171 printf(
" -log <file> Write logging information to the given file.\n");
1172 printf(
" -m List suggested experience for all monsters.\n");
1173 printf(
" -m2 Dump monster abilities.\n");
1174 printf(
" -m3 Dump artifact information.\n");
1175 printf(
" -m4 Dump spell information.\n");
1176 printf(
" -m5 Dump skill information.\n");
1177 printf(
" -m6 Dump race information.\n");
1178 printf(
" -m7 Dump alchemy information.\n");
1179 printf(
" -m8 Dump gods information.\n");
1180 printf(
" -m9 Dump more alchemy information (formula checking).\n");
1181 printf(
" -maps Set the map directory.\n");
1182 printf(
" -mexp Dump the experience table.\n");
1183 printf(
" -mon Turn on monster debugging.\n");
1184 printf(
" -mq Dump the quest list.\n");
1185 printf(
" -mt <name> Dump a list of treasures for a monster.\n");
1186 printf(
" -n Turn off debugging messages if on by default.\n");
1187 printf(
" -p <port> Specifies the port to listen on for incoming connections.\n");
1188 printf(
" -pack-assets <type> <filename>\n");
1189 printf(
" Packs specified assets type to the specified filename.\n");
1190 printf(
" Valid assets type are: archs, treasures, faces, messages, facesets, artifacts, formulae, images, quests.\n");
1191 printf(
" The file format will be tar ('images') or text (everything else).\n");
1192 printf(
" It is possible to combine multiple assets by using '+', for instance 'faces+messages+artifacts'.\n");
1193 printf(
" In this case the file will be in tar format.\n");
1194 printf(
" -playerdir Set the player files directory.\n");
1195 printf(
" -regions Set the region file.\n");
1196 printf(
" -templatedir Set the template map directory.\n");
1197 printf(
" -tmpdir Set the directory for temporary files (mostly maps.)\n");
1198 printf(
" -uniquedir Set the unique items/maps directory.\n");
1199 printf(
" -v Print version information.\n");
1272 #ifdef SHUTDOWN_FILE
1277 if ((fp = fopen(
buf,
"r")) != NULL) {
1295 (void) signum_unused;
1325 struct sigaction sa;
1327 sa.sa_sigaction = NULL;
1328 sigemptyset(&sa.sa_mask);
1331 sigaction(SIGHUP, &sa, NULL);
1333 signal(SIGPIPE, SIG_IGN);
uint8_t casting_time
It takes awhile to cast a spell.
uint8_t special_break_map
If set, then submaps in random maps can break the walls.
char meta_comment[MAX_BUF]
Comment we send to the metaserver.
One command line option definition.
const char * mapdir
Where the map files are.
char meta_server[MAX_BUF]
Hostname/ip addr of the metaserver.
struct Settings settings
Server settings.
uint8_t simple_exp
If true, use the simple experience system.
static struct Command_Line_Options options[]
Actual valid command line options.
uint8_t recycle_tmp_maps
Re-use tmp maps.
void init(int argc, char **argv)
This is the main server initialization function.
@ llevError
Error, serious thing.
static void init_beforeplay(void)
Called before the server starts listening to connections, processes various dump-related options.
const char * regions
Name of the regions file - libdir is prepended.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
int allow_broken_converters
If set, converters will work even if price of generated item is higher than the price of converted it...
char * log_timestamp_format
Format for timestap, if log_timestamp is set.
uint8_t armor_speed_linear
If 1, speed improvement is linear, else exponantiel.
void random_house_generator_init(Settings *settings)
Module initialisation.
int8_t mod[NROFATTACKS]
Modification to resistances.
uint8_t resurrection
Ressurection possible w/ permadeth on.
uint8_t set_title
Players can set thier title.
void dump_alchemy_costs(void)
Dumps to output all costs of recipes.
uint8_t ignore_plugin_compatibility
If set, don't check plugin version.
uint8_t not_permadeth
If true, death is non-permament.
uint8_t permanent_exp_ratio
How much exp should be 'permenant' and unable to be lost.
uint8_t crypt_mode
0 for legacy behavior, 1 for always Traditional
static void set_datadir(const char *path)
Command line option: set data path.
uint8_t dumpvalues
Set to dump various values/tables.
const char * datadir
Read only data files.
static void load_materials(BufferReader *reader, const char *filename)
Loads the materials.
static void set_mapdir(const char *path)
Command line option: set map path.
void cleanup(void)
Clean up everything and exit.
static void set_dumpmon7(void)
Command line option: dump alchemy.
void dump_faces(void)
Dump all faces to stderr, for debugging purposes.
uint32_t worldmaptilesy
Number of tiles high the worldmap is.
#define SHUTDOWN_FILE
If you want to take the game down while installing new versions, or for other reasons,...
static void rec_sighup(int i)
SIGHUP handler.
uint8_t min_name
Minimum characters for an account or player name.
uint32_t worldmapstartx
Starting x tile for the worldmap.
static void list_modules()
List all modules, then exit.
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
static materialtype_t * get_empty_mat(void)
Creates an empty materialtype_t structure.
static void set_dumpmont(const char *name)
Command line option: dump monster treasures.
void init_ob_methods(void)
Initializes the ob_method system.
static void set_dumpmon6(void)
Command line option: dump races.
uint8_t starting_stat_min
Minimum value of a starting stat.
void read_map_log(void)
Reads temporary maps information from disk.
uint8_t roll_stat_points
How many stat points legacy (rolled) chars start with.
int16_t pk_luck_penalty
Amount by which player luck is reduced if they PK.
#define FREE_AND_COPY_IF(sv, nv)
static void set_mondebug(void)
Command line option: monster debug flag.
@ llevMonster
Many many details.
static void server_dump_animations(void)
Dump all animations, then exit.
static void set_playerdir(const char *path)
Command line option: set player path.
void dump_gods(void)
Prints all gods to stderr.
uint16_t csport
Port for new client/server.
std::vector< materialtype_t * > materials
int ignore_assets_errors
If set then go on running even if there are errors in assets.
void load_races(BufferReader *reader, const char *filename)
Reads the races file in the lib/ directory, then overwrites old 'race' entries.
void init_server(void)
This sets up the listening socket.
static void set_dumpmon2(void)
Command line option: dump abilities.
uint8_t num_args
Number or args it takes.
char meta_host[MAX_BUF]
Hostname of this host.
static void set_dumpmon4(void)
Command line option: dump spells.
int forbid_play(void)
Checks if server should be started.
Plugin animator file specs[Config] name
uint32_t worldmaptilesx
Number of tiles wide the worldmap is.
void dump_races(void)
Dumps all race information to stderr.
int64_t pk_max_experience
Maximum experience one can get for PKing.
const char * cmd_option
How it is called on the command line.
static void server_dump_faces(void)
Dump all faces, then exit.
void init_signals(void)
Setup our signal handlers.
static void parse_args(int argc, char *argv[], int pass)
Parse command line arguments.
uint8_t spell_encumbrance
Encumbrance effects spells.
void init_gods(void)
This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD...
int material
What basic type(s) it is linked to.
void dump_experience(void)
Dump the experience table, then calls exit() - useful in terms of debugging to make sure the format o...
void add_hook(const char *name, collectorHook hook)
uint16_t meta_port
Port number to use for updates.
static module_information modules[]
All built modules.
uint8_t balanced_stat_loss
If true, Death stat depletion based on level etc.
LogLevel debug
Default debugging level.
static void load_settings(void)
This loads the settings file.
void init_archetype_pointers(void)
Initialize global archtype pointers:
int pk_max_experience_percent
Percentage of experience of victim the killer gets.
sstring add_refcount(sstring str)
This will increase the refcount of the string str.
void citylife_init(Settings *settings)
uint8_t death_penalty_ratio
Hhow much exp should be lost at death.
static void set_dumpmon3(void)
Command line option: dump artifacts.
void cftimer_init(void)
Initialize timers.
void random_house_generator_close()
Close the module.
void free_races(void)
Frees all race-related information.
uint16_t set_friendly_fire
Percent of damage done by peaceful player vs player damage.
uint8_t account_block_create
const char * motd
Name of the motd file.
const char * logfilename
Logfile to use.
uint32_t worldmapstarty
Starting y tile for the worldmap.
sstring add_string(const char *str)
This will add 'str' to the hash table.
void free_quest(void)
Free all quest status structures.
void init_readable(void)
Initialize linked lists utilized by message functions in tailor_readable_ob()
static void set_enable_module(const char *name)
Enable a module.
const char * name
Name of the material.
static void set_dumpmon1(void)
Command line option: dump monsters.
int metaserver2_init(void)
This initializes the metaserver2 logic - it reads the metaserver2 file, storing the values away.
spell prayer lvl t sp speed range duration short description
int armor_weight_reduction
Weight reduction per enchantment.
uint8_t stat_loss_on_death
If true, chars lose a random stat when they die.
std::vector< char * > disabled_plugins
List of disabled plugins, 'All' means all.
static void signal_shutdown(int signum_unused)
Signal handler that begins a normal server shutdown.
float item_power_factor
See note in setings file.
static void set_logfile(char *val)
Command line option: set logfile name.
void service_unregister()
const char * dumparg
Additional argument for some dump functions.
void assets_finish_archetypes_for_play()
void dump_spells(void)
Dumps all the spells - now also dumps skill associated with the spell.
const char * confdir
Configuration files.
FILE * logfile
Used by server/daemon.c.
static void set_tmpdir(const char *path)
Command line option: set temporary file path.
void dump_abilities(void)
Dump to standard out the abilities of all monsters.
static void set_uniquedir(const char *path)
Command line option: set unique path.
int8_t save[NROFATTACKS]
Save chances for the attacks.
uint8_t death_penalty_level
How many levels worth of exp may be lost on one death.
void cfcitybell_init(Settings *settings)
Citybells module initialisation.
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
void accounts_load(void)
This loads all the account entries into memory.
static void set_dumpmon9(void)
Command line option: dump alchemy costs.
#define MAX_BUF
Used for all kinds of things.
static void set_confdir(const char *path)
Command line option: set configuration path.
pluglist shows those as well as a short text describing each the list will simply appear empty The keyword for the Python plugin is Python plugout< keyword > Unloads a given identified by its _keyword_ So if you want to unload the Python you need to do plugout Python plugin< libname > Loads a given whose _filename_ is libname So in the case of you d have to do a plugin cfpython so Note that all filenames are relative to the default plugin path(SHARE/plugins). Console messages. ----------------- When Crossfire starts
void(* cmdlinefunc_args2)(const char *arg1, const char *arg2)
static void set_dumpmon8(void)
Command line option: dump gods.
const char * playerdir
Where the player files are.
void init_skills(void)
This just sets up the skill_names table above.
uint8_t spell_failure_effects
Nasty backlash to spell failures.
uint8_t starting_stat_points
How many stat points character starts with.
unsigned int meta_on
True if we should send updates.
int allow_denied_spells_writing
If set, players can write spells they can't cast.
void hiscore_init(void)
Initializes the module.
static void set_regions(const char *path)
Command line option: set regions file name.
static int should_exit
If set after command line argument parsing, then the server will exit.
void init_library(void)
It is vital that init_library() is called by any functions using this library.
char who_wiz_format[MAX_BUF]
The format that the who command should use when called by a dm.
void commands_init(void)
Init standard commands.
uint8_t spellpoint_level_depend
Spell costs go up with level.
void dump_quests(void)
Dump all of the quests, then calls exit() - useful in terms of debugging to make sure that quests are...
uint8_t fastclock
If true, clock goes warp 9.
void(* cmdlinefunc_args1)(const char *arg1)
static void free_materials(void)
Frees all memory allocated to materials.
uint8_t personalized_blessings
If 1, blessed weapons get an owner and a willpower value.
void print_monsters(void)
As dump_abilities(), but with an alternative way of output.
static void unset_debug(void)
Command line option: unset debug flag.
void dump_alchemy(void)
Dumps alchemy recipes to output.
static void help(void)
Display the command line options and exits.
uint8_t max_stat
Maximum stat value - 255 should be sufficient.
void(* cmdlinefunc_args0)(void)
Typedefs used when calling option handlers.
const char * description
Description, unused.
static void set_debug(void)
Command line option: debug flag.
void close_modules()
Clean up all modules which are not disabled.
void reset_sleep(void)
Initialise all variables used in the timing routines.
int armor_max_enchant
Maximum number of times an armor can be enchanted.
static void set_ignore_assets_errors()
Command line option: ignore assets errors.
void dump_monster_treasure(const char *name)
For debugging purposes.
void dump_animations(void)
Dump all animations to stderr, for debugging purposes.
void add_server_collect_hooks()
uint8_t armor_weight_linear
If 1, weight reduction is linear, else exponantiel.
static void set_dumpmon5(void)
Command line option: ?
int strcasecmp(const char *s1, const char *s2)
uint32_t worldmaptilesizex
Number of squares wide in a wm tile.
void init_modules()
Init all modules which are not disabled.
static void call_version(void)
Command line option: show version.
static void set_csport(const char *val)
Change the server's port.
uint8_t real_wiz
Use mud-like wizards.
static void init_startup(void)
Checks if starting the server is allowed.
const char * templatedir
Directory for the template map.
static void set_disable_plugin(const char *name)
Disable a plugin.
uint32_t worldmaptilesizey
Number of squares high in a wm tile.
static void set_localdir(const char *path)
Command line option: set local path.
void assets_pack(const char *what, const char *filename)
Pack the specified assets in a file.
static void set_disable_module(const char *name)
Disable a module.
void free_server(void)
Frees all memory allocated around here:
uint8_t no_player_stealing
If 1, can not steal from other players.
char * account_trusted_host
Block account creation for untrusted hosts.
uint8_t search_items
Search_items command.
const char * tmpdir
Directory to use for temporary files.
void dump_artifacts(void)
For debugging purposes.
uint8_t always_show_hp
'probe' spell HP bars for all living things (0, 1, or 2)
static void set_templatedir(const char *path)
Command line option: set template path.
uint8_t create_home_portals
If 1, can create portals in unique maps (apartments)
static void server_dump_bonuses()
Dump all bonuses (from the stat_bonus file) then exit.
uint8_t pass
What pass this should be processed on.
int armor_speed_improvement
Speed improvement.
@ NUM_STATS
Number of statistics.
int log_timestamp
If set, log will comport a timestamp.
char who_format[MAX_BUF]
The format that the who command should use.
static void server_pack_assets(const char *assets, const char *filename)
void(* func)()
function to call when we match this.
volatile sig_atomic_t shutdown_flag
@ llevDebug
Only for debugging purposes.
static void do_module(const char *name, bool enabled)
Change the 'enabled' flag of a module.
uint8_t starting_stat_max
Maximum value of a starting stat.
const char * uniquedir
Directory for the unique items.
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.
const char * localdir
Read/write data files.