70 "alive",
"wiz", NULL, NULL,
"was_wiz",
"applied",
"unpaid",
71 "can_use_shield",
"no_pick",
"client_anim_sync",
"client_anim_random",
73 NULL ,
"monster",
"friendly",
"generator",
74 "is_thrown",
"auto_apply",
"treasure",
"player sold",
75 "see_invisible",
"can_roll",
"overlay_floor",
76 "is_turnable", NULL , NULL ,
77 NULL ,
"is_used_up",
"identified",
"reflecting",
78 "changing",
"splitting",
"hitback",
"startequip",
79 "blocksview",
"undead",
"scared",
"unaggressive",
80 "reflect_missile",
"reflect_spell",
81 "no_magic",
"no_fix_player",
"is_lightable",
"tear_down",
82 "run_away", NULL , NULL ,
83 "pick_up",
"unique",
"no_drop",
84 NULL ,
"can_cast_spell",
"can_use_scroll",
"can_use_range",
85 "can_use_bow",
"can_use_armour",
"can_use_weapon",
86 "can_use_ring",
"has_ready_range",
"has_ready_bow",
87 "xrays", NULL,
"is_floor",
"lifesave",
"no_strength",
"sleep",
88 "stand_still",
"random_movement",
"only_attack",
"confused",
89 "stealth", NULL, NULL,
"cursed",
"damned",
90 "see_anywhere",
"known_magical",
"known_cursed",
91 "can_use_skill",
"been_applied",
92 "has_ready_scroll",
"can_use_rod", NULL,
93 "can_use_horn",
"make_invisible",
"inv_locked",
"is_wooded",
94 "is_hilly",
"has_ready_skill",
"has_ready_weapon",
95 "no_skill_ident",
"is_blind",
"can_see_in_dark",
"is_cauldron",
96 "is_dust",
"no_steal",
"one_hit", NULL,
"berserk",
"neutral",
97 "no_attack",
"no_damage", NULL, NULL,
"activate_on_push",
98 "activate_on_release",
"is_water",
"use_content_on_gen", NULL,
"is_buildable",
99 NULL,
"blessed",
"known_blessed"
115 source = realloc(source, strlen(source)+strlen(add)+1);
136 if (stat(name, &info)) {
137 printf(
"Couldn't stat template %s!\n", name);
141 (*buffer) = calloc(1, info.st_size+1);
143 printf(
"Template %s calloc failed!\n", name);
147 if (info.st_size == 0) {
152 file = fopen(name,
"rb");
154 printf(
"Couldn't open template %s!\n", name);
158 if (fread(*buffer, info.st_size, 1, file) != 1) {
159 printf(
"Couldn't read template %s!\n", name);
185 static char *
do_template(
const char *
template,
const char **vars,
const char **values) {
187 const char *sharp =
template;
191 char *current_result;
194 while ((sharp = strchr(sharp,
'#')) != NULL) {
199 return strdup(
template);
201 printf(
"Malformed template, mismatched #!\n");
202 return strdup(
template);
205 while (vars[var] != NULL) {
206 if (strlen(values[var]) > maxlen)
207 maxlen = strlen(values[var]);
210 result = calloc(1, strlen(
template)+maxlen*(count/2)+1);
213 current_result = result;
216 while ((sharp = strchr(sharp,
'#')) != NULL) {
217 end = strchr(sharp+1,
'#');
218 strncpy(current_result,
template, sharp-
template);
219 if (end == sharp+1) {
220 strcat(current_result,
"#");
222 current_result = current_result+strlen(current_result);
224 while (vars[var] != 0 && strncmp(vars[var], sharp+1, end-sharp-1))
227 printf(
"Wrong tag: %s\n", sharp);
229 strcpy(current_result, values[var]);
231 current_result = current_result+strlen(current_result);
235 strcat(current_result,
template);
254 if (p && strlen(p) > 0) {
272 return (
strcasecmp(*(
const char **)a, *(
const char **)b));
328 for (item = 0; item < array->
count; item++)
329 free(array->
item[item]);
348 newtext = calloc(1, 1);
350 for (i = 0; i < array->
count; i++) {
352 newtext = realloc(newtext, strlen(newtext)+strlen(
", ")+1);
353 newtext = strncat(newtext,
", ", 2);
355 newtext = realloc(newtext, strlen(newtext)+strlen(array->
item[i])+1);
356 newtext = strncat(newtext, array->
item[i], strlen(array->
item[i]));
361 int main(
int argc,
char *argv[]) {
369 char *wiki_page = NULL;
370 char *monster_entries = NULL;
374 char image_list_path[128];
378 const char *wikidir =
"/tmp";
408 sprintf(image_list_path,
"%s/image_list", wikidir);
409 image_list = fopen(image_list_path,
"w");
419 monster[archnum++] = at;
422 printf(
"Sorting...");
425 printf(
"done. %i items found\n", archnum);
429 for (i = 0; i < archnum; i++) {
432 const char *key[16] = { NULL, };
433 const char *val[16] = { NULL, };
442 if (letter != last_letter) {
445 key[keycount] = NULL;
447 res = fprintf(fp,
"%s",
template);
456 snprintf(wikifile,
sizeof(wikifile),
"%s/%c", wikidir, letter);
457 fp = fopen(wikifile,
"w");
459 fprintf(stderr,
"Unable to write to wiki file!\n");
463 char letterindex[256] =
"";
464 char letterindexnext[7];
466 letterindexnext[0] =
'\0';
467 for (li =
'a'; li <=
'z'; li++) {
469 sprintf(letterindexnext,
"%c ", toupper(li));
471 sprintf(letterindexnext,
"[[%c]] ", toupper(li));
473 strncat(letterindex, letterindexnext, 256);
477 key[keycount] =
"LETTER";
478 sprintf(buf[keycount],
"%c", toupper(letter));
479 val[keycount++] = buf[keycount];
480 key[keycount] =
"LETTERINDEX";
481 val[keycount++] = letterindex;
482 key[keycount] = NULL;
484 res = fprintf(fp,
template);
489 last_letter = letter;
495 char *vulnerable_row;
499 const int CANUSE_LENGTH = 16;
509 const sint8 special_flags[] = { 21, 93, 52, 38, 13, 32, 61, -1 };
510 const char *special_names[] = {
521 canuse.
item = calloc(1,
sizeof(
const char *)*(CANUSE_LENGTH+1));
529 key[keycount] =
"LORE";
530 key[keycount+1] = NULL;
535 lore_row = strdup(
"");
548 key[keycount] =
"CANUSE";
549 key[keycount+1] = NULL;
554 canuse_row = strdup(
"");
565 push(&vulner, rowtext);
568 push(&resist, rowtext);
574 key[keycount] =
"PROTECTED";
575 key[keycount+1] = NULL;
580 protected_row = strdup(
"");
584 key[keycount] =
"VULNERABLE";
585 key[keycount+1] = NULL;
590 vulnerable_row = strdup(
"");
595 val[keycount] = NULL;
602 key[keycount] =
"ATTACKS";
603 key[keycount+1] = NULL;
608 attack_row = strdup(
"");
613 val[keycount] = NULL;
614 for (j = 0; special_flags[j] >= 0; j++) {
616 push(&special, special_names[j]);
620 key[keycount] =
"SPECIAL";
621 key[keycount+1] = NULL;
626 special_row = strdup(
"");
629 key[keycount] =
"CANUSEROW";
630 val[keycount++] = canuse_row;
631 key[keycount] =
"PROTECTEDROW";
632 val[keycount++] = protected_row;
633 key[keycount] =
"VULNERABLEROW";
634 val[keycount++] = vulnerable_row;
635 key[keycount] =
"SPECIALROW";
636 val[keycount++] = attack_row;
637 key[keycount] =
"ATTACKROW";
638 val[keycount++] = special_row;
639 key[keycount] =
"LOREROW";
640 val[keycount++] = lore_row;
641 key[keycount] =
"XP";
643 val[keycount++] = buf[keycount];
644 key[keycount] =
"HP";
646 val[keycount++] = buf[keycount];
647 key[keycount] =
"AC";
649 val[keycount++] = buf[keycount];
650 key[keycount] =
"NAME";
652 key[keycount] =
"RACE";
656 val[keycount++] =
NA;
659 key[keycount] =
"FACE";
660 sprintf(buf[keycount],
"{{http://aaron.baugher.biz/images/cf/%s.png}}", at->
clone.
face->
name);
661 val[keycount++] = buf[keycount];
663 fprintf(image_list, buf[keycount]);
666 key[keycount] =
"GENFACE";
667 val[keycount++] =
"";
668 key[keycount] = NULL;
671 fprintf(fp,
template);
682 free(vulnerable_row);
747 object *tmp, *above = NULL;
752 for (tmp =
GET_MAP_OB(m, x, y); tmp != NULL; tmp = above) {
783 #ifndef DOXYGEN_SHOULD_SKIP_THIS
796 va_start(ap, old_format);
797 vfprintf(
logfile, old_format, ap);
802 fprintf(
logfile,
"ext_info_map: %s\n", str2);
839 int execute_event(
object *op,
int eventcode,
object *activator,
object *third,
const char *message,
int fix) {
void set_darkness_map(mapstruct *m)
void move_firewall(object *ob)
void dragon_ability_gain(object *ob, int x, int y)
void set_map_timeout(void)
static int read_template(const char *name, char **buffer)
void fix_auto_apply(mapstruct *m)
struct treasureliststruct * randomitems
char * monster_attack_row
const char *const flag_names[NUM_FLAGS+1]
void init_archetypes(void)
int execute_global_event(int eventcode,...)
void esrv_update_spells(player *pl)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
void esrv_del_item(player *pl, int tag)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
void free_data(String_Array *array)
void remove_ob(object *op)
static int sort_archetypes(const void *a, const void *b)
const char * join_with_comma(String_Array *array)
void identify(object *op)
char * monster_protected_row
void trap_adjust(object *ob, int x)
static char * cat_template(char *source, char *add)
int auto_apply(object *op)
char * monster_canuse_row
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
char * strdup_local(const char *str)
void esrv_send_item(object *ob, object *obx)
EXTERN const char *const attacktype_desc[NROFATTACKS]
void monster_check_apply(object *ob, object *obt)
object * find_skill_by_number(object *who, int skillno)
object * insert_ob_in_map(object *op, mapstruct *m, object *originator, int flag)
int main(int argc, char *argv[])
static const flag_definition flags[]
sint16 resist[NROFATTACKS]
int execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
int snprintf(char *dest, int max, const char *format,...)
struct string_array String_Array
void emergency_save(int x)
char * monster_vulnerable_row
void clean_tmp_files(void)
static void free_if_used(char *p)
void ext_info_map(int color, const mapstruct *map, uint8 type, uint8 subtype, const char *str1, const char *str2)
#define GET_MAP_OB(M, X, Y)
int strcasecmp(const char *s1, const char *s2)
char * monster_special_row
void LOG(LogLevel logLevel, const char *format,...)
static int sortbyname(const void *a, const void *b)
object * generate_treasure(treasurelist *t, int difficulty)
void free_object(object *ob)
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *txt, const char *txt2)
static char * do_template(const char *template, const char **vars, const char **values)
void push(String_Array *array, const char *string)
EXTERN archetype * first_archetype
#define HAS_RANDOM_ITEMS(op)
void init_artifacts(void)