102 {
"alive",
"FLAG_ALIVE" },
103 {
"wiz",
"FLAG_WIZ" },
104 {
"was_wiz",
"FLAG_WAS_WIZ" },
105 {
"applied",
"FLAG_APPLIED" },
106 {
"unpaid",
"FLAG_UNPAID" },
107 {
"can_use_shield",
"FLAG_USE_SHIELD" },
108 {
"no_pick",
"FLAG_NO_PICK" },
109 {
"client_anim_sync",
"FLAG_CLIENT_ANIM_SYNC" },
110 {
"client_anim_random",
"FLAG_CLIENT_ANIM_RANDOM" },
111 {
"is_animated",
"FLAG_ANIMATE" },
112 {
"monster",
"FLAG_MONSTER" },
113 {
"friendly",
"FLAG_FRIENDLY" },
114 {
"generator",
"FLAG_GENERATOR" },
115 {
"is_thrown",
"FLAG_IS_THROWN" },
116 {
"auto_apply",
"FLAG_AUTO_APPLY" },
117 {
"treasure",
"FLAG_TREASURE" },
118 {
"player sold",
"FLAG_PLAYER_SOLD" },
119 {
"see_invisible",
"FLAG_SEE_INVISIBLE" },
120 {
"can_roll",
"FLAG_CAN_ROLL" },
121 {
"overlay_floor",
"FLAG_OVERLAY_FLOOR" },
122 {
"is_turnable",
"FLAG_IS_TURNABLE" },
123 {
"is_used_up",
"FLAG_IS_USED_UP" },
124 {
"identified",
"FLAG_IDENTIFIED" },
125 {
"reflecting",
"FLAG_REFLECTING" },
126 {
"changing",
"FLAG_CHANGING" },
127 {
"splitting",
"FLAG_SPLITTING" },
128 {
"hitback",
"FLAG_HITBACK" },
129 {
"startequip",
"FLAG_STARTEQUIP" },
130 {
"blocksview",
"FLAG_BLOCKSVIEW" },
131 {
"undead",
"FLAG_UNDEAD" },
132 {
"scared",
"FLAG_SCARED" },
133 {
"unaggressive",
"FLAG_UNAGGRESSIVE" },
134 {
"reflect_missile",
"FLAG_REFL_MISSILE" },
135 {
"reflect_spell",
"FLAG_REFL_SPELL" },
136 {
"no_magic",
"FLAG_NO_MAGIC" },
137 {
"no_fix_player",
"FLAG_NO_FIX_PLAYER" },
138 {
"is_lightable",
"FLAG_IS_LIGHTABLE" },
139 {
"tear_down",
"FLAG_TEAR_DOWN" },
140 {
"run_away",
"FLAG_RUN_AWAY" },
141 {
"unique",
"FLAG_UNIQUE" },
142 {
"no_drop",
"FLAG_NO_DROP" },
143 {
"can_cast_spell",
"FLAG_CAST_SPELL" },
144 {
"can_use_scroll",
"FLAG_USE_SCROLL" },
145 {
"can_use_range",
"FLAG_USE_RANGE" },
146 {
"can_use_bow",
"FLAG_USE_BOW" },
147 {
"can_use_armour",
"FLAG_USE_ARMOUR" },
148 {
"can_use_weapon",
"FLAG_USE_WEAPON" },
149 {
"can_use_ring",
"FLAG_USE_RING" },
150 {
"has_ready_range",
"FLAG_READY_RANGE" },
151 {
"has_ready_bow",
"FLAG_READY_BOW" },
152 {
"xrays",
"FLAG_XRAYS" },
153 {
"is_floor",
"FLAG_IS_FLOOR" },
154 {
"lifesave",
"FLAG_LIFESAVE" },
155 {
"no_strength",
"FLAG_NO_STRENGTH" },
156 {
"sleep",
"FLAG_SLEEP" },
157 {
"stand_still",
"FLAG_STAND_STILL" },
158 {
"random_movement",
"FLAG_RANDOM_MOVE" },
159 {
"only_attack",
"FLAG_ONLY_ATTACK" },
160 {
"confused",
"FLAG_CONFUSED" },
161 {
"stealth",
"FLAG_STEALTH" },
162 {
"cursed",
"FLAG_CURSED" },
163 {
"damned",
"FLAG_DAMNED" },
164 {
"see_anywhere",
"FLAG_SEE_ANYWHERE" },
165 {
"known_magical",
"FLAG_KNOWN_MAGICAL" },
166 {
"known_cursed",
"FLAG_KNOWN_CURSED" },
167 {
"can_use_skill",
"FLAG_CAN_USE_SKILL" },
168 {
"been_applied",
"FLAG_BEEN_APPLIED" },
169 {
"has_ready_scroll",
"FLAG_READY_SCROLL" },
170 {
"make_invisible",
"FLAG_MAKE_INVIS" },
171 {
"inv_locked",
"FLAG_INV_LOCKED" },
172 {
"is_wooded",
"FLAG_IS_WOODED" },
173 {
"is_hilly",
"FLAG_IS_HILLY" },
174 {
"has_ready_skill",
"FLAG_READY_SKILL" },
175 {
"has_ready_weapon",
"FLAG_READY_WEAPON" },
176 {
"no_skill_ident",
"FLAG_NO_SKILL_IDENT" },
177 {
"is_blind",
"FLAG_BLIND" },
178 {
"can_see_in_dark",
"FLAG_SEE_IN_DARK" },
179 {
"is_cauldron",
"FLAG_IS_CAULDRON" },
180 {
"no_steal",
"FLAG_NO_STEAL" },
181 {
"one_hit",
"FLAG_ONE_HIT" },
182 {
"berserk",
"FLAG_BERSERK" },
183 {
"neutral",
"FLAG_NEUTRAL" },
184 {
"no_attack",
"FLAG_NO_ATTACK" },
185 {
"no_damage",
"FLAG_NO_DAMAGE" },
186 {
"activate_on_push",
"FLAG_ACTIVATE_ON_PUSH" },
187 {
"activate_on_release",
"FLAG_ACTIVATE_ON_RELEASE" },
188 {
"is_water",
"FLAG_IS_WATER" },
189 {
"use_content_on_gen",
"FLAG_CONTENT_ON_GEN" },
190 {
"is_buildable",
"FLAG_IS_BUILDABLE" },
191 {
"blessed",
"FLAG_BLESSED" },
192 {
"known_blessed",
"FLAG_KNOWN_BLESSED" },
200 for (flag = 0; flags[flag].
field; flag++)
201 if (!strcmp(flags[flag].field, name))
360 ret->
field = strdup(attribute);
414 if (!strcmp(types[type]->name, name))
417 printf(
"type not found: %s\n", name);
426 return strcmp((*la)->name, (*lb)->name);
433 if (strcmp(lists[list]->name, name) == 0)
443 return fgets(buffer, 200, file);
467 printf(
"empty ignore list?\n");
471 for (attr = 0; attr < list->
count; attr++) {
478 char *sn, *en, *sv, *ev;
479 char value[200], name[200], temp[200];
482 if (type == fallback_type)
486 sn = strstr(const_cast<char *>(buf),
"arch");
489 sn = strchr(sn,
'"');
490 en = strchr(sn+1,
'"');
491 sv = strstr(const_cast<char *>(buf),
"value");
492 sv = strchr(sv,
'"');
493 ev = strchr(sv+1,
'"');
495 name[en-sn-1] =
'\0';
496 strncpy(name, sn+1, en-sn-1);
497 value[ev-sv-1] =
'\0';
498 strncpy(value, sv+1, ev-sv-1);
505 snprintf(temp, 200,
"@ref %s %s", flag->
code_name, strcmp(value,
"0") ?
"set" :
"unset");
507 snprintf(temp, 200,
"@ref object::%s = %s", name, value);
513 char buf[200], tmp[200];
518 if (strstr(buf, block_end) != NULL) {
523 if (strstr(buf,
"<description>") != NULL) {
525 if (strstr(buf,
"</description>") != NULL)
543 if (strstr(buf,
"<ignore_list") != NULL) {
544 find = strstr(buf,
"name=");
547 find = strchr(find+1,
'"');
550 end = strchr(find+1,
'"');
553 tmp[end-find-1] =
'\0';
554 strncpy(tmp, find+1, end-find-1);
558 if (strstr(buf,
"<ignore>") != NULL) {
560 if (strstr(buf,
"</ignore>") != NULL)
562 find = strstr(buf,
"arch=");
565 find = strchr(find+1,
'"');
568 end = strchr(find+1,
'"');
571 tmp[end-find-1] =
'\0';
572 strncpy(tmp, find+1, end-find-1);
577 if (strstr(buf,
"<required>") != NULL) {
579 if (strstr(buf,
"</required>") != NULL)
585 if (strstr(buf,
"<import_type") != NULL) {
588 find = strstr(buf,
"name=");
591 find = strchr(find+1,
'"');
594 end = strchr(find+1,
'"');
597 tmp[end-find-1] =
'\0';
598 strncpy(tmp, find+1, end-find-1);
605 printf(
"%s: import %s not found\n", type->
name, tmp);
608 if (strstr(buf,
"<attribute") != NULL) {
609 find = strstr(buf,
"arch");
612 find = strchr(find,
'"');
613 end = strchr(find+1,
'"');
618 tmp[end-find-1] =
'\0';
619 strncpy(tmp, find+1, end-find-1);
622 find = strstr(buf,
"editor");
627 find = strchr(find,
'"');
628 end = strchr(find+1,
'"');
629 tmp[end-find-1] =
'\0';
630 strncpy(tmp, find+1, end-find-1);
631 attr->
name = strdup(tmp);
634 if (strstr(buf,
"</attribute>") == NULL && strstr(buf,
"/>") == NULL) {
636 if (strstr(buf,
"<![CDATA[<html>") != NULL)
639 if (strstr(buf,
"]]>") != NULL)
642 if (strstr(buf,
"</attribute>") != NULL)
663 printf(
"type: %s [%d]\n", type->
name, type->
number);
664 printf(
" attributes:\n");
687 if (!strcmp(attributes[attr]->field, name))
688 return attributes[attr];
694 attributes[attribute_count-1] = ret;
696 ret->
field = strdup(name);
706 for (desc = 0; desc < attribute->
type_count; desc++) {
708 return attribute->
types[desc];
710 return attribute->
types[desc];
729 att->
type =
static_cast<char **
>(realloc(att->
type, att->
count*
sizeof(
const char *)));
737 char buf[200], tmp[200];
746 list->
name = strdup(name);
749 if (strstr(buf,
"</ignore_list>") != NULL) {
753 start = strstr(buf,
"arch=");
756 start = strchr(start+1,
'"');
759 end = strchr(start+1,
'"');
763 tmp[end-start-1] =
'\0';
764 strncpy(tmp, start+1, end-start-1);
768 list->
fields =
static_cast<char **
>(realloc(list->
fields, list->
count*
sizeof(
char *)));
776 printf(
"ignore lists:\n");
778 printf(
" %s:", lists[list]->name);
779 for (field = 0; field < lists[list]->
count; field++)
780 printf(
" %s", lists[list]->fields[field]);
812 "weight_speed_ratio",
830 "price_adjustment_buy",
831 "price_adjustment_sell",
832 "casting_requirements",
834 "identified_name_pl",
836 "identified_animation",
837 "identified_anim_speed",
838 "identified_anim_random",
865 for (val = 0;
in_living[val] != NULL; val++) {
866 if (!strcmp(
in_living[val], attribute)) {
867 fprintf(file,
"living::%s", attribute);
872 fprintf(file,
"page_custom_attribute_%s \"%s\"", attribute, attribute);
875 if (strstr(attribute,
"resist_")) {
876 fprintf(file,
"object::resist");
879 if (!strcmp(attribute,
"connected")) {
880 fprintf(file,
"page_connected \"connection value\"");
883 fprintf(file,
"object::%s", attribute);
893 file = fopen(buf,
"w+");
895 fprintf(file,
"/**\n");
899 for (req = 0; type_names[req].
code_name != NULL; req++) {
900 if (type_names[req].value == type->
number) {
901 fprintf(file,
"@var %s\nSee @ref page_type_%d\n*/\n\n/**\n", type_names[req].code_name, type->
number);
907 fprintf(file,
"@page page_type_%d %s\n\n", type->
number, type->
name);
909 if (type != fallback_type) {
910 fprintf(file,
"\n\nType defined by:\n");
912 fprintf(file,
"- @ref object::type = %d\n", type->
number);
914 fprintf(file,
"- %s\n", type->
required[req]);
917 fprintf(file,
"\n\n# Attributes\n\n");
918 fprintf(file,
"<table>\n\t<tr>\n\t\t<th>Attribute</th>\n\t\t<th>Field</th>\n\t\t<th>Description</th>\n\t</tr>\n");
920 fprintf(file,
"\t<tr>\n\t\t<td>%s</td>\n\t\t<td>@ref ", type->
attributes[attr]->
name);
925 fprintf(file,
"</table>\n*/\n");
937 index = fopen(buf,
"w+");
938 fprintf(index,
"/**\n@page type_index Type index\n");
940 fprintf(index,
"Types not listed here have the attributes defined in @subpage page_type_0 \"this page\".\n\n");
943 fprintf(index,
"- @subpage page_type_%d \"%s (%d)\"\n", types[type]->number, types[type]->name, types[type]->number);
946 fprintf(index,
"*/\n");
958 index = fopen(buf,
"w+");
959 fprintf(index,
"/**\n@page field_index Field index\n");
961 fprintf(index,
"This page lists all attributes.\n\n");
964 fprintf(index,
"- @subpage ");
966 fprintf(index,
"\n");
969 fprintf(index,
"*/\n");
982 file = fopen(buf,
"w+");
985 fprintf(file,
"/**\n@page page_custom_attribute_%s %s", attribute->
field, attribute->
field);
986 fprintf(file,
"\nThis is a @ref page_custom_attributes \"custom attribute\".\n");
988 if (strcmp(attribute->
field,
"connected") == 0)
989 fprintf(file,
"/**\n@page ");
991 fprintf(file,
"/**\n@fn ");
996 if (strstr(attribute->
field,
"resist_"))
997 fprintf(file,
"\n@section %s %s resistance\n", attribute->
field, attribute->
field+7);
999 fprintf(file,
"\n# Use\n");
1001 fprintf(file,
"<table>\n\t<tr>\n\t\t<th>Type(s)</th>\n\t\t<th>Description</th>\n\t</tr>");
1003 for (desc = 0; desc < attribute->
type_count; desc++) {
1006 fprintf(file,
"\t<tr>\n\t\t<td>\n");
1008 for (type = 0; type < attribute->
types[desc]->
count; type++) {
1009 if (type < attribute->types[desc]->count-1)
1013 fprintf(file,
"@ref page_type_%d%s", attribute->
types[desc]->
number[type], end);
1018 fprintf(file,
"\n*/\n");
1025 int number, attr, dummy;
1026 char buf[200], tmp[200];
1031 printf(
"Syntax: %s /path/to/Gridarta/types.xml\n", argv[0]);
1038 xml = fopen(argv[1],
"r");
1041 printf(
"Could not find file %s\n", argv[1]);
1045 while (
read_line(buf, 200, xml) != NULL) {
1048 if (strstr(buf,
"<default_type>")) {
1050 default_type->
name = strdup(
"(default type)");
1051 read_type(default_type, xml,
"</default_type>");
1055 if (strstr(buf,
"<ignore_list") != NULL) {
1056 start = strstr(buf,
"name=");
1057 start = strchr(start+1,
'"');
1058 end = strchr(start+1,
'"');
1059 tmp[end-start-1] =
'\0';
1060 strncpy(tmp, start+1, end-start-1);
1065 start = strstr(buf,
"<type number");
1067 start = strchr(start,
'"');
1070 end = strchr(start+1,
'"');
1073 tmp[end-start-1] =
'\0';
1074 strncpy(tmp, start+1, end-start-1);
1078 start = strstr(end,
"name=");
1079 start = strchr(start,
'"');
1080 end = strchr(start+1,
'"');
1081 tmp[end-start-1] =
'\0';
1082 strncpy(tmp, start+1, end-start-1);
1084 if (!strcmp(tmp,
"Misc")) {
1100 while (
read_line(buf, 200, xml) != NULL && strstr(buf,
"</type>") == NULL)
1110 type->
name = strdup(tmp);
1117 fallback_type->
description = strdup(
"This type regroups all types who don't have a specific definition.");
1119 for (number = 0; number <
type_count; number++) {
1129 for (number = 0; number <
type_count; number++)
void read_ignore_list(const char *name, FILE *file)
Read the contents of a <ignore_list> tag.
see doc/Developers/objects
void write_type_index(void)
Write index of all types.
Eneq((at)csd.uu.se): Id for close_container archetype.
static type_name type_names[]
void ignore_attributes(type_definition *type, ignore_list *list)
Remove all attributes in the specified list from the type.
Try to find a fire/heat source to light this when applied.
type_definition * get_type_definition(void)
Returns a new type_definition having the default attributes.
void read_type(type_definition *type, FILE *file, const char *block_end)
Read all lines related to a type, stop when "block_end" is found on a line.
void copy_attributes(const type_definition *source, type_definition *type)
attribute_type * get_description_for_attribute(attribute_definition *attribute, const char *description)
Gets a type description for specified attribute, create it if doesn't exist.
Object for applying character class modifications to someone.
void write_attribute_file(attribute_definition *attribute)
Write the description of a field.
const flag_definition * find_flag(const char *name)
Return flag if exists, NULL else.
Duplicator/multiplier object.
const char * type_dir
Where the files about types will be stored.
static const char * in_living[]
Fields part of the living structure.
animal 'body parts' -b.t.
Global type definitions and header inclusions.
peterm: detector is an object which notices the presense of another object and is triggered like butt...
const char * field_dir
Where the files about the fields will be stored.
Allows the use of a skill.
Generic item builder, see subtypes below.
void copy_default_attributes(type_definition *type)
type_definition * fallback_type
Dummy object type that non defined objects use.
Floor tile -> native layer 0.
void write_attribute_reference(const char *attribute, FILE *file)
Write the part to the right of a @ref for the specified attribute.
int main(int argc, char **argv)
battleground, by Andreas Vogl
inserts an invisible, weightless force into a player with a specified string.
const char * destination_dir
Root destination dir.
type_definition * default_type
Definitions all types have by default.
inserts an invisible, weightless force into a player with a specified string WHEN TRIGGERED...
type_attribute ** attributes
attribute_definition ** attributes
char * read_line(char *buffer, int size, FILE *file)
void dump_type(type_definition *type)
void add_required_parameter(type_definition *type, const char *buf)
Add a required parameter to the specified type.
type_attribute * duplicate_attribute(type_attribute *attr)
static const char * custom_attributes[]
Custom attributes we know about, to point to the right page.
int is_custom_attribute(const char *attribute)
Object owned by a player which can convert a monster into a peaceful being incapable of attack...
can add a skill to player's inventory -bt.
One type for an attribute.
static const flag_definition flags[]
Flag mapping.
type_definition ** types
Defined types.
Mark Wedel (mark@pyramid.com) Shop inventories.
Also see SKILL_TOOL (74) below.
type_attribute * get_attribute_for_type(type_definition *type, const char *attribute, int clean)
Gets the attribute for the specified type.
void dump_ignore_lists(void)
Lauwenmark: an invisible object holding a plugin event hook.
ignore_list * find_ignore_list(const char *name)
See Monster (Grimreaper).
A force, holding the effect of a resistance potion.
void add_type_to_attribute(attribute_definition *attribute, type_definition *type, int attr)
void free_attribute(type_attribute *attr)
metals, minerals, dragon scales
type_definition * find_type_definition(const char *name)
Used for type import.
void write_type_file(type_definition *type)
Write a type definition file.
One list of fields to ignore.
attribute_definition * get_attribute(const char *name)
Get an attribute, create it if it doesn't exist yet.
void write_attribute_index(void)
Write the index of all attributes.
int sort_type_attribute(const void *a, const void *b)
To sort attributes.
Core defines: object types, flags, etc.
void ignore_attribute(type_definition *type, const char *attribute)
Remove an attribute from the type.