 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
73 size_t namelen = strlen(plname);
80 if (map != NULL && pl->
ob->
map != map)
85 if (!strcmp(
name, plname))
90 if (strlen(pl->
ob->
name) < namelen)
93 if (!strcmp(pl->
ob->
name, plname))
96 if (!strncasecmp(pl->
ob->
name, plname, namelen)) {
146 fp = fopen(
buf,
"r");
177 fp = fopen(
buf,
"r");
214 fp = fopen(
buf,
"r");
259 if (*cp ==
'-' || *cp ==
'_')
262 for (; *cp !=
'\0'; cp++)
303 while (tmp != NULL && tmp->
next != NULL)
328 p->last_save_tick = 9999999;
517 players.push_back(at);
557 for (ol =
list, lastdist = 1000; ol != NULL; ol = ol->
next) {
611 #define DETOUR_AMOUNT 2
626 #define MAX_SPACES 50
662 int lastx, lasty, dir, i, diff, firstdir = 0, lastdir, max =
MAX_SPACES, mflags, blocked;
680 while (diff > 1 && max > 0) {
829 if (op->type ==
SKILL) {
843 LOG(
llevError,
"give_initial_items: Removing duplicate object %s\n", op->name);
965 if (key ==
'q' || key ==
'Q') {
969 }
else if (key ==
'a' || key ==
'A') {
1047 int roll[4], i, low_index, k;
1049 for (i = 0; i < 4; ++i)
1050 roll[i] = (
int)
RANDOM()%6+1;
1052 for (i = 0, low_index = 0, k = 7; i < 4; ++i)
1057 for (i = 0, k = 0; i < 4; ++i) {
1102 if (statsort[i] < statsort[i+1]) {
1104 statsort[i] = statsort[i+1];
1167 LOG(
llevError,
"player.c:swap_stat() - swap_first is -1\n");
1222 int keynum = key-
'0';
1223 static const int8_t stat_trans[] = {
1234 if (keynum > 0 && keynum <= 7) {
1250 if (op->
map == NULL) {
1300 if (key ==
'q' || key ==
'Q') {
1305 if (key ==
'd' || key ==
'D') {
1332 "Welcome to Crossfire!\n Press `?' for help\n");
1336 "%s entered the game.", op->
name);
1362 if (oldmap != op->
map) {
1383 int x = op->
x, y = op->
y;
1440 int i, stat, failure=0;
1613 if (key !=
'y' && key !=
'Y' && key !=
'q' && key !=
'Q') {
1616 "OK, continuing to play.");
1625 "%s quits the game.",
1640 for (mp =
first_map; mp != NULL; mp = next) {
1685 if (op->
enemy == NULL) {
1713 for (diff = 0; diff < 3; diff++) {
1737 int j, k, wvratio, current_ratio;
1738 char putstring[128], tmpstr[16];
1796 if (tmp->type ==
MONEY || tmp->type ==
GEM)
1811 "item name: %s item type: %d weight/value: %d",
1812 tmp->name ? tmp->name : tmp->arch->name, tmp->type,
1813 (
int)(
price_base(tmp)*100/(tmp->weight*
MAX(tmp->nrof, 1))));
1816 snprintf(putstring,
sizeof(putstring),
"...flags: ");
1817 for (k = 0; k < 4; k++) {
1818 for (j = 0; j < 32; j++) {
1819 if ((tmp->flags[k]>>j)&0x01) {
1820 snprintf(tmpstr,
sizeof(tmpstr),
"%d ", k*32+j);
1821 strcat(putstring, tmpstr);
1869 static int checks[] = {
1897 for (
int m = 0; checks[
m] != 0;
m++) {
1916 current_ratio =
price_base(tmp)*100/(tmp->weight*
MAX(tmp->nrof, 1));
1917 if (current_ratio >= wvratio) {
1945 && inv->race ==
type
1948 else if (inv->type ==
ARROW && inv->race ==
type)
1972 object *tmp = NULL, *ntmp;
1973 int attacknum, attacktype, betterby = 0, i;
1980 && arrow->race ==
type
1988 }
else if (arrow->type ==
ARROW && arrow->race ==
type) {
1990 if (target->
race != NULL
1991 && arrow->slaying != NULL
1992 && strstr(arrow->slaying, target->
race)) {
1999 betterby = (arrow->magic+arrow->stats.dam)*2;
2002 for (attacknum = 0; attacknum <
NROFATTACKS; attacknum++) {
2003 attacktype = 1<<attacknum;
2004 if ((arrow->attacktype&attacktype) && (target->
arch->
clone.
resist[attacknum]) < 0)
2005 if (((arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100) > betterby) {
2007 betterby = (arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100;
2010 if ((2+arrow->magic+arrow->stats.dam) > betterby) {
2012 betterby = 2+arrow->
magic+arrow->stats.dam;
2014 if (arrow->title && (1+arrow->magic+arrow->stats.dam) > betterby) {
2016 betterby = 1+arrow->
magic+arrow->stats.dam;
2044 int i, mflags,
found, number;
2047 if (op->
map == NULL)
2060 for (i = 0,
found = 0; i < 20; i++) {
2110 int fire_bow(
object *op,
object *arrow,
int dir,
int wc_mod, int16_t sx, int16_t sy) {
2113 int bowspeed, mflags;
2118 "You can't shoot yourself!");
2129 "You cannot use %s without the skill %s", bow->
name, bow->
skill);
2145 "Your %s is broken.",
2158 if (arrow == NULL) {
2160 if (arrow == NULL) {
2164 "You have no %s left.",
2181 if (arrow->
nrof == 0) {
2188 if (arrow == NULL) {
2190 "You have no %s left.",
2237 int mod = bow->
magic
2245 if (plmod+mod > 140)
2247 else if (plmod+mod < -100)
2249 arrow->
stats.
wc = 20-(int8_t)plmod-(int8_t)mod;
2304 if ((
a % 8) + 1 == b || (
a + 6 % 8) + 1 == b)
2326 int ret = 0, wcmod = 0;
2335 ret =
fire_bow(op, NULL, dir, 0, op->
x, op->
y);
2339 ret |=
fire_bow(op, NULL, dir, 0, op->
x, op->
y);
2344 ret =
fire_bow(op, NULL, dir, 0, op->
x, op->
y);
2368 "You have no range item readied.");
2380 "The %s goes poof.",
2384 }
else if (item->
type ==
ROD) {
2389 "The %s whines for a while, but nothing happens.",
2399 }
else if (item->
type ==
ROD) {
2449 "You have no applicable skill to use.");
2461 "Illegal shoot type.");
2485 object *
find_key(
object *pl,
object *container,
object *door) {
2489 if (container->
inv == NULL)
2501 if (!tmp && door->
slaying != NULL) {
2523 if (pl != container) {
2549 "The %s in your %s vibrates as you approach the door",
2550 name_tmp, name_cont);
2572 object *key =
find_key(op, op, door);
2589 "You open the door with the %s",
2606 if (door->
msg && *door->
msg) {
2641 object *mon, *tpl, *mon_owner;
2643 int on_battleground;
2650 assert(tpl->
map != NULL);
2751 "You withhold your attack");
2771 }
else if ((mon->
stats.
hp >= 0)
2806 else if (bef != tpl->
map) {
2824 if (dir == 1 || dir == 5) {
2826 for (y = 0; y <= sy; y++) {
2827 for (x = 0; x < sx; x++) {
2834 }
else if (dir == 3 || dir == 7) {
2836 for (y = 0; y < sy; y++) {
2837 for (x = 0; x <= sx; x++) {
2847 for (part = transport; part; part = part->
more) {
2863 int x, y, scroll_dir = 0;
2870 if (transport->
direction == 1 && dir == 8) {
2872 }
else if (transport->
direction == 2 && dir == 3) {
2874 }
else if (transport->
direction == 3 && dir == 2) {
2876 }
else if (transport->
direction == 5 && dir == 6) {
2878 }
else if (transport->
direction == 6 && dir == 5) {
2880 }
else if (transport->
direction == 7 && dir == 8) {
2882 }
else if (transport->
direction == 8 && dir == 7) {
2884 }
else if (transport->
direction == 8 && dir == 1) {
2896 if (x != transport->
x || y != transport->
y) {
2900 if (pl->type ==
PLAYER) {
2901 pl->contr->do_los = 1;
2902 pl->map = transport->
map;
2906 pl->contr->socket->update_look = 1;
2907 pl->contr->socket->look_position = 0;
2972 if ((dir < 0) || (dir >= 9)) {
2973 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
3051 if ((dir < 0) || (dir >= 9)) {
3052 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
3117 "Your invisibility spell runs out.");
3150 "You can stretch your stiff joints once more.");
3194 "Your %s vibrates violently, then evaporates.",
3206 LOG(
llevError,
"Error: LIFESAVE set without applied object.\n");
3256 time_t now =
time(NULL);
3258 strncpy(buf2,
" R.I.P.\n\n", len);
3262 snprintf(
buf,
sizeof(
buf),
"%s\n", op->
name);
3263 strncat(buf2,
" ", 20-strlen(
buf)/2);
3264 strncat(buf2,
buf, len-strlen(buf2)-1);
3266 snprintf(
buf,
sizeof(
buf),
"who was in level %d when killed\n", op->
level);
3268 snprintf(
buf,
sizeof(
buf),
"who was in level %d when died.\n\n", op->
level);
3269 strncat(buf2,
" ", 20-strlen(
buf)/2);
3270 strncat(buf2,
buf, len-strlen(buf2)-1);
3273 strncat(buf2,
" ", 21-strlen(
buf)/2);
3274 strncat(buf2,
buf, len-strlen(buf2)-1);
3276 strftime(
buf,
MAX_BUF,
"%b %d %Y\n", localtime(&now));
3277 strncat(buf2,
" ", 20-strlen(
buf)/2);
3278 strncat(buf2,
buf, len-strlen(buf2)-1);
3295 int gen_hp, gen_sp, gen_grace;
3298 int rate_grace = 2000;
3315 if (op->contr->gen_grace >= 0)
3316 gen_grace = (op->contr->gen_grace+1)*op->stats.maxgrace;
3318 gen_grace = op->stats.maxgrace;
3319 rate_grace -= rate_grace/2*op->contr->gen_grace;
3323 if (op->contr->ranges[
range_golem] == NULL && --op->last_sp < 0) {
3324 gen_sp = gen_sp*10/
MAX(op->contr->gen_sp_armour, 10);
3325 if (op->stats.sp < op->stats.maxsp) {
3330 if (op->contr->digestion < 0)
3331 op->stats.food += op->contr->digestion;
3332 else if (op->contr->digestion > 0
3334 op->stats.food = last_food;
3337 op->last_sp = rate_sp/(
MAX(gen_sp, 20)+10);
3342 if (--op->last_grace < 0) {
3343 if (op->stats.grace < op->stats.maxgrace/2)
3345 op->last_grace = rate_grace/(
MAX(gen_grace, 20)+10);
3351 if (op->stats.hp < op->stats.maxhp) {
3356 if (op->contr->digestion < 0)
3357 op->stats.food += op->contr->digestion;
3358 else if (op->contr->digestion > 0
3360 op->stats.food = last_food;
3363 op->last_heal = rate_hp/(
MAX(gen_hp, 20)+10);
3367 if (--op->last_eat < 0) {
3368 int bonus =
MAX(op->contr->digestion, 0);
3369 int penalty =
MAX(-op->contr->digestion, 0);
3370 if (op->contr->gen_hp > 0)
3371 op->last_eat = 25*(1+
bonus)/(op->contr->gen_hp+penalty+1);
3373 op->last_eat = 25*(1+
bonus)/(penalty+1);
3388 object *flesh = NULL;
3394 "You blindly grab for a bite of food.");
3396 if (op->stats.food >= 0 || op->stats.hp < 0)
3398 }
else if (tmp->type ==
FLESH)
3405 if (op->stats.food < 0 && op->stats.hp >= 0 && flesh) {
3407 "You blindly grab for a bite of food.");
3450 if (tmp->nrof > 1) {
3480 "Your body feels cleansed");
3491 "Your mind feels clearer");
3525 assert(trophy != NULL);
3527 "You have been defeated in combat!\n"
3528 "Local medics have saved your life...");
3543 snprintf(
buf,
sizeof(
buf),
3544 "This %s was %s %s the %s, who was defeated at level %d by %s.\n",
3568 snprintf(
buf,
sizeof(
buf),
"%s starved to death.", op->
name);
3571 snprintf(
buf,
sizeof(
buf),
"%s died.", op->
name);
3592 int will_kill_again;
3620 for (z = 0; z < num_stats_lose; z++) {
3639 if (deparch == NULL) {
3659 if (this_stat < 0) {
3661 int keep_chance = this_stat*this_stat;
3663 if (keep_chance < 1)
3679 if (lose_this_stat) {
3689 if (this_stat >= -50) {
3705 if (god && (strcmp(god,
"none")))
3708 "For a brief moment you feel the holy presence of %s protecting you",
3713 "For a brief moment you feel a holy presence protecting you.");
3722 snprintf(
buf,
sizeof(
buf),
"%s's gravestone", op->
name);
3724 snprintf(
buf,
sizeof(
buf),
"%s's gravestones", op->
name);
3726 snprintf(
buf,
sizeof(
buf),
"RIP\nHere rests the hero %s the %s,\n"
3781 will_kill_again = 0;
3786 if (will_kill_again) {
3796 if (will_kill_again&(1<<at))
3859 if (op->
map != NULL)
3949 object *skop, *spob;
3955 LOG(
llevError,
"Player %s lacks critical skill use_magic_item!\n", op->
name);
3958 spob = throw_ob->
inv;
4014 int i,
level = 0, mflag;
4017 if (!ob || !ob->
map)
4058 if (!op || !op->
map)
4065 if (!skop || num >= skop->
level) {
4067 "You ran too much! You are no longer hidden!");
4081 "You moved out of hiding! You are visible!");
4109 for (i = 1; i < 9; i++) {
4127 else if (tmp->type ==
PLAYER) {
4171 LOG(
llevError,
"player_can_view() called for non-player object\n");
4227 op->
hide ?
"unhidden" :
"visible");
4266 && strcmp(tmp->name,
"battleground") == 0
4275 if (invtmp != NULL) {
4276 if (x != NULL && y != NULL)
4282 if (x != NULL && y != NULL)
4287 if (trophy != NULL) {
4288 if (tmp->other_arch) {
4289 *trophy = tmp->other_arch;
4336 if (tr == NULL || tr->
item == NULL) {
4350 "You gained the ability of %s",
4367 "You gained the ability of %s",
4386 if (item->
msg != NULL)
4416 snprintf(
buf,
sizeof(
buf),
"You feel attuned to ");
4420 strcat(
buf,
" and ");
4441 if (item->
msg != NULL)
4473 for (i = 0; i < static_cast<int>(
range_size); i++) {
4474 if (pl->
ranges[i] == ob) {
4504 const uint8_t to_alloc = 5;
int16_t gen_sp
Bonuses to regeneration speed of sp.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
#define ADD_PLAYER_NO_STATS_ROLL
Stats provided from client.
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
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.
sstring name_pl
The plural name of the object.
#define GET_MAP_OB(M, X, Y)
Gets the bottom object on a map.
#define MSG_TYPE_COMMAND_NEWPLAYER
Create a new character - not really a command, but is responding to player input.
int do_skill(object *op, object *part, object *skill, int dir, const char *string)
Main skills use function-similar in scope to cast_spell().
uint32_t do_los
If true, need to call update_los() in draw(), and clear.
void apply_changes_to_player(object *pl, object *change, int limit_stats)
Applies (race) changes to a player.
int16_t bed_y
x,y - coordinates of respawn (savebed).
#define UP_OBJ_FACE
Only thing that changed was the face.
int check_pick(object *op)
Sees if there is stuff to be picked up/picks up stuff, for players only.
void make_visible(object *op)
Makes an object visible again.
float weapon_speed_left
How much speed is left to spend this round.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
player * next
Pointer to next player, NULL if this is last.
static void kill_player_permadeath(object *op)
Kills a player in permadeath mode.
void SockList_AddInt(SockList *sl, uint32_t data)
Adds a 32 bit value.
#define FLAG_NEUTRAL
monster is from type neutral
object * object_find_by_type_subtype(const object *who, int type, int subtype)
Find object in inventory.
player * first_player
First player.
struct Settings settings
Server settings.
@ bow_spreadshot
Fire three arrows in a cone.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your and press< Return > You can also use say if you feel like typing a little extra Other NPCs may not speak to but display intelligence with their movement Some monsters can be friendly
void object_update_turn_face(object *op)
If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the ot...
#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.
void pets_terminate_all(object *owner)
Removes all pets someone owns.
@ bow_normal
Standard mode, one random arrow.
int face_player(object *op, int dir)
Face player in the given direction.
int16_t maxhp
Max hit points.
static struct Command_Line_Options options[]
Actual valid command line options.
#define ST_GET_PASSWORD
Name entered, now for password.
#define MSG_TYPE_COMMAND_SUCCESS
Successful result from command.
#define FLAG_CONFUSED
Will also be unable to cast spells.
const char * unarmed_skill
Prefered skill to use in unarmed combat.
static int player_fire_bow(object *op, int dir)
Special fire code for players - this takes into account the special fire modes players can have but m...
uint16_t emergency_y
Coordinates to use on that map.
void kill_player(object *op, const object *killer)
Handle a player's death.
@ 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.
uint32_t path_attuned
Paths the object is attuned to.
void command_search_items(object *op, const char *params)
'search-items' command.
static archetype * get_player_archetype(archetype *at)
Get next player archetype from archetype list.
#define MSG_TYPE_ADMIN_PLAYER
Player coming/going/death.
uint32_t mode
Mode of player for pickup.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define FLAG_UNDEAD
Monster is undead.
@ bow_threewide
Fire three arrows in the same direction.
@ FLESH
animal 'body parts' -b.t.
int monster_can_detect_enemy(object *op, object *enemy, rv_vector *rv)
Determine if we can 'detect' the enemy.
int path_to_player(object *mon, object *pl, unsigned mindiff)
Returns the direction to the player, if valid.
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
int blocked_link(object *ob, mapstruct *m, int16_t sx, int16_t sy)
Returns true if the given coordinate is blocked except by the object passed is not blocking.
object * inv
Pointer to the first object in the inventory.
uint8_t resurrection
Ressurection possible w/ permadeth on.
void recursive_roll(object *op, int dir, object *pusher)
An object is pushed by another which is trying to take its place.
uint32_t golem_count
To track the golem.
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
Simple function we use below to keep adding to the same string but also make sure we don't overwrite ...
#define FLAG_STARTEQUIP
Object was given to player at start.
char first_map_path[MAX_BUF]
The start-level.
#define MSG_TYPE_SKILL
Messages related to skill use.
#define QUERY_FLAG(xyz, p)
bool is_wraith
Whether this player is a wraith or not, initialized at load time.
objectlink * next
Next item to link to.
treasure * items
Items in this list, linked.
uint8_t set_title
Players can set thier title.
void remove_locked_door(object *op)
Same as remove_door() but for locked doors.
const char *const spellpathnames[NRSPELLPATHS]
Perhaps not the best place for this, but needs to be in some file in the common area so that standalo...
#define ARCH_DEPLETION
Archetype for depletion.
#define NDI_GREEN
SeaGreen.
void do_learn_spell(object *op, object *spell, int special_prayer)
Actually makes op learn spell.
Socket structure, represents a client-server connection.
#define ST_GET_NAME
Player just connected.
char first_map_ext_path[MAX_BUF]
Path used for per-race start maps.
void esrv_new_player(player *pl, uint32_t weight)
Tells the client that here is a player it should start using.
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
uint8_t not_permadeth
If true, death is non-permament.
uint64_t price_base(const object *obj)
Determine the base (intrinsic) value of an item.
SockList * player_get_delayed_buffer(player *pl)
Get a delayed socket buffer, that will be sent after the player's tick is complete.
objectlink * get_friends_of(const object *owner)
Get a list of friendly objects for the specified owner.
void esrv_send_inventory(object *pl, object *op)
Sends inventory of a container.
void roll_again(object *op)
Ask the player what to do with the statistics.
player * find_player_socket(const socket_struct *ns)
Return a player for a socket structure.
struct archetype * arch
Pointer to archetype.
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Main dispatch when someone casts a spell.
static object * find_better_arrow(object *op, object *target, const char *type, int *better)
Similar to find_arrow(), but looks for (roughly) the best arrow to use against the target.
int absdir(int d)
Computes an absolute direction.
uint32_t no_shout
if True, player is *not *able to use shout command.
void SockList_AddString(SockList *sl, const char *data)
Adds a string without length.
#define FOR_BELOW_PREPARE(op_, it_)
Constructs a loop iterating over all objects below an object.
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.
static bool starving(object *op)
#define FLAG_UNIQUE
Item is really unique (UNIQUE_ITEMS)
int16_t invisible
How much longer the object will be invis.
#define MSG_TYPE_VICTIM_DIED
Player died!
uint32_t peaceful
If set, won't attack friendly creatures.
object * ob
The object representing the player.
static int turn_transport(object *transport, object *captain, int dir)
Try to turn a transport in the desired direction.
void spring_trap(object *trap, object *victim)
This function generalizes attacks by runes/traps.
object * get_nearest_player(object *mon)
Finds the nearest visible player or player-friendly for some object.
void apply_map_builder(object *pl, int dir)
Global building function.
object * transport
Transport the player is in.
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.
sstring anim_suffix
Used to determine combined animations.
object * arch_present_in_ob(const archetype *at, const object *op)
Searches for any objects with a matching archetype in the inventory of the given object.
treasurelist * find_treasurelist(const char *name)
Search for the given treasurelist by name.
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.
void esrv_send_pickup(player *pl)
Sends the "pickup" state to pl if client wants it requested.
living last_applied_stats
Last applied stats sent to the client.
object * ob
Item to link to.
int8_t levhp[11]
What hp bonus the player gained on that level.
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
@ GT_ONLY_GOOD
Don't generate bad/cursed items.
void fix_weight(void)
Check recursively the weight of all players, and fix what needs to be fixed.
void player_set_own_title(struct player *pl, const char *title)
Sets the custom title.
@ range_none
No range selected.
#define SET_ANIMATION(ob, newanim)
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
@ party_rejoin_if_exists
Rejoin if party exists.
#define CS_QUERY_SINGLECHAR
Single character response expected.
SockList ** delayed_buffers
Buffers which will be sent after the player's tick completes.
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.
uint32_t last_path_denied
Last spell denied sent to client.
int allowed_class(const object *op)
Returns true if the given player is a legal class.
@ SKILL
Also see SKILL_TOOL (74) below.
int8_t direction
Means the object is moving that way.
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.
static const flag_definition flags[]
Flag mapping.
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...
int8_t levsp[11]
What sp bonus the player gained on that level.
#define FLAG_SCARED
Monster is scared (mb player in future)
char savebed_map[MAX_BUF]
Map where player will respawn after death.
uint8_t roll_stat_points
How many stat points legacy (rolled) chars start with.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
object * object_find_by_flag_applied(const object *who, int flag)
Find applied object in inventory by flag.
void send_delayed_buffers(player *pl)
Send all delayed buffers for a player.
int player_can_view(object *pl, object *op)
Check the player los field for viewability of the object op.
void confirm_password(object *op)
Ask the player to confirm her password during creation.
living last_stats
Last stats as sent to client.
void get_name(object *op)
Waiting for the player's name.
@ TRANSPORT
see doc/Developers/objects
#define SOUND_TYPE_LIVING
uint32_t hidden
If True, player (DM) is hidden from view.
SockList inbuf
If we get an incomplete packet, this is used to hold the data.
object * enemy
Monster/player to follow even if not closest.
#define BALSL_LOSS_CHANCE_RATIO
void send_account_players(socket_struct *ns)
Upon successful login/account creation, we send a list of characters associated with the account to t...
uint8_t hide
The object is hidden, not invisible.
#define MSG_TYPE_COMMAND_ERROR
Bad syntax/can't use command.
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 ...
@ range_golem
Control golem.
#define FLAG_INV_LOCKED
Item will not be dropped from inventory.
int apply_manual(object *op, object *tmp, int aflag)
Main apply handler.
char path[HUGE_BUF]
Filename of the map.
#define P_IS_ALIVE
Something alive is on this space.
#define MSG_TYPE_MISC
Messages that don't go elsewhere.
#define FLAG_APPLIED
Object is ready for use by living.
#define NDI_BLUE
Actually, it is Dodger Blue.
int16_t level
Level of creature or object.
#define FLAG_STEALTH
Will wake monsters with less range.
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.
@ bow_bestarrow
Try to find an arrow matching the target.
#define BALSL_MAX_LOSS_RATIO
uint32_t pticks
Number of ticks since time reset.
@ GT_STARTEQUIP
Generated items have the FLAG_STARTEQUIP.
void hiscore_check(object *op, int quiet)
Checks if player should enter the hiscore, and if so writes her into the list.
int swap_first
First stat player has selected to swap.
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.
#define HUGE_BUF
Used for messages - some can be quite long.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
int handle_newcs_player(object *op)
Handles commands the player can send us, and various checks on invisibility, golem and such.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
#define FLAG_NO_PICK
Object can't be picked up.
#define MSG_TYPE_SPELL_END
A spell ends.
const char *const lose_msg[NUM_STATS]
Message when a player decreases permanently a stat.
Plugin animator file specs[Config] name
void player_set_state(player *pl, uint8_t state)
Set the player's state to the specified one.
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
#define FOR_BELOW_FINISH()
Finishes FOR_BELOW_PREPARE().
#define MIN_STAT
The minimum legal value of any stat.
#define FLAG_ALIVE
Object can fight (or be fought)
void add_statbonus(object *op)
Adds stat-bonuses given by the class which the player has chosen.
@ range_builder
Map builder.
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
const char *const short_stat_name[NUM_STATS]
Short name of stats.
#define MSG_TYPE_COMMAND_DEBUG
Various debug type commands.
int32_t carrying
How much weight this object contains.
#define AP_NULL
Nothing specific.
void set_player_socket(player *p, socket_struct *ns)
This copies the data from the socket into the player structure.
void remove_door(object *op)
Remove non locked doors.
int16_t y
Position in the map for this object.
static event_registration m
void clear_los(player *pl)
Clears/initialises the los-array associated to the player controlling the object.
Account_Chars * account_chars
Detailed information on characters on this account.
uint8_t mapy
How large a map the client wants.
#define MAP_IN_MEMORY
Map is fully loaded.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
static int turn_one_transport(object *transport, object *captain, int dir)
Turn a transport to an adjacent direction (+1 or -1), updating the move_type flags in the same proces...
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.
int get_party_password(object *op, partylist *party)
Ask the player for the password of the party she wants to join.
void player_unready_range_ob(player *pl, object *ob)
Unready an object for a player.
object * object_find_by_name(const object *who, const char *name)
Finds an object in inventory name.
#define EVENT_LOGIN
Player login.
object * chosen_skill
The skill chosen to use.
#define object_decrease_nrof_by_one(xyz)
#define MAX_SPACES
This is used to prevent infinite loops.
uint8_t balanced_stat_loss
If true, Death stat depletion based on level etc.
#define BALSL_NUMBER_LOSSES_RATIO
char killer[BIG_NAME]
Who killed this player.
static void flee_player(object *op)
The player is scared, and should flee.
uint8_t subtype
Subtype of object.
#define MSG_TYPE_ATTRIBUTE_STAT_LOSS
#define FLAG_WAS_WIZ
Player was once a wiz.
#define MSG_TYPE_ADMIN_NEWS
bool is_criminal(object *op)
float last_speed
Last speed as sent to client.
Used to link together several objects.
sstring add_refcount(sstring str)
This will increase the refcount of the string str.
int check_race_and_class(living *stats, archetype *race, archetype *opclass)
This checks to see if the race and class are legal.
void enter_player_savebed(object *op)
This is a basic little function to put the player back to his savebed.
const char * determine_god(object *op)
Determines if op worships a god.
#define MSG_TYPE_ATTRIBUTE_RACE
Race-related changes.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
uint32_t run_on
Player should keep moving in dir until run is off.
uint8_t anim_speed
Ticks between animation-frames.
#define ST_CHANGE_PASSWORD_CONFIRM
Player is confirming new password.
@ range_size
Maximum, exclusive, value.
int move_ob(object *op, int dir, object *originator)
Op is trying to move in direction dir.
#define MSG_TYPE_APPLY_SUCCESS
Was able to apply object.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
int8_t blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]
Array showing what spaces the player can see.
player * find_player_options(const char *plname, int options, const mapstruct *map)
Find a player.
void do_hidden_move(object *op)
For hidden creatures - a chance of becoming 'unhidden' every time they move - as we subtract off 'inv...
#define MOVE_WALK
Object walks.
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
static object * pick_arrow_target(object *op, const char *type, int dir)
Looks in a given direction, finds the first valid target, and calls find_better_arrow() to find a dec...
#define ST_PLAY_AGAIN
Player left through a bed of reality, and can login again.
treasurelist represents one logical group of items to be generated together.
object * ranges[range_size]
Object for each range.
static int action_makes_visible(object *op)
We call this when there is a possibility for our action disturbing our hiding place or invisibility s...
#define ADD_PLAYER_NO_MAP
Do not set the first map.
int64_t calc_skill_exp(const object *who, const object *op, const object *skill)
Calculates amount of experience can be gained for successful use of a skill.
const char * motd
Name of the motd file.
void account_char_free(Account_Chars *chars)
This frees all data associated with the character information.
object clone
An object from which to do object_copy()
static void fire_misc_object(object *op, int dir)
Fires a misc (wand/rod/horn) object in 'dir'.
static void loot_object(object *op)
Grab and destroy some treasure.
uint8_t run_away
Monster runs away if it's hp goes below this percentage.
void party_leave(object *op)
Makes a player leave his party.
sstring add_string(const char *str)
This will add 'str' to the hash table.
uint8_t delayed_buffers_used
Used items in delayed_buffers_used.
int account_remove_player(const char *account_name, const char *player_name)
Removes a player name from an account.
void apply_anim_suffix(object *who, const char *suffix)
Applies a compound animation to an object.
mapstruct * first_map
First map.
#define FOR_OB_AND_BELOW_FINISH()
Finishes FOR_OB_AND_BELOW_PREPARE().
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
Computes the size of a multitile object.
#define HEAD(op)
Returns the head part of an object.
int apply_container(object *op, object *sack, int aflags)
Handle apply on containers.
static int similar_direction(int a, int b)
Is direction a similar to direction b? Find out in this exciting function below.
void enter_player_maplevel(object *op)
Move a player to its stored map level.
MoveType move_type
Type of movement this object uses.
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
void SockList_AddChar(SockList *sl, unsigned char c)
Adds an 8 bit value.
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).
#define FLAG_FREED
Object is in the list of free objects.
void delete_character(const char *name)
Totally deletes a character.
uint32_t last_path_attuned
Last spell attunment sent to client.
#define MSG_TYPE_ITEM
Item related information.
const Face * face
Face with colors.
int out_of_map(mapstruct *m, int x, int y)
Return 1 if coordinates X and Y are out of the map M, taking into account tiling.
uint32_t last_character_flags
Last character flags (CS_STAT_CHARACTER_FLAGS) sent to client.
char * host
Which host it is connected from (ip address).
int64_t last_skill_exp[MAX_SKILLS]
Last exp sent to client.
#define MSG_TYPE_ATTACK
Attack related messages.
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
const char * rules
Name of rules file.
int32_t value
How much money it is worth (or contains)
#define MOVE_FLYING
Combo of fly_low and fly_high.
char * account_name
Name of the account logged in on this socket.
int has_carried_lights(const object *op)
Checks if op has a light source.
void object_update_speed(object *op)
Updates the speed of an object.
int8_t levgrace[11]
What grace bonus the player gained on that level.
uint8_t last_anim
Last sequence used to draw face.
#define FREE_AND_COPY(sv, nv)
Release the shared string if not NULL, and make it a reference to nv.
const char * news
Name of news file.
uint32_t tmp_invis
Will invis go away when we attack?
#define EVENT_BORN
A new character has been created.
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.
void do_some_living(object *op)
Regenerate hp/sp/gr, decreases food.
@ bow_nw
Fire north-west whatever the facing direction.
struct archetype * item
Which item this link can be.
#define FLAG_PARALYZED
Monster or player is paralyzed.
uint8_t stat_loss_on_death
If true, chars lose a random stat when they die.
sstring materialname
Specific material name.
static const char * gravestone_text(object *op, char *buf2, int len)
Create a text for a player's gravestone.
#define FLAG_USE_SHIELD
Can this creature use a shield?
int hideability(object *ob)
Look at the surrounding terrain to determine the hideability of this object.
void leave(player *pl, int draw_exit)
Player logs out, or was disconnected.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
player * find_player(const char *plname)
Find a player by her full name.
#define FLAG_CAN_ROLL
Object can be rolled.
static object * find_arrow(object *op, const char *type)
Find an arrow in the inventory and after that in the right type container (quiver).
static void kill_player_not_permadeath(object *op)
Kills a player in non-permadeath mode.
MoveType move_on
Move types affected moving on to this space.
int32_t food
How much food in stomach.
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
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...
void display_motd(const object *op)
Sends the message of the day to the player.
rangetype shoottype
Which range-attack is being used by player.
int object_matches_string(object *pl, object *op, const char *name)
This is a subset of the parse_id command.
const char * confdir
Configuration files.
#define FLAG_USE_WEAPON
(Monster) can wield weapons
int32_t last_weight_limit
Last weight limit transmitted to client.
const char *const drain_msg[NUM_STATS]
Message when a player is drained of a stat.
#define FLAG_NO_DROP
Object can't be dropped.
#define MAX_SKILLS
This is the maximum number of skills the game may handle.
#define FIND_PLAYER_PARTIAL_NAME
Find on partial name.
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 AC_PLAYER_STAT_NO_CHANGE
#define FLAG_CAN_USE_SKILL
The monster can use skills.
void each(std::function< void(T *)> op)
Apply a function to each asset.
#define DETOUR_AMOUNT
This value basically determines how large a detour a monster will take from the direction path when l...
#define FOR_OB_AND_BELOW_PREPARE(op_)
Constructs a loop iterating over an object and all objects below it in the same pile.
#define MSG_TYPE_SPELL
Spell related info.
int get_rangevector_from_mapcoord(const mapstruct *m, int x, int y, const object *op2, rv_vector *retval)
This is basically the same as get_rangevector() above, but instead of the first parameter being an ob...
int16_t SP_level_spellpoint_cost(object *caster, object *spell, int flags)
Scales the spellpoint cost of a spell by it's increased effectiveness.
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
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.
char maplevel[MAX_BUF]
On which level is the player?
uint32_t fire_on
Player should fire object, not move.
int get_dam_bonus(int stat)
void SockList_Init(SockList *sl)
Initializes the SockList instance.
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.
void receive_play_again(object *op, char key)
Player replied to play again / disconnect.
object * object_find_by_type_without_flags(const object *who, int type, int *flags, int num_flags)
Find an object in inventory that does not have any of the provided flags set.
uint16_t last_item_power
Last value for item_power.
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...
Various statistics of objects.
treasure * next
Next treasure-item in a linked list.
#define FLAG_MONSTER
Will attack players.
void fire(object *op, int dir)
Received a fire command for the player - go and do it.
int push_ob(object *who, int dir, object *pusher)
Something is pushing some other object.
@ key_inventory
Only use keys in inventory.
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
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,...
object * last_skill_ob[MAX_SKILLS]
Exp objects sent to client.
void apply_death_exp_penalty(object *op)
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percent...
int get_dex_bonus(int stat)
#define P_OUT_OF_MAP
This space is outside the map.
void move_player_attack(object *op, int dir)
The player is also actually going to try and move (not fire weapons).
Archetypes * archetypes()
Get archetypes.
static std::shared_ptr< inja::Environment > env
Rendering environment.
#define MAX_BUF
Used for all kinds of things.
int32_t last_weight
Last weight as sent to client; -1 means do not send weight.
uint8_t listening
Which priority will be used in info_all.
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.
int is_wraith_pl(object *op)
Tests if a player is a wraith.
#define ADD_PLAYER_NEW
Name/password provided, so skip to roll stats.
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.
void cast_dust(object *op, object *throw_ob, int dir)
Handles op throwing objects of type 'DUST'.
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.
int transfer_ob(object *op, int x, int y, int randomly, object *originator)
Move an object (even linked objects) to another spot on the same map.
void set_first_map(object *op)
This loads the first map an puts the player on it.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
void key_confirm_quit(object *op, char key)
We receive the reply to the 'quit confirmation' message.
unapplymode unapply
Method for auto unapply.
#define offsetof(type, member)
The offsetof macro is part of ANSI C, but many compilers lack it, for example "gcc -ansi".
void remove_unpaid_objects(object *op, object *env, int free_items)
This goes throws the inventory and removes unpaid objects, and puts them back in the map (location an...
const char * playerdir
Where the player files are.
void SockList_Term(SockList *sl)
Frees all resources allocated by a SockList instance.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
#define MOVE_FLY_LOW
Low flying object.
#define EVENT_PLAYER_DEATH
Global Death event
void dead_player(object *op)
Kill a player on a permanent death server with resurrection.
int16_t gen_sp_armour
Penalty to sp regen from armour.
int16_t maxgrace
Maximum grace.
#define MSG_TYPE_ITEM_ADD
Item added to inventory.
char search_str[MAX_BUF]
Item we are looking for.
#define MSG_TYPE_COMMAND_FAILURE
Failed result from command.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
void key_change_class(object *op, char key)
This function takes the key that is passed, and does the appropriate action with it (change race,...
#define FLAG_KNOWN_MAGICAL
The object is known to be magical.
int stand_near_hostile(object *who)
Determine if who is standing near a hostile creature.
#define FIND_PLAYER_NO_HIDDEN_DM
Don't find hidden DMs.
#define OUT_OF_REAL_MAP(M, X, Y)
Checks if a square is out of the map.
#define ST_PLAYING
Usual state.
int16_t gen_hp
Bonuses to regeneration speed of hp.
int roll_stat(void)
This rolls four 1-6 rolls and sums the best 3 of the 4.
object * get_nearest_criminal(object *mon)
#define FLAG_READY_SKILL
(Monster or Player) has a skill readied
#define FLAG_READY_BOW
not implemented yet
#define FLAG_REMOVED
Object is not in any map or invenory.
#define ST_CHANGE_CLASS
New character, choosing class.
uint8_t magic
Max magic bonus to item If the entry is a list transition, 'magic' contains the difficulty required t...
object * object_find_by_type_and_slaying(const object *who, int type, const char *slaying)
Find object in inventory by type and slaying.
#define FLAG_WIZ
Object has special privilegies.
char * emergency_mapname
Map to return players to in emergency.
#define NDI_UNIQUE
Print immediately, don't buffer.
sstring slaying
Which race to do double damage to.
#define FLAG_FRIENDLY
Will help players.
#define EVENT_DEATH
Player or monster dead.
sstring name
The name of the object, obviously...
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
@ BATTLEGROUND
battleground, by Andreas Vogl
#define MSG_TYPE_SKILL_FAILURE
Failure in using skill.
@ pet_normal
Standard mode/.
uint32_t has_hit
If set, weapon_sp instead of speed will count.
object * object_find_by_arch_name(const object *who, const char *name)
Find object in inventory by archetype name.
const char * party_get_password(const partylist *party)
Returns the party's password.
partylist * party_to_join
Used when player wants to join a party but we will have to get password first so we have to remember ...
int get_thaco_bonus(int stat)
language_t i18n_get_language_by_code(const char *code)
Find the identifier of a language from its code.
int object_can_pick(const object *who, const object *item)
Finds out if an object can be picked up.
std::vector< archetype * > players
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
void key_roll_stat(object *op, char key)
Player is currently swapping stats.
#define ST_CONFIRM_PASSWORD
New character, confirm password.
@ unapply_nochoice
Will unapply objects when there no choice to unapply.
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_.
object * object_find_by_type(const object *who, int type)
Find object in inventory.
#define SOUND_TYPE_GROUND
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
#define MSG_TYPE_ITEM_REMOVE
Item removed from inv.
int16_t maxsp
Max spell points.
int is_identifiable_type(const object *op)
Return true if this item's type is one that cares about whether or not it's been identified – e....
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.
void enter_exit(object *op, object *exit_ob)
Tries to move 'op' to exit_ob.
object * check_spell_known(object *op, const char *name)
Checks to see if player knows the spell.
#define NDI_ALL
Inform all players of this message.
int fire_bow(object *op, object *arrow, int dir, int wc_mod, int16_t sx, int16_t sy)
Creature (monster or player) fires a bow.
static int save_life(object *op)
Can the player be saved by an item?
sstring skill
Name of the skill this object uses/grants.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
language_t language
The language the player wishes to use.
archetype * find_archetype(const char *name)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
uint8_t state
Input state of the player (name, password, etc).
#define MSG_TYPE_ATTRIBUTE_GOD
changing god info
void dragon_ability_gain(object *who, int atnr, int level)
When a dragon-player gains a new stage of evolution, he gets some treasure.
uint32_t in_memory
Combination of IN_MEMORY_xxx flags.
void change_luck(object *op, int value)
Alter the object's luck.
static void restore_player(object *op)
Remove confusion, disease, and poison on death.
uint32_t braced
Will not move if braced, only attack.
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
int did_make_save(const object *op, int level, int bonus)
This function takes an object (monster/player, op), and determines if it makes a basic save throw by ...
void send_rules(const object *op)
Send the rules to a player.
uint8_t max_stat
Maximum stat value - 255 should be sufficient.
sstring msg
If this is a book/sign/magic mouth/etc.
This is used by get_rangevector to determine where the other creature is.
#define MSG_TYPE_ADMIN_RULES
@ SKILL_TOOL
Allows the use of a skill.
void send_news(const object *op)
Send the news to a player.
int get_randomized_dir(int dir)
Returns a random direction (1..8) similar to a given direction.
#define FLAG_BEEN_APPLIED
The object has been applied.
#define CLEAR_FLAG(xyz, p)
#define AP_NOPRINT
Don't print messages - caller will do that may be some that still print.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
#define EVENT_REMOVE
A Player character has been removed.
void SockList_ResetRead(SockList *sl)
Resets the length of the stored data for reading.
#define NDI_DK_ORANGE
DarkOrange2.
void strip_endline(char *buf)
Removes endline from buffer (modified in place).
@ bow_n
Fire north whatever the facing direction.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
uint8_t * faces_sent
This is a bitmap on sent face status.
void get_password(object *op)
Waiting for the player's password.
int16_t last_resist[NROFATTACKS]
last resist values sent to client.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
Player Stats effect how well a character can survie and interact inside the crossfire world This section discusses the various stats
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.
@ keyrings
Use keys in inventory and active key rings.
void play_again(object *op)
Ask the player whether to play again or disconnect.
player * get_player(player *p)
Create a player's object, initialize a player's structure.
#define MSG_TYPE_ADMIN_LOGIN
login messages/errors
#define FLAG_ANIMATE
The object looks at archetype for faces.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
End of a bad effect.
struct treasurelist * randomitems
Items to be generated.
void fix_luck(void)
Fixes luck of players, slowly move it towards 0.
int save_player(object *op, int flag)
Saves a player to disk.
#define ST_GET_PARTY_PASSWORD
Player tried to join a password-protected party.
int object_matches_pickup_mode(const object *item, int mode)
Checks if an item matches a specific pickup mode.
object * container
Current container being used.
uint8_t delayed_buffers_allocated
Number of items in delayed_buffers_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 cure_disease(object *sufferer, object *caster, sstring skill)
Do the cure disease stuff, from the spell "cure disease".
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
void free_objectlink(objectlink *ol)
Recursively frees all objectlinks.
signed long object_sum_weight(object *op)
object_sum_weight() is a recursive function which calculates the weight an object is carrying.
#define FLAG_UNPAID
Object hasn't been paid for yet.
#define FLAG_NO_STRENGTH
Strength-bonus not added to wc/dam.
uint32_t last_path_repelled
Last spell repelled sent to client.
#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...
int move_player(object *op, int dir)
Move player in the given direction.
uint8_t login_method
Login method this client is using.
void remove_statbonus(object *op)
Subtracts stat-bonuses given by the class which the player has chosen.
#define MSG_TYPE_ATTACK_NOATTACK
You avoid attacking.
char * spellarg
Optional argument when casting obj::spell.
void make_path_to_file(const char *filename)
Checks if any directories in the given path doesn't exist, and creates if necessary.
char password[16]
2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16
player * find_player_partial_name(const char *plname)
Find a player by a partial name.
uint8_t state
How the object was last drawn (animation)
void roll_stats(object *op)
Roll the initial player's statistics.
sstring name
More definite name, like "generate_kobold".
uint32_t nrof
Number of objects.
#define FLAG_XRAYS
X-ray vision.
socket_struct * socket
Socket information for this player.
mapstruct * next
Next map, linked list.
player * add_player(socket_struct *ns, int flags)
Tries to add player on the connection passwd in ns.
void query_base_name(const object *op, int plural, char *buf, size_t size)
Query a short name for the item.
uint8_t search_items
Search_items command.
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
char title[BIG_NAME]
Default title, like fighter, wizard, etc.
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.
void drain_rod_charge(object *rod)
Drain charges from a rod.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
static int player_attack_door(object *op, object *door)
Player is "attacking" a door.
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
petmode_t petmode
Which petmode?
bool shop_contains(object *ob)
Check if an object is in a shop.
static void swap_stat(object *op, int swap_second)
Player finishes selecting what stats to swap.
float last_weapon_sp
if diff than weapon_sp, update client.
#define ST_ROLL_STAT
New character, rolling stats.
void clear_player(player *pl)
Clears data in player structure.
void pets_control_golem(object *op, int dir)
Makes the golem go in specified direction.
const char * invis_race
What race invisible to?
char spellparam[MAX_BUF]
What param to add to spells.
void link_player_skills(object *op)
This function goes through the player inventory and sets up the last_skills[] array in the player obj...
uint8_t darkness
Indicates level of darkness of map.
object * find_key(object *pl, object *container, object *door)
We try to find a key for the door as passed.
void give_initial_items(object *pl, treasurelist *items)
Gives a new player her initial items.
static void update_transport_block(object *transport, int dir)
Update the move_type of a transport based on the direction.
#define MSG_TYPE_APPLY
Applying objects.
void player_map_change_common(object *op, mapstruct *const oldmap, mapstruct *const newmap)
void account_char_save(Account_Chars *chars)
Saves the character information for the given account.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_CURSED
The object is cursed.
void pick_up(object *op, object *alt)
Try to pick up an item.
int direction
General direction to the targer.
void check_stat_bounds(living *stats, int8_t min_stat, int8_t max_stat)
Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_s...
void send_query(socket_struct *ns, uint8_t flags, const char *text)
Asks the client to query the user.
void Send_With_Handling(socket_struct *ns, SockList *sl)
Calls Write_To_Socket to send data to the client.
int is_true_undead(object *op)
Is the object a true undead?
uint16_t material
What materials this object consist of.
Contains the base information we use to make up a packet we want to send.
unsigned int distance
Distance, in squares.
bowtype_t bowtype
Which firemode?
@ NUM_STATS
Number of statistics.
#define MSG_TYPE_ITEM_INFO
Information related to items.
int apply_race_and_class(object *op, archetype *race, archetype *opclass, living *stats)
This is somewhat like key_change_class() above, except we know the race to change to,...
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
static const int32_t MAX_FOOD
int8_t luck
Affects thaco and ac from time to time.
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
void drain_wand_charge(object *wand)
Drains a charge from a wand.
int playername_ok(const char *cp)
Is the player name valid.
float last_character_load
Last value sent to the client.
void account_char_remove(Account_Chars *chars, const char *pl_name)
This removes a character on this account.
uint32_t ticks_played
How many ticks this player has played.
usekeytype usekeys
Method for finding keys for doors.
party_rejoin_mode rejoin_party
Whether to rejoin or not party at login.
void events_execute_global_event(int eventcode,...)
Execute a global event.
int object_can_merge(object *ob1, object *ob2)
Examines the 2 objects given to it, and returns true if they can be merged together,...
@ llevDebug
Only for debugging purposes.
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
#define NRSPELLPATHS
Number of spell paths.
const char * i18n(const object *who, const char *code)
Translate a message in the appropriate language.
#define P_BLOCKSVIEW
This spot blocks the player's view.
#define FLAG_IDENTIFIED
Player knows full info about item.
void skill_attack(object *tmp, object *pl, int dir, const char *string, object *skill)
Core routine for use when we attack using a skills system.
#define CS_QUERY_HIDEINPUT
Hide input being entered.
const char * localdir
Read/write data files.