Go to the documentation of this file.
75 "alive",
"wiz", NULL, NULL,
"was_wiz",
"applied",
"unpaid",
76 "can_use_shield",
"no_pick",
"client_anim_sync",
"client_anim_random",
78 NULL ,
"monster",
"friendly",
"generator",
79 "is_thrown",
"auto_apply",
"treasure",
"player sold",
80 "see_invisible",
"can_roll",
"overlay_floor",
81 "is_turnable", NULL , NULL ,
82 NULL ,
"is_used_up",
"identified",
"reflecting",
83 "changing",
"splitting",
"hitback",
"startequip",
84 "blocksview",
"undead",
"scared",
"unaggressive",
85 "reflect_missile",
"reflect_spell",
86 "no_magic",
"no_fix_player",
"is_lightable",
"tear_down",
87 "run_away", NULL , NULL ,
88 "pick_up",
"unique",
"no_drop",
89 NULL ,
"can_cast_spell",
"can_use_scroll",
"can_use_range",
90 "can_use_bow",
"can_use_armour",
"can_use_weapon",
91 "can_use_ring",
"has_ready_range",
"has_ready_bow",
92 "xrays", NULL,
"is_floor",
"lifesave",
"no_strength",
"sleep",
93 "stand_still",
"random_movement",
"only_attack",
"confused",
94 "stealth", NULL, NULL,
"cursed",
"damned",
95 "see_anywhere",
"known_magical",
"known_cursed",
96 "can_use_skill",
"been_applied",
97 "has_ready_scroll", NULL, NULL,
98 NULL,
"make_invisible",
"inv_locked",
"is_wooded",
99 "is_hilly",
"has_ready_skill",
"has_ready_weapon",
100 "no_skill_ident",
"is_blind",
"can_see_in_dark",
"is_cauldron",
101 "is_dust",
"no_steal",
"one_hit", NULL,
"berserk",
"neutral",
102 "no_attack",
"no_damage", NULL, NULL,
"activate_on_push",
103 "activate_on_release",
"is_water",
"use_content_on_gen", NULL,
"is_buildable",
104 NULL,
"blessed",
"known_blessed"
120 source = realloc(source, strlen(source)+strlen(add)+1);
141 if (stat(
name, &info)) {
142 printf(
"Couldn't stat template %s!\n",
name);
146 (*buffer) = calloc(1, info.st_size+1);
148 printf(
"Template %s calloc failed!\n",
name);
152 if (info.st_size == 0) {
159 printf(
"Couldn't open template %s!\n",
name);
163 if (fread(*buffer, info.st_size, 1,
file) != 1) {
164 printf(
"Couldn't read template %s!\n",
name);
190 static char *
do_template(
const char *tpl,
const char **vars,
const char **values) {
192 const char *sharp = tpl;
196 char *current_result;
199 while ((sharp = strchr(sharp,
'#')) != NULL) {
206 printf(
"Malformed template, mismatched #!\n");
210 while (vars[var] != NULL) {
211 if (strlen(values[var]) > maxlen)
212 maxlen = strlen(values[var]);
215 result = calloc(1, strlen(tpl)+maxlen*(
count/2)+1);
221 while ((sharp = strchr(sharp,
'#')) != NULL) {
222 end = strchr(sharp+1,
'#');
223 strncpy(current_result, tpl, sharp-tpl);
224 if (end == sharp+1) {
225 strcat(current_result,
"#");
227 current_result = current_result+strlen(current_result);
229 while (vars[var] != 0 && strncmp(vars[var], sharp+1, end-sharp-1))
232 printf(
"Wrong tag: %s\n", sharp);
234 strcpy(current_result, values[var]);
236 current_result = current_result+strlen(current_result);
240 strcat(current_result, tpl);
259 if (p && strlen(p) > 0) {
277 return (
strcasecmp(*(
const char **)
a, *(
const char **)
b));
316 int16_t i = array->count;
334 free(array->item[
item]);
353 newtext = calloc(1, 1);
354 qsort(array->item, array->count,
sizeof(
char *),
sortbyname);
355 for (i = 0; i < array->count; i++) {
357 newtext = realloc(newtext, strlen(newtext)+strlen(
", ")+1);
358 newtext = strncat(newtext,
", ", 2);
360 newtext = realloc(newtext, strlen(newtext)+strlen(array->item[i])+1);
361 newtext = strncat(newtext, array->item[i], strlen(array->item[i]));
366 int main(
int argc,
char *argv[]) {
374 char *wiki_page = NULL;
375 char *monster_entries = NULL;
379 char image_list_path[128];
383 const char *wikidir =
"/tmp";
410 sprintf(image_list_path,
"%s/image_list", wikidir);
411 image_list = fopen(image_list_path,
"w");
421 monster[archnum++] = at;
424 printf(
"Sorting...");
427 printf(
"done. %i items found\n", archnum);
431 for (i = 0; i < archnum; i++) {
434 const char *
key[16] = { NULL, };
435 const char *val[16] = { NULL, };
444 if (letter != last_letter) {
447 key[keycount] = NULL;
449 res = fprintf(fp,
"%s", tpl);
458 snprintf(wikifile,
sizeof(wikifile),
"%s/%c", wikidir, letter);
459 fp = fopen(wikifile,
"w");
461 fprintf(stderr,
"Unable to write to wiki file!\n");
465 char letterindex[256] =
"";
466 char letterindexnext[7];
468 letterindexnext[0] =
'\0';
469 for (li =
'a'; li <=
'z'; li++) {
473 sprintf(letterindexnext,
"%c ", toupper(li));
475 sprintf(letterindexnext,
"[[%c]] ", toupper(li));
477 p = strchr(letterindex,
'\0');
478 snprintf(p, letterindex+
sizeof(letterindex)-p,
"%s", letterindexnext);
482 key[keycount] =
"LETTER";
483 sprintf(
buf[keycount],
"%c", toupper(letter));
484 val[keycount++] =
buf[keycount];
485 key[keycount] =
"LETTERINDEX";
486 val[keycount++] = letterindex;
487 key[keycount] = NULL;
489 res = fprintf(fp, tpl);
494 last_letter = letter;
500 char *vulnerable_row;
504 const int CANUSE_LENGTH = 16;
514 const int8_t special_flags[] = { 21, 93, 52, 38, 13, 32, 61, -1 };
515 const char *special_names[] = {
526 canuse.
item = calloc((CANUSE_LENGTH+1),
sizeof(
const char *));
534 key[keycount] =
"LORE";
535 key[keycount+1] = NULL;
540 lore_row = strdup(
"");
553 key[keycount] =
"CANUSE";
554 key[keycount+1] = NULL;
559 canuse_row = strdup(
"");
570 push(&vulner, rowtext);
573 push(&resist, rowtext);
579 key[keycount] =
"PROTECTED";
580 key[keycount+1] = NULL;
585 protected_row = strdup(
"");
589 key[keycount] =
"VULNERABLE";
590 key[keycount+1] = NULL;
595 vulnerable_row = strdup(
"");
600 val[keycount] = NULL;
607 key[keycount] =
"ATTACKS";
608 key[keycount+1] = NULL;
613 attack_row = strdup(
"");
618 val[keycount] = NULL;
619 for (j = 0; special_flags[j] >= 0; j++) {
621 push(&special, special_names[j]);
625 key[keycount] =
"SPECIAL";
626 key[keycount+1] = NULL;
631 special_row = strdup(
"");
634 key[keycount] =
"CANUSEROW";
635 val[keycount++] = canuse_row;
636 key[keycount] =
"PROTECTEDROW";
637 val[keycount++] = protected_row;
638 key[keycount] =
"VULNERABLEROW";
639 val[keycount++] = vulnerable_row;
640 key[keycount] =
"SPECIALROW";
641 val[keycount++] = attack_row;
642 key[keycount] =
"ATTACKROW";
643 val[keycount++] = special_row;
644 key[keycount] =
"LOREROW";
645 val[keycount++] = lore_row;
646 key[keycount] =
"XP";
648 val[keycount++] =
buf[keycount];
649 key[keycount] =
"HP";
651 val[keycount++] =
buf[keycount];
652 key[keycount] =
"AC";
654 val[keycount++] =
buf[keycount];
655 key[keycount] =
"NAME";
657 key[keycount] =
"RACE";
661 val[keycount++] =
NA;
664 key[keycount] =
"FACE";
665 sprintf(
buf[keycount],
"{{http://aaron.baugher.biz/images/cf/%s.png}}", at->
clone.
face->
name);
666 val[keycount++] =
buf[keycount];
668 fprintf(image_list,
buf[keycount]);
671 key[keycount] =
"GENFACE";
672 val[keycount++] =
"";
673 key[keycount] = NULL;
687 free(vulnerable_row);
735 while ((
op->stats.hp--) > 0)
751 object *
tmp, *above = NULL;
763 while ((
tmp->stats.hp--) > 0)
770 &&
tmp->randomitems) {
773 while ((
tmp->stats.hp--) > 0)
791 #ifndef DOXYGEN_SHOULD_SKIP_THIS
805 va_start(ap, format);
811 fprintf(
logfile,
"ext_info_map: %s\n", str1);
#define GET_MAP_OB(M, X, Y)
#define HAS_RANDOM_ITEMS(op)
void emergency_save(int flag)
object * find_skill_by_number(object *who, int skillno)
void LOG(LogLevel logLevel, const char *format,...)
#define QUERY_FLAG(xyz, p)
archetype * get_next_archetype(archetype *current)
const char * join_with_comma(String_Array *array)
char * monster_protected_row
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
static const flag_definition flags[]
void esrv_update_spells(player *pl)
static int sort_archetypes(const void *a, const void *b)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
int16_t resist[NROFATTACKS]
void dragon_ability_gain(object *who, int atnr, int level)
void esrv_send_item(object *pl, object *op)
static event_registration m
void set_darkness_map(mapstruct *m)
void apply_auto_fix(mapstruct *m)
void object_free_drop_inventory(object *ob)
void push(String_Array *array, const char *string)
struct string_array String_Array
int main(int argc, char *argv[])
static char * cat_template(char *source, char *add)
void void ext_info_map(int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
void free_data(String_Array *array)
void move_firewall(object *op)
char * monster_attack_row
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
static int sortbyname(const void *a, const void *b)
void esrv_del_item(player *pl, object *ob)
void monster_check_apply_all(object *monster)
static int read_template(const char *name, char **buffer)
int apply_auto(object *op)
char * monster_canuse_row
void clean_tmp_files(void)
const char *const attacktype_desc[NROFATTACKS]
#define CLEAR_FLAG(xyz, p)
void set_map_timeout(void)
static void free_if_used(char *p)
int strcasecmp(const char *s1, const char *s2)
static char * do_template(const char *tpl, const char **vars, const char **values)
char * monster_special_row
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
void object_remove(object *op)
object * generate_treasure(treasurelist *t, int difficulty)
const char *const flag_names[NUM_FLAGS+1]
char * monster_vulnerable_row
object * identify(object *op)