50 static void map_info(
object *op,
const char *search) {
53 "Maps matching search: '%s'", search);
57 "[fixed]Path Reset In (HH:MM:SS) Pl IM TO");
60 "[fixed]Path Reset In (HH:MM)");
64 char *to_be_freed = NULL;
65 char *search_array[64];
66 int search_array_count = 0;
68 to_be_freed = strdup(search);
70 search_array[0] = to_be_freed;
71 search_array_count = 1;
73 search_array_count =
split_string(to_be_freed,search_array,64,
',');
79 if ( search_array_count ) {
81 for (
int i=0; i<search_array_count; ++i) {
82 if ( strstr(
m->path,search_array[i]) ) {
88 if ( !match )
continue;
92 if (strlen(
m->path) <= 26) {
93 strcpy(map_path,
m->path);
95 safe_strncpy(map_path,
m->path + strlen(
m->path) - 26,
sizeof(map_path));
103 else if (
m->timeout) {
106 const uint32_t hh = ttr/3600, mm = (ttr%3600)/60, ss = ttr%60;
110 "[fixed]%-26.26s %2d:%02d:%02d %2d %2d %4d",
111 map_path, hh, mm, ss,
m->players,
m->in_memory,
m->timeout);
115 "[fixed]%-26.26s %2d:%02d%s", map_path, hh, mm,
116 m->players ?
" (in use)" :
"");
119 if ( to_be_freed ) free( to_be_freed );
136 if (*params ==
'\0' || (!strcmp(params,
""))) {
138 "Your current language is set to: English.");
140 "Available languages:");
148 if (language ==
nullptr) {
150 "Unknown language.");
157 "Your current language is set to English.");
181 "The first column is the name of the body location.");
184 "The second column is how many of those locations your body has.");
187 "The third column is how many slots in that location are available.");
195 "[fixed]%-30s %5d %5d",
201 "You are not allowed to wear armor.");
204 "You are not allowed to use weapons.");
254 int nrm = 0, mapmem = 0, anr, anims, sum_alloc = 0, sum_used = 0, i, alnr;
269 for (m =
first_map, nrofmaps = 0; m != NULL; m = m->
next, nrofmaps++)
276 "Sizeof: object=%zu player=%zu map=%zu",
283 "[fixed]%6d used", ob_used);
287 "[fixed] (used list mismatch: %d)",
292 "[fixed]%6d free (%.2f%% of %d allocated)",
297 "[fixed] (free list mismatch: %d)",
302 "[fixed]%6d on active list",
305 i = (ob_used*
sizeof(
object));
310 "[fixed] object total: %11d", i);
312 i = (ob_free*
sizeof(
object));
316 "[fixed]%4d players: %8d",
323 "[fixed]%4d maps allocated: %8d",
324 nrofmaps, i = (nrofmaps*
sizeof(
mapstruct)));
330 "[fixed]%4d maps in memory: %8d",
337 "[fixed]%4d archetypes: %8d",
344 "[fixed]%4d animations: %8d",
345 anims, i = (anims*
sizeof(uint16_t)));
351 "[fixed]%4zu treasurelists %8d",
358 "[fixed]%4ld treasures %8d",
365 "[fixed]%4ld artifacts %8d",
372 "[fixed]%4ld artifacts strngs %8d",
379 "[fixed]%4d artifactlists %8d",
386 "[fixed]Total space allocated:%8d",
390 "[fixed]Total space used: %8d",
417 "You are in %s.\n%s",
439 "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %d reset_group: %s",
449 #ifdef DEBUG_MALLOC_LEVEL 458 void command_malloc_verify(
object *op,
char *parms) {
459 extern int malloc_verify(
void);
461 if (!malloc_verify())
463 "Heap is corrupted.");
466 "Heap checks out OK.");
495 if (pl->
ob->
map != NULL)
499 for (
auto reg : all_regions) {
500 if (reg->longname == NULL && reg->counter > 0) {
501 if (reg->parent != NULL) {
502 reg->parent->counter += reg->counter;
505 LOG(
llevError,
"command_whereabouts() Region %s with no longname has no parent\n", reg->name);
509 "In the world currently there are:");
511 for (
auto reg : all_regions)
512 if (reg->counter > 0) {
552 int num_players = 0, num_wiz = 0, num_afk = 0, num_bot = 0;
561 if (pl->
ob->
map == NULL)
568 if (party && pl->
party != party)
576 "who failed - out of memory!");
594 if (reg == NULL && party == NULL)
596 "Total Players (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
597 num_players, num_wiz, num_afk, num_bot);
598 else if (party == NULL)
600 "Total Players in %s (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
604 "Total Players in party %s (%d) -- WIZ(%d) AFK(%d) BOT(%d)",
605 party->
partyname, num_players, num_wiz, num_afk, num_bot);
607 qsort(chars, num_players,
sizeof(
chars_names), (
int (*)(
const void *,
const void *))
name_cmp);
608 for (i = 0; i < num_players; i++)
643 strcpy(outbuf,
"[fixed]");
646 LOG(
llevError,
"display_who_entry(): I was passed a null player\n");
649 for (i = 0; i <= strlen(format); i++) {
650 if (format[i] ==
'%') {
653 strcat(outbuf, tmpbuf);
654 }
else if (format[i] ==
'_') {
657 snprintf(tmpbuf,
sizeof(tmpbuf),
"%c", format[i]);
658 strcat(outbuf, tmpbuf);
705 snprintf(return_val, size,
"%u", pl->
ob->
count);
709 snprintf(return_val, size,
"\n");
717 snprintf(return_val, size,
"%d", pl->
ob->
level);
753 snprintf(return_val, size,
"%%");
757 snprintf(return_val, size,
"_");
761 return_val[0] =
'\0';
778 "You are no longer AFK");
894 if (*params ==
'\0' || !sscanf(params,
"%d", &i)) {
896 "Global debug level is %d.",
902 "Debug level set to %d.",
928 "You will now walk through walls.");
932 "You will now be stopped by walls.");
958 "You can now cast spells anywhere.");
962 "You now cannot cast spells in no-magic areas.");
1091 if (*params ==
'\0' || !sscanf(params,
"%d", &i)) {
1093 "Set listen to what (presently %d)?",
1099 "Verbose level should be positive.");
1104 "Your verbose level is now %d.",
1121 uint32_t hours, minutes;
1139 "[fixed]\nStat Nat/Real/Max");
1142 "[fixed]Str %2d/ %3d/%3d",
1145 "[fixed]Dex %2d/ %3d/%3d",
1148 "[fixed]Con %2d/ %3d/%3d",
1151 "[fixed]Int %2d/ %3d/%3d",
1154 "[fixed]Wis %2d/ %3d/%3d",
1157 "[fixed]Pow %2d/ %3d/%3d",
1160 "[fixed]Cha %2d/ %3d/%3d",
1163 "\nAttack Mode: %s",
1169 if (weap_speed < 0.0f)
1171 if (weap_speed > 1.0f)
1179 "\n\nDam/Sec: %4d", (
int)(dps + 0.5f));
1190 minutes = (uint32_t)seconds / 60;
1191 hours = minutes / 60;
1192 minutes = minutes % 60;
1195 "You have played this character for %u ticks, which amounts " 1196 "to %d hours and %d minutes.",
1232 t = buf+strlen(buf);
1233 if ((dir =
opendir(buf)) != NULL) {
1234 const struct dirent *entry;
1236 while ((entry =
readdir(dir)) != NULL) {
1238 if (!((entry->d_name[0] ==
'.' && entry->d_name[1] ==
'\0')
1239 || (entry->d_name[0] ==
'.' && entry->d_name[1] ==
'.' && entry->d_name[2] ==
'\0'))) {
1242 strcpy(t, entry->d_name);
1243 if (stat(buf, &st) == 0) {
1247 if (S_ISDIR(st.st_mode)) {
1248 struct tm *tm = localtime(&st.st_mtime);
1251 "[fixed]%s\t%04d %02d %02d %02d %02d %02d",
1277 static const char *
const types[] = {
1283 if (*params ==
'\0') {
1285 "applymode is set to %s",
1290 if (!strcmp(params,
"nochoice"))
1292 else if (!strcmp(params,
"never"))
1294 else if (!strcmp(params,
"always"))
1298 "applymode: Unknown options %s, valid options are nochoice, never, always",
1303 "applymode%s set to %s",
1318 static const char *
const types[] = {
1334 if (*params ==
'\0') {
1336 "bowmode is set to %s",
1342 if (!strcmp(params, types[i])) {
1365 "bowmode%s set to %s",
1383 if (*params ==
'\0') {
1385 "unarmed skill is set to %s",
1398 "You do not know any such skill called %s",
1407 "%s is not an unarmed skill!",
1422 "unarmed skill is now set to %s",
1437 static const char *
const types[] = {
1444 if (*params ==
'\0') {
1446 "petmode is set to %s",
1451 if (!strcmp(params,
"normal"))
1453 else if (!strcmp(params,
"sad"))
1455 else if (!strcmp(params,
"defend"))
1457 else if (!strcmp(params,
"arena"))
1461 "petmode: Unknown options %s, valid options are normal, sad (seek and destroy), defend, arena",
1466 "petmode%s set to %s",
1481 int counter = 0, target = 0;
1482 int have_shown_pet = 0;
1483 if (*params !=
'\0')
1484 target = atoi(params);
1488 for (obl = list; obl != NULL; obl = obl->
next) {
1489 object *ob = obl->
ob;
1498 }
else if (!have_shown_pet && ++counter == target) {
1500 "[fixed]level %d %s",
1503 "[fixed]%d/%d HP, %d/%d SP",
1529 "[fixed]wc %d damage %d ac %d",
1540 "You have no pets.");
1541 else if (target != 0 && have_shown_pet == 0)
1556 static const char *
const types[] = {
1562 if (*params ==
'\0') {
1564 "usekeys is set to %s",
1569 if (!strcmp(params,
"inventory"))
1571 else if (!strcmp(params,
"keyrings"))
1573 else if (!strcmp(params,
"containers"))
1577 "usekeys: Unknown option %s, valid options are inventory, keyrings, containers",
1582 "usekeys%s set to %s",
1606 "[fixed]%-20s %+5d",
1618 "\nNatural skin resistances:");
1620 for (attack = 0; attack <
NROFATTACKS; attack++) {
1647 const char *language;
1650 snprintf(suffix,
sizeof(suffix),
".%s", language);
1660 snprintf(filename,
sizeof(filename),
"%s/mischelp",
settings.
datadir);
1671 if (!(dirp =
opendir(filename)))
1679 && *de->d_name ==
'.' 1680 && (namelen == 1 || de->d_name[1] ==
'.'))
1682 if (strstr(de->d_name, suffix)) {
1683 strcat(line, strtok(de->d_name,
"."));
1701 static int find_help_file_in(
const char *dir,
const char *name,
const char *language,
char *path,
int length) {
1704 snprintf(path, length,
"%s/%s/%s.%s",
settings.
datadir, dir, name, language);
1705 if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) {
1724 static int find_help_file(
const char *name,
const char *language,
int wiz,
char *path,
int length) {
1728 if (strcmp(language,
"en") &&
find_help_file_in(
"wizhelp", name,
"en", path, length))
1734 if (strcmp(language,
"en") &&
find_help_file_in(
"help", name,
"en", path, length))
1772 const char *language;
1777 if (*params ==
'\0') {
1778 snprintf(filename,
sizeof(filename),
"%s/def_help",
settings.
datadir);
1786 if (!strcmp(params,
"topics")) {
1797 if (!strcmp(params,
"commands")) {
1805 if (strchr(params,
'.') || strchr(params,
' ') || strchr(params,
'/')) {
1807 "Illegal characters in '%s'",
1816 "No help available on '%s'",
1840 if (sscanf(line,
"%d", &i))
1875 "To leave the game, sleep in (apply) a bed to reality. To " 1876 "permenantly delete your character, use the 'delete' command.");
1895 i18n(op,
"Quitting will delete your character.\nAre you sure you want to delete your character (y/n):"));
1913 "Sounds are turned off.");
1917 "The sounds are enabled.");
1954 unsigned int pwd_len = strlen(password);
1956 if (pwd_len == 0 || pwd_len > 16) {
1961 "Password changed cancelled.");
1974 "You are not allowed to play.");
1982 "The passwords did not match.");
1989 "\nWelcome, Brave New Warrior!\n");
1998 "You entered the wrong current password.");
2011 i18n(op,
"Please confirm your new password, or blank to cancel:"));
2019 "The new passwords don't match!");
2022 "Password changed.");
2050 "You cannot change your title.");
2057 "Dragons cannot change titles.");
2061 if (*params ==
'\0') {
2065 snprintf(buf,
sizeof(buf),
"Your title is '%s'.", tmp);
2069 if (strcmp(params,
"clear") == 0 || strcmp(params,
"default") == 0) {
2072 "Your title is the default title.");
2075 "Title set to default.");
2080 if ((
int)strlen(params) >=
MAX_NAME) {
2100 "You can not save on unholy ground.");
2103 "You don't deserve to save yet.");
2107 "You have been saved.");
2126 "You will not attack other players.");
2129 "You will attack other players.");
2143 if (*params ==
'\0' || !sscanf(params,
"%d", &i)) {
2145 "Your current wimpy level is %d.",
2150 if (i < 0 || i > 100) {
2152 "Wimpy level must be between 1 and 100.");
2157 "Your new wimpy level is %d.",
2171 if (*params ==
'\0')
2195 if (*params ==
'\0') {
2198 "Your pets have been killed.");
2201 int counter = 0, removecount = 0;
2202 int target = atoi(params);
2204 for (obl = list; obl != NULL; obl = obl->
next) {
2205 object *ob = obl->
ob;
2207 if (++counter == target || (target == 0 && !
strcasecmp(ob->
name, params))) {
2216 if (removecount != 0)
2222 "Couldn't find any suitable pets to kill.");
2245 "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.");
2260 int level, exp, check_exhaust = 0;
2261 const int max_harvest = 10;
2262 object *found[max_harvest];
2264 object *item, *inv, *harvested;
2265 sstring trace, ttool, tspeed, race, tool, slevel, sexp;
2289 if (!trace || strcmp(trace,
"") == 0 || !ttool || strcmp(ttool,
"") == 0 || !tspeed || strcmp(tspeed,
"") == 0) {
2314 const char* harvestitems;
2330 if (race && (!slevel || !sexp)) {
2331 LOG(
llevError,
"do_harvest: item %s without harvest_[level|exp]\n", inv->
name);
2334 if (race == trace && (!tool || tool == ttool))
2335 found[count++] = inv;
2337 if (count >= max_harvest)
2341 if (count >= max_harvest)
2349 assert(count <= max_harvest);
2351 inv = found[
rndm(0, count-1)];
2358 level = atoi(slevel);
2361 speed = atof(tspeed);
2363 speed = -speed*pl->
speed;
2368 if (level > skill->
level+10) {
2374 if (level >= skill->
level)
2377 else if (skill->
level <= level+10)
2400 if (inv->
nrof == 0) {
2401 check_exhaust = (count == 1 ? 1 : 0);
2405 if (count == 1 && inv->
nrof == 1) {
2408 if ( inv->
nrof == 1 ) {
2436 if (check_exhaust) {
2439 if (replacement[0] !=
'-') {
#define MSG_TYPE_COMMAND_MAPS
const char *const change_resist_msg[NROFATTACKS]
These are the descriptions of the resistances displayed when a player puts on/takes off an item...
uint8_t login_method
Login method this client is using.
Fire north-west whatever the facing direction.
void free_objectlink(objectlink *ol)
Recursively frees all objectlinks.
Will unapply whatever is necessary - this goes beyond no choice - if there are multiple ojbect of the...
object * ob
Item to link to.
signed long object_sum_weight(object *op)
object_sum_weight() is a recursive function which calculates the weight an object is carrying...
#define NUM_BODY_LOCATIONS
Number of body locations.
Use keys in inventory and active containers.
living orig_stats
Permanent real stats of player.
static int onoff_value(const char *line)
Utility function to convert a reply to a yes/no or on/off value.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
#define ST_GET_PARTY_PASSWORD
Player tried to join a password-protected party.
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
void bufferreader_destroy(BufferReader *br)
Destroy a BufferReader.
void command_whereami(object *op, const char *params)
'whereami' command.
struct archetype * arch
Pointer to archetype.
void roll_again(object *op)
Ask the player what to do with the statistics.
int check_name(player *me, const char *name)
Ensure player's name is valid.
void command_title(object *op, const char *params)
Player wishes to change her title.
uint32_t hidden
If True, player (DM) is hidden from view.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
int16_t players
How many players are on this level right now.
region * get_region_by_map(mapstruct *m)
Gets a region from a map.
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
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 LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
bool check_password(const char *typed, const char *crypted)
Hash a password and compare it to the stored version.
#define FABS(x)
Decstations have trouble with fabs()...
int rndm(int min, int max)
Returns a number between min and max.
#define MSG_TYPE_COMMAND_CONFIG
bowmode, petmode, applymode
std::vector< archetype * > players
void map_path(const char *map, int flags, char *pathname, size_t bufsize)
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
int nroffreeobjects
How many OBs allocated and free (free)
void command_listen(object *op, const char *params)
Change the player's listen level.
char who_wiz_format[MAX_BUF]
The format that the who command should use when called by a dm.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
region * get_region_from_string(const char *name)
Tries to find a region that 'name' corresponds to.
void * language_t
Strings that should be manipulated through add_string() and free_string().
void player_set_own_title(struct player *pl, const char *title)
Sets the custom title.
void command_wizpass(object *op, const char *params)
Wizard toggling wall-crossing.
AllAnimations * animations()
Get animations.
uint32_t peaceful
If set, won't attack friendly creatures.
void dump_all_maps(void)
Prints out debug-information about all maps.
static void map_info(object *op, const char *search)
This is the 'maps' command.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
void command_motd(object *op, const char *params)
Display the message of the day.
const char * i18n(const object *who, const char *code)
Translate a message in the appropriate language.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
void dump_map(const mapstruct *m)
Prints out debug-information about a map.
player * first_player
First player.
unapplymode
This is used to control what to do when we need to unapply an object before we can apply another one...
#define LOOK_OBJ(ob)
This returns TRUE if the object is something that should be displayed in the look window...
int save_player(object *op, int flag)
Saves a player to disk.
const char * playerdir
Where the player files are.
#define MAP_ENTER_X(m)
Default X coordinate for map enter.
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...
#define HUGE_BUF
Used for messages - some can be quite long.
partylist * party
Party this player is part of.
sstring slaying
Which race to do double damage to.
void command_dumpallmaps(object *op, const char *params)
Various map-related statistics.
sstring add_string(const char *str)
Share a string.
#define SND_MUTE
Don't sent anything for now.
#define ST_CHANGE_PASSWORD_CONFIRM
Player is confirming new password.
void dump_friendly_objects(void)
Dumps all friendly objects.
#define MAP_HEIGHT(m)
Map height.
#define ST_CONFIRM_PASSWORD
New character, confirm password.
std::vector< region * > all_regions
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
static void help_topics(object *op, int what)
Player wants to know available help topics.
DIR * opendir(const char *)
static int name_cmp(const chars_names *c1, const chars_names *c2)
Local function for qsort comparison.
void command_sound(object *op, const char *params)
Player wants to change sound status.
int16_t y
Position in the map for this object.
#define FLAG_USE_WEAPON
(Monster) can wield weapons
int is_dragon_pl(const object *op)
Checks if player is a dragon.
int checkbanned(const char *login, const char *host)
Check if a player and/or host is banned.
void dump_all_archetypes(void)
Dumps all archetypes to debug-level output.
uint32_t get_weight_limit(int stat)
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
void time_info(object *op)
Players wants to know the time.
#define ST_CHANGE_PASSWORD_NEW
Player is entering new password.
#define FLAG_AFK
Player is AFK.
player * find_player(const char *plname)
Find a player by her full name.
LogLevel debug
Default debugging level.
int64_t level_exp(int level, double expmul)
Returns how much experience is needed for a player to become the given level.
int player_has_own_title(const struct player *pl)
Returns whether the player has a custom title.
void print_los(object *op)
Debug-routine which dumps the array which specifies the visible area of a player. ...
int object_count_used(void)
Object statistics.
object * chosen_skill
The skill chosen to use.
void receive_player_password(object *op, const char *password)
A player just entered her password, including for changing it.
void do_harvest(object *pl, int dir, object *skill)
Player is trying to harvest something.
char * ss_dump_table(int what, char *buf, size_t size)
Dump the contents of the share string tables.
Attack other players in arena.
Use keys in inventory and active key rings.
#define MSG_TYPE_COMMAND_STATISTICS
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
bowtype_t
Bow firing mode.
void pets_terminate_all(object *owner)
Removes all pets someone owns.
void command_fix_me(object *op, const char *params)
Wrapper to fix a player.
Will not unapply objects automatically.
#define ST_ROLL_STAT
New character, rolling stats.
double expmul
needed experience = (calc_exp*expmul) - means some races/classes can need less/more exp to gain level...
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
char * longname
Official title of the region, this might be defined to be the same as name.
#define ST_PLAYING
Usual state.
char * host
Which host it is connected from (ip address).
archetype * try_find_archetype(const char *name)
#define MAP_WHEN_RESET(m)
This is when the map will reset.
int32_t weight
Attributes of the object.
float weapon_speed
The overall speed of this object.
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 command_passwd(object *pl, const char *params)
Player is asking to change password.
static void current_map_info(object *op)
'mapinfo' command.
uint32_t counter
A generic counter for holding temporary data.
void hiscore_display(object *op, int max, const char *match)
Displays the high score file.
void get_name(object *op)
Waiting for the player's name.
uint8_t run_away
Monster runs away if it's hp goes below this percentage.
void list_players(object *op, region *reg, partylist *party)
Displays the players in a region or party.
void object_dump_all(void)
Dumps all objects to console.
AssetsManager * getManager()
#define MSG_TYPE_ADMIN_DM
DM related admin actions.
void command_kill_pets(object *op, const char *params)
Player wants to get rid of pets.
long nrofartifacts
Only used in malloc_info().
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
void command_quit(object *op, const char *params)
Tell players to use the 'delete' command.
#define MAP_IN_MEMORY
Map is fully loaded.
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.
int16_t level
Level of creature or object.
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.
Main Crossfire structure, one ingame object.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
player * next
Pointer to next player, NULL if this is last.
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
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...
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
sstring reset_group
For reset purpose, all maps in the same group reset at the same time.
uint32_t sound
Client sound mode.
const char *const attacktype_desc[NROFATTACKS]
Short description of names of the attacktypes.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
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.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
size_t assets_number_of_treasurelists()
static void current_region_info(object *op)
'whereami' command.
void send_query(socket_struct *ns, uint8_t flags, const char *text)
Asks the client to query the user.
void command_dumpallobjects(object *op, const char *params)
Various object-related statistics.
char * msg
Message map creator may have left.
#define MSG_TYPE_COMMAND_ERROR
Bad syntax/can't use command.
Defines for loader.l / loader.c.
float speed
Frequency of object 'moves' relative to server tick rate.
int32_t carrying
How much weight this object contains.
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
const char * get_region_msg(const region *r)
Gets a message for a region.
char path[HUGE_BUF]
Filename of the map.
static bool IS_PLAYER(object *op)
object * env
Pointer to the object which is the environment.
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
#define QUERY_FLAG(xyz, p)
#define ST_CONFIRM_QUIT
Player used the 'quit' command, make sure that's ok.
uint8_t unarmed_skills[UNARMED_SKILLS_COUNT]
Table of unarmed attack skills.
artifactlist * next
Next list of artifacts.
void get_password(object *op)
Waiting for the player's password.
void command_wizcast(object *op, const char *params)
Wizard toggling "cast everywhere" ability.
void command_resistances(object *op, const char *params)
Players wants to know her resistances.
void player_get_title(const player *pl, char *buf, size_t bufsize)
Returns the player's title.
void command_peaceful(object *op, const char *params)
Player toggles her peaceful status.
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 player_set_state(player *pl, uint8_t state)
Set the player's state to the specified one.
char new_password[16]
2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16
int strcasecmp(const char *s1, const char *s2)
void command_dumpfriendlyobjects(object *op, const char *params)
Various friendly object-related statistics.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
socket_struct * socket
Socket information for this player.
char * name
Shortend name of the region as maps refer to it.
char password[16]
2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16
Try to find an arrow matching the target.
objectlink * get_friends_of(const object *owner)
Get a list of friendly objects for the specified owner.
void command_help(object *op, const char *params)
Player is asking for some help.
int region_is_child_of_region(const region *child, const region *r)
Checks if a region is a child of another.
int atnr_is_dragon_enabled(int attacknr)
Determine if the attacktype represented by the specified attack-number is enabled for dragon players...
void command_version(object *op, const char *params)
Server version.
artifactlist * first_artifactlist
First artifact.
Archetypes * archetypes()
Get archetypes.
Used to link together several objects.
void command_statistics(object *pl, const char *params)
Prints out some useful information for the character.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
char * partyname
Party name.
#define CS_QUERY_SINGLECHAR
Single character response expected.
#define MSG_TYPE_COMMAND_WHO
language_t language
The language the player wishes to use.
void command_printlos(object *op, const char *params)
Various LOS-related statistics.
uint8_t state
Input state of the player (name, password, etc).
object * ob
The object representing the player.
#define MAP_ENTER_Y(m)
Default Y coordinate for map enter.
size_t count() const
Get the number of assets.
This represents all archetypes for one particular object type.
static int find_help_file(const char *name, const char *language, int wiz, char *path, int length)
Find an appropriate help file.
#define P_OUT_OF_MAP
This space is outside the map.
void command_dumpmap(object *op, const char *params)
Various map-related statistics.
mapstruct * first_map
First map.
uint32_t braced
Will not move if braced, only attack.
struct Settings settings
Global settings.
void i18n_list_languages(object *who)
List all languages for who.
uint32_t map_size(mapstruct *m)
Calculate map size without intermediate sign extension.
void command_ssdumptable(object *op, const char *params)
Various string-related statistics.
#define MSG_TYPE_SKILL_FAILURE
Failure in using skill.
usekeytype usekeys
Method for finding keys for doors.
void command_delete(object *op, const char *params)
Player wants to totally delete her character.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
unapplymode unapply
Method for auto unapply.
int16_t dam
How much damage this object does when hitting.
void command_list(object *pl, bool is_dm)
Display the list of commands to a player.
#define MSG_TYPE_ADMIN_VERSION
version info
uint32_t is_bot
Client shouldn't be reported to metaserver.
void command_save(object *op, const char *params)
Player wants to get saved.
void command_usekeys(object *op, const char *params)
Player wants to change how keys are used.
void receive_player_name(object *op, const char *name)
A player just entered her name.
uint32_t ticks_played
How many ticks this player has played.
#define FLAG_WIZ
Object has special privilegies.
#define MAP_MINTIMEOUT
At least that many ticks before swapout.
uint8_t listening
Which priority will be used in info_all.
long seconds(void)
Return wall clock time in seconds.
living stats
Str, Con, Dex, etc.
#define MAX_BUF
Used for all kinds of things.
LogLevel
Log levels for the LOG() function.
char who_format[MAX_BUF]
The format that the who command should use.
static void malloc_info(object *op)
Sends various memory-related statistics.
void command_time(object *op, const char *params)
Players asks for the time.
uint32_t tick_duration
Gloabal variables:
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
float speed_left
How much speed is left to spend this round.
struct mapstruct * map
Pointer to the map in which this object is present.
void command_bowmode(object *op, const char *params)
Player wants to change the bowmode, how arrows are fired.
const char * get_name_of_region_for_map(const mapstruct *m)
Gets the name of a region for a map.
void command_strings(object *op, const char *params)
Various string-related statistics.
void command_debug(object *op, const char *params)
Player wants to see/change the debug level.
uint32_t in_memory
Combination of IN_MEMORY_xxx flags.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
object * object_create_arch(archetype *at)
Create a full object using the given archetype.
treasurelist represents one logical group of items to be generated together.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
type_definition ** types
Defined types.
long nrofallowedstr
Only used in malloc_info().
void command_whereabouts(object *op, const char *params)
'whereabouts' command.
const char * datadir
Read only data files.
void set_map_reset_time(mapstruct *map)
Updates the map's timeout.
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
void pets_terminate(object *pet)
Removes a pet, taking care of clearning the owner's fields if needed.
sstring name_pl
The plural name of the object.
int object_count_active(void)
Objects statistics.
region * get_region_by_name(const char *region_name)
Gets a region by name.
static event_registration m
This structure contains all information related to one map square.
int nrofallocobjects
How many OBs allocated (free + used)
#define FREE_AND_COPY(sv, nv)
Release the shared string if not NULL, and make it a reference to nv.
#define MSG_TYPE_COMMAND_MALLOC
uint32_t name_changed
If true, the player has set a name.
void command_petmode(object *op, const char *params)
Player wants to change how her pets behave.
const char * localdir
Read/write data files.
#define FLAG_WIZCAST
The wizard can cast spells in no-magic area.
sstring name
The name of the object, obviously...
void check_login(object *op, const char *password)
Actually login a player, load from disk and such.
#define MAP_WIDTH(m)
Map width.
uint32_t nrof
Number of objects.
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_...
Utility structure for the 'who' command.
#define SK_EXP_ADD_SKILL
Give the player the skill.
#define MSG_TYPE_COMMAND_INFO
Generic info: resistances, etc.
#define CLEAR_FLAG(xyz, p)
bowtype_t bowtype
Which firemode?
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
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.
struct dirent * readdir(DIR *)
#define ST_CHANGE_PASSWORD_OLD
Player is entering old password to change password.
treasurelist * find_treasurelist(const char *name)
Search for the given treasurelist by name.
void command_maps(object *op, const char *params)
'maps' command.
body_locations_struct body_locations[NUM_BODY_LOCATIONS]
The ordering of this is actually doesn't make a difference However, for ease of use, new entries should go at the end so those people that debug the code that get used to something being in the location 4 don't get confused.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
void send_news(const object *op)
Send the news to a player.
treasure is one element in a linked list, which together consist of a complete treasure-list.
#define MSG_TYPE_COMMAND_BODY
void send_rules(const object *op)
Send the rules to a player.
void command_showpets(object *op, const char *params)
Players wants to know her pets.
language_t i18n_find_language_by_code(const char *code)
Attempt to find the identifier of a language from its code.
sstring skill
Name of the skill this object uses/grants.
int16_t maxsp
Max spell points.
#define FLAG_MONSTER
Will attack players.
Will unapply objects when there no choice to unapply.
#define MSG_TYPE_SKILL
Messages related to skill use.
static void display_help_file(object *op, const char *filename)
Attempt to send the contents of the specified file to the player.
uint8_t set_title
Players can set thier title.
void command_unarmed_skill(object *op, const char *params)
Player wants to change prefered unarmed skill.
#define NDI_UNIQUE
Print immediately, don't buffer.
C function wrappers to interact with assets.
#define CS_QUERY_HIDEINPUT
Hide input being entered.
void command_news(object *op, const char *params)
Display the server news.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
void command_body(object *op, const char *params)
This command dumps the body information for object *op.
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.
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.
const char * get_region_longname(const region *r)
Gets the longname of a region.
void command_malloc(object *op, const char *params)
Display memory information.
A buffer that will be expanded as content is added to it.
const char * unarmed_skill
Prefered skill to use in unarmed combat.
int16_t maxhp
Max hit points.
uint8_t subtype
Subtype of object.
Only use keys in inventory.
uint16_t difficulty
What level the player should be to play here.
void command_afk(object *op, const char *params)
Toggles the afk status of a player.
void command_wimpy(object *op, const char *params)
Player wants to change how soon she'll flee.
void command_language(object *op, const char *params)
This is the 'language' command.
void command_hiscore(object *op, const char *params)
Player is asking for the hiscore.
int object_count_free(void)
Objects statistics.
mapstruct * next
Next map, linked list.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
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...
int8_t wc
Weapon Class, lower WC increases probability of hitting.
float ticks_to_seconds(int ticks)
tag_t count
Unique object number for this object.
petmode_t petmode
Which petmode?
sstring i18n_get_language_code(language_t language)
Return the code of a specified language.
#define FLAG_WIZPASS
The wizard can go through walls.
char const * newhash(char const *password)
This is one artifact, ie one special item.
void command_rules(object *op, const char *params)
Display the server rules.
void command_who(object *op, const char *params)
'who' command.
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...
object clone
An object from which to do object_copy()
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
#define P_NO_CLERIC
No clerical spells cast here.
objectlink * next
Next item to link to.
size_t assets_number_of_treasures()
void command_dumpallarchetypes(object *op, const char *params)
Various archetypes-related statistics.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int8_t body_used[NUM_BODY_LOCATIONS]
Calculated value based on items equipped.
void command_brace(object *op, const char *params)
Player toggles her braced status.
char * name
Name of map as given by its creator.
void command_mapinfo(object *op, const char *params)
'mapinfo' command.
void display_motd(const object *op)
Sends the message of the day to the player.
void command_players(object *op, const char *params)
Display all known players.