 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
55 object *owner, *tmp, *attacker, *tmp3;
124 object *tmp2 =
HEAD(tmp);
156 if (attacker != NULL) {
185 object *tmp2 =
HEAD(tmp);
193 assert(tmp3 == NULL);
230 for (cur = link; cur != NULL; cur = cur->
next) {
231 object *ob = cur->
ob;
256 for (cur =
list; cur != NULL; cur = cur->next) {
257 if (cur->ob->type !=
PLAYER
260 && (for_owner == NULL || for_owner == owner)
290 if (owner->
map == NULL) {
295 LOG(
llevError,
"Owner of the pet not on a map in memory!?\n");
307 "Your pet magically appears next to you");
342 for (i = 0; i < 15; i++) {
372 for (part = ob; part != NULL; part = part->
more) {
398 if (new_ob->
enemy == NULL)
404 "You stand in the way of someones pet.");
436 object *tmp = NULL, *prev = NULL, *head = NULL;
438 for (atmp = at; atmp != NULL; atmp = atmp->
more) {
487 if (head->randomitems) {
498 head->last_grace = 0;
500 head->other_arch = NULL;
563 for (tmp = op; tmp; tmp = tmp->
more) {
564 int16_t x = tmp->
x+
DIRX(op), y = tmp->
y+
DIRY(op);
590 if (victim != NULL && victim != op && victim->
head != op) {
595 if (victim->
race != NULL && op->
race != NULL && strstr(op->
race, victim->
race)) {
599 "%s avoids damaging %s.",
601 }
else if (victim == owner) {
605 "%s avoids damaging you.",
653 const object *god = NULL;
665 "You dismiss your existing golem.");
674 else if (spob->
race != NULL) {
679 "You must worship a god to cast %s.",
688 "%s has no %s for you to call.",
704 "There is something in the way.");
712 "Your spell fails.");
775 for (tmp2 = tmp; tmp2; tmp2 = tmp2->
more) {
776 if (tmp2->
name != NULL)
782 if (tmp->
race != NULL)
784 if (god->
race != NULL)
828 race = strtok(
buf,
",");
831 race = strtok(NULL,
",");
836 racenr =
rndm(0, racenr-1);
838 race = strtok(
buf,
",");
839 for (i = 0; i < racenr; i++)
840 race = strtok(NULL,
",");
848 "The spell fails! %s's creatures are beyond the range of your summons",
872 int pets_summon_object(
object *op,
object *caster,
object *spell_ob,
int dir,
const char *stringarg) {
873 int16_t x, y, nrof = 1, i;
888 if (level < tr->magic)
891 if (stringarg != NULL && !strcmp(tr->
item->
name, stringarg))
896 if (lasttr == NULL) {
900 "The spell fails to summon any monsters.");
903 summon_arch = lasttr->
item;
905 }
else if (spell_ob->
race != NULL && !strcmp(spell_ob->
race,
"GODCULTMON")) {
908 int summon_level, tries;
920 if (god->
race == NULL) {
923 "%s has no creatures that you may summon!",
929 if (summon_level == 0)
937 "%s fails to send anything.",
950 "There is something in the way.");
954 }
while (ndir == -1);
955 if (mon->
level > summon_level/2)
959 summon_arch = mon->
arch;
967 if (summon_arch == NULL) {
969 "There is no monsters available for summoning.");
979 "There is something in the way.");
984 mult = (
RANDOM()%2 ? -1 : 1);
986 for (i = 1; i <= nrof; i++) {
988 object *prev = NULL, *head = NULL, *tmp;
991 ndir =
absdir(dir+(i/2)*mult);
1001 for (atmp = summon_arch; atmp != NULL; atmp = atmp->
more) {
1003 if (atmp == summon_arch) {
1024 tmp->speed_left = -1;
1035 head->stats.exp = 0;
1037 if (head != NULL && head->randomitems) {
1060 object *realowner = ob;
1062 if (realowner == NULL)
1087 object *rowner, *towner;
1090 if (target == NULL || pet == NULL || owner == NULL)
1103 if (rowner == NULL) {
1110 if (towner == NULL && target->
type !=
PLAYER) {
1111 LOG(
llevError,
"Target is not a player but has no owner. We should not be here.\n");
1130 if (target->
type !=
PLAYER && rowner == towner)
int SP_level_range_adjust(const object *caster, const object *spob)
Adjust the range of the spell based on level.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
#define UP_OBJ_FACE
Only thing that changed was the face.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
Utility function to assign the correct skill when casting.
static object * choose_cult_monster(object *pl, const object *god, int summon_level)
Returns a monster (chosen at random) that this particular player (and his god) find acceptable.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
void remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
int16_t maxhp
Max hit points.
void pets_terminate_all(object *owner)
Removes all pets someone owns.
#define FLAG_STAND_STILL
NPC will not (ever) move.
#define FLAG_CONFUSED
Will also be unable to cast spells.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
void pets_control_golem(object *op, int dir)
Makes the golem go in specified direction.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
archetype * more
Next part of a linked object.
int monster_can_detect_enemy(object *op, object *enemy, rv_vector *rv)
Determine if we can 'detect' the enemy.
#define FLAG_GENERATOR
Will generate type ob->stats.food.
object * pets_get_enemy(object *pet, rv_vector *rv)
Given that 'pet' is a friendly object, this function returns a monster the pet should attack,...
uint32_t golem_count
To track the golem.
#define QUERY_FLAG(xyz, p)
objectlink * next
Next item to link to.
treasure * items
Items in this list, linked.
int get_random_dir(void)
Returns a random direction (1..8).
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
Check if the given object (usually a player) is standing on a battleground tile.
objectlink * get_friends_of(const object *owner)
Get a list of friendly objects for the specified owner.
@ pet_defend
Stay close to the owner.
struct archetype * arch
Pointer to archetype.
uint16_t attack_movement
What kind of attack movement.
int absdir(int d)
Computes an absolute direction.
float speed
Frequency of object 'moves' relative to server tick rate.
void object_set_enemy(object *op, object *enemy)
Sets the enemy of an object.
#define MSG_TYPE_SPELL_PET
Pet related messages.
int16_t invisible
How much longer the object will be invis.
float speed_left
How much speed is left to spend this round.
struct mapstruct * map
Pointer to the map in which this object is present.
int pets_summon_golem(object *op, object *caster, int dir, object *spob)
Summons a monster.
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects.
object * ob
Item to link to.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
static void mark_inventory_as_no_drop(object *ob)
Mark all inventory items as FLAG_NO_DROP.
object * races_get_random_monster(const char *race, int level)
Get a random monster of specified race and level at most the specified one.
int SP_level_duration_adjust(const object *caster, const object *spob)
Adjust the duration of the spell based on level.
int8_t direction
Means the object is moving that way.
tag_t count
Unique object number for this object.
@ llevMonster
Many many details.
object * enemy
Monster/player to follow even if not closest.
int rndm(int min, int max)
Returns a number between min and max.
@ range_golem
Control golem.
#define P_IS_ALIVE
Something alive is on this space.
#define MSG_TYPE_MISC
Messages that don't go elsewhere.
int16_t level
Level of creature or object.
@ GT_STARTEQUIP
Generated items have the FLAG_STARTEQUIP.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
const object * find_god(const char *name)
Returns a god's object from its name.
#define FLAG_ALIVE
Object can fight (or be fought)
int16_t y
Position in the map for this object.
static event_registration m
#define MAP_IN_MEMORY
Map is fully loaded.
object * monster_find_nearest_enemy(object *npc, object *owner)
Returns the nearest enemy (monster or generator) which is visible to npc.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
void object_update(object *op, int action)
object_update() updates the array which represents the map.
struct player * contr
Pointer to the player which control this object.
Used to link together several objects.
const char * determine_god(object *op)
Determines if op worships a god.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
int move_ob(object *op, int dir, object *originator)
Op is trying to move in direction dir.
#define MOVE_WALK
Object walks.
object * ranges[range_size]
Object for each range.
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.
int pets_should_arena_attack(object *pet, object *owner, object *target)
Determines if checks so pets don't attack players or other pets should be overruled by the arena petm...
#define HEAD(op)
Returns the head part of an object.
uint16_t nrof
Random 1 to nrof items are generated.
MoveType move_type
Type of movement this object uses.
void pets_move_golem(object *op)
Handles a golem's movement.
uint8_t type
PLAYER, BULLET, etc.
int16_t dam
How much damage this object does when hitting.
struct archetype * item
Which item this link can be.
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
int caster_level(const object *caster, const object *spell)
This function returns the effective level the spell is being cast at.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
void pets_attempt_follow(object *for_owner, int force)
Check pets so they try to follow their master around the world.
uint32_t tag_t
Object tag, unique during the whole game.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
rangetype shoottype
Which range-attack is being used by player.
#define FLAG_NO_DROP
Object can't be dropped.
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
This is basically the same as out_of_map above(), but instead we return NULL if no map is valid (coor...
#define MSG_TYPE_SPELL
Spell related info.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
sstring race
Human, goblin, dragon, etc.
int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
Returns true if the given object can't fit in the given spot.
#define FLAG_SPLITTING
Object splits into stats.food other objs.
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.
#define P_OUT_OF_MAP
This space is outside the map.
#define MAX_BUF
Used for all kinds of things.
int SP_level_wc_adjust(const object *caster, const object *spob)
Returns adjusted wc based on the caster and the spell.
object * head
Points to the main object of a large body.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
void monster_check_apply_all(object *monster)
Calls monster_check_apply() for all inventory objects.
@ pet_sad
Try to find enemies.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
int16_t maxgrace
Maximum grace.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
void get_search_arr(int *search_arr)
New function to make monster searching more efficient, and effective! This basically returns a random...
#define FLAG_REMOVED
Object is not in any map or invenory.
int monster_can_see_enemy(object *op, object *enemy)
Assuming no walls/barriers, lets check to see if its possible to see an enemy.
#define NDI_UNIQUE
Print immediately, don't buffer.
sstring slaying
Which race to do double damage to.
#define FLAG_FRIENDLY
Will help players.
sstring name
The name of the object, obviously...
int SP_level_dam_adjust(const object *caster, const object *spob)
Returns adjusted damage based on the caster.
int pets_summon_object(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
General purpose summoning function.
#define MSG_TYPE_SPELL_FAILURE
Spell failure messages.
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_.
static object * get_real_owner(object *ob)
Recursively look through the owner property of objects until the real owner is found.
int object_find_free_spot(const object *ob, mapstruct *m, int x, int y, int start, int stop)
object_find_free_spot(object, map, x, y, start, stop) will search for a spot at the given map and coo...
void pets_follow_owner(object *ob, object *owner)
A pet is trying to follow its owner.
uint32_t in_memory
Combination of IN_MEMORY_xxx flags.
tag_t attacked_by_count
The tag of attacker, so we can be sure.
sstring msg
If this is a book/sign/magic mouth/etc.
This is used by get_rangevector to determine where the other creature is.
object * monster_check_enemy(object *npc, rv_vector *rv)
Checks npc->enemy and returns that enemy if still valid, NULL otherwise.
int on_same_map(const object *op1, const object *op2)
Checks whether 2 objects are on the same map or not.
@ pet_arena
Attack other players in arena.
#define CLEAR_FLAG(xyz, p)
object * attacked_by
This object start to attack us! only player & monster.
int16_t duration
Number of moves (see 'speed') spell lasts.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
From map.c This is used by get_player to determine where the other creature is.
partylist * party
Party this player is part of.
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
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.
void free_objectlink(objectlink *ol)
Recursively frees all objectlinks.
void pets_move(object *ob)
Handles a pet's movement.
int freedir[SIZEOFFREE]
Direction we're pointing on this spot.
#define OB_TYPE_MOVE_BLOCK(ob1, type)
Basic macro to see if if ob1 can not move onto a space based on the 'type' move_block parameter Add c...
sstring name
More definite name, like "generate_kobold".
#define PETMOVE
If the upper four bits of attack_movement are set to this number, the monster follows a player until ...
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
object * more
Pointer to the rest of a large body of objects.
int attack_ob(object *op, object *hitter)
Simple wrapper for attack_ob_simple(), will use hitter's values.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
petmode_t petmode
Which petmode?
#define FLAG_CHANGING
Changes to other_arch when anim is done.
uint32_t attacktype
Bitmask of attacks this object does.
int direction
General direction to the targer.
#define FLAG_SLEEP
NPC is sleeping.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
static object * fix_summon_pet(archetype *at, object *op, int dir)
This makes multisquare/single square monsters proper for map insertion.
@ llevDebug
Only for debugging purposes.
archetype * determine_holy_arch(const object *god, const char *type)
Determines the archetype for holy servant and god avatar.