 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
53 #define num_resist_table 19
107 if (
t->change_arch.name) {
113 if (
t->change_arch.title) {
119 if (
t->change_arch.slaying) {
140 if (
t->item && (
t->item->clone.invisible != 0 || !(flag&
GT_INVISIBLE))) {
142 if (
t->nrof && tmp->
nrof <= 1)
176 if ((
int)
t->chance >= 100 || (
RANDOM()%100+1) <
t->chance) {
178 if (strcmp(
t->name,
"NONE") && difficulty >=
t->magic)
183 if (
t->next_yes != NULL)
186 if (
t->next_no != NULL)
215 LOG(
llevDebug,
"create_one_treasure: tries exceeded 100, returning without making treasure\n");
219 for (
t = tl->
items;
t != NULL;
t =
t->next) {
225 if (!
t || value >= 0) {
226 LOG(
llevError,
"create_one_treasure: got null object or not able to find treasure\n");
230 if (!strcmp(
t->name,
"NONE"))
232 if (difficulty >=
t->magic)
265 LOG(
llevDebug,
"createtreasure: tries exceeded 100, returning without making treasure\n");
305 LOG(
llevError,
"In generate treasure, created multiple objects.\n");
324 int level, mult, olevel;
346 olevel =
rndm(0, difficulty)+
rndm(0, difficulty);
352 else if (olevel <
level)
418 { 70, 2, 7, 11, 10 },
419 { 70, 2, 7, 11, 10 },
420 { 70, 2, 7, 11, 10 },
421 { 70, 2, 7, 11, 10 },
422 { 70, 2, 7, 11, 10 },
423 { 70, 2, 5, 12, 11 },
424 { 70, 2, 5, 12, 11 },
425 { 70, 2, 5, 12, 11 },
426 { 70, 2, 5, 12, 11 },
427 { 70, 2, 5, 12, 11 },
428 { 70, 2, 3, 13, 12 },
429 { 70, 2, 3, 13, 12 },
430 { 70, 2, 3, 13, 12 },
431 { 70, 2, 3, 13, 12 },
432 { 70, 2, 3, 13, 12 },
433 { 70, 2, 3, 12, 13 },
434 { 70, 2, 3, 12, 13 },
435 { 70, 2, 3, 12, 13 },
436 { 70, 2, 3, 12, 13 },
437 { 70, 2, 3, 12, 13 },
438 { 70, 2, 3, 11, 14 },
439 { 70, 2, 3, 11, 14 },
440 { 70, 2, 3, 11, 14 },
441 { 70, 2, 3, 11, 14 },
442 { 70, 2, 3, 11, 14 },
443 { 70, 2, 3, 10, 15 },
444 { 70, 2, 3, 10, 15 },
445 { 70, 2, 3, 10, 15 },
446 { 70, 2, 3, 10, 15 },
447 { 70, 2, 3, 10, 15 },
590 for (loop = 0; loop < (
MAXMAGIC+1); ++loop) {
596 LOG(
llevError,
"Warning, table for difficulty %d bad.\n", difficulty);
600 return (
RANDOM()%3) ? loop : -loop;
619 int32_t base_weight, base_speed;
642 if (magic < 0 && !(
RANDOM()%3))
845 for (i = 0; i < difficulty; i++)
861 #define DICE2 (dice2())
872 return chance(2, 27) ? 2 : 1;
875 #define DICESPELL (RANDOM()%3+RANDOM()%3+RANDOM()%3+RANDOM()%3+RANDOM()%3)
904 int was_magic = op->
magic, num_enchantments = 0, save_item_power;
906 if (!creator || creator->
type == op->
type)
916 LOG(
llevDebug,
"fix_generated_item: Unable to generate treasure for %s\n", op->
name);
925 set_magic(difficulty > 25 ? 30 : difficulty+5, op, max_magic,
flags);
929 if (!op->
magic && max_magic)
934 || difficulty >= 999)
953 }
else if (save_item_power) {
990 }
else if (!op->
title) {
1010 int too_many_tries = 0, is_special = 0;
1023 if (too_many_tries++ > 10)
1047 if (op->
arch == NULL) {
1095 if (op->
msg != NULL)
1119 if (
rndm(1, 6) <= 1)
1123 }
else if (
rndm(1, 100) <= 1) {
1164 if (
rndm(1, 6) <= 1)
1168 }
else if (
rndm(1, 100) <= 2) {
1207 if (
t->name != NULL) {
1208 for (i = 0; i < depth; i++)
1210 fprintf(
logfile,
"{ (list: %s)\n",
t->name);
1213 for (i = 0; i < depth; i++)
1215 fprintf(
logfile,
"} (end of list: %s)\n",
t->name);
1217 for (i = 0; i < depth; i++)
1219 if (
t->item->clone.type ==
FLESH)
1220 fprintf(
logfile,
"%s's %s\n",
name,
t->item->clone.name);
1222 fprintf(
logfile,
"%s\n",
t->item->clone.name);
1224 if (
t->next_yes != NULL) {
1225 for (i = 0; i < depth; i++)
1227 fprintf(
logfile,
" (if yes)\n");
1230 if (
t->next_no != NULL) {
1231 for (i = 0; i < depth; i++)
1233 fprintf(
logfile,
" (if no)\n");
1250 if (!
strcasecmp(at->clone.name,
name) && at->clone.title == NULL) {
1251 fprintf(logfile,
"treasures for %s (arch: %s)\n", at->clone.name, at->name);
1252 if (at->clone.randomitems != NULL)
1253 dump_monster_treasure_rec(at->clone.name, at->clone.randomitems->items, 1);
1255 fprintf(logfile,
"(nothing)\n");
1256 fprintf(logfile,
"\n");
1262 fprintf(
logfile,
"No objects have the name %s!\n\n",
name);
1278 snprintf(tmpbuf,
sizeof(tmpbuf),
"%s's %s", donor->
name, item->
name);
1280 snprintf(tmpbuf,
sizeof(tmpbuf),
"%s's %s", donor->
name, item->
name_pl);
1300 LOG(
llevError,
"could not find original archetype %s for custom monster!\n", donor->
arch->
name);
1307 if ((item->
weight = (
signed long)(((
double)item->
weight/(
double)100.0)*(
double)donor->
weight)) == 0)
1332 if (item->
face != NULL) {
1333 snprintf(tmpbuf,
sizeof(tmpbuf),
"%s_%s", donor->
arch->
name, item->
face->
name);
1424 if (
list->items == NULL || position <= 0) {
1426 list->items = added;
1431 while (position > 0 && prev->
next) {
1446 if (
list->items == 0 || position < 0) {
1449 if (position == 0) {
1451 list->items->next = NULL;
1458 while (prev && position > 0) {
sstring name
Face name, as used by archetypes and such.
sstring name_pl
The plural name of the object.
static void set_magic(int difficulty, object *op, int max_magic, int flags)
Sets a random magical bonus in the given object based upon the given difficulty, and the given max po...
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
struct Settings settings
Server settings.
void set_abs_magic(object *op, int magic)
Sets magical bonus in an object, and recalculates the effect on the armour variable,...
uint8_t range_modifier
How going up in level affects range
static void dump_monster_treasure_rec(const char *name, treasure *t, int depth)
For debugging purposes.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
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()...
uint16_t difficulty
What level the player should be to play here.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
uint8_t armor_speed_linear
If 1, speed improvement is linear, else exponantiel.
@ FLESH
animal 'body parts' -b.t.
object * inv
Pointer to the first object in the inventory.
#define FLAG_STARTEQUIP
Object was given to player at start.
#define num_resist_table
Number of items in resist_table.
#define QUERY_FLAG(xyz, p)
#define FLAG_REFL_MISSILE
Arrows will reflect from object.
treasure * items
Items in this list, linked.
static int level_for_item(const object *op, int difficulty)
Calculate the appropriate level for wands staves and scrolls.
int8_t item_power
Power rating of the object.
struct archetype * arch
Pointer to archetype.
int16_t total_chance
If non-zero, only 1 item on this list should be generated.
#define FLAG_OBJ_ORIGINAL
NEVER SET THIS.
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-...
struct mapstruct * map
Pointer to the map in which this object is present.
treasurelist * find_treasurelist(const char *name)
Search for the given treasurelist by name.
object * generate_treasure(treasurelist *t, int difficulty)
Generate a treasure from a list generating a single item.
@ GT_ONLY_GOOD
Don't generate bad/cursed items.
object * item
Special values of the artifact.
#define SET_ANIMATION(ob, newanim)
void fix_generated_item(object *op, object *creator, int difficulty, int max_magic, int flags)
fix_generated_item(): This is called after an item is generated, in order to set it up right.
int get_power_from_ench(int ench)
static const flag_definition flags[]
Flag mapping.
#define MAXMAGIC
Maximum magic for difficulty/magic mapping.
void set_materialname(object *op)
Set the material name and type for an item, if not set.
#define MAX_SPELLITEM_LEVEL
Highest level of rods/staves/scrolls to generate.
#define FLAG_BLESSED
Item has a blessing, opposite of cursed/damned.
treasure * get_empty_treasure(void)
Allocate and return the pointer to an empty treasure structure.
void rod_adjust(object *rod)
Adjusts rod attributes.
#define ARMOUR_SPEED(xyz)
static int special_potion(object *op)
Check if object is a special potion.
static void create_all_treasures(treasure *t, object *op, int flag, int difficulty, int tries)
Creates all the treasures.
int rndm(int min, int max)
Returns a number between min and max.
sstring title
Of foo, etc.
int16_t level
Level of creature or object.
@ GT_STARTEQUIP
Generated items have the FLAG_STARTEQUIP.
AssetsManager * getManager()
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
static void put_treasure(object *op, object *creator, int flags)
Inserts generated treasure where it should go.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
#define FLAG_NO_PICK
Object can't be picked up.
Plugin animator file specs[Config] name
static void change_treasure(treasure *t, object *op)
if there are change_xxx commands in the treasure, we include the changes in the generated object
#define FLAG_ALIVE
Object can fight (or be fought)
int16_t y
Position in the map for this object.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
static int magic_from_difficulty(int difficulty)
This is used when determining the magical bonus created on specific maps.
static void trap_adjust(object *trap, int difficulty)
Adjust trap difficulty to the map.
void init_archetype_pointers(void)
Initialize global archtype pointers:
static archetype * amulet_arch
treasurelist represents one logical group of items to be generated together.
object clone
An object from which to do object_copy()
sstring add_string(const char *str)
This will add 'str' to the hash table.
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW).
const Face * face
Face with colors.
void treasure_free(treasure *t)
Frees a treasure, including its yes, no and next items.
void tailor_readable_ob(object *book, int msg_type)
The main routine.
int32_t value
How much money it is worth (or contains)
int armor_weight_reduction
Weight reduction per enchantment.
int isqrt(int n)
Compute the square root.
#define FREE_AND_COPY(sv, nv)
Release the shared string if not NULL, and make it a reference to nv.
uint8_t type
PLAYER, BULLET, etc.
#define INS_NO_MERGE
Don't try to merge with other items.
#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
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
int32_t food
How much food in stomach.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
static int resist_table[]
Resistances which can show up on rings and amulets.
FILE * logfile
Used by server/daemon.c.
void each(std::function< void(T *)> op)
Apply a function to each asset.
#define FLAG_NO_STEAL
Item can't be stolen.
static void set_ring_bonus(object *op, int bonus)
Randomly adds one magical ability to the given object.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
treasure * next
Next treasure-item in a linked list.
#define FLAG_MONSTER
Will attack players.
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
Archetypes * archetypes()
Get archetypes.
#define MAX_BUF
Used for all kinds of things.
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 d
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
void treasure_remove_item(treasurelist *list, int position)
Remove the treasure at the specified position from the list.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
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.
static const int difftomagic_list[DIFFLEVELS][MAXMAGIC+1]
Based upon the specified difficulty and upon the difftomagic_list array, a random magical bonus is re...
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
uint8_t dam_modifier
How going up in level affects damage.
sstring slaying
Which race to do double damage to.
uint8_t duration_modifier
how level modifies duration
sstring name
The name of the object, obviously...
archetype * find_archetype(const char *name)
sstring msg
If this is a book/sign/magic mouth/etc.
const char *const spell_mapping[SPELL_MAPPINGS]
This table is only necessary to convert objects that existed before the spell object conversion to th...
int reference_count
How many times this temporary archetype is used.
#define CHANCE_FOR_ARTIFACT
Chance an item becomes an artifact if not magic is 1 in this value.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
static void fix_flesh_item(object *item, const object *donor)
Objects of type FLESH are similar to type FOOD, except they inherit properties (name,...
#define NUM_ANIMATIONS(ob)
treasure * treasure_insert(treasurelist *list, int position)
Insert a new treasure in the treasure list, at a specific position in the children list.
void dump_monster_treasure(const char *name)
For debugging purposes.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
#define DIFFLEVELS
Maximum difficulty for difficulty/magic mapping.
uint8_t armor_weight_linear
If 1, weight reduction is linear, else exponantiel.
int strcasecmp(const char *s1, const char *s2)
struct treasurelist * randomitems
Items to be generated.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
Magical Runes Runes are magical inscriptions on the dungeon which cast a spell or detonate when something steps on them Flying objects don t detonate runes Beware ! Runes are invisible most of the time They are only visible occasionally ! There are several runes which are there are some special runes which may only be called with the invoke and people may apply it to read it Maybe useful for mazes ! This rune will not nor is it ordinarily invisible Partial Visibility of they ll be visible only part of the time They have a(your level/2) chance of being visible in any given round
const Face * try_find_face(const char *name, const Face *error)
static archetype * crown_arch
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
sstring name
More definite name, like "generate_kobold".
uint32_t nrof
Number of objects.
bool chance(int a, int b)
Return true with a probability of a/b.
living stats
Str, Con, Dex, etc.
treasure is one element in a linked list, which together consist of a complete treasure-list.
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
static void do_single_item(treasure *t, object *op, int flag, int difficulty)
Creates the item for a treasure.
This is one artifact, ie one special item.
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
int calc_item_power(const object *op)
This takes an object 'op' and figures out what its item_power rating should be.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various what they and how they effect the player s actions Also in this section are the stat modifiers that specific classes professions bring Player and sps the current and maximum the Current and Maximum The Current Sp can go somewhat negative When Sp is negative not all spells can be and a more negative Sp makes spell casting less likey to succeed can affect Damage and how the characters as well as how often the character can attack this affects the prices when buying and selling items if this drops the player will start losing hit points wd Cleric or Dwarf sm Elf wd Fireborn ft Human ra Mage C Monk se Ninja hi Priest C Quetzalcoatl mw Swashbuckler si Thief st Viking ba Warrior or Wizard C Wraith C Class Prof Str Dex Con Wis Cha Int Pow Net Skills Enclosed are codes used for the skills above The ones in and fighting should all be pretty self explanatory For the other a brief description is for a more detailed look at the skills doc file Skill remove use magic items phys no fire cold Fireborns are supposed to be fire spirits They re closely in tune with magic and are powerful and learn magic easily Being fire they are immune to fire and and vulnerable to cold They are vulnerable to ghosthit and drain because being mostly non anything which strikes directly at the spirit hits them harder race attacktype restrictions immunities prot vuln Quetzalcoatl physical no armour fire cold Quetzalcoatl s are now born knowing the spell of burning but because of their negative wisdom bonus
static archetype * ring_arch
Arches for rings, amulets and crowns.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_CURSED
The object is cursed.
#define ATNR_LIFE_STEALING
void generate_artifact(object *op, int difficulty)
Decides randomly which artifact the object should be turned into.
static void create_one_treasure(treasurelist *tl, object *op, int flag, int difficulty, int tries)
Creates one treasure from the list.
#define FLAG_IS_THROWN
Object is designed to be thrown.
int armor_speed_improvement
Speed improvement.
@ GT_MINIMAL
Do minimal adjustments, don't make artifacts, and so on.
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
@ llevDebug
Only for debugging purposes.
int legal_artifact_combination(const object *op, const artifact *art)
Checks if op can be combined with art.