Go to the documentation of this file.
98 if (
t->item == NULL &&
t->name == NULL)
99 LOG(
llevError,
"Treasurelist %s has element with no name or archetype\n", tl->
name);
100 if (
t->chance >= 100 &&
t->next_yes && (
t->next ||
t->next_no))
101 LOG(
llevError,
"Treasurelist %s has element that has 100%% generation, next_yes field as well as next or next_no\n", tl->
name);
102 if (
t->name && strcmp(
t->name,
"NONE"))
118 LOG(
llevInfo,
"Starting to collect assets from %s\n", datadir);
152 LOG(
llevInfo,
"Finished collecting assets from %s\n", datadir);
166 LOG(llevError,
"Fatal: %s is generator without content_on_gen but lacks other_arch.\n", arch->name);
171 LOG(llevError,
"Fatal: %s is generator with content_on_gen but lacks inventory.\n", arch->name);
188 if (arch->clone.other_arch->clone.move_type == 0) {
189 LOG(llevError,
"Summonable archetype %s [%s] has no move_type defined!\n", arch->clone.other_arch->name, arch->clone.other_arch->clone.name);
190 fatal(SEE_LAST_ERROR);
207 auto skill = manager->archetypes()->first([&arch] (const archetype *skill) {
208 return skill->clone.type == SKILL && arch->clone.skill == skill->clone.name;
245 check_treasurelist(list->items, list);
262 if (!strcmp(
name,
"none"))
370 assets->
each([writer,
buf] (T *asset) {
399 auto dot = strrchr(
name,
'.');
423 memset(&h, 0,
sizeof(h));
428 h.
mtime = time(NULL);
447 if (!fs->prefix || fs->allocated <= face->number || !fs->faces[face->number].datalen) {
452 add_to_tar(tar, fs->faces[face->number].data, fs->faces[face->number].datalen,
filename);
466 bool isTar = (
count > 1) || (strcmp(
split[0],
"images") == 0);
475 for (
size_t t = 0;
t <
count;
t++) {
477 const char *
name =
nullptr;
480 if (strcmp(
type,
"treasures") == 0) {
482 name =
"crossfire.trs";
483 }
else if (strcmp(
type,
"faces") == 0) {
486 name =
"crossfire.face";
487 }
else if (strcmp(
type,
"archs") == 0) {
489 name =
"crossfire.arc";
490 }
else if (strcmp(
type,
"messages") == 0) {
493 }
else if (strcmp(
type,
"facesets") == 0) {
496 }
else if (strcmp(
type,
"artifacts") == 0) {
499 }
else if (strcmp(
type,
"formulae") == 0) {
502 }
else if (strcmp(
type,
"quests") == 0) {
504 name =
"crossfire.quests";
505 }
else if (strcmp(
type,
"images") == 0) {
525 if (fwrite(
static_cast<void*
>(
data), 1, length,
out) != length) {
550 object *
op = &
arch->clone;
552 op->speed_left = op->speed_left - RANDOM() % 100 / 100.0;
553 op->speed = -op->speed;
588 while (isdigit(*
name)) {
589 mult = 10*mult+(*
name-
'0');
625 cp = strstr(
name,
" of ");
628 part1[cp-
name] =
'\0';
637 for (auto al = first_artifactlist; al != NULL; al = al->next) {
638 if (al->type == at->clone.type) {
639 for (auto art = al->items; art != NULL; art = art->next) {
640 if (!strcasecmp(art->item->name, part2)) {
641 value = at->clone.value * art->item->value;
656 cp = strstr(
name,
"'s ");
659 part1[cp-
name] =
'\0';
667 if (at->clone.randomitems != NULL) {
668 auto at2 = find_treasure_by_name(at->clone.randomitems->items, part2, 0);
670 value = at2->clone.value * isqrt(at->clone.level * 2);
692 LOG(
llevError,
"quest %s required but not found!\n", code);
void facesets_for_each(faceset_op op)
static void do_pack(AssetWriter< T > *writer, AssetsCollection< T > *assets, StringBuffer *buf)
recipelist * get_formulalist(int i)
StringBuffer * stringbuffer_new(void)
size_t assets_number_of_animations()
void * archetypes_tracker
int mtar_open(mtar_t *tar, const char *filename, const char *mode)
void quest_for_each(quest_op op, void *user)
size_t assets_dump_undefined()
void(* quest_op)(const quest_definition *, void *)
#define QUERY_FLAG(xyz, p)
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
void archetypes_for_each(arch_op op)
archetype * get_next_archetype(archetype *current)
#define FLAG_CONTENT_ON_GEN
const Face * findById(uint16_t id)
GeneralMessage * get_random_message()
AllAnimations * animations()
void animations_for_each(anim_op op)
face_sets * find_faceset(int id)
void(* face_op)(const Face *)
EXTERN artifactlist * first_artifactlist
std::pair< nonstd::string_view, nonstd::string_view > split(nonstd::string_view view, char Separator)
treasurelist * find_treasurelist(const char *name)
size_t visibleCount() const
size_t assets_number_of_archetypes()
static void check_generators(void)
void init_formulae(BufferReader *reader, const char *filename)
const Face * find_face(const char *name)
AssetsManager * getManager()
T * find(const Key &name)
void collect(const std::string &directory)
int get_bitmap_checksum()
GeneralMessage * random()
void(* faceset_op)(const face_sets *)
#define ASSETS_ARCHETYPES
int mtar_finalize(mtar_t *tar)
static void build_filename(const char *name, const char *prefix, char *dest, size_t max)
void fatal(enum fatal_error err)
size_t quests_count(bool includeSystem)
void check_summoned(void)
char * stringbuffer_finish(StringBuffer *sb)
face_sets * findById(int id)
static void pack_formulae(StringBuffer *buf)
const typedef char * sstring
void assets_finish_archetypes_for_play()
const char * hooks_filename[20]
void addLoader(AssetLoader *loader)
static void pack_images(mtar_t *tar)
void each(std::function< void(T *)> op)
const Face * get_face_by_id(uint16_t id)
int mtar_write_data(mtar_t *tar, const void *data, unsigned size)
quest_definition * quest_get_by_code(sstring code)
static void check_spells(void)
#define ASSETS_ATTACK_MESSAGES
const GeneralMessage * get_message_from_identifier(const char *identifier)
int mtar_write_header(mtar_t *tar, const mtar_header_t *h)
Archetypes * archetypes()
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Animations * try_find_animation(const char *name)
int mtar_close(mtar_t *tar)
long recipe_find_ingredient_cost(const char *name)
quest_definition * quest_find_by_code(sstring code)
static void add_to_tar(mtar_t *tar, void *data, size_t len, const char *filename)
void LOG(LogLevel logLevel, const char *format,...)
virtual void write(const T *asset, StringBuffer *buf)=0
size_t assets_number_of_treasurelists()
archetype * find_archetype(const char *name)
void init_attackmess(BufferReader *reader, const char *filename)
size_t stringbuffer_length(StringBuffer *sb)
Animations * find_animation(const char *name)
void(* anim_op)(const Animations *)
int strcasecmp(const char *s1, const char *s2)
void faces_for_each(face_op op)
archetype * try_find_archetype(const char *name)
const Face * try_find_face(const char *name, const Face *error)
void assets_pack(const char *what, const char *filename)
static void pack_artifacts(StringBuffer *buf)
void assets_collect(const char *datadir, int what)
virtual void write(const artifact *item, StringBuffer *buf)
void(* arch_op)(archetype *)
void stringbuffer_delete(StringBuffer *sb)
void check_formulae(void)
const char *const spell_mapping[SPELL_MAPPINGS]
static AssetsManager * manager
size_t assets_number_of_treasures()
static void check_treasurelist(treasure *t, const treasurelist *tl)