 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
77 for (
auto allowed : at->
allowed)
105 for (; al != NULL; al = nextal) {
107 for (
auto art : al->
items) {
123 #define ARTIFACT_TRIES 2
137 if (!
list ||
list->total_chance == 0) {
141 int chance_of_invalid_item = 0;
142 for (
auto check :
list->items) {
144 chance_of_invalid_item += check->chance;
162 (*numerator) = art->
chance * (
list->total_chance + chance_of_invalid_item);
163 (*denominator) =
list->total_chance *
list->total_chance;
191 for (
auto r : al->
items) {
199 if (art == NULL || roll >= 0) {
200 LOG(
llevError,
"Got null entry and non zero roll in generate_artifact, type %d\n", op->
type);
203 if (!strcmp(art->
item->
name,
"NONE"))
209 if (difficulty < art->difficulty)
213 #ifdef TREASURE_VERBOSE
233 snprintf(new_name,
sizeof(new_name),
"of %s",
artifact->name);
253 int neg, success = 0;
258 for (
auto tmp : art->
allowed) {
259 #ifdef TREASURE_VERBOSE
292 const char* dot =
name + strlen(
name) - 1;
293 while (dot >
name && (isdigit(*dot) || (*dot ==
'x')))
302 snprintf(
buf + strlen(
buf), size - strlen(
buf),
"_%s%s", suffix, dot);
306 snprintf(
buf, size,
"%s_%s",
name, suffix);
311 #define KEY_FACE_SUFFIX "face_suffix"
312 #define KEY_ANIMATION_SUFFIX "animation_suffix"
326 #ifdef TREASURE_VERBOSE
417 if (change->
nrof != 0 && change->
nrof != 1) {
418 LOG(
llevDebug,
"archetype %s has nrof set to %d, which will be ignored\n",
477 if (change->
level < 0)
600 for (
const auto at :
list->items) {
620 for (
const auto art : al->
items) {
621 fprintf(
logfile,
"Artifact %-30s Difficulty %3d Chance %5d\n", art->item->name, art->difficulty, art->chance);
622 if (!art->allowed.empty()) {
623 fprintf(
logfile,
"\tAllowed combinations:");
624 for (
auto allowed : art->allowed)
625 fprintf(
logfile,
"%s,", allowed);
648 bool allowed = std::none_of(art->
allowed.cbegin(), art->
allowed.cend(),
649 [&] (
const auto name) { return strcmp(arch->name, name + 1) == 0; });
650 if (allowed && arch->
clone.
face != NULL) {
668 while (arch != NULL) {
sstring name
Face name, as used by archetypes and such.
sstring name_pl
The plural name of the object.
New face structure - this enforces the notion that data is face by face only - you can not change the...
static void compute_face_name(char *buf, size_t size, const char *name, const char *suffix)
Compute the name of a face with a suffix, taking into account names like '.123' or '....
void set_abs_magic(object *op, int magic)
Sets magical bonus in an object, and recalculates the effect on the armour variable,...
int16_t maxhp
Max hit points.
#define FLAG_STAND_STILL
NPC will not (ever) move.
#define FLAG_CONFUSED
Will also be unable to cast spells.
const artifact * find_artifact(const object *op, const char *name)
Searches and returns a specific artifact compatible with an object, NULL if not found.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
#define FLAG_CLIENT_ANIM_RANDOM
Client animate this, randomized.
uint32_t path_attuned
Paths the object is attuned to.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
object * inv
Pointer to the first object in the inventory.
#define QUERY_FLAG(xyz, p)
#define FLAG_REFL_MISSILE
Arrows will reflect from object.
archetype * get_next_archetype(archetype *current)
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
int8_t item_power
Power rating of the object.
struct archetype * arch
Pointer to archetype.
float speed
Frequency of object 'moves' relative to server tick rate.
std::vector< artifact * > items
Artifacts for this type.
void give_artifact_abilities(object *op, const object *artifact)
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-...
Each object (this also means archetypes!) could have a few of these "dangling" from it; this could al...
static void free_artifact(artifact *at)
Totally frees an artifact, its next items, and such.
artifactlist * get_empty_artifactlist(void)
Allocate and return the pointer to an empty artifactlist structure.
object * item
Special values of the artifact.
void add_abilities(object *op, const object *change)
Apply artifact properties to an object.
archetype * head
The main part of a linked object.
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
artifactlist * next
Next list of artifacts.
std::vector< sstring > allowed
List of archetypes the artifact can affect.
const Face * blank_face
Following can just as easily be pointers, but it is easier to keep them like this.
key_value * key_values
Fields not explictly known by the loader.
sstring title
Of foo, etc.
const char * object_get_value(const object *op, const char *const key)
Get an extra value by key.
int16_t level
Level of creature or object.
#define FLAG_STEALTH
Will wake monsters with less range.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
Plugin animator file specs[Config] name
#define FLAG_ALIVE
Object can fight (or be fought)
uint32_t path_denied
Paths the object is denied access to.
const char * value
Key's value.
uint32_t path_repelled
Paths the object is repelled from.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
sstring add_refcount(sstring str)
This will increase the refcount of the string str.
key_value * next
Next key in the list.
uint8_t anim_speed
Ticks between animation-frames.
uint16_t number
This is the image unique identifier.
void free_all_artifacts(void)
Free all artifact-related information.
object clone
An object from which to do object_copy()
sstring add_string(const char *str)
This will add 'str' to the hash table.
sstring name
Usually monster-name/combination.
MoveType move_type
Type of movement this object uses.
#define FLAG_BLIND
If set, object cannot see (visually)
const Face * face
Face with colors.
sstring find_string(const char *str)
Searches a string in the shared strings.
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
int32_t value
How much money it is worth (or contains)
int is_identified(const object *op)
Return true if the item is identified, either because it is of a type that doesn't ever need identifi...
void object_update_speed(object *op)
Updates the speed of an object.
uint8_t type
PLAYER, BULLET, etc.
#define FLAG_DAMNED
The object is very cursed.
int16_t dam
How much damage this object does when hitting.
int8_t magic
Any magical bonuses to this item.
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn t
sstring materialname
Specific material name.
This represents all archetypes for one particular object type.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
int32_t food
How much food in stomach.
#define KEY_ANIMATION_SUFFIX
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
#define FLAG_NO_SAVE
If set (through plugins), the object is not saved on maps.
FILE * logfile
Used by server/daemon.c.
sstring race
Human, goblin, dragon, etc.
const Animations * animation
Animation of this item, NULL if not animated.
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn though Notes on Specific and settings file datadir Usually usr share crossfire Contains data that the server does not need to modify while such as the etc A default install will pack the artifact
void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator)
Compute the chance for a specified item to become the specified artifact.
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
static void free_artifactlist(artifactlist *al)
Free specified list and its items.
#define MAX_BUF
Used for all kinds of things.
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
int32_t weight
Attributes of the object.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
Animations * try_find_animation(const char *name)
int16_t maxgrace
Maximum grace.
const char * key
Name of the key.
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
sstring slaying
Which race to do double damage to.
archetype * find_archetype_by_object_name(const char *name)
This function retrieves an archetype given the name that appears during the game (for example,...
sstring name
The name of the object, obviously...
sstring artifact
If set, the item is the artifact with this name and the matching type.
uint16_t chance
Chance of the artifact to happen.
int16_t maxsp
Max spell points.
void change_attr_value(living *stats, int attr, int8_t value)
Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat.
int32_t last_sp
As last_heal, but for spell points.
const typedef char * sstring
This represents one animation.
int8_t gen_sp_armour
Sp regen penalty this object has (was last_heal)
#define ARTIFACT_TRIES
Give 1 re-roll attempt per artifact.
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
uint16_t artifact_get_face(const artifact *art)
Get a suitable face number for representing an artifact.
#define FLAG_REFLECTING
Object reflects from walls (lightning)
sstring msg
If this is a book/sign/magic mouth/etc.
void object_free_key_values(object *op)
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links.
uint16_t total_chance
Sum of chance for are artifacts on this list.
#define CLEAR_FLAG(xyz, p)
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
void object_give_identified_properties(object *op)
Ensure op has all its "identified" properties set.
artifactlist * first_artifactlist
First artifact.
#define FLAG_ANIMATE
The object looks at archetype for faces.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
archetype * try_find_archetype(const char *name)
const Face * try_find_face(const char *name, const Face *error)
sstring name
More definite name, like "generate_kobold".
uint32_t nrof
Number of objects.
#define FLAG_XRAYS
X-ray vision.
living stats
Str, Con, Dex, etc.
How to Install a Crossfire Server on you must install a python script engine on your computer Python is the default script engine of Crossfire You can find the python engine you have only to install them The VisualC Crossfire settings are for but you habe then to change the pathes in the VC settings Go in Settings C and Settings Link and change the optional include and libs path to the new python installation path o except the maps ! You must download a map package and install them the share folder Its must look like doubleclick on crossfire32 dsw There are projects in your libcross lib and plugin_python You need to compile all Easiest way is to select the plugin_python ReleaseLog as active this will compile all others too Then in Visual C press< F7 > to compile If you don t have an appropriate compiler you can try to get the the VC copies the crossfire32 exe in the crossfire folder and the plugin_python dll in the crossfire share plugins folder we will remove it when we get time for it o Last showing lots of weird write to the Crossfire mailing list
This is one artifact, ie one special item.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
void dump_artifacts(void)
For debugging purposes.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_CURSED
The object is cursed.
artifact * get_empty_artifact(void)
Allocate and return the pointer to an empty artifact structure.
void generate_artifact(object *op, int difficulty)
Decides randomly which artifact the object should be turned into.
artifactlist * find_artifactlist(int type)
Finds the artifact list for a certain item type.
uint16_t material
What materials this object consist of.
@ NUM_STATS
Number of statistics.
object * next
Pointer to the next object in the free/used list.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
uint8_t type
Object type that this list represents.
int8_t luck
Affects thaco and ac from time to time.
sstring name
Name of the animation sequence.
@ llevDebug
Only for debugging purposes.
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
#define FLAG_IDENTIFIED
Player knows full info about item.
in that case they will be relative to whatever the PWD of the crossfire server process is You probably shouldn though Notes on Specific and settings file datadir Usually usr share crossfire Contains data that the server does not need to modify while such as the etc A default install will pack the and treasurelist definitions into a single or trs file and the graphics into a face(metadata) and .tar(bitmaps) file
int legal_artifact_combination(const object *op, const artifact *art)
Checks if op can be combined with art.