63 (sec%86400)/3600, (sec%3600)/60, sec%60);
70 if (search && strstr(m->
path, search) == NULL)
74 if (strlen(m->
path) <= 18)
75 strcpy(map_path, m->
path);
77 strcpy(map_path, m->
path+strlen(m->
path)-18);
98 const char *language_str;
107 if (!params || (!strcmp(params,
""))) {
246 int nrm = 0, mapmem = 0, anr, anims, sum_alloc = 0, sum_used = 0, i, tlnr, alnr;
267 for (m =
first_map, nrofmaps = 0; m != NULL; m = m->
next, nrofmaps++)
281 ob_used, i = (ob_used*
sizeof(
object)));
288 ob_free, i = (ob_free*
sizeof(
object)));
299 players, i = (players*
sizeof(
player)));
307 nrofmaps, i = (nrofmaps*
sizeof(
mapstruct)));
446 #ifdef DEBUG_MALLOC_LEVEL
456 int command_malloc_verify(
object *op,
char *parms) {
457 extern int malloc_verify(
void);
459 if (!malloc_verify())
495 if (pl->
ob->
map != NULL)
501 if (reg->
parent != NULL) {
505 LOG(
llevError,
"command_whereabouts() Region %s with no longname has no parent\n", reg->
name);
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)
582 sprintf(chars[num_players-1].namebuf,
"%s", pl->
ob->
name);
597 if (reg == NULL && party == NULL)
601 num_players, num_wiz, num_afk, num_bot);
602 else if (party == NULL)
611 party->
partyname, num_players, num_wiz, num_afk, num_bot);
613 qsort(chars, num_players,
sizeof(
chars_names), (
int (*)(
const void *,
const void *))
name_cmp);
614 for (i = 0; i < num_players; i++)
653 strcpy(outbuf,
"[fixed]");
657 LOG(
llevError,
"display_who_entry(): I was passed a null player\n");
660 for (i = 0; i <= strlen(format); i++) {
661 if (format[i] ==
'%') {
664 strcat(outbuf, tmpbuf);
665 strcat(outbuf1, tmpbuf);
666 }
else if (format[i] ==
'_') {
668 strcat(outbuf1,
" ");
670 snprintf(tmpbuf,
sizeof(tmpbuf),
"%c", format[i]);
671 strcat(outbuf, tmpbuf);
672 strcat(outbuf1, tmpbuf);
948 if (params == NULL || !sscanf(params,
"%d", &i)) {
980 if (op && op->
below) {
1267 if (params == NULL || !sscanf(params,
"%d", &i)) {
1309 strcat(buf2, FMT64);
1317 strcat(buf2, FMT64);
1396 t = buf+strlen(buf);
1397 if ((Dir =
opendir(buf)) != NULL) {
1398 const struct dirent *Entry;
1400 while ((Entry =
readdir(Dir)) != NULL) {
1402 if (!((Entry->
d_name[0] ==
'.' && Entry->
d_name[1] ==
'\0')
1403 || (Entry->
d_name[0] ==
'.' && Entry->
d_name[1] ==
'.' && Entry->
d_name[2] ==
'\0'))) {
1406 strcpy(t, Entry->
d_name);
1407 if (stat(buf, &Stat) == 0) {
1412 struct tm *tm = localtime(&Stat.st_mtime);
1445 static const char *
const types[] = {
1459 if (!strcmp(params,
"nochoice"))
1461 else if (!strcmp(params,
"never"))
1463 else if (!strcmp(params,
"always"))
1493 static const char *
const types[] = {
1519 if (!strcmp(params, types[i])) {
1526 snprintf(buf,
sizeof(buf),
"bowmode: Unknown options %s, valid options are:", params);
1529 strcat(buf, types[i]);
1558 static const char *
const types[] = {
1573 if (!strcmp(params,
"normal"))
1575 else if (!strcmp(params,
"sad"))
1577 else if (!strcmp(params,
"defend"))
1579 else if (!strcmp(params,
"arena"))
1608 int counter = 0, target = 0;
1609 int have_shown_pet = 0;
1611 target = atoi(params);
1614 object *ob = obl->
ob;
1626 }
else if (!have_shown_pet && ++counter == target) {
1676 else if (target != 0 && have_shown_pet == 0)
1694 static const char *
const types[] = {
1708 if (!strcmp(params,
"inventory"))
1710 else if (!strcmp(params,
"keyrings"))
1712 else if (!strcmp(params,
"containers"))
1760 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
1761 if ((tmp->
type ==
FORCE) && (strcmp(tmp->
arch->
name,
"dragon_skin_force") == 0)) {
1765 for (attack = 0; attack <
NROFATTACKS; attack++) {
1797 const char *language;
1800 snprintf(suffix,
sizeof(suffix),
".%s", language);
1821 if (!(dirp =
opendir(filename)))
1830 && (namelen == 1 || de->
d_name[1] ==
'.'))
1832 if (strstr(de->
d_name, suffix)) {
1833 strcat(line, strtok(de->
d_name,
"."));
1854 int i, size, namelen;
1881 for (i = 0; i < size; i++) {
1882 namelen = strlen(ap[i].name);
1884 strcat(line, ap[i].name);
1905 const char *language;
1914 if ((fp = fopen(filename,
"r")) == NULL) {
1918 while (fgets(line,
MAX_BUF, fp)) {
1920 len = strlen(line)-1;
1921 if (line[len] ==
'\n')
1932 if (!strcmp(params,
"topics")) {
1943 if (!strcmp(params,
"commands")) {
1957 if (strchr(params,
'.') || strchr(params,
' ') || strchr(params,
'/')) {
1966 if (stat(filename, &st) || !
S_ISREG(st.st_mode)) {
1969 if (stat(filename, &st) || !
S_ISREG(st.st_mode)) {
1972 if (stat(filename, &st) || !
S_ISREG(st.st_mode))
1983 if ((fp = fopen(filename,
"r")) == NULL) {
1993 while (fgets(line,
MAX_BUF, fp)) {
1995 len = strlen(line)-1;
1996 if (line[len] ==
'\n')
2029 if (sscanf(line,
"%d", &i))
2163 if (pwd_len <= 1 || pwd_len > 17) {
2266 if (params == NULL) {
2274 if (strcmp(params,
"clear") == 0 || strcmp(params,
"default") == 0) {
2285 if ((
int)strlen(params) >=
MAX_NAME) {
2356 if (params == NULL || !sscanf(params,
"%d", &i)) {
2412 int counter = 0, removecount = 0;
2414 if (params == NULL) {
2419 int target = atoi(params);
2421 object *ob = obl->
ob;
2424 if (++counter == target || (target == 0 && !
strcasecmp(ob->
name, params))) {
2432 if (removecount != 0)
2474 int count = 0, proba;
2479 sstring trace, ttool, tspeed, race, tool, slevel, sexp;
2503 if (!trace || strcmp(trace,
"") == 0 || !ttool || strcmp(ttool,
"") == 0 || !tspeed || strcmp(tspeed,
"") == 0) {
2510 while (item && count < 10) {
2511 for (inv = item->
inv; inv; inv = inv->
below) {
2518 if (race && (!slevel || !sexp)) {
2519 LOG(
llevError,
"do_harvest: item %s without harvest_[level|exp]\n", inv->
name);
2522 if (race == trace && (!tool || tool == ttool))
2523 found[count++] = inv;
2532 inv = found[
rndm(0, count-1)];
2537 level = atoi(slevel);
2540 speed = atof(tspeed);
2542 speed = -speed*pl->
speed;
2547 if (level > skill->
level+10) {
2552 if (level >= skill->
level)
2554 proba = 10+skill->
level-level;
2555 else if (skill->
level <= level+10)
2556 proba = 10+(skill->
level-level)*2;
int command_whereami(object *op, char *params)
int command_petmode(object *op, char *params)
#define I18N_MSG_CMISC_014
#define I18N_MSG_CMISC_124
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
#define I18N_MSG_CMISC_148
#define I18N_MSG_CMISC_160
#define I18N_MSG_CMISC_175
#define NUM_BODY_LOCATIONS
int check_password(char *typed, char *crypted)
#define I18N_MSG_CMISC_017
#define I18N_MSG_CMISC_006
#define I18N_MSG_CMISC_049
#define ST_GET_PARTY_PASSWORD
void display_who_entry(object *op, player *pl, const char *format)
command_array_struct Commands[]
const char * get_ob_key_value(const object *op, const char *const key)
#define I18N_MSG_CMISC_111
const int WizCommandsSize
void roll_again(object *op)
void change_exp(object *op, sint64 exp, const char *skill_name, int flag)
#define I18N_MSG_CMISC_163
#define I18N_MSG_CMISC_034
#define I18N_MSG_CMISC_121
#define I18N_MSG_CMISC_029
int check_name(player *me, const char *name)
#define I18N_MSG_CMISC_001
int command_news(object *op, char *params)
int command_applymode(object *op, char *params)
#define I18N_MSG_CMISC_003
#define I18N_MSG_CMISC_217
#define I18N_MSG_CMISC_144
int command_sound(object *op, char *params)
int command_dumpbelow(object *op, char *params)
region * get_region_by_name(const char *region_name)
#define I18N_MSG_CMISC_198
int command_motd(object *op, char *params)
EXTERN int num_animations
#define I18N_MSG_CMISC_002
int command_time(object *op, char *params)
#define I18N_MSG_CMISC_200
char who_wiz_format[MAX_BUF]
#define MSG_TYPE_COMMAND_MALLOC
#define I18N_MSG_CMISC_109
int region_is_child_of_region(const region *child, const region *r)
EXTERN objectlink * first_friendly_object
#define I18N_MSG_CMISC_048
int command_listen(object *op, char *params)
#define I18N_MSG_CMISC_162
#define I18N_MSG_CMISC_050
#define I18N_MSG_CMISC_128
#define I18N_MSG_CMISC_168
#define I18N_MSG_CMISC_136
#define I18N_MSG_CMISC_139
int save_player(object *op, int flag)
StringBuffer * stringbuffer_new(void)
#define I18N_MSG_CMISC_120
#define I18N_MSG_CMISC_199
#define I18N_MSG_CMISC_212
#define MSG_TYPE_SKILL_FAILURE
#define I18N_MSG_CMISC_026
#define ST_CHANGE_PASSWORD_CONFIRM
#define I18N_MSG_CMISC_031
int command_explore(object *op, char *params)
struct treasureliststruct * next
#define I18N_MSG_CMISC_197
short freearr_x[SIZEOFFREE]
#define ST_CONFIRM_PASSWORD
#define I18N_MSG_CMISC_167
#define MSG_TYPE_COMMAND_BODY
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
region * get_region_by_map(mapstruct *m)
sint64 level_exp(int level, double expmul)
#define I18N_MSG_CMISC_190
#define I18N_MSG_CMISC_195
DIR * opendir(const char *)
void dump_all_archetypes(void)
void malloc_info(object *op)
int checkbanned(const char *login, const char *host)
#define I18N_MSG_CMISC_134
#define I18N_MSG_CMISC_151
#define I18N_MSG_CMISC_009
int command_showpets(object *op, char *params)
#define ST_CHANGE_PASSWORD_NEW
int command_resistances(object *op, char *params)
#define I18N_MSG_CMISC_108
player * find_player(const char *plname)
#define I18N_MSG_CMISC_016
body_locations_struct body_locations[NUM_BODY_LOCATIONS]
#define I18N_MSG_CMISC_095
#define I18N_MSG_CMISC_178
void remove_friendly_object(object *op)
void check_login(object *op)
signed long sum_weight(object *op)
int command_afk(object *op, char *params)
int command_peaceful(object *op, char *params)
const char * language_names[]
int command_help(object *op, char *params)
void map_info(object *op, char *search)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
int command_usekeys(object *op, char *params)
#define I18N_MSG_CMISC_005
void terminate_all_pets(object *owner)
int command_archs(object *op, char *params)
#define I18N_MSG_CMISC_185
const int CommunicationCommandSize
#define I18N_MSG_CMISC_042
#define I18N_MSG_CMISC_102
#define MAP_WHEN_RESET(m)
region * get_region_from_string(const char *name)
short freearr_y[SIZEOFFREE]
#define I18N_MSG_CMISC_192
#define I18N_MSG_CMISC_024
void get_name(object *op)
void current_region_info(object *op)
#define I18N_MSG_CMISC_191
#define I18N_MSG_CMISC_112
#define I18N_MSG_CMISC_007
#define I18N_MSG_CMISC_113
#define I18N_MSG_CMISC_180
#define I18N_MSG_CMISC_012
int rndm(int min, int max)
const char * get_region_longname(const region *r)
#define I18N_MSG_CMISC_202
#define I18N_MSG_CMISC_051
#define I18N_MSG_CMISC_159
struct obj * chosen_skill
int command_dumpfriendlyobjects(object *op, char *params)
#define I18N_MSG_CMISC_020
void remove_ob(object *op)
#define I18N_MSG_CMISC_025
#define I18N_MSG_CMISC_155
#define I18N_MSG_CMISC_096
int command_whereabouts(object *op, char *params)
#define I18N_MSG_CMISC_055
#define I18N_MSG_CMISC_187
struct artifactliststruct * next
int command_wizcast(object *op, char *params)
#define I18N_MSG_CMISC_023
#define I18N_MSG_CMISC_173
#define I18N_MSG_CMISC_188
int do_harvest(object *pl, int dir, object *skill)
#define I18N_MSG_CMISC_141
#define I18N_MSG_CMISC_131
#define I18N_MSG_CMISC_193
#define I18N_MSG_CMISC_047
int command_bowmode(object *op, char *params)
#define I18N_MSG_CMISC_153
#define I18N_MSG_CMISC_094
int command_statistics(object *pl, char *params)
void get_password(object *op)
int is_dragon_pl(const object *op)
void receive_player_password(object *op)
#define I18N_MSG_CMISC_146
#define I18N_MSG_CMISC_164
#define I18N_MSG_CMISC_043
int command_malloc(object *op, char *params)
void dump_object(object *op, StringBuffer *sb)
#define I18N_MSG_CMISC_027
#define I18N_MSG_CMISC_215
#define I18N_MSG_CMISC_015
#define I18N_MSG_CMISC_145
#define I18N_MSG_CMISC_092
#define I18N_MSG_CMISC_039
#define I18N_MSG_CMISC_105
int command_output_count(object *op, char *params)
#define I18N_MSG_CMISC_176
int command_dumpallarchetypes(object *op, char *params)
#define I18N_MSG_CMISC_165
int command_strings(object *op, char *params)
#define I18N_MSG_CMISC_205
#define I18N_MSG_CMISC_053
#define I18N_MSG_CMISC_052
object * get_owner(object *op)
#define I18N_MSG_CMISC_204
static void show_commands(object *op, int what)
#define I18N_MSG_CMISC_181
#define I18N_MSG_CMISC_119
void send_query(socket_struct *ns, uint8 flags, const char *text)
#define I18N_MSG_CMISC_021
#define CS_QUERY_SINGLECHAR
#define I18N_MSG_CMISC_037
#define I18N_MSG_CMISC_018
int command_who(object *op, char *params)
EXTERN const char *const change_resist_msg[NROFATTACKS]
#define I18N_MSG_CMISC_101
#define I18N_MSG_CMISC_103
int command_fix_me(object *op, char *params)
#define I18N_MSG_CMISC_171
#define I18N_MSG_CMISC_004
EXTERN Animations * animations
#define I18N_MSG_CMISC_174
int command_kill_pets(object *op, char *params)
char * ss_dump_table(int what, char *buf, size_t size)
int command_dumpallmaps(object *op, char *params)
#define I18N_MSG_CMISC_114
#define I18N_MSG_CMISC_010
#define I18N_MSG_CMISC_129
#define I18N_MSG_CMISC_203
#define I18N_MSG_CMISC_216
int command_version(object *op, char *params)
EXTERN treasurelist * first_treasurelist
#define I18N_MSG_CMISC_038
void dm_stack_push(player *pl, tag_t item)
void time_info(object *op)
char d_name[_MAX_FNAME+1]
const char * language_codes[]
int command_output_sync(object *op, char *params)
struct regiondef * parent
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
EXTERN artifactlist * first_artifactlist
EXTERN const char *const attacktype_desc[NROFATTACKS]
#define I18N_MSG_CMISC_132
#define I18N_MSG_CMISC_137
object * insert_ob_in_ob(object *op, object *where)
void dump_map(const mapstruct *m)
#define I18N_MSG_CMISC_152
#define I18N_MSG_CMISC_135
command_array_struct WizCommands[]
#define I18N_MSG_CMISC_054
#define I18N_MSG_CMISC_149
#define I18N_MSG_CMISC_127
object * get_object(void)
int players_on_map(mapstruct *m, int show_all)
void replace_unprintable_chars(char *buf)
object * insert_ob_in_map(object *op, mapstruct *m, object *originator, int flag)
#define I18N_MSG_CMISC_118
int command_dumpallobjects(object *op, char *params)
#define I18N_MSG_CMISC_209
#define I18N_MSG_CMISC_210
#define I18N_MSG_CMISC_177
#define I18N_MSG_CMISC_196
#define I18N_MSG_CMISC_211
#define I18N_MSG_CMISC_115
#define I18N_MSG_CMISC_000
sint16 resist[NROFATTACKS]
EXTERN long nrofartifacts
int command_mapinfo(object *op, char *params)
int command_players(object *op, char *params)
sint8 body_info[NUM_BODY_LOCATIONS]
EXTERN long nrofallowedstr
int snprintf(char *dest, int max, const char *format,...)
int command_title(object *op, char *params)
sint8 body_used[NUM_BODY_LOCATIONS]
#define I18N_MSG_CMISC_117
#define I18N_MSG_CMISC_179
#define I18N_MSG_CMISC_022
#define I18N_MSG_CMISC_186
#define I18N_MSG_CMISC_028
#define I18N_MSG_CMISC_107
int get_language(object *op)
void print_los(object *op)
int command_rules(object *op, char *params)
#define I18N_MSG_CMISC_130
#define FREE_AND_COPY(sv, nv)
int set_ob_key_value(object *op, const char *key, const char *value, int add_key)
#define I18N_MSG_CMISC_182
#define I18N_MSG_CMISC_099
int command_ssdumptable(object *op, char *params)
#define I18N_MSG_CMISC_019
#define I18N_MSG_CMISC_040
int command_maps(object *op, char *params)
int command_debug(object *op, char *params)
#define MSG_TYPE_COMMAND_INFO
#define I18N_MSG_CMISC_057
#define I18N_MSG_CMISC_208
#define I18N_MSG_CMISC_150
#define I18N_MSG_CMISC_213
int command_passwd(object *pl, char *params)
#define MSG_TYPE_COMMAND_STATISTICS
#define I18N_MSG_CMISC_214
void arch_info(object *op)
#define I18N_MSG_CMISC_011
#define I18N_MSG_CMISC_097
#define I18N_MSG_CMISC_036
#define MSG_TYPE_COMMAND_WHO
void dump_all_objects(void)
struct dirent * readdir(DIR *)
#define I18N_MSG_CMISC_032
command_array_struct CommunicationCommands[]
int command_save(object *op, char *params)
#define ST_CHANGE_PASSWORD_OLD
void ss_dump_statistics(char *buf, size_t size)
#define I18N_MSG_CMISC_201
static void help_topics(object *op, int what)
#define I18N_MSG_CMISC_183
#define I18N_MSG_CMISC_098
#define I18N_MSG_CMISC_161
void send_news(const object *op)
#define I18N_MSG_CMISC_104
#define I18N_MSG_CMISC_035
int command_body(object *op, char *params)
void send_rules(const object *op)
#define I18N_MSG_CMISC_125
const char * get_name_of_region_for_map(const mapstruct *m)
EXTERN player * first_player
void get_who_escape_code_value(char *return_val, int size, const char letter, player *pl)
#define I18N_MSG_CMISC_206
#define I18N_MSG_CMISC_194
void copy_object_with_inv(object *src_ob, object *dest_ob)
#define GET_MAP_OB(M, X, Y)
int strcasecmp(const char *s1, const char *s2)
int command_hiscore(object *op, char *params)
#define I18N_MSG_CMISC_056
int find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
#define I18N_MSG_CMISC_133
char * crypt_string(char *str, char *salt)
int command_printlos(object *op, char *params)
#define I18N_MSG_CMISC_154
#define I18N_MSG_CMISC_045
#define I18N_MSG_CMISC_013
#define I18N_MSG_CMISC_033
void display_high_score(object *op, int max, const char *match)
void LOG(LogLevel logLevel, const char *format,...)
#define CS_QUERY_HIDEINPUT
void receive_player_name(object *op)
#define I18N_MSG_CMISC_166
#define I18N_MSG_CMISC_138
#define I18N_MSG_CMISC_158
EXTERN region * first_region
int command_quit(object *op, char *params)
#define I18N_MSG_CMISC_169
#define I18N_MSG_CMISC_100
#define I18N_MSG_CMISC_044
int command_brace(object *op, char *params)
#define I18N_MSG_CMISC_172
int command_dumpmap(object *op, char *params)
void dump_friendly_objects(void)
void free_object(object *ob)
#define I18N_MSG_CMISC_116
#define MSG_TYPE_COMMAND_CONFIG
#define I18N_MSG_CMISC_140
#define I18N_MSG_CMISC_207
char * strerror_local(int errnum, char *buf, size_t size)
int random_roll(int min, int max, const object *op, int goodbad)
#define I18N_MSG_CMISC_189
#define I18N_MSG_CMISC_046
int command_language(object *op, char *params)
int command_wimpy(object *op, char *params)
#define I18N_MSG_CMISC_143
const char * i18n_translate(int language, int id)
#define MSG_TYPE_COMMAND_MAPS
#define I18N_MSG_CMISC_106
int onoff_value(const char *line)
#define I18N_MSG_CMISC_110
#define I18N_MSG_CMISC_170
#define I18N_MSG_CMISC_122
void fix_object(object *op)
#define I18N_MSG_CMISC_142
void list_players(object *op, region *reg, partylist *party)
EXTERN mapstruct * first_map
EXTERN archetype * first_archetype
#define I18N_MSG_CMISC_147
#define I18N_MSG_CMISC_030
#define I18N_MSG_CMISC_184
#define I18N_MSG_CMISC_157
char * stringbuffer_finish(StringBuffer *sb)
#define I18N_MSG_CMISC_156
#define I18N_MSG_CMISC_041
const char * get_region_msg(const region *r)
#define I18N_MSG_CMISC_123
#define I18N_MSG_CMISC_093
#define I18N_MSG_CMISC_126
#define I18N_MSG_CMISC_008
int atnr_is_dragon_enabled(int attacknr)
void current_map_info(object *op)
static int name_cmp(const chars_names *c1, const chars_names *c2)
void display_motd(const object *op)
EXTERN long nroftreasures
int command_wizpass(object *op, char *params)