Go to the documentation of this file.
71 "alive",
"wiz", NULL, NULL,
"was_wiz",
"applied",
"unpaid",
72 "can_use_shield",
"no_pick",
"client_anim_sync",
"client_anim_random",
74 NULL ,
"monster",
"friendly",
"generator",
75 "is_thrown",
"auto_apply",
"treasure",
"player sold",
76 "see_invisible",
"can_roll",
"overlay_floor",
77 "is_turnable", NULL , NULL ,
78 NULL ,
"is_used_up",
"identified",
"reflecting",
79 "changing",
"splitting",
"hitback",
"startequip",
80 "blocksview",
"undead",
"scared",
"unaggressive",
81 "reflect_missile",
"reflect_spell",
82 "no_magic",
"no_fix_player",
"is_lightable",
"tear_down",
83 "run_away", NULL , NULL ,
84 "pick_up",
"unique",
"no_drop",
85 NULL ,
"can_cast_spell",
"can_use_scroll",
"can_use_range",
86 "can_use_bow",
"can_use_armour",
"can_use_weapon",
87 "can_use_ring",
"has_ready_range",
"has_ready_bow",
88 "xrays", NULL,
"is_floor",
"lifesave",
"no_strength",
"sleep",
89 "stand_still",
"random_movement",
"only_attack",
"confused",
90 "stealth", NULL, NULL,
"cursed",
"damned",
91 "see_anywhere",
"known_magical",
"known_cursed",
92 "can_use_skill",
"been_applied",
93 "has_ready_scroll", NULL, NULL,
94 NULL,
"make_invisible",
"inv_locked",
"is_wooded",
95 "is_hilly",
"has_ready_skill",
"has_ready_weapon",
96 "no_skill_ident",
"is_blind",
"can_see_in_dark",
"is_cauldron",
97 "is_dust",
"no_steal",
"one_hit", NULL,
"berserk",
"neutral",
98 "no_attack",
"no_damage", NULL, NULL,
"activate_on_push",
99 "activate_on_release",
"is_water",
"use_content_on_gen", NULL,
"is_buildable",
100 NULL,
"blessed",
"known_blessed"
116 source = realloc(source, strlen(source)+strlen(add)+1);
137 if (stat(
name, &info)) {
138 printf(
"Couldn't stat template %s!\n",
name);
142 (*buffer) = calloc(1, info.st_size+1);
144 printf(
"Template %s calloc failed!\n",
name);
148 if (info.st_size == 0) {
155 printf(
"Couldn't open template %s!\n",
name);
159 if (fread(*buffer, info.st_size, 1,
file) != 1) {
160 printf(
"Couldn't read template %s!\n",
name);
186 static char *
do_template(
const char *
template,
const char **vars,
const char **values) {
188 const char *sharp =
template;
192 char *current_result;
195 while ((sharp = strchr(sharp,
'#')) != NULL) {
200 return strdup(
template);
202 printf(
"Malformed template, mismatched #!\n");
203 return strdup(
template);
206 while (vars[var] != NULL) {
207 if (strlen(values[var]) > maxlen)
208 maxlen = strlen(values[var]);
211 result = calloc(1, strlen(
template)+maxlen*(
count/2)+1);
217 while ((sharp = strchr(sharp,
'#')) != NULL) {
218 end = strchr(sharp+1,
'#');
219 strncpy(current_result,
template, sharp-
template);
220 if (end == sharp+1) {
221 strcat(current_result,
"#");
223 current_result = current_result+strlen(current_result);
225 while (vars[var] != 0 && strncmp(vars[var], sharp+1, end-sharp-1))
228 printf(
"Wrong tag: %s\n", sharp);
230 strcpy(current_result, values[var]);
232 current_result = current_result+strlen(current_result);
236 strcat(current_result,
template);
255 if (p && strlen(p) > 0) {
273 return (
strcasecmp(*(
const char **)
a, *(
const char **)
b));
312 int16_t i = array->count;
330 free(array->item[
item]);
349 newtext = calloc(1, 1);
350 qsort(array->item, array->count,
sizeof(
char *),
sortbyname);
351 for (i = 0; i < array->count; i++) {
353 newtext = realloc(newtext, strlen(newtext)+strlen(
", ")+1);
354 newtext = strncat(newtext,
", ", 2);
356 newtext = realloc(newtext, strlen(newtext)+strlen(array->item[i])+1);
357 newtext = strncat(newtext, array->item[i], strlen(array->item[i]));
362 int main(
int argc,
char *argv[]) {
370 char *wiki_page = NULL;
371 char *monster_entries = NULL;
375 char image_list_path[128];
379 const char *wikidir =
"/tmp";
406 sprintf(image_list_path,
"%s/image_list", wikidir);
407 image_list = fopen(image_list_path,
"w");
417 monster[archnum++] = at;
420 printf(
"Sorting...");
423 printf(
"done. %i items found\n", archnum);
427 for (i = 0; i < archnum; i++) {
430 const char *
key[16] = { NULL, };
431 const char *val[16] = { NULL, };
440 if (letter != last_letter) {
443 key[keycount] = NULL;
445 res = fprintf(fp,
"%s",
template);
454 snprintf(wikifile,
sizeof(wikifile),
"%s/%c", wikidir, letter);
455 fp = fopen(wikifile,
"w");
457 fprintf(stderr,
"Unable to write to wiki file!\n");
461 char letterindex[256] =
"";
462 char letterindexnext[7];
464 letterindexnext[0] =
'\0';
465 for (li =
'a'; li <=
'z'; li++) {
469 sprintf(letterindexnext,
"%c ", toupper(li));
471 sprintf(letterindexnext,
"[[%c]] ", toupper(li));
473 p = strchr(letterindex,
'\0');
474 snprintf(p, letterindex+
sizeof(letterindex)-p,
"%s", letterindexnext);
478 key[keycount] =
"LETTER";
479 sprintf(
buf[keycount],
"%c", toupper(letter));
480 val[keycount++] =
buf[keycount];
481 key[keycount] =
"LETTERINDEX";
482 val[keycount++] = letterindex;
483 key[keycount] = NULL;
485 res = fprintf(fp,
template);
490 last_letter = letter;
496 char *vulnerable_row;
500 const int CANUSE_LENGTH = 16;
510 const int8_t special_flags[] = { 21, 93, 52, 38, 13, 32, 61, -1 };
511 const char *special_names[] = {
522 canuse.
item = calloc((CANUSE_LENGTH+1),
sizeof(
const char *));
530 key[keycount] =
"LORE";
531 key[keycount+1] = NULL;
536 lore_row = strdup(
"");
549 key[keycount] =
"CANUSE";
550 key[keycount+1] = NULL;
555 canuse_row = strdup(
"");
566 push(&vulner, rowtext);
569 push(&resist, rowtext);
575 key[keycount] =
"PROTECTED";
576 key[keycount+1] = NULL;
581 protected_row = strdup(
"");
585 key[keycount] =
"VULNERABLE";
586 key[keycount+1] = NULL;
591 vulnerable_row = strdup(
"");
596 val[keycount] = NULL;
603 key[keycount] =
"ATTACKS";
604 key[keycount+1] = NULL;
609 attack_row = strdup(
"");
614 val[keycount] = NULL;
615 for (j = 0; special_flags[j] >= 0; j++) {
617 push(&special, special_names[j]);
621 key[keycount] =
"SPECIAL";
622 key[keycount+1] = NULL;
627 special_row = strdup(
"");
630 key[keycount] =
"CANUSEROW";
631 val[keycount++] = canuse_row;
632 key[keycount] =
"PROTECTEDROW";
633 val[keycount++] = protected_row;
634 key[keycount] =
"VULNERABLEROW";
635 val[keycount++] = vulnerable_row;
636 key[keycount] =
"SPECIALROW";
637 val[keycount++] = attack_row;
638 key[keycount] =
"ATTACKROW";
639 val[keycount++] = special_row;
640 key[keycount] =
"LOREROW";
641 val[keycount++] = lore_row;
642 key[keycount] =
"XP";
644 val[keycount++] =
buf[keycount];
645 key[keycount] =
"HP";
647 val[keycount++] =
buf[keycount];
648 key[keycount] =
"AC";
650 val[keycount++] =
buf[keycount];
651 key[keycount] =
"NAME";
653 key[keycount] =
"RACE";
657 val[keycount++] =
NA;
660 key[keycount] =
"FACE";
661 sprintf(
buf[keycount],
"{{http://aaron.baugher.biz/images/cf/%s.png}}", at->
clone.
face->
name);
662 val[keycount++] =
buf[keycount];
664 fprintf(image_list,
buf[keycount]);
667 key[keycount] =
"GENFACE";
668 val[keycount++] =
"";
669 key[keycount] = NULL;
672 fprintf(fp,
template);
683 free(vulnerable_row);
730 while ((
op->stats.hp--) > 0)
746 object *
tmp, *above = NULL;
758 while ((
tmp->stats.hp--) > 0)
765 &&
tmp->randomitems) {
768 while ((
tmp->stats.hp--) > 0)
786 #ifndef DOXYGEN_SHOULD_SKIP_THIS
799 va_start(ap, format);
805 fprintf(
logfile,
"ext_info_map: %s\n", str1);
#define GET_MAP_OB(M, X, Y)
#define HAS_RANDOM_ITEMS(op)
void esrv_update_spells(player *pl)
void dragon_ability_gain(object *ob, int x, int y)
static int sort_archetypes(const void *a, const void *b)
int main(int argc, char *argv[])
void LOG(LogLevel logLevel, const char *format,...)
#define QUERY_FLAG(xyz, p)
archetype * get_next_archetype(archetype *current)
const char *const flag_names[NUM_FLAGS+1]
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *txt)
static char * do_template(const char *template, const char **vars, const char **values)
void set_darkness_map(mapstruct *m)
char * monster_vulnerable_row
static const flag_definition flags[]
void free_data(String_Array *array)
char * monster_protected_row
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
int16_t resist[NROFATTACKS]
static void free_if_used(char *p)
void clean_tmp_files(void)
static event_registration m
const char * join_with_comma(String_Array *array)
void object_free_drop_inventory(object *ob)
char * monster_special_row
struct string_array String_Array
void push(String_Array *array, const char *string)
void esrv_send_item(object *ob, object *obx)
char * monster_canuse_row
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
void move_firewall(object *ob)
void monster_check_apply_all(object *monster)
void apply_auto_fix(mapstruct *m)
object * find_skill_by_number(object *who, int skillno)
void esrv_del_item(player *pl, object *ob)
const char *const attacktype_desc[NROFATTACKS]
void emergency_save(int x)
int apply_auto(object *op)
#define CLEAR_FLAG(xyz, p)
static int read_template(const char *name, char **buffer)
int strcasecmp(const char *s1, const char *s2)
void set_map_timeout(void)
char * monster_attack_row
void object_remove(object *op)
static int sortbyname(const void *a, const void *b)
static char * cat_template(char *source, char *add)
object * generate_treasure(treasurelist *t, int difficulty)
void ext_info_map(int color, const mapstruct *map, uint8_t type, uint8_t subtype, const char *str1)
object * identify(object *op)