 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
69 int arch_flag, name_flag, race_flag;
99 && (!(victim->
name && name_flag) || strcmp(op->
race, victim->
name))
100 && (!(victim->
race && race_flag) || strcmp(op->
race, victim->
race)))
155 if (newface && op->
face != newface) {
175 const Face *newface = NULL;
176 object *head = op->
head ? op->
head : op;
192 if (newface && op->
face != newface) {
230 LOG(
llevError,
"apply_container: '%s' tried to apply %s, which is not a container\n", op->
name, sack ? sack->
name :
"(null)");
241 if ( sack->
env != op ) {
243 "Not in your inventory: %s",
252 if (op->
contr != NULL)
269 "Already readied %s.",
281 "Already opened %s.",
303 "Already closed %s.",
342 if (op->
contr != NULL)
368 "You unlock %s with %s.",
369 name_sack, name_tmp);
373 "You don't have the key to unlock %s.",
391 if (sack->
env != op) {
404 if (sack->
nrof > 1) {
414 object *part = sack->
head ? sack->
head : sack;
427 if (op->
contr != NULL)
443 if (op->
contr != NULL)
488 LOG(
llevError,
"BUG: do_learn_spell(): not a player\n");
496 LOG(
llevError,
"BUG: do_learn_spell(): spell already known, but not marked as startequip\n");
511 "Type 'bind cast %s to store the spell in a key.",
529 LOG(
llevError,
"BUG: do_forget_spell(): not a player\n");
534 LOG(
llevError,
"BUG: do_forget_spell(): spell not known\n");
539 "You lose knowledge of %s.",
568 snprintf(
buf,
sizeof(
buf),
":%s:", who->
race);
569 buf[
sizeof(
buf)-1] =
'\0';
571 if (strstr(restriction,
buf) != NULL)
603 "You should pay for it first.");
644 "But you are floating high above the ground!");
657 "The object disappears in a puff of smoke!");
659 "It must have been an illusion.");
672 "I don't know how to apply the %s.",
676 "You must get it first!\n");
772 LOG(
llevError,
"BUG: unapply_special(): applied skill is not a chosen skill\n");
779 "You stop using the %s.",
784 "You can no longer use the skill: %s.",
917 object *tmp = NULL, *last;
937 "No matter how hard you try, you just can't remove %s.",
985 "The %s just won't come off",
1018 object *tmp = NULL, *ws = NULL;
1074 else if (tmp != tmp1)
1132 return (who->
level/5)+5 >= improves;
1162 LOG(
llevError,
"apply_special() from object without environment.\n");
1180 "No matter how hard you try, you just can't remove %s.",
1199 "You need the %s skill to use this item!",
1231 "That weapon is too powerful for you to use. It would consume your soul!");
1283 LOG(
llevError,
"BUG: apply_special(): can't apply two skills\n");
1298 "That weapon is too powerful for you to use. It would consume your soul!");
1328 "You will now fire %s with %s.",
1351 "You ready your %s.",
1381 "Oops, it feels deadly cold!");
1469 while (invtmp->stats.hp-- > 0)
1471 invtmp->randomitems = NULL;
1472 }
else if (invtmp && invtmp->arch
1474 && invtmp->type !=
SPELL
1475 && invtmp->type !=
CLASS
1481 invtmp->randomitems = NULL;
1539 while (tmp->stats.hp-- > 0)
1541 tmp->randomitems = NULL;
1543 object *head =
HEAD(tmp);
1562 && tmp->type !=
SPELL
1564 && tmp->type !=
CLASS
1567 tmp->randomitems = NULL;
1598 if (abs(failure/4) > power)
1599 power = abs(failure/4);
1601 if (failure <= -1 && failure > -15) {
1605 "Your spell warps!");
1616 if (failure <= -35 && failure > -60) {
1618 "The magic recoils on you!");
1623 if (failure <= -60 && failure > -70) {
1625 "The magic recoils and paralyzes you!");
1630 if (failure <= -70 && failure > -80) {
1632 "The magic recoils on you!");
1637 if (failure <= -80) {
1643 "You unleash uncontrolled mana!");
1651 "Your mana is drained!");
1670 int excess_stat = 0;
1688 if (stat > 20+race_bonus) {
1690 stat = 20+race_bonus;
1691 }
else if (stat < 1) {
1699 excess_stat += stat;
1709 if (excess_stat < 0) excess_stat = 0;
1715 for (j = 0; excess_stat > 0 && j < 100; j++) {
1725 if (stat < 20+race_bonus) {
1765 if ((!has_noclassfacechange) && anim == 0) {
1811 "You don't have the body to use a %s",
1823 "You have a prohibition against using a %s",
1838 "You need to unapply some item(s):");
1873 "Equipping that combined with other items would consume your soul!");
1898 int damage_percentile;
1905 if (owner == NULL || strcmp(owner, who->
name) == 0)
1909 item_will = will != NULL ? atol(will) : 0;
1912 "This %s refuses to serve you - it keeps evading your hand !",
1918 random_effect =
random_roll(0, 100, who, 1)-margin*20;
1919 if (random_effect > 80) {
1920 msg =
"You don't know why, but you have the feeling that the %s is angry at you !";
1921 damage_percentile = 60;
1922 }
else if (random_effect > 60) {
1923 msg =
"The %s seems to look at you nastily !";
1924 damage_percentile = 45;
1925 }
else if (random_effect > 40) {
1926 msg =
"You have the strange feeling that the %s is annoyed...";
1927 damage_percentile = 30;
1928 }
else if (random_effect > 20) {
1929 msg =
"The %s seems tired, or bored, in a way. Very strange !";
1930 damage_percentile = 15;
1931 }
else if (random_effect > 0) {
1932 msg =
"You hear the %s sighing !";
1933 damage_percentile = 0;
1936 damage_percentile = 0;
1941 if (damage_percentile > 0) {
1942 int weapon_bite = (who->
stats.
hp*damage_percentile)/100;
1943 if (weapon_bite < 1)
1947 "You get a nasty bite in the hand !");
1968 const char *quotepos;
1973 quotepos = strstr(op->
name,
"'");
1974 if (quotepos == NULL || strncmp(op->
name, who->
name, quotepos-op->
name) == 0)
1979 "The weapon does not recognize you as its owner.");
2003 "Readied skill: %s.",
2014 "You can now use the skill: %s.",
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
sstring name
Face name, as used by archetypes and such.
void paralyze_living(object *op, int dam)
Paralyze a living thing.
@ CLASS
Object for applying character class modifications to someone.
#define FLAG_USE_BOW
(Monster) can apply and fire bows
New face structure - this enforces the notion that data is face by face only - you can not change the...
#define HAS_RANDOM_ITEMS(op)
This return TRUE if object has still randomitems which could be expanded.
static int unapply_special(object *who, object *op, int aflags)
Unapplies specified item.
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
struct Settings settings
Global settings.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
object * object_find_by_type_applied(const object *who, int type)
Find applied object in inventory.
#define NUM_BODY_LOCATIONS
Number of body locations.
#define AP_APPLY
Item is to be applied.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
uint16_t difficulty
What level the player should be to play here.
#define MOVE_ALL
Mask of all movement types.
#define AP_NO_MERGE
Don't try to merge object after (un)applying it.
#define FLAG_USE_RING
(Monster) can use rings, boots, gauntlets, etc
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
uint16_t container_position
Start of container contents to send to client.
object * inv
Pointer to the first object in the inventory.
#define FLAG_STARTEQUIP
Object was given to player at start.
#define QUERY_FLAG(xyz, p)
int apply_special(object *who, object *op, int aflags)
Apply an object.
void confuse_living(object *op, object *hitter, int dam)
Confuse a living thing.
void clear_skill(object *who)
This function just clears the chosen_skill and range_skill values in the player.
static int apply_check_apply_restrictions(object *who, object *op, int aflags)
Checks for general apply restrictions (no body, prohibited by god, conflicts with other items,...
object * object_merge(object *op, object *top)
This function goes through all objects below and including top, and merges op to the first matching o...
void esrv_send_inventory(object *pl, object *op)
Sends inventory of a container.
int8_t item_power
Power rating of the object.
static int apply_check_owner(const object *who, const object *op, int aflags)
Checks that the item's owner matches the applier.
static int apply_check_race_restrictions(object *who, object *item)
Checks if an item is restricted to a race.
static int set_object_face_other(object *op)
Makes an object's face the other_arch face, supposed to be the "opened" one.
struct archetype * arch
Pointer to archetype.
int16_t invisible
How much longer the object will be invis.
#define CAN_APPLY_RESTRICTION
object * transport
Transport the player is in.
struct mapstruct * map
Pointer to the map in which this object is present.
sstring anim_suffix
Used to determine combined animations.
#define MSG_TYPE_APPLY_CURSED
Applied a cursed object (BAD)
int apply_by_living(object *pl, object *op, int aflag, int quiet)
Living thing is applying an object.
@ GT_ONLY_GOOD
Don't generate bad/cursed items.
@ range_none
No range selected.
void apply_changes_to_player(object *pl, object *change, int limit_stats)
Applies (race) changes to a player.
static int unapply_for_ob(object *who, object *op, int aflags)
Remove equipment so an object can be applied.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound for specified player only.
@ SKILL
Also see SKILL_TOOL (74) below.
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
tag_t count
Unique object number for this object.
int change_skill(object *who, object *new_skill, int flag)
This changes the object's skill to new_skill.
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...
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
#define FLAG_BLESSED
Item has a blessing, opposite of cursed/damned.
@ TRANSPORT
see doc/Developers/objects
@ unapply_always
Will unapply whatever is necessary - this goes beyond no choice - if there are multiple ojbect of the...
void scroll_failure(object *op, int failure, int power)
op made some mistake with a scroll, this takes care of punishment.
int rndm(int min, int max)
Returns a number between min and max.
void esrv_add_spells(player *pl, object *spell)
This tells the client to add the spell *spell, if spell is NULL, then add all spells in the player's ...
#define FLAG_APPLIED
Object is ready for use by living.
int16_t level
Level of creature or object.
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Execute an event on the specified object.
static int apply_check_personalized_blessings(object *who, const object *op)
If personalized blessings are activated, the weapon can bite the wielder if he/she is not the one who...
static void auto_apply_fix_inventory(mapstruct *m, object *tmp)
Go through one object on a map and process any special treasure creation or such for anything in it's...
void do_learn_spell(object *op, object *spell, int special_prayer)
Actually makes op learn spell.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
Plugin animator file specs[Config] name
void cast_magic_storm(object *op, object *tmp, int lvl)
This is really used mostly for spell fumbles and the like.
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
@ range_builder
Map builder.
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
#define FLAG_IS_A_TEMPLATE
Object has no ingame life until instantiated.
int32_t carrying
How much weight this object contains.
#define AP_NULL
Nothing specific.
int16_t y
Position in the map for this object.
static event_registration m
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
void give_initial_items(object *pl, treasurelist *items)
Gives a new player her initial items.
struct player * contr
Pointer to the player which control this object.
#define AP_PRINT
Print what to do, don't actually do it Note this is supported in all the functions.
object * object_find_by_name(const object *who, const char *name)
Finds an object in inventory name.
void esrv_remove_spell(player *pl, object *spell)
void apply_handle_yield(object *tmp)
This checks whether the object has a "on_use_yield" field, and if so generated and drops matching ite...
object * chosen_skill
The skill chosen to use.
uint8_t subtype
Subtype of object.
#define FLAG_WAS_WIZ
Player was once a wiz.
void drop(object *op, object *tmp)
Drop an item, either on the floor or in a container.
uint8_t anim_speed
Ticks between animation-frames.
void blind_living(object *op, object *hitter, int dam)
Blind a living thing.
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Searches for any objects with a matching type & name variable in the inventory of the given object.
#define MSG_TYPE_APPLY_SUCCESS
Was able to apply object.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
#define FLAG_USE_RANGE
(Monster) can apply and use range items
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
@ BUILDER
Generic item builder, see subtypes below.
object * ranges[range_size]
Object for each range.
object clone
An object from which to do object_copy()
void apply_by_living_below(object *pl)
Attempt to apply the object 'below' the player.
int32_t weight_limit
Weight-limit of object.
void apply_anim_suffix(object *who, const char *suffix)
Applies a compound animation to an object.
#define FOR_OB_AND_BELOW_FINISH()
Finishes FOR_OB_AND_BELOW_PREPARE().
#define HEAD(op)
Returns the head part of an object.
object * below
Pointer to the object stacked below this one.
MoveType move_type
Type of movement this object uses.
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.
static int apply_check_item_power(const object *who, const object *op, int aflags)
Checks for item power restrictions when applying an item.
#define AP_IGNORE_CURSE
Apply/unapply regardless of cursed/damned status.
int32_t last_eat
How long since we last ate.
#define MOVE_FLYING
Combo of fly_low and fly_high.
void object_update_speed(object *op)
Updates the speed of an object.
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.
int apply_manual(object *op, object *tmp, int aflag)
Main apply handler.
#define FLAG_USE_SHIELD
Can this creature use a shield?
with a maximum of six This is not so if you are wearing plate you receive no benefit Armour is additive with all the supplementry forms of which means that it lasts until the next semi permanent spell effect is cast upon the character spell
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
#define EVENT_CLOSE
Container closed.
void do_forget_spell(object *op, const char *spell)
Erases spell from player's inventory.
float item_power_factor
See note in setings file.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
int16_t item_power
Total item power of objects equipped.
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
MoveType move_on
Move types affected moving on to this space.
uint32_t tag_t
Object tag, unique during the whole game.
rangetype shoottype
Which range-attack is being used by player.
#define FLAG_USE_WEAPON
(Monster) can wield weapons
object * find_key(object *pl, object *container, object *door)
We try to find a key for the door as passed.
#define AC_PLAYER_STAT_NO_CHANGE
#define MSG_TYPE_VICTIM_WAS_HIT
Player was hit by something.
#define FOR_OB_AND_BELOW_PREPARE(op_)
Constructs a loop iterating over an object and all objects below it in the same pile.
#define CAN_APPLY_UNAPPLY_MULT
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.
int8_t facing
Object is oriented/facing that way.
const Animations * animation
Animation of this item, NULL if not animated.
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...
#define FLAG_MONSTER
Will attack players.
object * find_skill_by_name(object *who, const char *name)
This returns the skill pointer of the given name (the one that accumulates exp, has the level,...
#define MAP_WIDTH(m)
Map width.
int should_director_abort(const object *op, const object *victim)
Check if op should abort moving victim because of it's race or slaying.
#define MAX_BUF
Used for all kinds of things.
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
object * head
Points to the main object of a large body.
int apply_container(object *op, object *sack, int aflags)
Handle apply on containers.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
living orig_stats
Permanent real stats of player.
object * current_weapon
Pointer to the weapon currently used.
int32_t weight
Attributes of the object.
void monster_check_apply_all(object *monster)
Calls monster_check_apply() for all inventory objects.
int apply_check_weapon_power(const object *who, int improves)
This checks to see of the player (who) is sufficient level to use a weapon with improves improvements...
unapplymode unapply
Method for auto unapply.
Animations * try_find_animation(const char *name)
int apply_auto(object *op)
Map was just loaded, handle op's initialization.
uint8_t spell_failure_effects
Nasty backlash to spell failures.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
#define MSG_TYPE_APPLY_BADBODY
Don't have body to use object.
#define FLAG_READY_SKILL
(Monster or Player) has a skill readied
#define FLAG_READY_BOW
not implemented yet
#define FLAG_WIZ
Object has special privilegies.
#define NDI_UNIQUE
Print immediately, don't buffer.
sstring slaying
Which race to do double damage to.
#define CAN_APPLY_UNAPPLY
sstring name
The name of the object, obviously...
#define AP_OPEN
Item is a container to be fully opened.
@ unapply_nochoice
Will unapply objects when there no choice to unapply.
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
int apply_can_apply_object(const object *who, const object *op)
Checks to see if 'who' can apply object 'op'.
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.
object * env
Pointer to the object which is the environment.
object * check_spell_known(object *op, const char *name)
Checks to see if player knows the spell.
#define AC_PLAYER_STAT_LIMIT
const typedef char * sstring
This represents one animation.
#define FLAG_AUTO_APPLY
Will be applied when created.
uint8_t personalized_blessings
If 1, blessed weapons get an owner and a willpower value.
sstring skill
Name of the skill this object uses/grants.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
int set_object_face_main(object *op)
Makes an object's face the main face, which is supposed to be the "closed" one.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
@ SKILL_TOOL
Allows the use of a skill.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
#define CAN_APPLY_UNAPPLY_CHOICE
#define FLAG_BEEN_APPLIED
Object was ever applied, for identification purposes.
static object * get_item_from_body_location(object *start, int loc)
Returns the object that is using body location 'loc'.
#define CLEAR_FLAG(xyz, p)
method_ret ob_apply(object *op, object *applier, int aflags)
Apply an object by running an event hook or an object method.
#define AP_NOPRINT
Don't print messages - caller will do that may be some that still print.
#define MAP_HEIGHT(m)
Map height.
int cast_wonder(object *op, object *caster, int dir, object *spell_ob)
wonder is really just a spell that will likely cast another spell.
#define MSG_TYPE_APPLY_FAILURE
Apply OK, but no/bad result.
void apply_auto_fix(mapstruct *m)
Go through the entire map (only the first time when an original map is loaded) and performs special a...
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
#define FLAG_ANIMATE
The object looks at archetype for faces.
struct treasurelist * randomitems
Items to be generated.
object * container
Current container being used.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
int transport_can_hold(const object *transport, const object *op, int nrof)
Can transport hold object op? This is a pretty trivial function, but in the future,...
MoveType move_off
Move types affected moving off this space.
#define FLAG_UNPAID
Object hasn't been paid for yet.
const Face * try_find_face(const char *name, const Face *error)
#define FLAG_READY_RANGE
(Monster) has a range attack readied...
sstring name
More definite name, like "generate_kobold".
#define FLAG_IS_LINKED
The object is linked with other objects.
uint32_t nrof
Number of objects.
socket_struct * socket
Socket information for this player.
int8_t body_used[NUM_BODY_LOCATIONS]
Calculated value based on items equipped.
#define MSG_TYPE_APPLY_PROHIBITION
Class/god prohibiiton on obj.
living stats
Str, Con, Dex, etc.
@ unapply_never
Will not unapply objects automatically.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
object * more
Pointer to the rest of a large body of objects.
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
#define AP_UNAPPLY
Item is to be remvoed.
static void apply_update_ranged_skill(const object *who, object *op, int aflags)
Updates ranged skill information.
#define FLAG_READY_WEAPON
(Monster or Player) has a weapon readied
void player_unready_range_ob(player *pl, object *ob)
Unready an object for a player.
#define MSG_TYPE_APPLY
Applying objects.
#define FLAG_CURSED
The object is cursed.
#define MSG_TYPE_APPLY_ERROR
@ NUM_STATS
Number of statistics.
#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.
#define METHOD_SILENT_ERROR
Player was warned she can't use the item for now.
sstring name
Name of the animation sequence.
@ llevDebug
Only for debugging purposes.
object * identify(object *op)
Identifies an item.
#define MSG_TYPE_APPLY_UNAPPLY
Unapply an object.