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");
153 while (fgets(buf,
MAX_BUF, fp) != NULL) {
177 fp = fopen(buf,
"r");
184 while (fgets(buf,
MAX_BUF, fp) != NULL) {
214 fp = fopen(buf,
"r");
220 while (fgets(buf,
MAX_BUF, fp) != NULL) {
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) {
729 x = lastx+freearr_x[
absdir(lastdir+i)];
730 y = lasty+freearr_y[
absdir(lastdir+i)];
733 if (mflags&P_OUT_OF_MAP)
829 if (op->type ==
SKILL) {
843 LOG(
llevError,
"give_initial_items: Removing duplicate object %s\n", op->name);
962 if (key ==
'q' || key ==
'Q') {
966 }
else if (key ==
'a' || key ==
'A') {
968 const char *name = op->
name;
1044 int roll[4], i, low_index, k;
1046 for (i = 0; i < 4; ++i)
1047 roll[i] = (
int)
RANDOM()%6+1;
1049 for (i = 0, low_index = 0, k = 7; i < 4; ++i)
1054 for (i = 0, k = 0; i < 4; ++i) {
1099 if (statsort[i] < statsort[i+1]) {
1101 statsort[i] = statsort[i+1];
1164 LOG(
llevError,
"player.c:swap_stat() - swap_first is -1\n");
1219 int keynum = key-
'0';
1220 static const int8_t stat_trans[] = {
1231 if (keynum > 0 && keynum <= 7) {
1247 if (op->
map == NULL) {
1297 if (key ==
'q' || key ==
'Q') {
1302 if (key ==
'd' || key ==
'D') {
1329 "Welcome to Crossfire!\n Press `?' for help\n");
1333 "%s entered the game.", op->
name);
1359 if (oldmap != op->
map) {
1380 int x = op->
x, y = op->
y;
1437 int i, stat, failure=0;
1610 if (key !=
'y' && key !=
'Y' && key !=
'q' && key !=
'Q') {
1613 "OK, continuing to play.");
1622 "%s quits the game.",
1637 for (mp =
first_map; mp != NULL; mp = next) {
1639 if (!strncmp(mp->
path, buf, strlen(buf)))
1682 if (op->
enemy == NULL) {
1710 for (diff = 0; diff < 3; diff++) {
1734 int j, k, wvratio, current_ratio;
1735 char putstring[128], tmpstr[16];
1793 if (tmp->type ==
MONEY || tmp->type ==
GEM)
1808 "item name: %s item type: %d weight/value: %d",
1809 tmp->name ? tmp->name : tmp->arch->name, tmp->type,
1810 (
int)(
price_base(tmp)*100/(tmp->weight*
MAX(tmp->nrof, 1))));
1813 snprintf(putstring,
sizeof(putstring),
"...flags: ");
1814 for (k = 0; k < 4; k++) {
1815 for (j = 0; j < 32; j++) {
1816 if ((tmp->flags[k]>>j)&0x01) {
1817 snprintf(tmpstr,
sizeof(tmpstr),
"%d ", k*32+j);
1818 strcat(putstring, tmpstr);
1866 static int checks[] = {
1894 for (
int m = 0; checks[
m] != 0;
m++) {
1913 current_ratio =
price_base(tmp)*100/(tmp->weight*
MAX(tmp->nrof, 1));
1914 if (current_ratio >= wvratio) {
1942 && inv->race == type
1945 else if (inv->type ==
ARROW && inv->race == type)
1969 object *tmp = NULL, *ntmp;
1970 int attacknum, attacktype, betterby = 0, i;
1977 && arrow->race == type
1985 }
else if (arrow->type ==
ARROW && arrow->race == type) {
1987 if (target->
race != NULL
1988 && arrow->slaying != NULL
1989 && strstr(arrow->slaying, target->
race)) {
1996 betterby = (arrow->magic+arrow->stats.dam)*2;
1999 for (attacknum = 0; attacknum <
NROFATTACKS; attacknum++) {
2000 attacktype = 1<<attacknum;
2001 if ((arrow->attacktype&attacktype) && (target->
arch->
clone.
resist[attacknum]) < 0)
2002 if (((arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100) > betterby) {
2004 betterby = (arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100;
2007 if ((2+arrow->magic+arrow->stats.dam) > betterby) {
2009 betterby = 2+arrow->
magic+arrow->stats.dam;
2011 if (arrow->title && (1+arrow->magic+arrow->stats.dam) > betterby) {
2013 betterby = 1+arrow->
magic+arrow->stats.dam;
2041 int i, mflags, found, number;
2044 if (op->
map == NULL)
2057 for (i = 0, found = 0; i < 20; i++) {
2107 int fire_bow(
object *op,
object *arrow,
int dir,
int wc_mod, int16_t sx, int16_t sy) {
2110 int bowspeed, mflags;
2115 "You can't shoot yourself!");
2126 "You cannot use %s without the skill %s", bow->
name, bow->
skill);
2142 "Your %s is broken.",
2155 if (arrow == NULL) {
2157 if (arrow == NULL) {
2161 "You have no %s left.",
2178 if (arrow->
nrof == 0) {
2185 if (arrow == NULL) {
2187 "You have no %s left.",
2227 if (arrow->
speed < 1.0)
2234 int mod = bow->
magic 2242 if (plmod+mod > 140)
2244 else if (plmod+mod < -100)
2246 arrow->
stats.
wc = 20-(int8_t)plmod-(int8_t)mod;
2301 if ((a % 8) + 1 == b || (a + 6 % 8) + 1 == b)
2323 int ret = 0, wcmod = 0;
2332 ret =
fire_bow(op, NULL, dir, 0, op->
x, op->
y);
2336 ret |=
fire_bow(op, NULL, dir, 0, op->
x, op->
y);
2341 ret =
fire_bow(op, NULL, dir, 0, op->
x, op->
y);
2365 "You have no range item readied.");
2377 "The %s goes poof.",
2381 }
else if (item->
type ==
ROD) {
2386 "The %s whines for a while, but nothing happens.",
2396 }
else if (item->
type ==
ROD) {
2446 "You have no applicable skill to use.");
2458 "Illegal shoot type.");
2482 object *
find_key(
object *pl,
object *container,
object *door) {
2486 if (container->
inv == NULL)
2498 if (!tmp && door->
slaying != NULL) {
2520 if (pl != container) {
2546 "The %s in your %s vibrates as you approach the door",
2547 name_tmp, name_cont);
2569 object *key =
find_key(op, op, door);
2586 "You open the door with the %s",
2603 if (door->
msg && *door->
msg) {
2638 object *mon, *tpl, *mon_owner;
2640 int on_battleground;
2647 assert(tpl->
map != NULL);
2748 "You withhold your attack");
2768 }
else if ((mon->
stats.
hp >= 0)
2803 else if (bef != tpl->
map) {
2821 if (dir == 1 || dir == 5) {
2823 for (y = 0; y <= sy; y++) {
2824 for (x = 0; x < sx; x++) {
2831 }
else if (dir == 3 || dir == 7) {
2833 for (y = 0; y < sy; y++) {
2834 for (x = 0; x <= sx; x++) {
2844 for (part = transport; part; part = part->
more) {
2860 int x, y, scroll_dir = 0;
2867 if (transport->
direction == 1 && dir == 8) {
2869 }
else if (transport->
direction == 2 && dir == 3) {
2871 }
else if (transport->
direction == 3 && dir == 2) {
2873 }
else if (transport->
direction == 5 && dir == 6) {
2875 }
else if (transport->
direction == 6 && dir == 5) {
2877 }
else if (transport->
direction == 7 && dir == 8) {
2879 }
else if (transport->
direction == 8 && dir == 7) {
2881 }
else if (transport->
direction == 8 && dir == 1) {
2893 if (x != transport->
x || y != transport->
y) {
2897 if (pl->type ==
PLAYER) {
2898 pl->contr->do_los = 1;
2899 pl->map = transport->
map;
2903 pl->contr->socket->update_look = 1;
2904 pl->contr->socket->look_position = 0;
2969 if ((dir < 0) || (dir >= 9)) {
2970 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
3048 if ((dir < 0) || (dir >= 9)) {
3049 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
3114 "Your invisibility spell runs out.");
3147 "You can stretch your stiff joints once more.");
3199 "Your %s vibrates violently, then evaporates.",
3211 LOG(
llevError,
"Error: LIFESAVE set without applied object.\n");
3261 time_t now = time(NULL);
3263 strncpy(buf2,
" R.I.P.\n\n", len);
3265 snprintf(buf,
sizeof(buf),
"%s the %s\n", op->
name, op->
contr->
title);
3267 snprintf(buf,
sizeof(buf),
"%s\n", op->
name);
3268 strncat(buf2,
" ", 20-strlen(buf)/2);
3269 strncat(buf2, buf, len-strlen(buf2)-1);
3271 snprintf(buf,
sizeof(buf),
"who was in level %d when killed\n", op->
level);
3273 snprintf(buf,
sizeof(buf),
"who was in level %d when died.\n\n", op->
level);
3274 strncat(buf2,
" ", 20-strlen(buf)/2);
3275 strncat(buf2, buf, len-strlen(buf2)-1);
3277 snprintf(buf,
sizeof(buf),
"by %s.\n\n", op->
contr->
killer);
3278 strncat(buf2,
" ", 21-strlen(buf)/2);
3279 strncat(buf2, buf, len-strlen(buf2)-1);
3281 strftime(buf,
MAX_BUF,
"%b %d %Y\n", localtime(&now));
3282 strncat(buf2,
" ", 20-strlen(buf)/2);
3283 strncat(buf2, buf, len-strlen(buf2)-1);
3300 int gen_hp, gen_sp, gen_grace;
3303 int rate_grace = 2000;
3320 if (op->contr->gen_grace >= 0)
3321 gen_grace = (op->contr->gen_grace+1)*op->stats.maxgrace;
3323 gen_grace = op->stats.maxgrace;
3324 rate_grace -= rate_grace/2*op->contr->gen_grace;
3328 if (op->contr->ranges[
range_golem] == NULL && --op->last_sp < 0) {
3329 gen_sp = gen_sp*10/
MAX(op->contr->gen_sp_armour, 10);
3330 if (op->stats.sp < op->stats.maxsp) {
3335 if (op->contr->digestion < 0)
3336 op->stats.food += op->contr->digestion;
3337 else if (op->contr->digestion > 0
3339 op->stats.food = last_food;
3342 op->last_sp = rate_sp/(
MAX(gen_sp, 20)+10);
3347 if (--op->last_grace < 0) {
3348 if (op->stats.grace < op->stats.maxgrace/2)
3350 op->last_grace = rate_grace/(
MAX(gen_grace, 20)+10);
3356 if (op->stats.hp < op->stats.maxhp) {
3361 if (op->contr->digestion < 0)
3362 op->stats.food += op->contr->digestion;
3363 else if (op->contr->digestion > 0
3365 op->stats.food = last_food;
3368 op->last_heal = rate_hp/(
MAX(gen_hp, 20)+10);
3372 if (--op->last_eat < 0) {
3373 int bonus =
MAX(op->contr->digestion, 0);
3374 int penalty =
MAX(-op->contr->digestion, 0);
3375 if (op->contr->gen_hp > 0)
3376 op->last_eat = 25*(1+bonus)/(op->contr->gen_hp+penalty+1);
3378 op->last_eat = 25*(1+bonus)/(penalty+1);
3393 object *flesh = NULL;
3399 "You blindly grab for a bite of food.");
3401 if (op->stats.food >= 0 || op->stats.hp < 0)
3403 }
else if (tmp->type ==
FLESH)
3410 if (op->stats.food < 0 && op->stats.hp >= 0 && flesh) {
3412 "You blindly grab for a bite of food.");
3455 if (tmp->nrof > 1) {
3485 "Your body feels cleansed");
3496 "Your mind feels clearer");
3530 assert(trophy != NULL);
3532 "You have been defeated in combat!\n" 3533 "Local medics have saved your life...");
3545 snprintf(buf,
sizeof(buf),
"%s's %s", op->
name, tmp->
name);
3548 snprintf(buf,
sizeof(buf),
3549 "This %s was %s %s the %s, who was defeated at level %d by %s.\n",
3573 snprintf(buf,
sizeof(buf),
"%s starved to death.", op->
name);
3576 snprintf(buf,
sizeof(buf),
"%s died.", op->
name);
3597 int will_kill_again;
3625 for (z = 0; z < num_stats_lose; z++) {
3644 if (deparch == NULL) {
3664 if (this_stat < 0) {
3666 int keep_chance = this_stat*this_stat;
3668 if (keep_chance < 1)
3684 if (lose_this_stat) {
3694 if (this_stat >= -50) {
3710 if (god && (strcmp(god,
"none")))
3713 "For a brief moment you feel the holy presence of %s protecting you",
3718 "For a brief moment you feel a holy presence protecting you.");
3727 snprintf(buf,
sizeof(buf),
"%s's gravestone", op->
name);
3729 snprintf(buf,
sizeof(buf),
"%s's gravestones", op->
name);
3731 snprintf(buf,
sizeof(buf),
"RIP\nHere rests the hero %s the %s,\n" 3786 will_kill_again = 0;
3791 if (will_kill_again) {
3801 if (will_kill_again&(1<<at))
3864 if (op->
map != NULL)
3893 snprintf(buf,
sizeof(buf),
"%s", op->
name);
3954 object *skop, *spob;
3960 LOG(
llevError,
"Player %s lacks critical skill use_magic_item!\n", op->
name);
3963 spob = throw_ob->
inv;
4019 int i,
level = 0, mflag;
4022 if (!ob || !ob->
map)
4063 if (!op || !op->
map)
4070 if (!skop || num >= skop->
level) {
4072 "You ran too much! You are no longer hidden!");
4086 "You moved out of hiding! You are visible!");
4101 int i, friendly = 0,
player = 0, mflags;
4114 for (i = 1; i < 9; i++) {
4132 else if (tmp->type ==
PLAYER) {
4176 LOG(
llevError,
"player_can_view() called for non-player object\n");
4232 op->
hide ?
"unhidden" :
"visible");
4271 && strcmp(tmp->name,
"battleground") == 0
4280 if (invtmp != NULL) {
4281 if (x != NULL && y != NULL)
4287 if (x != NULL && y != NULL)
4292 if (trophy != NULL) {
4293 if (tmp->other_arch) {
4294 *trophy = tmp->other_arch;
4339 for (tr = trlist->
items; tr != NULL && tr->
magic != level; tr = tr->
next)
4341 if (tr == NULL || tr->
item == NULL) {
4355 "You gained the ability of %s",
4372 "You gained the ability of %s",
4391 if (item->
msg != NULL)
4421 snprintf(buf,
sizeof(buf),
"You feel attuned to ");
4425 strcat(buf,
" and ");
4446 if (item->
msg != NULL)
4478 for (i = 0; i < static_cast<int>(
range_size); i++) {
4479 if (pl->
ranges[i] == ob) {
4509 const uint8_t to_alloc = 5;
4555 snprintf(buf,
sizeof(buf),
"You start %s.", action);
void account_char_remove(Account_Chars *chars, const char *pl_name)
This removes a character on this account.
uint8_t login_method
Login method this client is using.
object * object_find_by_flag_applied(const object *who, int flag)
Find applied object in inventory by flag.
void spring_trap(object *trap, object *victim)
This function generalizes attacks by runes/traps.
Fire north-west whatever the facing direction.
void free_objectlink(objectlink *ol)
Recursively frees all objectlinks.
uint8_t not_permadeth
If true, death is non-permament.
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...
const char * rules
Name of rules file.
#define MSG_TYPE_MISC
Messages that don't go elsewhere.
#define FLAG_NO_DROP
Object can't be dropped.
object * ob
Item to link to.
signed long object_sum_weight(object *op)
object_sum_weight() is a recursive function which calculates the weight an object is carrying...
int16_t gen_hp
Bonuses to regeneration speed of hp.
uint8_t delayed_buffers_allocated
Number of items in delayed_buffers_used.
char first_map_path[MAX_BUF]
The start-level.
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
int apply_manual(object *op, object *tmp, int aflag)
Main apply handler.
const char * determine_god(object *op)
Determines if op worships a god.
object * ranges[range_size]
Object for each range.
living orig_stats
Permanent real stats of player.
static void restore_player(object *op)
Remove confusion, disease, and poison on death.
#define FLAG_DAMNED
The object is very cursed.
#define FLAG_UNPAID
Object hasn't been paid for yet.
#define MOVE_WALK
Object walks.
#define UP_OBJ_FACE
Only thing that changed was the face.
#define MSG_TYPE_ADMIN_LOGIN
login messages/errors
#define MSG_TYPE_ATTRIBUTE_GOD
changing god info
#define ST_GET_PARTY_PASSWORD
Player tried to join a password-protected party.
see doc/Developers/objects
#define EVENT_REMOVE
A Player character has been removed.
#define MSG_TYPE_ITEM
Item related information.
int change_skill(object *who, object *new_skill, int flag)
This changes the object's skill to new_skill.
Spell-related defines: spellpath, subtypes, ...
void fire(object *op, int dir)
Received a fire command for the player - go and do it.
uint8_t stat_loss_on_death
If true, chars lose a random stat when they die.
void get_name(object *op)
Waiting for the player's name.
int apply_container(object *op, object *sack, int aflags)
Handle apply on containers.
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.
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 ...
uint8_t max_stat
Maximum stat value - 255 should be sufficient.
void enter_exit(object *op, object *exit_ob)
Tries to move 'op' to exit_ob.
const char *const short_stat_name[NUM_STATS]
Short name of stats.
This is used by get_rangevector to determine where the other creature is.
struct archetype * arch
Pointer to archetype.
float last_weapon_sp
if diff than weapon_sp, update client.
void leave(player *pl, int draw_exit)
Player logs out, or was disconnected.
object * check_spell_known(object *op, const char *name)
Checks to see if player knows the spell.
player * add_player(socket_struct *ns, int flags)
Tries to add player on the connection passwd in ns.
void cast_dust(object *op, object *throw_ob, int dir)
Handles op throwing objects of type 'DUST'.
uint32_t hidden
If True, player (DM) is hidden from view.
void remove_door(object *op)
Remove non locked doors.
int account_remove_player(const char *account_name, const char *player_name)
Removes a player name from an account.
char * account_name
Name of the account logged in on this socket.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
void SockList_Init(SockList *sl)
Initializes the SockList instance.
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
static void kill_player_not_permadeath(object *op)
Kills a player in non-permadeath mode.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void play_again(object *op)
Ask the player whether to play again or disconnect.
#define NDI_ALL
Inform all players of this message.
float weapon_speed_left
How much speed is left to spend this round.
void add_statbonus(object *op)
Adds stat-bonuses given by the class which the player has chosen.
uint32_t last_path_attuned
Last spell attunment sent to client.
int8_t direction
Means the object is moving that way.
#define FABS(x)
Decstations have trouble with fabs()...
int cure_disease(object *sufferer, object *caster, sstring skill)
Do the cure disease stuff, from the spell "cure disease".
#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...
void change_luck(object *op, int value)
Alter the object's luck.
#define MSG_TYPE_ITEM_ADD
Item added to inventory.
void SockList_ResetRead(SockList *sl)
Resets the length of the stored data for reading.
#define MSG_TYPE_COMMAND_FAILURE
Failed result from command.
std::vector< archetype * > players
#define MSG_TYPE_ITEM_INFO
Information related to items.
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
#define BALSL_NUMBER_LOSSES_RATIO
Defines various flags that both the new client and new server use.
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 drain_wand_charge(object *wand)
Drains a charge from a wand.
static void loot_object(object *op)
Grab and destroy some treasure.
void player_set_own_title(struct player *pl, const char *title)
Sets the custom title.
SockList * player_get_delayed_buffer(player *pl)
Get a delayed socket buffer, that will be sent after the player's tick is complete.
int player_can_view(object *pl, object *op)
Check the player los field for viewability of the object op.
#define FLAG_FRIENDLY
Will help players.
int push_ob(object *who, int dir, object *pusher)
Something is pushing some other object.
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
archetype * find_archetype(const char *name)
uint32_t peaceful
If set, won't attack friendly creatures.
void key_confirm_quit(object *op, char key)
We receive the reply to the 'quit confirmation' message.
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...
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
const char * i18n(const object *who, const char *code)
Translate a message in the appropriate language.
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
bool(* repeat_cb)(player *, void *data)
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 MSG_TYPE_SPELL
Spell related info.
player * first_player
First player.
#define SOUND_TYPE_GROUND
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.
int16_t maxgrace
Maximum grace.
int save_player(object *op, int flag)
Saves a player to disk.
object * get_nearest_player(object *mon)
Finds the nearest visible player or player-friendly for some object.
const char * playerdir
Where the player files are.
const char * motd
Name of the motd file.
static int similar_direction(int a, int b)
Is direction a similar to direction b? Find out in this exciting function below.
void dragon_ability_gain(object *who, int atnr, int level)
When a dragon-player gains a new stage of evolution, he gets some treasure.
object * object_find_by_name(const object *who, const char *name)
Finds an object in inventory name.
#define HUGE_BUF
Used for messages - some can be quite long.
#define SET_ANIMATION(ob, newanim)
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
void enter_player_maplevel(object *op)
Move a player to its stored map level.
partylist * party
Party this player is part of.
object * more
Pointer to the rest of a large body of objects.
sstring slaying
Which race to do double damage to.
#define NDI_BLUE
Actually, it is Dodger Blue.
sstring add_string(const char *str)
Share a string.
int32_t value
How much money it is worth (or contains)
#define ST_CHANGE_PASSWORD_CONFIRM
Player is confirming new password.
int8_t luck
Affects thaco and ac from time to time.
Socket structure, represents a client-server connection.
#define ST_CONFIRM_PASSWORD
New character, confirm password.
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 remove_friendly_object(object *op)
Removes the specified object from the linked list of friendly objects.
void link_player_skills(object *op)
This function goes through the player inventory and sets up the last_skills[] array in the player obj...
void esrv_send_inventory(object *pl, object *op)
Sends inventory of a container.
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
int8_t blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]
Array showing what spaces the player can see.
#define FLAG_CONFUSED
Will also be unable to cast spells.
#define FLAG_STEALTH
Will wake monsters with less range.
void key_roll_stat(object *op, char key)
Player is currently swapping stats.
void make_path_to_file(const char *filename)
Checks if any directories in the given path doesn't exist, and creates if necessary.
const char * party_get_password(const partylist *party)
Returns the party's password.
#define EVENT_LOGIN
Player login.
void send_account_players(socket_struct *ns)
Upon successful login/account creation, we send a list of characters associated with the account to t...
int16_t y
Position in the map for this object.
const char *const drain_msg[NUM_STATS]
Message when a player is drained of a stat.
int8_t magic
Any magical bonuses to this item.
#define SOUND_TYPE_LIVING
#define FLAG_USE_WEAPON
(Monster) can wield weapons
int hideability(object *ob)
Look at the surrounding terrain to determine the hideability of this object.
uint32_t mode
Mode of player for pickup.
uint16_t material
What materials this object consist of.
void confirm_password(object *op)
Ask the player to confirm her password during creation.
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
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...
Fire three arrows in a cone.
void SockList_AddInt(SockList *sl, uint32_t data)
Adds a 32 bit value.
#define OUT_OF_REAL_MAP(M, X, Y)
Checks if a square is out of the map.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
void party_leave(object *op)
Makes a player leave his party.
MoveType move_on
Move types affected moving on to this space.
object * chosen_skill
The skill chosen to use.
#define MSG_TYPE_ITEM_REMOVE
Item removed from inv.
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...
int swap_first
First stat player has selected to swap.
void dead_player(object *op)
Kill a player on a permanent death server with resurrection.
char title[BIG_NAME]
Default title, like fighter, wizard, etc.
Use keys in inventory and active key rings.
Fire three arrows in the same direction.
animal 'body parts' -b.t.
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
void pets_terminate_all(object *owner)
Removes all pets someone owns.
#define ST_ROLL_STAT
New character, rolling stats.
object * object_find_by_arch_name(const object *who, const char *name)
Find object in inventory by archetype name.
static struct Command_Line_Options options[]
Actual valid command line options.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
int8_t levgrace[11]
What grace bonus the player gained on that level.
#define ST_PLAYING
Usual state.
#define NDI_DK_ORANGE
DarkOrange2.
uint8_t anim_speed
Ticks between animation-frames.
int handle_newcs_player(object *op)
Handles commands the player can send us, and various checks on invisibility, golem and such...
int object_matches_pickup_mode(const object *item, int mode)
Checks if an item matches a specific pickup mode.
char * host
Which host it is connected from (ip address).
#define MSG_TYPE_APPLY
Applying objects.
void apply_death_exp_penalty(object *op)
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percent...
object * object_find_by_type_and_slaying(const object *who, int type, const char *slaying)
Find object in inventory by type and slaying.
#define FOR_OB_AND_BELOW_FINISH()
Finishes FOR_OB_AND_BELOW_PREPARE().
void set_first_map(object *op)
This loads the first map an puts the player on it.
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 ...
uint16_t emergency_y
Coordinates to use on that map.
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_REMOVED
Object is not in any map or invenory.
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 ...
int32_t weight
Attributes of the object.
void events_execute_global_event(int eventcode,...)
Execute a global event.
object * transport
Transport the player is in.
static int player_attack_door(object *op, object *door)
Player is "attacking" a door.
#define FLAG_CAN_ROLL
Object can be rolled.
Account_Chars * account_chars
Detailed information on characters on this account.
#define FLAG_KNOWN_MAGICAL
The object is known to be magical.
static std::shared_ptr< inja::Environment > env
Rendering environment.
repeat_cb repeat_func
If not NULL, automatically repeat the action repeat_func until interrupted.
rangetype shoottype
Which range-attack is being used by player.
#define FIND_PLAYER_PARTIAL_NAME
Find on partial name.
#define MOVE_ALL
Mask of all movement types.
uint8_t run_away
Monster runs away if it's hp goes below this percentage.
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.
int32_t last_weight_limit
Last weight limit transmitted to client.
AssetsManager * getManager()
void pets_control_golem(object *op, int dir)
Makes the golem go in specified direction.
Allows the use of a skill.
#define MIN_STAT
The minimum legal value of any stat.
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...
#define FLAG_UNDEAD
Monster is undead.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
const char * news
Name of news file.
#define FLAG_READY_SKILL
(Monster or Player) has a skill readied
void apply_changes_to_player(object *pl, object *change, int limit_stats)
Applies (race) changes to a player.
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
#define MAP_IN_MEMORY
Map is fully loaded.
int16_t level
Level of creature or object.
void esrv_new_player(player *pl, uint32_t weight)
Tells the client that here is a player it should start using.
int object_matches_string(object *pl, object *op, const char *name)
This is a subset of the parse_id command.
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...
static void flee_player(object *op)
The player is scared, and should flee.
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...
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
End of a bad effect.
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
player * next
Pointer to next player, NULL if this is last.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
int move_player(object *op, int dir)
Move player in the given direction.
object * object_find_by_type_subtype(const object *who, int type, int subtype)
Find object in inventory.
char maplevel[MAX_BUF]
On which level is the player?
uint8_t hide
The object is hidden, not invisible.
int check_pick(object *op)
Sees if there is stuff to be picked up/picks up stuff, for players only.
#define FLAG_ALIVE
Object can fight (or be fought)
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
#define ADD_PLAYER_NO_STATS_ROLL
Stats provided from client.
uint32_t do_los
If true, need to call update_los() in draw(), and clear.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
uint16_t last_item_power
Last value for item_power.
int get_thaco_bonus(int stat)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
int16_t last_resist[NROFATTACKS]
last resist values sent to client.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
Computes the size of a multitile object.
void roll_again(object *op)
Ask the player what to do with the statistics.
sstring repeat_action
Shared string with textual description of current repeat action (e.g.
void player_set_state(player *pl, uint8_t state)
Set the player's state to the specified one.
sstring materialname
Specific material name.
void send_query(socket_struct *ns, uint8_t flags, const char *text)
Asks the client to query the user.
sstring name
More definite name, like "generate_kobold".
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 ...
battleground, by Andreas Vogl
#define MSG_TYPE_COMMAND_SUCCESS
Successful result from command.
#define MSG_TYPE_COMMAND_ERROR
Bad syntax/can't use command.
uint8_t search_items
Search_items command.
player * find_player_socket(const socket_struct *ns)
Return a player for a socket structure.
float speed
Frequency of object 'moves' relative to server tick rate.
int32_t carrying
How much weight this object contains.
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...
void command_search_items(object *op, const char *params)
'search-items' command.
int stand_near_hostile(object *who)
Determine if who is standing near a hostile creature.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
#define FLAG_CAN_USE_SKILL
The monster can use skills.
#define MOVE_FLY_LOW
Low flying object.
int roll_stat(void)
This rolls four 1-6 rolls and sums the best 3 of the 4.
char path[HUGE_BUF]
Filename of the map.
#define ADD_PLAYER_NEW
Name/password provided, so skip to roll stats.
void fix_luck(void)
Fixes luck of players, slowly move it towards 0.
void player_start_repeat(player *pl, const char *action, repeat_cb cb)
Start repeating an action.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
void drain_rod_charge(object *rod)
Drain charges from a rod.
int hide(object *op, object *skill)
Main hide handling.
#define FLAG_UNAGGRESSIVE
Monster doesn't attack players.
#define QUERY_FLAG(xyz, p)
#define FLAG_USE_SHIELD
Can this creature use a shield?
#define MSG_TYPE_ADMIN_PLAYER
Player coming/going/death.
int get_dex_bonus(int stat)
sstring anim_suffix
Used to determine combined animations.
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...
void SockList_Term(SockList *sl)
Frees all resources allocated by a SockList instance.
#define ARCH_DEPLETION
Archetype for depletion.
void fix_weight(void)
Check recursively the weight of all players, and fix what needs to be fixed.
void player_map_change_common(object *op, mapstruct *const oldmap, mapstruct *const newmap)
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
void account_char_save(Account_Chars *chars)
Saves the character information for the given account.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
#define FLAG_IDENTIFIED
Item is identifiable (e.g.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define EVENT_BORN
A new character has been created.
#define MOVE_FLYING
Combo of fly_low and fly_high.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
uint32_t last_character_flags
Last character flags (CS_STAT_CHARACTER_FLAGS) sent to client.
socket_struct * socket
Socket information for this player.
sstring msg
If this is a book/sign/magic mouth/etc.
uint32_t golem_count
To track the golem.
char password[16]
2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16
uint8_t balanced_stat_loss
If true, Death stat depletion based on level etc.
int has_carried_lights(const object *op)
Checks if op has a light source.
Try to find an arrow matching the target.
sstring race
Human, goblin, dragon, etc.
const Animations * animation
Animation of this item, NULL if not animated.
#define NDI_GREEN
SeaGreen.
objectlink * get_friends_of(const object *owner)
Get a list of friendly objects for the specified owner.
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.
language_t i18n_get_language_by_code(const char *code)
Find the identifier of a language from its code.
#define MSG_TYPE_COMMAND_NEWPLAYER
Create a new character - not really a command, but is responding to player input. ...
#define AP_NULL
Nothing specific.
#define ST_PLAY_AGAIN
Player left through a bed of reality, and can login again.
int playername_ok(const char *cp)
Is the player name valid.
Archetypes * archetypes()
Get archetypes.
Used to link together several objects.
#define MSG_TYPE_SPELL_END
A spell ends.
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. ...
#define offsetof(type, member)
The offsetof macro is part of ANSI C, but many compilers lack it, for example "gcc -ansi"...
player * get_player(player *p)
Create a player's object, initialize a player's structure.
#define CS_QUERY_SINGLECHAR
Single character response expected.
language_t language
The language the player wishes to use.
void remove_statbonus(object *op)
Subtracts stat-bonuses given by the class which the player has chosen.
int monster_can_detect_enemy(object *op, object *enemy, rv_vector *rv)
Determine if we can 'detect' the enemy.
void SockList_AddString(SockList *sl, const char *data)
Adds a string without length.
static int turn_transport(object *transport, object *captain, int dir)
Try to turn a transport in the desired direction.
uint8_t state
Input state of the player (name, password, etc).
#define FLAG_PARALYZED
Monster or player is paralyzed.
object * ob
The object representing the player.
uint32_t fire_on
Player should fire object, not move.
const char *const lose_msg[NUM_STATS]
Message when a player decreases permanently a stat.
const Face * face
Face with colors.
static archetype * get_player_archetype(archetype *at)
Get next player archetype from archetype list.
char killer[BIG_NAME]
Who killed this player.
static void update_transport_block(object *transport, int dir)
Update the move_type of a transport based on the direction.
void hiscore_check(object *op, int quiet)
Checks if player should enter the hiscore, and if so writes her into the list.
#define AP_NOPRINT
Don't print messages - caller will do that may be some that still print.
static void kill_player_permadeath(object *op)
Kills a player in permadeath mode.
void send_news(const object *op)
Send the news to a player.
void remove_locked_door(object *op)
Same as remove_door() but for locked doors.
#define P_OUT_OF_MAP
This space is outside the map.
char spellparam[MAX_BUF]
What param to add to spells.
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
int do_skill(object *op, object *part, object *skill, int dir, const char *string)
Main skills use function-similar in scope to cast_spell().
uint8_t last_anim
Last sequence used to draw face.
int move_ob(object *op, int dir, object *originator)
Op is trying to move in direction dir.
void do_learn_spell(object *op, object *spell, int special_prayer)
Actually makes op learn spell.
mapstruct * first_map
First map.
uint32_t braced
Will not move if braced, only attack.
struct Settings settings
Global settings.
uint8_t state
How the object was last drawn (animation)
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.
#define FLAG_SCARED
Monster is scared (mb player in future)
float last_speed
Last speed as sent to client.
void roll_stats(object *op)
Roll the initial player's statistics.
int32_t last_weight
Last weight as sent to client; -1 means do not send weight.
#define MSG_TYPE_SKILL_FAILURE
Failure in using skill.
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it...
usekeytype usekeys
Method for finding keys for doors.
#define FLAG_XRAYS
X-ray vision.
float last_character_load
Last value sent to the client.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
int16_t bed_y
x,y - coordinates of respawn (savebed).
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
void kill_player(object *op, const object *killer)
Handle a player's death.
uint32_t tag_t
Object tag, unique during the whole game.
unapplymode unapply
Method for auto unapply.
int16_t dam
How much damage this object does when hitting.
#define AT_PHYSICAL
Basic attack (1)
uint32_t pticks
Number of ticks since time reset.
uint32_t last_path_denied
Last spell denied sent to client.
int16_t gen_sp_armour
Penalty to sp regen from armour.
char savebed_map[MAX_BUF]
Map where player will respawn after death.
#define EVENT_PLAYER_DEATH
Global Death event.
#define HEAD(op)
Returns the head part of an object.
int get_randomized_dir(int dir)
Returns a random direction (1..8) similar to a given direction.
#define MSG_TYPE_ADMIN_NEWS
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
uint32_t ticks_played
How many ticks this player has played.
#define FLAG_WIZ
Object has special privilegies.
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...
void set_player_socket(player *p, socket_struct *ns)
This copies the data from the socket into the player structure.
#define FLAG_BEEN_APPLIED
Object was ever applied, for identification purposes.
uint8_t listening
Which priority will be used in info_all.
#define MSG_TYPE_COMMAND_DEBUG
Various debug type commands.
living stats
Str, Con, Dex, etc.
static void fire_misc_object(object *op, int dir)
Fires a misc (wand/rod/horn) object in 'dir'.
#define BALSL_LOSS_CHANCE_RATIO
void delete_character(const char *name)
Totally deletes a character.
living last_stats
Last stats as sent to client.
#define MAX_BUF
Used for all kinds of things.
#define MSG_TYPE_ATTACK
Attack related messages.
#define NRSPELLPATHS
Number of spell paths.
Standard mode, one random arrow.
int16_t invisible
How much longer the object will be invis.
int64_t last_skill_exp[MAX_SKILLS]
Last exp sent to client.
void add_friendly_object(object *op)
Add a new friendly object to the list of friendly objects.
Fire north whatever the facing direction.
uint64_t price_base(const object *obj)
Price an item based on its value or archetype value, type, identification/BUC status, and other heuristics.
void delete_map(mapstruct *m)
Frees the map, including the mapstruct.
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.
size_t strlcpy(char *dst, const char *src, size_t size)
Portable implementation of strlcpy(3).
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...
float speed_left
How much speed is left to spend this round.
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.
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...
#define MSG_TYPE_ATTRIBUTE_STAT_LOSS
struct mapstruct * map
Pointer to the map in which this object is present.
Skill-related defines, including subtypes.
uint32_t last_path_repelled
Last spell repelled sent to client.
void player_unready_range_ob(player *pl, object *ob)
Unready an object for a player.
int8_t levsp[11]
What sp bonus the player gained on that level.
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
const char * confdir
Configuration files.
int object_can_pick(const object *who, const object *item)
Finds out if an object can be picked up.
int is_true_undead(object *op)
Is the object a true undead?
uint32_t in_memory
Combination of IN_MEMORY_xxx flags.
Various statistics of objects.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
bool shop_contains(object *ob)
Check if an object is in a shop.
static const flag_definition flags[]
Flag mapping.
void SockList_AddChar(SockList *sl, unsigned char c)
Adds an 8 bit value.
treasurelist represents one logical group of items to be generated together.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
int8_t facing
Object is oriented/facing that way.
int check_race_and_class(living *stats, archetype *race, archetype *opclass)
This checks to see if the race and class are legal.
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
#define FLAG_CURSED
The object is cursed.
struct treasurelist * randomitems
Items to be generated.
void do_hidden_move(object *op)
For hidden creatures - a chance of becoming 'unhidden' every time they move - as we subtract off 'inv...
#define FLAG_ANIMATE
The object looks at archetype for faces.
void clear_los(player *pl)
Clears/initialises the los-array associated to the player controlling the object. ...
static void swap_stat(object *op, int swap_second)
Player finishes selecting what stats to swap.
sstring name_pl
The plural name of the object.
Object structure, the core of Crossfire.
void query_base_name(const object *op, int plural, char *buf, size_t size)
Query a short name for the item.
Maximum, exclusive, value.
object * find_key(object *pl, object *container, object *door)
We try to find a key for the door as passed.
static event_registration m
object * container
Current container being used.
#define object_decrease_nrof_by_one(xyz)
#define MSG_TYPE_VICTIM_DIED
Player died!
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.
#define FLAG_NEUTRAL
monster is from type neutral
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...
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...
#define FREE_AND_COPY(sv, nv)
Release the shared string if not NULL, and make it a reference to nv.
treasure * next
Next treasure-item in a linked list.
Also see SKILL_TOOL (74) below.
object * get_nearest_criminal(object *mon)
const char * localdir
Read/write data files.
object * last_skill_ob[MAX_SKILLS]
Exp objects sent to client.
void send_rules(const object *op)
Send the rules to a player.
MoveType move_type
Type of movement this object uses.
void recursive_roll(object *op, int dir, object *pusher)
An object is pushed by another which is trying to take its place.
sstring name
The name of the object, obviously...
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
Only for debugging purposes.
#define MSG_TYPE_ATTACK_NOATTACK
You avoid attacking.
uint32_t nrof
Number of objects.
#define MSG_TYPE_ADMIN_RULES
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_...
uint32_t no_shout
if True, player is *not *able to use shout command.
uint8_t darkness
Indicates level of darkness of map.
#define AC_PLAYER_STAT_NO_CHANGE
Do not make any stat adjustments.
unsigned int distance
Distance, in squares.
int face_player(object *op, int dir)
Face player in the given direction.
void object_set_enemy(object *op, object *enemy)
Sets the enemy of an object.
uint32_t run_on
Player should keep moving in dir until run is off.
#define MSG_TYPE_COMMAND_INFO
Generic info: resistances, etc.
#define CLEAR_FLAG(xyz, p)
treasure * items
Items in this list, linked.
uint8_t type
PLAYER, BULLET, etc.
void account_char_free(Account_Chars *chars)
This frees all data associated with the character information.
#define ADD_PLAYER_NO_MAP
Do not set the first map.
void get_password(object *op)
Waiting for the player's password.
bowtype_t bowtype
Which firemode?
int direction
General direction to the targer.
char search_str[MAX_BUF]
Item we are looking for.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
uint8_t delayed_buffers_used
Used items in delayed_buffers_used.
void do_some_living(object *op)
Regenerate hp/sp/gr, decreases food.
player * find_player(const char *plname)
Find a player by her full name.
#define FLAG_NO_STRENGTH
Strength-bonus not added to wc/dam.
#define FLAG_APPLIED
Object is ready for use by living.
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...
char * spellarg
Optional argument when casting obj::spell.
char first_map_ext_path[MAX_BUF]
Path used for per-race start maps.
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
void object_update_speed(object *op)
Updates the speed of an object.
treasurelist * find_treasurelist(const char *name)
Search for the given treasurelist by name.
void send_delayed_buffers(player *pl)
Send all delayed buffers for a player.
int16_t gen_sp
Bonuses to regeneration speed of sp.
#define ST_CHANGE_CLASS
New character, choosing class.
living last_applied_stats
Last applied stats sent to the client.
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.
#define MSG_TYPE_APPLY_SUCCESS
Was able to apply object.
object * inv
Pointer to the first object in the inventory.
int8_t levhp[11]
What hp bonus the player gained on that level.
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
static object * find_arrow(object *op, const char *type)
Find an arrow in the inventory and after that in the right type container (quiver).
int path_to_player(object *mon, object *pl, unsigned mindiff)
Returns the direction to the player, if valid.
#define FOR_OB_AND_BELOW_PREPARE(op_)
Constructs a loop iterating over an object and all objects below it in the same pile.
#define FLAG_STARTEQUIP
Object was given to player at start.
treasure is one element in a linked list, which together consist of a complete treasure-list.
void give_initial_items(object *pl, treasurelist *items)
Gives a new player her initial items.
void make_visible(object *op)
Makes an object visible again.
Don't generate bad/cursed items.
#define FIND_PLAYER_NO_HIDDEN_DM
Don't find hidden DMs.
void strip_endline(char *buf)
Removes endline from buffer (modified in place).
static const int32_t MAX_FOOD
#define GET_MAP_OB(M, X, Y)
Gets the bottom object on a map.
#define MAX_SPACES
This is used to prevent infinite loops.
int get_dam_bonus(int stat)
sstring skill
Name of the skill this object uses/grants.
int16_t maxsp
Max spell points.
int allowed_class(const object *op)
Returns true if the given player is a legal class.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_MONSTER
Will attack players.
void esrv_send_pickup(player *pl)
Sends the "pickup" state to pl if client wants it requested.
Will unapply objects when there no choice to unapply.
#define MSG_TYPE_SKILL
Messages related to skill use.
void receive_play_again(object *op, char key)
Player replied to play again / disconnect.
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.
SockList ** delayed_buffers
Buffers which will be sent after the player's tick completes.
uint8_t set_title
Players can set thier title.
#define NDI_UNIQUE
Print immediately, don't buffer.
uint32_t tmp_invis
Will invis go away when we attack?
int is_wraith_pl(object *op)
Tests if a player is a wraith.
#define FLAG_READY_BOW
not implemented yet
static bool starving(object *op)
bool pick_up(object *op, object *alt)
Try to pick up an item.
C function wrappers to interact with assets.
#define CS_QUERY_HIDEINPUT
Hide input being entered.
player * find_player_partial_name(const char *plname)
Find a player by a partial name.
bool is_criminal(object *op)
uint32_t has_hit
If set, weapon_sp instead of speed will count.
uint8_t magic
Max magic bonus to item If the entry is a list transition, 'magic' contains the difficulty required t...
static const char * gravestone_text(object *op, char *buf2, int len)
Create a text for a player's gravestone.
#define FLAG_WAS_WIZ
Player was once a wiz.
int absdir(int d)
Computes an absolute direction.
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.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
int32_t food
How much food in stomach.
const char * invis_race
What race invisible to?
void clear_player(player *pl)
Clears data in player structure.
Structure containing object statistics.
int get_party_password(object *op, partylist *party)
Ask the player for the password of the party she wants to join.
#define P_BLOCKSVIEW
This spot blocks the player's view.
struct archetype * item
Which item this link can be.
#define MSG_TYPE_ATTRIBUTE_RACE
Race-related changes.
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...
const char * unarmed_skill
Prefered skill to use in unarmed combat.
int16_t maxhp
Max hit points.
uint8_t subtype
Subtype of object.
uint16_t difficulty
What level the player should be to play here.
Only use keys in inventory.
void apply_map_builder(object *pl, int dir)
Global building function.
#define MAX_SKILLS
This is the maximum number of skills the game may handle.
#define FOR_BELOW_PREPARE(op_, it_)
Constructs a loop iterating over all objects below an object.
void player_cancel_repeat(player *pl)
If the player is repeating an action, cancel it.
Contains the base information we use to make up a packet we want to send.
char * emergency_mapname
Map to return players to in emergency.
#define P_IS_ALIVE
Something alive is on this space.
mapstruct * next
Next map, linked list.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
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...
int8_t wc
Weapon Class, lower WC increases probability of hitting.
#define ST_GET_NAME
Player just connected.
uint8_t roll_stat_points
How many stat points legacy (rolled) chars start with.
void object_update(object *op, int action)
object_update() updates the array which represents the map.
#define DETOUR_AMOUNT
This value basically determines how large a detour a monster will take from the direction path when l...
tag_t count
Unique object number for this object.
#define FLAG_UNIQUE
Item is really unique (UNIQUE_ITEMS)
petmode_t petmode
Which petmode?
#define FLAG_NO_PICK
Object can't be picked up.
void enter_player_savebed(object *op)
This is a basic little function to put the player back to his savebed.
uint8_t mapy
How large a map the client wants.
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...
#define FLAG_INV_LOCKED
Item will not be dropped from inventory.
player * find_player_options(const char *plname, int options, const mapstruct *map)
Find a player.
int die_roll(int num, int size, const object *op, int goodbad)
Roll a number of dice (2d3, 4d6).
bool is_wraith
Whether this player is a wraith or not, initialized at load time.
#define BALSL_MAX_LOSS_RATIO
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...
int object_can_merge(object *ob1, object *ob2)
Examines the 2 objects given to it, and returns true if they can be merged together, including inventory.
#define AT_DEATH
Chance of instant death, otherwise nothing (131072) peterm@soda.berkeley.edu.
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...
uint8_t * faces_sent
This is a bitmap on sent face status.
object * object_find_by_type(const object *who, int type)
Find object in inventory.
object clone
An object from which to do object_copy()
void move_player_attack(object *op, int dir)
The player is also actually going to try and move (not fire weapons).
bool object_value_set(const object *op, const char *const key)
Determine if an extra value is set.
objectlink * next
Next item to link to.
void display_motd(const object *op)
Sends the message of the day to the player.
#define FOR_BELOW_FINISH()
Finishes FOR_BELOW_PREPARE().
uint8_t resurrection
Ressurection possible w/ permadeth on.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Main dispatch when someone casts a spell.
SockList inbuf
If we get an incomplete packet, this is used to hold the data.
void * repeat_func_data
Arguments to pass into repeat_func.
void apply_anim_suffix(object *who, const char *suffix)
Applies a compound animation to an object.
uint32_t path_attuned
Paths the object is attuned to.
Generated items have the FLAG_STARTEQUIP.
#define ST_GET_PASSWORD
Name entered, now for password.
party_rejoin_mode rejoin_party
Whether to rejoin or not party at login.
#define FLAG_FREED
Object is in the list of free objects.
object * enemy
Monster/player to follow even if not closest.
void Send_With_Handling(socket_struct *ns, SockList *sl)
Calls Write_To_Socket to send data to the client.
#define EVENT_DEATH
Player or monster dead.
void each(std::function< void(T *)> op)
Apply a function to each asset.
static int save_life(object *op)
Can the player be saved by an item?