 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
24 : m_treasures(treasures), m_archetypes(
archetypes), m_tracker(tracker) {
54 if (sscanf(cp,
"arch %s",
variable)) {
60 }
else if (strncmp(cp,
"artifact ", 9) == 0) {
67 }
else if (sscanf(cp,
"list_magic_value %d", &value)) {
68 t->list_magic_value = (uint8_t)value;
69 }
else if (sscanf(cp,
"list_magic_adjustment %d", &value)) {
70 t->list_magic_adjustment = (int8_t)value;
71 }
else if (sscanf(cp,
"list %s",
variable)) {
77 }
else if (sscanf(cp,
"change_name %s",
variable))
79 else if (sscanf(cp,
"change_title %s",
variable))
81 else if (sscanf(cp,
"change_slaying %s",
variable))
83 else if (sscanf(cp,
"chance %d", &value))
84 t->chance = (uint8_t)value;
85 else if (sscanf(cp,
"nrof %d", &value))
86 t->nrof = (uint16_t)value;
87 else if (sscanf(cp,
"magic %d", &value))
88 t->magic = (uint8_t)value;
89 else if (!strcmp(cp,
"yes"))
91 else if (!strcmp(cp,
"no"))
93 else if (!strcmp(cp,
"end"))
95 else if (!strcmp(cp,
"more")) {
116 if (*
buf ==
'#' || *
buf ==
'\0')
119 if (sscanf(
buf,
"treasureone %s",
name) || sscanf(
buf,
"treasure %s",
name)) {
128 if (!strncmp(
buf,
"treasureone", 11)) {
129 for (
t = tl->
items;
t != NULL;
t =
t->next) {
130 if (
t->next_yes ||
t->next_no) {
131 LOG(
llevError,
"Treasure %s is one item, but on treasure %s\n", tl->
name,
t->item ?
t->item->name :
t->name);
132 LOG(
llevError,
" the next_yes or next_no field is set\n");
All archetypes in the game.
size_t bufferreader_current_line(BufferReader *br)
Return the index of the last line returned by bufferreader_next_line().
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
treasure * items
Items in this list, linked.
int16_t total_chance
If non-zero, only 1 item on this list should be generated.
TreasureLoader(Treasures *treasures, Archetypes *archetypes, AssetsTracker *tracker)
other than new code I created new archetypes
treasure * get_empty_treasure(void)
Allocate and return the pointer to an empty treasure structure.
Plugin animator file specs[Config] name
Base class to be informed of where an asset is defined.
treasure * loadTreasure(BufferReader *reader, const std::string &filename)
Reads one treasure, including the 'yes', 'no' and 'more' options.
AssetsTracker * m_tracker
T * define(const Key &name, T *asset)
Define an asset, erasing an existing one.
size_t nroftreasures
Number of treasure items, for malloc info.
treasurelist represents one logical group of items to be generated together.
sstring add_string(const char *str)
This will add 'str' to the hash table.
sstring name
Usually monster-name/combination.
Archetypes * m_archetypes
virtual void assetDefined(const archetype *asset, const std::string &filename)
Function called when an asset is defined in a file.
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn t
T * get(const Key &name)
Get a named asset.
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
#define MAX_BUF
Used for all kinds of things.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
treasure is one element in a linked list, which together consist of a complete treasure-list.
virtual void load(BufferReader *reader, const std::string &filename) override
Load all treasures from a buffer.
*envar *is the environment variable
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.