 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
20 #define WANT_UNARMED_SKILLS
52 static void map_info(
object *op,
const char *search) {
55 "Maps matching search: '%s'", search);
59 "[fixed]Path Reset In (HH:MM:SS) Pl IM TO");
62 "[fixed]Path Reset In (HH:MM)");
66 char *to_be_freed = NULL;
67 char *search_array[64];
68 int search_array_count = 0;
70 to_be_freed = strdup(search);
72 search_array[0] = to_be_freed;
73 search_array_count = 1;
75 search_array_count =
split_string(to_be_freed,search_array,64,
',');
81 if ( search_array_count ) {
83 for (
int i=0; i<search_array_count; ++i) {
84 if ( strstr(
m->path,search_array[i]) ) {
90 if ( !match )
continue;
94 if (strlen(
m->path) <= 26) {
105 else if (
m->timeout) {
108 const uint32_t hh = ttr/3600, mm = (ttr%3600)/60, ss = ttr%60;
112 "[fixed]%-26.26s %2d:%02d:%02d %2d %2d %4d",
113 map_path, hh, mm, ss,
m->players,
m->in_memory,
m->timeout);
117 "[fixed]%-26.26s %2d:%02d%s",
map_path, hh, mm,
118 m->players ?
" (in use)" :
"");
121 if ( to_be_freed ) free( to_be_freed );
138 if (*params ==
'\0' || (!strcmp(params,
""))) {
140 "Your current language is set to: English.");
142 "Available languages:");
150 if (language ==
nullptr) {
152 "Unknown language.");
159 "Your current language is set to English.");
183 "The first column is the name of the body location.");
186 "The second column is how many of those locations your body has.");
189 "The third column is how many slots in that location are available.");
197 "[fixed]%-30s %5d %5d",
203 "You are not allowed to wear armor.");
206 "You are not allowed to use weapons.");
256 int nrm = 0, mapmem = 0, anr, anims, sum_alloc = 0, sum_used = 0, i, alnr;
271 for (
m =
first_map, nrofmaps = 0;
m != NULL;
m =
m->next, nrofmaps++)
278 "Sizeof: object=%zu player=%zu map=%zu",
285 "[fixed]%6d used", ob_used);
289 "[fixed] (used list mismatch: %d)",
294 "[fixed]%6d free (%.2f%% of %d allocated)",
299 "[fixed] (free list mismatch: %d)",
304 "[fixed]%6d on active list",
307 i = (ob_used*
sizeof(
object));
312 "[fixed] object total: %11d", i);
314 i = (ob_free*
sizeof(
object));
318 "[fixed]%4d players: %8d",
325 "[fixed]%4d maps allocated: %8d",
326 nrofmaps, i = (nrofmaps*
sizeof(
mapstruct)));
332 "[fixed]%4d maps in memory: %8d",
339 "[fixed]%4d archetypes: %8d",
346 "[fixed]%4d animations: %8d",
347 anims, i = (anims*
sizeof(uint16_t)));
353 "[fixed]%4zu treasurelists %8d",
360 "[fixed]%4ld treasures %8d",
367 "[fixed]%4ld artifacts %8d",
374 "[fixed]%4ld artifacts strngs %8d",
381 "[fixed]%4d artifactlists %8d",
388 "[fixed]Total space allocated:%8d",
392 "[fixed]Total space used: %8d",
419 "You are in %s.\n%s",
441 "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %d reset_group: %s",
442 m->players,
m->difficulty,
451 #ifdef DEBUG_MALLOC_LEVEL
460 void command_malloc_verify(
object *op,
char *parms) {
461 extern int malloc_verify(
void);
463 if (!malloc_verify())
465 "Heap is corrupted.");
468 "Heap checks out OK.");
497 if (pl->
ob->
map != NULL)
502 if (reg->longname == NULL && reg->counter > 0) {
503 if (reg->parent != NULL) {
504 reg->parent->counter += reg->counter;
507 LOG(
llevError,
"command_whereabouts() Region %s with no longname has no parent\n", reg->name);
511 "In the world currently there are:");
514 if (reg->counter > 0) {
554 int num_players = 0, num_wiz = 0, num_afk = 0, num_bot = 0;
563 if (pl->
ob->
map == NULL)
570 if (party && pl->
party != party)
578 "who failed - out of memory!");
596 if (reg == NULL && party == NULL)
598 "Total Players (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
600 else if (party == NULL)
602 "Total Players in %s (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
606 "Total Players in party %s (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
645 strcpy(outbuf,
"[fixed]");
648 LOG(
llevError,
"display_who_entry(): I was passed a null player\n");
651 for (i = 0; i <= strlen(format); i++) {
652 if (format[i] ==
'%') {
655 strcat(outbuf, tmpbuf);
656 }
else if (format[i] ==
'_') {
659 snprintf(tmpbuf,
sizeof(tmpbuf),
"%c", format[i]);
660 strcat(outbuf, tmpbuf);
707 snprintf(return_val, size,
"%u", pl->
ob->
count);
711 snprintf(return_val, size,
"\n");
719 snprintf(return_val, size,
"%d", pl->
ob->
level);
755 snprintf(return_val, size,
"%%");
759 snprintf(return_val, size,
"_");
763 return_val[0] =
'\0';
780 "You are no longer AFK");
896 if (*params ==
'\0' || !sscanf(params,
"%d", &i)) {
898 "Global debug level is %d.",
904 "Debug level set to %d.",
930 "You will now walk through walls.");
934 "You will now be stopped by walls.");
960 "You can now cast spells anywhere.");
964 "You now cannot cast spells in no-magic areas.");
1093 if (*params ==
'\0' || !sscanf(params,
"%d", &i)) {
1095 "Set listen to what (presently %d)?",
1101 "Verbose level should be positive.");
1106 "Your verbose level is now %d.",
1123 uint32_t hours, minutes;
1141 "[fixed]\nStat Nat/Real/Max");
1144 "[fixed]Str %2d/ %3d/%3d",
1147 "[fixed]Dex %2d/ %3d/%3d",
1150 "[fixed]Con %2d/ %3d/%3d",
1153 "[fixed]Int %2d/ %3d/%3d",
1156 "[fixed]Wis %2d/ %3d/%3d",
1159 "[fixed]Pow %2d/ %3d/%3d",
1162 "[fixed]Cha %2d/ %3d/%3d",
1165 "\nAttack Mode: %s",
1171 if (weap_speed < 0.0f)
1173 if (weap_speed > 1.0f)
1181 "\n\nDam/Sec: %4d", (
int)(dps + 0.5f));
1192 minutes = (uint32_t)
seconds / 60;
1193 hours = minutes / 60;
1194 minutes = minutes % 60;
1197 "You have played this character for %u ticks, which amounts "
1198 "to %d hours and %d minutes.",
1236 const struct dirent *entry;
1238 while ((entry =
readdir(dir)) != NULL) {
1240 if (!((entry->d_name[0] ==
'.' && entry->d_name[1] ==
'\0')
1241 || (entry->d_name[0] ==
'.' && entry->d_name[1] ==
'.' && entry->d_name[2] ==
'\0'))) {
1244 strcpy(
t, entry->d_name);
1245 if (stat(
buf, &
st) == 0) {
1249 if (S_ISDIR(
st.st_mode)) {
1250 struct tm *tm = localtime(&
st.st_mtime);
1253 "[fixed]%s\t%04d %02d %02d %02d %02d %02d",
1279 static const char *
const types[] = {
1285 if (*params ==
'\0') {
1287 "applymode is set to %s",
1292 if (!strcmp(params,
"nochoice"))
1294 else if (!strcmp(params,
"never"))
1296 else if (!strcmp(params,
"always"))
1300 "applymode: Unknown options %s, valid options are nochoice, never, always",
1305 "applymode%s set to %s",
1320 static const char *
const types[] = {
1336 if (*params ==
'\0') {
1338 "bowmode is set to %s",
1344 if (!strcmp(params,
types[i])) {
1367 "bowmode%s set to %s",
1385 if (*params ==
'\0') {
1387 "unarmed skill is set to %s",
1400 "You do not know any such skill called %s",
1404 for (i = 0; i <
sizeof(unarmed_skills); i++)
1405 if (
skill->subtype == unarmed_skills[i])
1407 if (i ==
sizeof(unarmed_skills)) {
1409 "%s is not an unarmed skill!",
1424 "unarmed skill is now set to %s",
1439 static const char *
const types[] = {
1446 if (*params ==
'\0') {
1448 "petmode is set to %s",
1453 if (!strcmp(params,
"normal"))
1455 else if (!strcmp(params,
"sad"))
1457 else if (!strcmp(params,
"defend"))
1459 else if (!strcmp(params,
"arena"))
1463 "petmode: Unknown options %s, valid options are normal, sad (seek and destroy), defend, arena",
1468 "petmode%s set to %s",
1483 int counter = 0, target = 0;
1484 int have_shown_pet = 0;
1485 if (*params !=
'\0')
1486 target = atoi(params);
1490 for (obl =
list; obl != NULL; obl = obl->
next) {
1491 object *ob = obl->
ob;
1500 }
else if (!have_shown_pet && ++counter == target) {
1502 "[fixed]level %d %s",
1505 "[fixed]%d/%d HP, %d/%d SP",
1531 "[fixed]wc %d damage %d ac %d",
1542 "You have no pets.");
1543 else if (target != 0 && have_shown_pet == 0)
1558 static const char *
const types[] = {
1564 if (*params ==
'\0') {
1566 "usekeys is set to %s",
1571 if (!strcmp(params,
"inventory"))
1573 else if (!strcmp(params,
"keyrings"))
1575 else if (!strcmp(params,
"containers"))
1579 "usekeys: Unknown option %s, valid options are inventory, keyrings, containers",
1584 "usekeys%s set to %s",
1608 "[fixed]%-20s %+5d",
1620 "\nNatural skin resistances:");
1622 for (attack = 0; attack <
NROFATTACKS; attack++) {
1649 const char *language;
1652 snprintf(suffix,
sizeof(suffix),
".%s", language);
1662 snprintf(filename,
sizeof(filename),
"%s/mischelp",
settings.
datadir);
1673 if (!(dirp =
opendir(filename)))
1681 && *de->d_name ==
'.'
1682 && (namelen == 1 || de->d_name[1] ==
'.'))
1684 if (strstr(de->d_name, suffix)) {
1685 strcat(
line, strtok(de->d_name,
"."));
1707 if (stat(path, &
st) == 0 && S_ISREG(
st.st_mode)) {
1774 const char *language;
1779 if (*params ==
'\0') {
1780 snprintf(filename,
sizeof(filename),
"%s/def_help",
settings.
datadir);
1788 if (!strcmp(params,
"topics")) {
1799 if (!strcmp(params,
"commands")) {
1807 if (strchr(params,
'.') || strchr(params,
' ') || strchr(params,
'/')) {
1809 "Illegal characters in '%s'",
1818 "No help available on '%s'",
1842 if (sscanf(
line,
"%d", &i))
1877 "To leave the game, sleep in (apply) a bed to reality. To "
1878 "permenantly delete your character, use the 'delete' command.");
1897 i18n(op,
"Quitting will delete your character.\nAre you sure you want to delete your character (y/n):"));
1915 "Sounds are turned off.");
1919 "The sounds are enabled.");
1956 unsigned int pwd_len = strlen(password);
1958 if (pwd_len == 0 || pwd_len > 16) {
1963 "Password changed cancelled.");
1976 "You are not allowed to play.");
1984 "The passwords did not match.");
1991 "\nWelcome, Brave New Warrior!\n");
2000 "You entered the wrong current password.");
2013 i18n(op,
"Please confirm your new password, or blank to cancel:"));
2021 "The new passwords don't match!");
2024 "Password changed.");
2052 "You cannot change your title.");
2059 "Dragons cannot change titles.");
2063 if (*params ==
'\0') {
2067 snprintf(
buf,
sizeof(
buf),
"Your title is '%s'.", tmp);
2071 if (strcmp(params,
"clear") == 0 || strcmp(params,
"default") == 0) {
2074 "Your title is the default title.");
2077 "Title set to default.");
2082 if ((
int)strlen(params) >=
MAX_NAME) {
2102 "You can not save on unholy ground.");
2105 "You don't deserve to save yet.");
2109 "You have been saved.");
2128 "You will not attack other players.");
2131 "You will attack other players.");
2145 if (*params ==
'\0' || !sscanf(params,
"%d", &i)) {
2147 "Your current wimpy level is %d.",
2152 if (i < 0 || i > 100) {
2154 "Wimpy level must be between 1 and 100.");
2159 "Your new wimpy level is %d.",
2173 if (*params ==
'\0')
2197 if (*params ==
'\0') {
2200 "Your pets have been killed.");
2203 int counter = 0, removecount = 0;
2204 int target = atoi(params);
2206 for (obl =
list; obl != NULL; obl = obl->
next) {
2207 object *ob = obl->
ob;
2209 if (++counter == target || (target == 0 && !
strcasecmp(ob->
name, params))) {
2218 if (removecount != 0)
2224 "Couldn't find any suitable pets to kill.");
2247 "passwd is maintained for older clients that do not support the account system. Please use the 'Password' button in your character selection screen to change your password.");
2262 int count = 0, proba;
2263 int level, exp, check_exhaust = 0;
2266 object *item, *inv, *harvested;
2267 sstring trace, ttool, tspeed, race, tool, slevel, sexp;
2291 if (!trace || strcmp(trace,
"") == 0 || !ttool || strcmp(ttool,
"") == 0 || !tspeed || strcmp(tspeed,
"") == 0) {
2297 const int max_harvest = 10;
2317 const char* harvestitems;
2327 while (item && count < max_harvest) {
2335 if (race && (!slevel || !sexp)) {
2336 LOG(
llevError,
"do_harvest: item %s without harvest_[level|exp]\n", inv->
name);
2339 if (race == trace && (!tool || tool == ttool))
2340 found[count++] = inv;
2345 if (count >= max_harvest)
2360 level = atoi(slevel);
2363 speed = atof(tspeed);
2401 if (inv->
nrof == 0) {
2402 check_exhaust = (count == 1 ? 1 : 0);
2406 if (count == 1 && inv->
nrof == 1) {
2409 if ( inv->
nrof == 1 ) {
2437 if (check_exhaust) {
2440 if (replacement[0] !=
'-') {
size_t count() const
Get the number of assets.
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
sstring name_pl
The plural name of the object.
void command_dumpallarchetypes(object *op, const char *params)
Various archetypes-related statistics.
Main Crossfire structure, one ingame object.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
const char * get_name_of_region_for_map(const mapstruct *m)
Gets the name of a region for a map.
player * next
Pointer to next player, NULL if this is last.
long nrofartifacts
Only used in malloc_info().
player * first_player
First player.
#define ST_CHANGE_PASSWORD_OLD
Player is entering old password to change password.
struct Settings settings
Global settings.
void pets_terminate_all(object *owner)
Removes all pets someone owns.
int16_t maxhp
Max hit points.
int object_count_active(void)
Objects statistics.
#define NUM_BODY_LOCATIONS
Number of body locations.
const char * unarmed_skill
Prefered skill to use in unarmed combat.
void command_list(object *pl, bool is_dm)
Display the list of commands to a player.
static int name_cmp(const chars_names *c1, const chars_names *c2)
Local function for qsort comparison.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
uint16_t difficulty
What level the player should be to play here.
void hiscore_display(object *op, int max, const char *match)
Displays the high score file.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void * language_t
Strings that should be manipulated through add_string() and free_string().
void send_news(const object *op)
Send the news to a player.
region * get_region_by_name(const char *region_name)
Gets a region by name.
static void map_info(object *op, const char *search)
This is the 'maps' command.
void ss_dump_statistics(char *buf, size_t size)
A call to this function will cause the statistics to be dumped into specified buffer.
void dump_friendly_objects(void)
Dumps all friendly objects.
void time_info(object *op)
Players wants to know the time.
#define MSG_TYPE_SKILL
Messages related to skill use.
#define QUERY_FLAG(xyz, p)
void receive_player_name(object *op, const char *name)
A player just entered her name.
char const * newhash(char const *password)
objectlink * next
Next item to link to.
uint8_t set_title
Players can set thier title.
uint32_t sound
Client sound mode.
void command_dumpallobjects(object *op, const char *params)
Various object-related statistics.
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
void command_dumpallmaps(object *op, const char *params)
Various map-related statistics.
void command_body(object *op, const char *params)
This command dumps the body information for object *op.
objectlink * get_friends_of(const object *owner)
Get a list of friendly objects for the specified owner.
bowtype_t
Bow firing mode.
@ pet_defend
Stay close to the owner.
int region_is_child_of_region(const region *child, const region *r)
Checks if a region is a child of another.
const char * datadir
Read only data files.
struct archetype * arch
Pointer to archetype.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
float speed
Frequency of object 'moves' relative to server tick rate.
void command_showpets(object *op, const char *params)
Players wants to know her pets.
uint32_t peaceful
If set, won't attack friendly creatures.
object * ob
The object representing the player.
void object_dump_all(void)
Dumps all objects to console.
static int onoff_value(const char *line)
Utility function to convert a reply to a yes/no or on/off value.
float speed_left
How much speed is left to spend this round.
AllAnimations * animations()
Get animations.
struct mapstruct * map
Pointer to the map in which this object is present.
treasurelist * find_treasurelist(const char *name)
Search for the given treasurelist by name.
double expmul
needed experience = (calc_exp*expmul) - means some races/classes can need less/more exp to gain level...
object * ob
Item to link to.
void get_password(object *op)
Waiting for the player's password.
void player_set_own_title(struct player *pl, const char *title)
Sets the custom title.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void command_statistics(object *pl, const char *params)
Prints out some useful information for the character.
void map_path(const char *map, int flags, char *pathname, size_t bufsize)
#define CS_QUERY_SINGLECHAR
Single character response expected.
void bufferreader_destroy(BufferReader *br)
Destroy a BufferReader.
uint32_t is_bot
Client shouldn't be reported to metaserver.
void command_hiscore(object *op, const char *params)
Player is asking for the hiscore.
tag_t count
Unique object number for this object.
#define FLAG_WIZCAST
The wizard can cast spells in no-magic area.
int player_has_own_title(const struct player *pl)
Returns whether the player has a custom title.
void command_kill_pets(object *op, const char *params)
Player wants to get rid of pets.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
artifactlist * next
Next list of artifacts.
void dump_map(const mapstruct *m)
Prints out debug-information about a map.
void command_rules(object *op, const char *params)
Display the server rules.
void command_ssdumptable(object *op, const char *params)
Various string-related statistics.
uint32_t hidden
If True, player (DM) is hidden from view.
char * name
Shortend name of the region as maps refer to it.
@ unapply_always
Will unapply whatever is necessary - this goes beyond no choice - if there are multiple ojbect of the...
int rndm(int min, int max)
Returns a number between min and max.
#define MSG_TYPE_COMMAND_ERROR
Bad syntax/can't use command.
char path[HUGE_BUF]
Filename of the map.
int16_t level
Level of creature or object.
@ bow_bestarrow
Try to find an arrow matching the target.
AssetsManager * getManager()
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
object * above
Pointer to the object stacked above this one.
const char * get_region_longname(const region *r)
Gets the longname of a region.
#define HUGE_BUF
Used for messages - some can be quite long.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
Plugin animator file specs[Config] name
float ticks_to_seconds(int ticks)
#define FOR_BELOW_FINISH()
Finishes FOR_BELOW_PREPARE().
char * longname
Official title of the region, this might be defined to be the same as name.
static void help_topics(object *op, int what)
Player wants to know available help topics.
#define MSG_TYPE_ADMIN_DM
DM related admin actions.
int32_t carrying
How much weight this object contains.
#define LOOK_OBJ(ob)
This returns TRUE if the object is something that should be displayed in the look window.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn ft Human ra Mage C Monk se Ninja hi Priest C Quetzalcoatl mw Swashbuckler st
void command_debug(object *op, const char *params)
Player wants to see/change the debug level.
int16_t y
Position in the map for this object.
void command_time(object *op, const char *params)
Players asks for the time.
static event_registration m
void pets_terminate(object *pet)
Removes a pet, taking care of clearning the owner's fields if needed.
#define MAP_IN_MEMORY
Map is fully loaded.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
struct player * contr
Pointer to the player which control this object.
BufferReader * bufferreader_init_from_file(BufferReader *br, const char *filepath, const char *failureMessage, LogLevel failureLevel)
Initialize or create a BufferReader from a file path.
void command_news(object *op, const char *params)
Display the server news.
#define MAP_MINTIMEOUT
At least that many ticks before swapout.
DIR * opendir(const char *)
uint32_t map_size(mapstruct *m)
Calculate map size without intermediate sign extension.
object * chosen_skill
The skill chosen to use.
long nrofallowedstr
Only used in malloc_info().
LogLevel debug
Default debugging level.
void send_rules(const object *op)
Send the rules to a player.
Used to link together several objects.
static void display_who_entry(object *op, player *pl, const char *format)
Display a line of 'who' to op, about pl, using the formatting specified by format.
static void current_region_info(object *op)
'whereami' command.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
#define ST_CHANGE_PASSWORD_CONFIRM
Player is confirming new password.
void command_malloc(object *op, const char *params)
Display memory information.
sstring i18n_get_language_code(language_t language)
Return the code of a specified language.
void check_login(object *op, const char *password)
Actually login a player, load from disk and such.
float weapon_speed
The overall speed of this object.
void list_players(object *op, region *reg, partylist *party)
Displays the players in a region or party.
unapplymode
This is used to control what to do when we need to unapply an object before we can apply another one.
treasurelist represents one logical group of items to be generated together.
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Splits a string delimited by passed in sep value into characters into an array of strings.
void command_dumpfriendlyobjects(object *op, const char *params)
Various friendly object-related statistics.
object clone
An object from which to do object_copy()
uint8_t run_away
Monster runs away if it's hp goes below this percentage.
void command_language(object *op, const char *params)
This is the 'language' command.
void command_petmode(object *op, const char *params)
Player wants to change how her pets behave.
#define MSG_TYPE_COMMAND_INFO
Generic info: resistances, etc.
sstring add_string(const char *str)
This will add 'str' to the hash table.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters speed
int object_count_free(void)
Objects statistics.
mapstruct * first_map
First map.
const char * get_region_msg(const region *r)
Gets a message for a region.
void display_motd(const object *op)
Sends the message of the day to the player.
#define MAP_WHEN_RESET(m)
This is when the map will reset.
struct dirent * readdir(DIR *)
#define MSG_TYPE_COMMAND_MALLOC
char * host
Which host it is connected from (ip address).
void command_passwd(object *pl, const char *params)
Player is asking to change password.
#define FLAG_AFK
Player is AFK.
#define MSG_TYPE_COMMAND_STATISTICS
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item.
#define FREE_AND_COPY(sv, nv)
Release the shared string if not NULL, and make it a reference to nv.
int16_t dam
How much damage this object does when hitting.
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn t
@ bow_nw
Fire north-west whatever the facing direction.
object * object_create_arch(archetype *at)
Create a full object using the given archetype.
void do_harvest(object *pl, int dir, object *skill)
Player is trying to harvest something.
void command_quit(object *op, const char *params)
Tell players to use the 'delete' command.
#define FLAG_WIZPASS
The wizard can go through walls.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
static int find_help_file_in(const char *dir, const char *name, const char *language, char *path, int length)
Find a (help) file in the specified subdirectory of data.
This represents all archetypes for one particular object type.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
#define ST_CHANGE_PASSWORD_NEW
Player is entering new password.
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
void command_applymode(object *op, const char *params)
Players wants to change the apply mode, ie how to handle applying an item when no body slot available...
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
int64_t level_exp(int level, double expmul)
Returns how much experience is needed for a player to become the given level.
body_locations_struct body_locations[NUM_BODY_LOCATIONS]
The ordering of this is actually doesn't make a difference However, for ease of use,...
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
static void display_help_file(object *op, const char *filename)
Attempt to send the contents of the specified file to the player.
#define FLAG_USE_WEAPON
(Monster) can wield weapons
void command_strings(object *op, const char *params)
Various string-related statistics.
char * ss_dump_table(int what, char *buf, size_t size)
Dump the contents of the share string tables.
#define SND_MUTE
Don't sent anything for now.
int nrofallocobjects
How many OBs allocated (free + used)
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
This structure contains all information related to one map square.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
void command_usekeys(object *op, const char *params)
Player wants to change how keys are used.
void command_whereabouts(object *op, const char *params)
'whereabouts' command.
char * partyname
Party name.
void command_afk(object *op, const char *params)
Toggles the afk status of a player.
void command_sound(object *op, const char *params)
Player wants to change sound status.
void command_save(object *op, const char *params)
Player wants to get saved.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
void command_resistances(object *op, const char *params)
Players wants to know her resistances.
#define FLAG_MONSTER
Will attack players.
@ key_inventory
Only use keys in inventory.
object * find_skill_by_name(object *who, const char *name)
This returns the skill pointer of the given name (the one that accumulates exp, has the level,...
long seconds(void)
Return wall clock time in seconds.
#define MAP_WIDTH(m)
Map width.
#define P_OUT_OF_MAP
This space is outside the map.
Archetypes * archetypes()
Get archetypes.
#define MAX_BUF
Used for all kinds of things.
void receive_player_password(object *op, const char *password)
A player just entered her password, including for changing it.
uint8_t listening
Which priority will be used in info_all.
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
int checkbanned(const char *login, const char *host)
Check if a player and/or host is banned.
void command_printlos(object *op, const char *params)
Various LOS-related statistics.
living orig_stats
Permanent real stats of player.
void set_map_reset_time(mapstruct *map)
Updates the map's timeout.
uint32_t get_weight_limit(int stat)
int32_t weight
Attributes of the object.
int nroffreeobjects
How many OBs allocated and free (free)
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
@ pet_sad
Try to find enemies.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
unapplymode unapply
Method for auto unapply.
const char * playerdir
Where the player files are.
static bool IS_PLAYER(object *op)
A buffer that will be expanded as content is added to it.
void print_los(object *op)
Debug-routine which dumps the array which specifies the visible area of a player.
char new_password[16]
2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
void command_delete(object *op, const char *params)
Player wants to totally delete her character.
#define ST_PLAYING
Usual state.
void command_version(object *op, const char *params)
Server version.
#define FLAG_WIZ
Object has special privilegies.
Crossfire Protocol which is used between clients and servers to play Crossfire This documentation is intended primarily for client implementers This manual is the collective result of various authors compiled over the course of many most of the time several years after the actual code was written As such it will surely contain omit certain important and possibly make life miserable many working open source server and client implementations of this protocol are available Fixes and improvements to this documentation are welcome History the communications plan was set to be a text based system It was up to the server and client to parse these messages and determine what to do These messages were assumed to be line per message At a reasonably early stage of Eric Anderson wrote a then the data itself you could send many data types
void command_players(object *op, const char *params)
Display all known players.
#define NDI_UNIQUE
Print immediately, don't buffer.
std::vector< region * > all_regions
sstring name
The name of the object, obviously...
const char *const attacktype_desc[NROFATTACKS]
Short description of names of the attacktypes.
Utility structure for the 'who' command.
#define MSG_TYPE_SKILL_FAILURE
Failure in using skill.
@ pet_normal
Standard mode/.
int object_count_used(void)
Object statistics.
void command_dumpmap(object *op, const char *params)
Various map-related statistics.
char who_wiz_format[MAX_BUF]
The format that the who command should use when called by a dm.
int is_dragon_pl(const object *op)
Checks if player is a dragon.
std::vector< archetype * > players
#define ST_CONFIRM_PASSWORD
New character, confirm password.
void command_maps(object *op, const char *params)
'maps' command.
@ unapply_nochoice
Will unapply objects when there no choice to unapply.
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
int16_t maxsp
Max spell points.
object * env
Pointer to the object which is the environment.
#define MSG_TYPE_COMMAND_BODY
non standard information is not specified num_players
const typedef char * sstring
void roll_again(object *op)
Ask the player what to do with the statistics.
void command_motd(object *op, const char *params)
Display the message of the day.
size_t assets_number_of_treasurelists()
void i18n_list_languages(object *who)
List all languages for who.
sstring skill
Name of the skill this object uses/grants.
language_t language
The language the player wishes to use.
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
uint8_t state
Input state of the player (name, password, etc).
void command_brace(object *op, const char *params)
Player toggles her braced status.
char * name
Name of map as given by its creator.
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coo...
void command_title(object *op, const char *params)
Player wishes to change her title.
language_t i18n_find_language_by_code(const char *code)
Attempt to find the identifier of a language from its code.
uint32_t braced
Will not move if braced, only attack.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
@ pet_arena
Attack other players in arena.
#define CLEAR_FLAG(xyz, p)
region * get_region_from_string(const char *name)
Tries to find a region that 'name' corresponds to.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
uint32_t tick_duration
Gloabal variables:
#define MAP_HEIGHT(m)
Map height.
#define MAP_ENTER_Y(m)
Default Y coordinate for map enter.
#define MSG_TYPE_COMMAND_CONFIG
bowmode, petmode, applymode
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players.
void command_who(object *op, const char *params)
'who' command.
object * object_find_by_type_and_arch_name(const object *who, int type, const char *name)
Find object in inventory by type and archetype name.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various stats
partylist * party
Party this player is part of.
artifactlist * first_artifactlist
First artifact.
@ containers
Use keys in inventory and active containers.
@ keyrings
Use keys in inventory and active key rings.
#define MSG_TYPE_COMMAND_MAPS
int strcasecmp(const char *s1, const char *s2)
static void malloc_info(object *op)
Sends various memory-related statistics.
static int find_help_file(const char *name, const char *language, int wiz, char *path, int length)
Find an appropriate help file.
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
void command_whereami(object *op, const char *params)
'whereami' command.
region * get_region_by_map(mapstruct *m)
Gets a region from a map.
void command_help(object *op, const char *params)
Player is asking for some help.
void command_bowmode(object *op, const char *params)
Player wants to change the bowmode, how arrows are fired.
int save_player(object *op, int flag)
Saves a player to disk.
#define ST_GET_PARTY_PASSWORD
Player tried to join a password-protected party.
void command_wizpass(object *op, const char *params)
Wizard toggling wall-crossing.
uint32_t counter
A generic counter for holding temporary data.
static void current_map_info(object *op)
'mapinfo' command.
#define MAP_ENTER_X(m)
Default X coordinate for map enter.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
void player_set_state(player *pl, uint8_t state)
Set the player's state to the specified one.
archetype * try_find_archetype(const char *name)
static void get_who_escape_code_value(char *return_val, int size, const char letter, player *pl)
Returns the value of the escape code used in the who format specifier.
void free_objectlink(objectlink *ol)
Recursively frees all objectlinks.
signed long object_sum_weight(object *op)
object_sum_weight() is a recursive function which calculates the weight an object is carrying.
bool check_password(const char *typed, const char *crypted)
Hash a password and compare it to the stored version.
uint8_t login_method
Login method this client is using.
#define P_NO_CLERIC
No clerical spells cast here.
#define ST_CONFIRM_QUIT
Player used the 'quit' command, make sure that's ok.
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
char password[16]
2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16
void command_wimpy(object *op, const char *params)
Player wants to change how soon she'll flee.
#define SK_EXP_ADD_SKILL
Give the player the skill.
uint32_t nrof
Number of objects.
socket_struct * socket
Socket information for this player.
int8_t body_used[NUM_BODY_LOCATIONS]
Calculated value based on items equipped.
living stats
Str, Con, Dex, etc.
#define MSG_TYPE_ADMIN_VERSION
version info
@ unapply_never
Will not unapply objects automatically.
treasure is one element in a linked list, which together consist of a complete treasure-list.
How to Install a Crossfire Server on you must install a python script engine on your computer Python is the default script engine of Crossfire You can find the python engine you have only to install them The VisualC Crossfire settings are for but you habe then to change the pathes in the VC settings Go in Settings C and Settings Link and change the optional include and libs path to the new python installation path o except the maps ! You must download a map package and install them the share folder Its must look like doubleclick on crossfire32 dsw There are projects in your libcross lib and plugin_python You need to compile all Easiest way is to select the plugin_python ReleaseLog as active this will compile all others too Then in Visual C press< F7 > to compile If you don t have an appropriate compiler you can try to get the the VC copies the crossfire32 exe in the crossfire folder and the plugin_python dll in the crossfire share plugins folder we will remove it when we get time for it o Last showing lots of weird write to the Crossfire mailing list
LogLevel
Log levels for the LOG() function.
This is one artifact, ie one special item.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
void command_unarmed_skill(object *op, const char *params)
Player wants to change prefered unarmed skill.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
petmode_t petmode
Which petmode?
#define ST_ROLL_STAT
New character, rolling stats.
int check_name(player *me, const char *name)
Ensure player's name is valid.
#define MSG_TYPE_COMMAND_WHO
uint32_t name_changed
If true, the player has set a name.
void command_wizcast(object *op, const char *params)
Wizard toggling "cast everywhere" ability.
void send_query(socket_struct *ns, uint8_t flags, const char *text)
Asks the client to query the user.
void command_peaceful(object *op, const char *params)
Player toggles her peaceful status.
bowtype_t bowtype
Which firemode?
void command_mapinfo(object *op, const char *params)
'mapinfo' command.
char who_format[MAX_BUF]
The format that the who command should use.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
usekeytype
How to use keys.
void command_listen(object *op, const char *params)
Change the player's listen level.
void dump_all_maps(void)
Prints out debug-information about all maps.
uint32_t ticks_played
How many ticks this player has played.
usekeytype usekeys
Method for finding keys for doors.
void command_fix_me(object *op, const char *params)
Wrapper to fix a player.
void dump_all_archetypes(void)
Dumps all archetypes to debug-level output.
size_t assets_number_of_treasures()
const char * i18n(const object *who, const char *code)
Translate a message in the appropriate language.
void player_get_title(const player *pl, char *buf, size_t bufsize)
Returns the player's title.
void get_name(object *op)
Waiting for the player's name.
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.
#define CS_QUERY_HIDEINPUT
Hide input being entered.
player * find_player(const char *plname)
Find a player by her full name.
const char * localdir
Read/write data files.