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)) {
127 if (
pl->socket == ns)
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;
335 op->speed_left = 0.5;
359 strncpy(p->
title,
op->arch->clone.name,
sizeof(p->
title)-1);
509 players.push_back(at);
549 for (ol =
list, lastdist = 1000; ol != NULL; ol = ol->
next) {
603 #define DETOUR_AMOUNT 2
618 #define MAX_SPACES 50
654 int lastx, lasty, dir, i, diff, firstdir = 0, lastdir,
max =
MAX_SPACES, mflags, blocked;
672 while (diff > 1 &&
max > 0) {
785 if (
pl->randomitems != NULL)
835 LOG(
llevError,
"give_initial_items: Removing duplicate object %s\n",
op->name);
908 op->chosen_skill = NULL;
914 if (
op->contr->socket->login_method == 0) {
943 if (
op->contr->socket->login_method > 0) {
957 if (
key ==
'q' ||
key ==
'Q') {
961 }
else if (
key ==
'a' ||
key ==
'A') {
963 const char *
name =
op->name;
971 op->contr->password[0] =
'~';
974 if (
pl->socket->login_method >= 1 &&
pl->socket->account_name != NULL) {
1027 op->contr->party_to_join = party;
1039 int roll[4], i, low_index, k;
1041 for (i = 0; i < 4; ++i)
1042 roll[i] = (
int)
RANDOM()%6+1;
1044 for (i = 0, low_index = 0, k = 7; i < 4; ++i)
1049 for (i = 0, k = 0; i < 4; ++i) {
1073 int sum =
op->stats.Str+
op->stats.Dex+
op->stats.Int+
op->stats.Con+
op->stats.Wis+
op->stats.Pow+
op->stats.Cha;
1075 op->stats.Str = roundf(scale *
op->stats.Str);
1076 op->stats.Dex = roundf(scale *
op->stats.Dex);
1077 op->stats.Int = roundf(scale *
op->stats.Int);
1078 op->stats.Con = roundf(scale *
op->stats.Con);
1079 op->stats.Wis = roundf(scale *
op->stats.Wis);
1080 op->stats.Pow = roundf(scale *
op->stats.Pow);
1081 op->stats.Cha = roundf(scale *
op->stats.Cha);
1084 statsort[0] =
op->stats.Str;
1085 statsort[1] =
op->stats.Dex;
1086 statsort[2] =
op->stats.Int;
1087 statsort[3] =
op->stats.Con;
1088 statsort[4] =
op->stats.Wis;
1089 statsort[5] =
op->stats.Pow;
1090 statsort[6] =
op->stats.Cha;
1094 if (statsort[i] < statsort[i+1]) {
1096 statsort[i] = statsort[i+1];
1104 op->stats.Str = statsort[0];
1105 op->stats.Dex = statsort[1];
1106 op->stats.Con = statsort[2];
1107 op->stats.Int = statsort[3];
1108 op->stats.Wis = statsort[4];
1109 op->stats.Pow = statsort[5];
1110 op->stats.Cha = statsort[6];
1112 op->contr->orig_stats.Str =
op->stats.Str;
1113 op->contr->orig_stats.Dex =
op->stats.Dex;
1114 op->contr->orig_stats.Int =
op->stats.Int;
1115 op->contr->orig_stats.Con =
op->stats.Con;
1116 op->contr->orig_stats.Wis =
op->stats.Wis;
1117 op->contr->orig_stats.Pow =
op->stats.Pow;
1118 op->contr->orig_stats.Cha =
op->stats.Cha;
1124 op->contr->levhp[1] = 9;
1125 op->contr->levsp[1] = 6;
1126 op->contr->levgrace[1] = 3;
1129 op->stats.hp =
op->stats.maxhp;
1130 op->stats.sp =
op->stats.maxsp;
1131 op->stats.grace =
op->stats.maxgrace;
1132 op->contr->orig_stats =
op->stats;
1158 if (
op->contr->swap_first == -1) {
1159 LOG(
llevError,
"player.c:swap_stat() - swap_first is -1\n");
1173 op->stats.Str =
op->contr->orig_stats.Str;
1174 op->stats.Dex =
op->contr->orig_stats.Dex;
1175 op->stats.Con =
op->contr->orig_stats.Con;
1176 op->stats.Int =
op->contr->orig_stats.Int;
1177 op->stats.Wis =
op->contr->orig_stats.Wis;
1178 op->stats.Pow =
op->contr->orig_stats.Pow;
1179 op->stats.Cha =
op->contr->orig_stats.Cha;
1186 op->contr->levhp[1] = 9;
1187 op->contr->levsp[1] = 6;
1188 op->contr->levgrace[1] = 3;
1191 op->stats.hp =
op->stats.maxhp;
1192 op->stats.sp =
op->stats.maxsp;
1193 op->stats.grace =
op->stats.maxgrace;
1194 op->contr->orig_stats =
op->stats;
1195 op->contr->swap_first = -1;
1214 int keynum =
key-
'0';
1215 static const int8_t stat_trans[] = {
1226 if (keynum > 0 && keynum <= 7) {
1227 if (
op->contr->swap_first == -1) {
1228 op->contr->swap_first = stat_trans[keynum];
1242 if (
op->map == NULL) {
1292 if (
key ==
'q' ||
key ==
'Q') {
1297 if (
key ==
'd' ||
key ==
'D') {
1320 op->contr->last_save_tick =
pticks;
1324 "Welcome to Crossfire!\n Press `?' for help\n");
1328 "%s entered the game.",
op->name);
1354 if (oldmap !=
op->map) {
1356 op->contr->bed_x =
op->x;
1357 op->contr->bed_y =
op->y;
1375 int x =
op->x,
y =
op->y;
1384 op->stats =
op->contr->orig_stats;
1391 strncpy(
op->contr->title,
op->arch->clone.name,
sizeof(
op->contr->title)-1);
1392 op->contr->title[
sizeof(
op->contr->title)-1] =
'\0';
1399 op->stats.hp =
op->stats.maxhp;
1400 op->stats.sp =
op->stats.maxsp;
1401 op->stats.grace = 0;
1431 int i, stat, failure=0;
1503 strlcpy(
op->contr->title,
op->arch->clone.name,
sizeof(
op->contr->title));
1531 op->stats.hp =
op->stats.maxhp;
1532 op->stats.sp =
op->stats.maxsp;
1533 op->stats.grace = 0;
1569 op->contr->last_save_tick =
pticks;
1603 if (
key !=
'y' &&
key !=
'Y' &&
key !=
'q' &&
key !=
'Q') {
1606 "OK, continuing to play.");
1615 "%s quits the game.",
1618 strcpy(
op->contr->killer,
"quit");
1639 if (
op->contr->socket->account_chars != NULL) {
1644 op->contr->socket->account_chars = NULL;
1662 if (
op->stats.hp < 0) {
1668 if (
op->enemy == NULL) {
1678 if (
op->enemy->map == NULL) {
1696 for (diff = 0; diff < 3; diff++) {
1720 int j, k, wvratio, current_ratio;
1721 char putstring[128], tmpstr[16];
1748 switch (
op->contr->mode) {
1794 "item name: %s item type: %d weight/value: %d",
1799 snprintf(putstring,
sizeof(putstring),
"...flags: ");
1800 for (k = 0; k < 4; k++) {
1801 for (j = 0; j < 32; j++) {
1802 if ((
tmp->flags[k]>>j)&0x01) {
1803 snprintf(tmpstr,
sizeof(tmpstr),
"%d ", k*32+j);
1804 strcat(putstring, tmpstr);
1852 static int checks[] = {
1880 for (
int m = 0; checks[
m] != 0;
m++) {
1900 if (current_ratio >= wvratio) {
1955 object *
tmp = NULL, *ntmp;
1956 int attacknum, attacktype, betterby = 0, i;
1963 && arrow->race ==
type
1971 }
else if (arrow->type ==
ARROW && arrow->race ==
type) {
1973 if (target->
race != NULL
1974 && arrow->slaying != NULL
1975 && strstr(arrow->slaying, target->
race)) {
1982 betterby = (arrow->magic+arrow->stats.dam)*2;
1985 for (attacknum = 0; attacknum <
NROFATTACKS; attacknum++) {
1986 attacktype = 1<<attacknum;
1987 if ((arrow->attacktype&attacktype) && (target->
arch->
clone.
resist[attacknum]) < 0)
1988 if (((arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100) > betterby) {
1990 betterby = (arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100;
1993 if ((2+arrow->magic+arrow->stats.dam) > betterby) {
1995 betterby = 2+arrow->magic+arrow->stats.dam;
1997 if (arrow->title && (1+arrow->magic+arrow->stats.dam) > betterby) {
1999 betterby = 1+arrow->magic+arrow->stats.dam;
2027 int i, mflags,
found, number;
2030 if (
op->map == NULL)
2035 if (number > (
op->stats.Dex+(
op->chosen_skill ?
op->chosen_skill->level :
op->level)))
2043 for (i = 0,
found = 0; i < 20; i++) {
2093 int fire_bow(
object *
op,
object *arrow,
int dir,
int wc_mod, int16_t sx, int16_t sy) {
2096 int bowspeed, mflags;
2101 "You can't shoot yourself!");
2112 "You cannot use %s without the skill %s", bow->
name, bow->
skill);
2122 LOG(
llevError,
"Range: bow without activated bow (%s).\n",
op->name);
2128 "Your %s is broken.",
2141 if (arrow == NULL) {
2143 if (arrow == NULL) {
2147 "You have no %s left.",
2164 if (arrow->
nrof == 0) {
2171 if (arrow == NULL) {
2173 "You have no %s left.",
2185 op->speed_left = 0.01-(float)
FABS(
op->speed)*100/bowspeed;
2220 int mod = bow->
magic
2227 int plmod = (
op->chosen_skill ?
op->chosen_skill->level :
op->level);
2228 if (plmod+mod > 140)
2230 else if (plmod+mod < -100)
2232 arrow->
stats.
wc = 20-(int8_t)plmod-(int8_t)mod;
2234 arrow->
level =
op->chosen_skill ?
op->chosen_skill->level :
op->level;
2287 if ((
a % 8) + 1 ==
b || (
a + 6 % 8) + 1 ==
b)
2309 int ret = 0, wcmod = 0;
2313 }
else if (
op->contr->bowtype >=
bow_n &&
op->contr->bowtype <=
bow_nw) {
2351 "You have no range item readied.");
2359 if (
item->stats.food <= 0) {
2363 "The %s goes poof.",
2367 }
else if (
item->type ==
ROD) {
2372 "The %s whines for a while, but nothing happens.",
2382 }
else if (
item->type ==
ROD) {
2402 switch (
op->contr->shoottype) {
2423 op->contr->golem_count = 0;
2429 if (!
op->chosen_skill) {
2432 "You have no applicable skill to use.");
2444 "Illegal shoot type.");
2472 if (container->
inv == NULL)
2506 if (
pl != container) {
2525 || (
pl->contr->usekeys ==
keyrings && (!container->
race || strcmp(container->
race,
"keys")))) {
2532 "The %s in your %s vibrates as you approach the door",
2533 name_tmp, name_cont);
2572 "You open the door with the %s",
2589 if (door->
msg && *door->
msg) {
2596 if (door->
type ==
DOOR &&
op->contr && !
op->contr->run_on) {
2624 object *
mon, *tpl, *mon_owner;
2626 int on_battleground;
2629 if (
op->contr->transport)
2630 tpl =
op->contr->transport;
2633 assert(tpl->
map != NULL);
2712 if (
op->contr->braced)
2716 if (
op->contr->tmp_invis ||
op->hide)
2728 && (
op->contr->peaceful && !on_battleground)) {
2729 if (!
op->contr->braced) {
2734 "You withhold your attack");
2736 if (
op->contr->tmp_invis ||
op->hide)
2762 if (
op->weapon_speed_left < 0) {
2763 op->speed_left = -0.01;
2766 op->weapon_speed_left -= 1.0;
2789 else if (bef != tpl->
map) {
2807 if (dir == 1 || dir == 5) {
2809 for (
y = 0;
y <= sy;
y++) {
2810 for (
x = 0;
x < sx;
x++) {
2817 }
else if (dir == 3 || dir == 7) {
2819 for (
y = 0;
y < sy;
y++) {
2820 for (
x = 0;
x <= sx;
x++) {
2830 for (part = transport; part; part = part->
more) {
2846 int x,
y, scroll_dir = 0;
2853 if (transport->
direction == 1 && dir == 8) {
2855 }
else if (transport->
direction == 2 && dir == 3) {
2857 }
else if (transport->
direction == 3 && dir == 2) {
2859 }
else if (transport->
direction == 5 && dir == 6) {
2861 }
else if (transport->
direction == 6 && dir == 5) {
2863 }
else if (transport->
direction == 7 && dir == 8) {
2865 }
else if (transport->
direction == 8 && dir == 7) {
2867 }
else if (transport->
direction == 8 && dir == 1) {
2879 if (
x != transport->
x ||
y != transport->
y) {
2884 pl->contr->do_los = 1;
2885 pl->map = transport->
map;
2889 pl->contr->socket->update_look = 1;
2890 pl->contr->socket->look_position = 0;
2949 object *transport =
op->contr->transport;
2955 if ((dir < 0) || (dir >= 9)) {
2956 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
2969 if (transport->
contr !=
op->contr)
2982 if (
op->speed_left < 0.0)
2983 op->speed_left = -0.01;
2999 if (
op->contr->fire_on) {
3009 if (
op->contr->fire_on || (
op->contr->run_on && pick != 0)) {
3010 op->direction = dir;
3028 object *transport =
op->contr->transport;
3034 if ((dir < 0) || (dir >= 9)) {
3035 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
3048 if (transport->
contr !=
op->contr)
3066 if (
op->contr->fire_on ||
op->contr->run_on) {
3067 op->direction = dir;
3087 if (
op->contr->hidden) {
3088 op->invisible = 1000;
3097 if (!
op->invisible) {
3100 "Your invisibility spell runs out.");
3121 op->contr->golem_count = 0;
3133 "You can stretch your stiff joints once more.");
3137 if (
op->direction && (
op->contr->run_on ||
op->contr->fire_on)) {
3146 if (
op->speed_left > 0)
3177 "Your %s vibrates violently, then evaporates.",
3182 if (
op->stats.hp < 0)
3183 op->stats.hp =
op->stats.maxhp;
3184 if (
op->stats.food < 0)
3189 LOG(
llevError,
"Error: LIFESAVE set without applied object.\n");
3239 time_t now = time(NULL);
3241 strncpy(buf2,
" R.I.P.\n\n", len);
3243 snprintf(
buf,
sizeof(
buf),
"%s the %s\n",
op->name,
op->contr->title);
3245 snprintf(
buf,
sizeof(
buf),
"%s\n",
op->name);
3246 strncat(buf2,
" ", 20-strlen(
buf)/2);
3247 strncat(buf2,
buf, len-strlen(buf2)-1);
3249 snprintf(
buf,
sizeof(
buf),
"who was in level %d when killed\n",
op->level);
3251 snprintf(
buf,
sizeof(
buf),
"who was in level %d when died.\n\n",
op->level);
3252 strncat(buf2,
" ", 20-strlen(
buf)/2);
3253 strncat(buf2,
buf, len-strlen(buf2)-1);
3255 snprintf(
buf,
sizeof(
buf),
"by %s.\n\n",
op->contr->killer);
3256 strncat(buf2,
" ", 21-strlen(
buf)/2);
3257 strncat(buf2,
buf, len-strlen(buf2)-1);
3259 strftime(
buf,
MAX_BUF,
"%b %d %Y\n", localtime(&now));
3260 strncat(buf2,
" ", 20-strlen(
buf)/2);
3261 strncat(buf2,
buf, len-strlen(buf2)-1);
3266 return op->stats.food <= 0;
3277 int last_food =
op->stats.food;
3278 int gen_hp, gen_sp, gen_grace;
3281 int rate_grace = 2000;
3286 if (
op->contr->gen_hp >= 0)
3287 gen_hp = (
op->contr->gen_hp+1)*
op->stats.maxhp;
3289 gen_hp =
op->stats.maxhp;
3290 rate_hp -= rate_hp/2*
op->contr->gen_hp;
3292 if (
op->contr->gen_sp >= 0)
3293 gen_sp = (
op->contr->gen_sp+1)*
op->stats.maxsp;
3295 gen_sp =
op->stats.maxsp;
3296 rate_sp -= rate_sp/2*
op->contr->gen_sp;
3298 if (
op->contr->gen_grace >= 0)
3299 gen_grace = (
op->contr->gen_grace+1)*
op->stats.maxgrace;
3301 gen_grace =
op->stats.maxgrace;
3302 rate_grace -= rate_grace/2*
op->contr->gen_grace;
3307 gen_sp = gen_sp*10/
MAX(
op->contr->gen_sp_armour, 10);
3308 if (
op->stats.sp <
op->stats.maxsp) {
3313 if (
op->contr->digestion < 0)
3314 op->stats.food +=
op->contr->digestion;
3315 else if (
op->contr->digestion > 0
3317 op->stats.food = last_food;
3320 op->last_sp = rate_sp/(
MAX(gen_sp, 20)+10);
3325 if (--
op->last_grace < 0) {
3326 if (
op->stats.grace <
op->stats.maxgrace/2)
3328 op->last_grace = rate_grace/(
MAX(gen_grace, 20)+10);
3334 if (
op->stats.hp <
op->stats.maxhp) {
3339 if (
op->contr->digestion < 0)
3340 op->stats.food +=
op->contr->digestion;
3341 else if (
op->contr->digestion > 0
3343 op->stats.food = last_food;
3346 op->last_heal = rate_hp/(
MAX(gen_hp, 20)+10);
3350 if (--
op->last_eat < 0) {
3351 int bonus =
MAX(
op->contr->digestion, 0);
3352 int penalty =
MAX(-
op->contr->digestion, 0);
3353 if (
op->contr->gen_hp > 0)
3354 op->last_eat = 25*(1+bonus)/(
op->contr->gen_hp+penalty+1);
3356 op->last_eat = 25*(1+bonus)/(penalty+1);
3371 object *flesh = NULL;
3377 "You blindly grab for a bite of food.");
3379 if (
op->stats.food >= 0 ||
op->stats.hp < 0)
3388 if (
op->stats.food < 0 &&
op->stats.hp >= 0 && flesh) {
3390 "You blindly grab for a bite of food.");
3418 if (
op->container) {
3433 if (
tmp->nrof > 1) {
3463 "Your body feels cleansed");
3474 "Your mind feels clearer");
3508 assert(trophy != NULL);
3510 "You have been defeated in combat!\n"
3511 "Local medics have saved your life...");
3516 op->stats.hp =
op->stats.maxhp;
3517 if (
op->stats.food <= 0)
3523 snprintf(
buf,
sizeof(
buf),
"%s's %s",
op->name,
tmp->name);
3526 snprintf(
buf,
sizeof(
buf),
3527 "This %s was %s %s the %s, who was defeated at level %d by %s.\n",
3528 tmp->name,
tmp->type ==
FLESH ?
"cut off" :
"taken from",
3529 op->name,
op->contr->title,
3530 (
int)(
op->level),
op->contr->killer);
3536 tmp->materialname = NULL;
3542 op->contr->braced = 0;
3551 snprintf(
buf,
sizeof(
buf),
"%s starved to death.",
op->name);
3552 strcpy(
op->contr->killer,
"starvation");
3554 snprintf(
buf,
sizeof(
buf),
"%s died.",
op->name);
3575 int will_kill_again;
3603 for (
z = 0;
z < num_stats_lose;
z++) {
3622 if (deparch == NULL) {
3642 if (this_stat < 0) {
3644 int keep_chance = this_stat*this_stat;
3646 if (keep_chance < 1)
3662 if (lose_this_stat) {
3672 if (this_stat >= -50) {
3688 if (god && (strcmp(god,
"none")))
3691 "For a brief moment you feel the holy presence of %s protecting you",
3696 "For a brief moment you feel a holy presence protecting you.");
3705 snprintf(
buf,
sizeof(
buf),
"%s's gravestone",
op->name);
3707 snprintf(
buf,
sizeof(
buf),
"%s's gravestones",
op->name);
3709 snprintf(
buf,
sizeof(
buf),
"RIP\nHere rests the hero %s the %s,\n"
3712 op->name,
op->contr->title,
3726 if (
op->stats.food < 100)
3727 op->stats.food = 900;
3728 op->stats.hp =
op->stats.maxhp;
3729 op->stats.sp =
MAX(
op->stats.sp,
op->stats.maxsp);
3730 op->stats.grace =
MAX(
op->stats.grace,
op->stats.maxgrace);
3748 op->contr->braced = 0;
3754 op->contr->mode = 0;
3764 will_kill_again = 0;
3767 will_kill_again |=
tmp->attacktype;
3769 if (will_kill_again) {
3776 force->speed_left = -5.0;
3779 if (will_kill_again&(1<<at))
3780 force->resist[at] = 100;
3823 op->contr->golem_count = 0;
3835 op->stats.hp =
op->stats.maxhp;
3841 sizeof(
op->contr->maplevel));
3842 if (
op->map != NULL)
3854 if (
op->contr->socket->account_chars != NULL) {
3859 op->contr->socket->account_chars = NULL;
3871 snprintf(
buf,
sizeof(
buf),
"%s",
op->name);
3874 tmp->level =
op->level;
3881 snprintf(ac_buf,
sizeof(ac_buf),
"%s",
op->contr->socket->account_name);
3903 LOG(
llevDebug,
"Fixed inventory in %s (%d -> %d)\n",
pl->ob->name, old, sum);
3914 if (!
pl->ob->contr->state)
3932 object *skop, *spob;
3938 LOG(
llevError,
"Player %s lacks critical skill use_magic_item!\n",
op->name);
3941 spob = throw_ob->
inv;
3964 op->contr->tmp_invis = 0;
3965 if (
op->contr->invis_race)
3997 int i,
level = 0, mflag;
4000 if (!
ob || !
ob->map)
4011 level = -(10+(2*
ob->map->darkness));
4041 if (!
op || !
op->map)
4047 if (
op->type ==
PLAYER &&
op->contr->run_on) {
4048 if (!skop || num >= skop->
level) {
4050 "You ran too much! You are no longer hidden!");
4056 num +=
op->map->difficulty;
4060 || ((
op->invisible -= num) <= 0)) {
4064 "You moved out of hiding! You are visible!");
4065 }
else if (
op->type ==
PLAYER && skop) {
4079 int i, friendly = 0,
player = 0, mflags;
4092 for (i = 1; i < 9; i++) {
4154 LOG(
llevError,
"player_can_view() called for non-player object\n");
4176 if (
FABS(dx) <= (
pl->contr->socket->mapx/2)
4177 &&
FABS(dy) <= (
pl->contr->socket->mapy/2)
4178 && !
pl->contr->blocked_los[dx+(
pl->contr->socket->mapx/2)][dy+(
pl->contr->socket->mapy/2)])
4203 if (
op->contr &&
op->contr->tmp_invis == 0)
4207 if (
op->hide || !
op->contr || (
op->contr &&
op->contr->tmp_invis)) {
4210 op->hide ?
"unhidden" :
"visible");
4249 && strcmp(
tmp->name,
"battleground") == 0
4258 if (invtmp != NULL) {
4259 if (
x != NULL &&
y != NULL)
4265 if (
x != NULL &&
y != NULL)
4270 if (trophy != NULL) {
4271 if (
tmp->other_arch) {
4272 *trophy =
tmp->other_arch;
4313 if (trlist == NULL ||
who->type !=
PLAYER)
4319 if (tr == NULL || tr->
item == NULL) {
4333 "You gained the ability of %s",
4347 if (
item->invisible) {
4350 "You gained the ability of %s",
4369 if (
item->msg != NULL)
4375 if (
item->animation) {
4377 who->animation =
item->animation;
4378 who->anim_speed =
item->anim_speed;
4399 snprintf(
buf,
sizeof(
buf),
"You feel attuned to ");
4401 if (
item->path_attuned&(1<<i)) {
4403 strcat(
buf,
" and ");
4424 if (
item->msg != NULL)
4456 for (i = 0; i < static_cast<int>(
range_size); i++) {
4457 if (
pl->ranges[i] ==
ob) {
4458 pl->ranges[i] = NULL;
4459 if (
pl->shoottype == i) {
4487 if (
pl->delayed_buffers_used ==
pl->delayed_buffers_allocated) {
4488 pl->delayed_buffers_allocated += 5;
4489 pl->delayed_buffers =
static_cast<SockList **
>(realloc(
pl->delayed_buffers,
pl->delayed_buffers_allocated *
sizeof(
pl->delayed_buffers[0])));
4490 if (!
pl->delayed_buffers) {
4491 LOG(
llevError,
"Unable to allocated %d delayed buffers, aborting\n",
pl->delayed_buffers_allocated);
4494 for (uint8_t s =
pl->delayed_buffers_allocated - 5; s < pl->delayed_buffers_allocated; s++) {
4498 sl =
pl->delayed_buffers[
pl->delayed_buffers_used];
4499 pl->delayed_buffers_used++;
#define object_was_destroyed(op, old_tag)
#define ADD_PLAYER_NO_STATS_ROLL
bool object_value_set(const object *op, const char *const key)
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
#define GET_MAP_OB(M, X, Y)
#define MSG_TYPE_COMMAND_NEWPLAYER
int do_skill(object *op, object *part, object *skill, int dir, const char *string)
void apply_changes_to_player(object *pl, object *change, int limit_stats)
int check_pick(object *op)
void make_visible(object *op)
object * object_get_owner(object *op)
static void kill_player_permadeath(object *op)
void SockList_AddInt(SockList *sl, uint32_t data)
object * object_find_by_type_subtype(const object *who, int type, int subtype)
void object_update_turn_face(object *op)
void remove_friendly_object(object *op)
void pets_terminate_all(object *owner)
int face_player(object *op, int dir)
static struct Command_Line_Options options[]
#define MSG_TYPE_COMMAND_SUCCESS
const char * unarmed_skill
static int player_fire_bow(object *op, int dir)
void kill_player(object *op, const object *killer)
void command_search_items(object *op, const char *params)
static archetype * get_player_archetype(archetype *at)
#define MSG_TYPE_ADMIN_PLAYER
void LOG(LogLevel logLevel, const char *format,...)
int monster_can_detect_enemy(object *op, object *enemy, rv_vector *rv)
int path_to_player(object *mon, object *pl, unsigned mindiff)
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
int blocked_link(object *ob, mapstruct *m, int16_t sx, int16_t sy)
void recursive_roll(object *op, int dir, object *pusher)
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
char first_map_path[MAX_BUF]
#define QUERY_FLAG(xyz, p)
void remove_locked_door(object *op)
const char *const spellpathnames[NRSPELLPATHS]
void do_learn_spell(object *op, object *spell, int special_prayer)
char first_map_ext_path[MAX_BUF]
void esrv_new_player(player *pl, uint32_t weight)
uint64_t price_base(const object *obj)
SockList * player_get_delayed_buffer(player *pl)
objectlink * get_friends_of(const object *owner)
void esrv_send_inventory(object *pl, object *op)
void roll_again(object *op)
player * find_player_socket(const socket_struct *ns)
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
static object * find_better_arrow(object *op, object *target, const char *type, int *better)
void SockList_AddString(SockList *sl, const char *data)
#define FOR_BELOW_PREPARE(op_, it_)
void object_set_enemy(object *op, object *enemy)
static bool starving(object *op)
#define MSG_TYPE_VICTIM_DIED
static int turn_transport(object *transport, object *captain, int dir)
void spring_trap(object *trap, object *victim)
object * get_nearest_player(object *mon)
void apply_map_builder(object *pl, int dir)
object * arch_present_in_ob(const archetype *at, const object *op)
void object_set_owner(object *op, object *owner)
void esrv_send_pickup(player *pl)
living last_applied_stats
#define MSG_TYPE_ATTRIBUTE
void player_set_own_title(struct player *pl, const char *title)
#define SET_ANIMATION(ob, newanim)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
#define CS_QUERY_SINGLECHAR
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
int allowed_class(const object *op)
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
static const flag_definition flags[]
int change_skill(object *who, object *new_skill, int flag)
void object_copy(const object *src_ob, object *dest_ob)
char savebed_map[MAX_BUF]
treasurelist * find_treasurelist(const char *name)
void fix_object(object *op)
object * object_find_by_flag_applied(const object *who, int flag)
int player_can_view(object *pl, object *op)
void confirm_password(object *op)
void get_name(object *op)
#define SOUND_TYPE_LIVING
#define BALSL_LOSS_CHANCE_RATIO
void send_account_players(socket_struct *ns)
#define MSG_TYPE_COMMAND_ERROR
void esrv_add_spells(player *pl, object *spell)
int apply_manual(object *op, object *tmp, int aflag)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
#define BALSL_MAX_LOSS_RATIO
void hiscore_check(object *op, int quiet)
AssetsManager * getManager()
object * object_insert_in_ob(object *op, object *where)
int handle_newcs_player(object *op)
int16_t resist[NROFATTACKS]
#define MSG_TYPE_SPELL_END
const char *const lose_msg[NUM_STATS]
void player_set_state(player *pl, uint8_t state)
#define FOR_BELOW_FINISH()
void add_statbonus(object *op)
void esrv_send_item(object *pl, object *op)
const char *const short_stat_name[NUM_STATS]
#define MSG_TYPE_COMMAND_DEBUG
void set_player_socket(player *p, socket_struct *ns)
void remove_door(object *op)
static event_registration m
void clear_los(player *pl)
Account_Chars * account_chars
void object_free_drop_inventory(object *ob)
static int turn_one_transport(object *transport, object *captain, int dir)
void object_update(object *op, int action)
int get_party_password(object *op, partylist *party)
void player_unready_range_ob(player *pl, object *ob)
#define object_decrease_nrof_by_one(xyz)
uint8_t balanced_stat_loss
#define BALSL_NUMBER_LOSSES_RATIO
static void flee_player(object *op)
#define MSG_TYPE_ATTRIBUTE_STAT_LOSS
#define MSG_TYPE_ADMIN_NEWS
bool is_criminal(object *op)
sstring add_refcount(sstring str)
int check_race_and_class(living *stats, archetype *race, archetype *opclass)
void enter_player_savebed(object *op)
const char * determine_god(object *op)
#define MSG_TYPE_ATTRIBUTE_RACE
short freearr_y[SIZEOFFREE]
#define ST_CHANGE_PASSWORD_CONFIRM
int move_ob(object *op, int dir, object *originator)
#define MSG_TYPE_APPLY_SUCCESS
void query_name(const object *op, char *buf, size_t size)
player * find_player_options(const char *plname, int options, const mapstruct *map)
void do_hidden_move(object *op)
#define FLAG_KNOWN_CURSED
static object * pick_arrow_target(object *op, const char *type, int dir)
static int action_makes_visible(object *op)
#define ADD_PLAYER_NO_MAP
int64_t calc_skill_exp(const object *who, const object *op, const object *skill)
void account_char_free(Account_Chars *chars)
static void fire_misc_object(object *op, int dir)
static void loot_object(object *op)
void party_leave(object *op)
sstring add_string(const char *str)
int account_remove_player(const char *account_name, const char *player_name)
void apply_anim_suffix(object *who, const char *suffix)
#define FOR_OB_AND_BELOW_FINISH()
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
int apply_container(object *op, object *sack, int aflags)
static int similar_direction(int a, int b)
void enter_player_maplevel(object *op)
void query_short_name(const object *op, char *buf, size_t size)
void SockList_AddChar(SockList *sl, unsigned char c)
void set_attr_value(living *stats, int attr, int8_t value)
void delete_character(const char *name)
int out_of_map(mapstruct *m, int x, int y)
uint32_t last_character_flags
int64_t last_skill_exp[MAX_SKILLS]
int has_carried_lights(const object *op)
void object_update_speed(object *op)
#define FREE_AND_COPY(sv, nv)
void do_some_living(object *op)
uint8_t stat_loss_on_death
static const char * gravestone_text(object *op, char *buf2, int len)
int hideability(object *ob)
void leave(player *pl, int draw_exit)
void object_free(object *ob, int flags)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
player * find_player(const char *plname)
static object * find_arrow(object *op, const char *type)
static void kill_player_not_permadeath(object *op)
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
#define FLAG_UNAGGRESSIVE
void display_motd(const object *op)
int object_matches_string(object *pl, object *op, const char *name)
const char *const drain_msg[NUM_STATS]
#define FIND_PLAYER_PARTIAL_NAME
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
#define AC_PLAYER_STAT_NO_CHANGE
#define FLAG_CAN_USE_SKILL
void each(std::function< void(T *)> op)
#define FOR_OB_AND_BELOW_PREPARE(op_)
int get_rangevector_from_mapcoord(const mapstruct *m, int x, int y, const object *op2, rv_vector *retval)
int16_t SP_level_spellpoint_cost(object *caster, object *spell, int flags)
void delete_map(mapstruct *m)
int random_roll(int min, int max, const object *op, int goodbad)
int get_dam_bonus(int stat)
void SockList_Init(SockList *sl)
int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
void receive_play_again(object *op, char key)
object * object_find_by_type_without_flags(const object *who, int type, int *flags, int num_flags)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
void fire(object *op, int dir)
int push_ob(object *who, int dir, object *pusher)
void fatal(enum fatal_error err)
object * find_skill_by_name(object *who, const char *name)
object * last_skill_ob[MAX_SKILLS]
void apply_death_exp_penalty(object *op)
int get_dex_bonus(int stat)
void move_player_attack(object *op, int dir)
Archetypes * archetypes()
static std::shared_ptr< inja::Environment > env
size_t strlcpy(char *dst, const char *src, size_t size)
object * object_new(void)
int is_wraith_pl(object *op)
object * create_archetype(const char *name)
void cast_dust(object *op, object *throw_ob, int dir)
void free_string(sstring str)
int transfer_ob(object *op, int x, int y, int randomly, object *originator)
void set_first_map(object *op)
void key_confirm_quit(object *op, char key)
#define offsetof(type, member)
void remove_unpaid_objects(object *op, object *env, int free_items)
void SockList_Term(SockList *sl)
#define FREE_AND_CLEAR_STR(xyz)
#define EVENT_PLAYER_DEATH
void dead_player(object *op)
#define MSG_TYPE_ITEM_ADD
#define MSG_TYPE_COMMAND_FAILURE
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
void key_change_class(object *op, char key)
#define FLAG_KNOWN_MAGICAL
int stand_near_hostile(object *who)
#define FIND_PLAYER_NO_HIDDEN_DM
#define OUT_OF_REAL_MAP(M, X, Y)
object * get_nearest_criminal(object *mon)
object * object_find_by_type_and_slaying(const object *who, int type, const char *slaying)
method_ret ob_process(object *op)
#define MSG_TYPE_SKILL_FAILURE
object * object_find_by_arch_name(const object *who, const char *name)
const char * party_get_password(const partylist *party)
int get_thaco_bonus(int stat)
language_t i18n_get_language_by_code(const char *code)
int object_can_pick(const object *who, const object *item)
std::vector< archetype * > players
void add_friendly_object(object *op)
void key_roll_stat(object *op, char key)
#define ST_CONFIRM_PASSWORD
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
object * object_find_by_type(const object *who, int type)
#define SOUND_TYPE_GROUND
#define MSG_TYPE_ITEM_REMOVE
int is_identifiable_type(const object *op)
void change_attr_value(living *stats, int attr, int8_t value)
void enter_exit(object *op, object *exit_ob)
object * check_spell_known(object *op, const char *name)
int fire_bow(object *op, object *arrow, int dir, int wc_mod, int16_t sx, int16_t sy)
static int save_life(object *op)
void animate_object(object *op, int dir)
archetype * find_archetype(const char *name)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
#define MSG_TYPE_ATTRIBUTE_GOD
void dragon_ability_gain(object *who, int atnr, int level)
void change_luck(object *op, int value)
static void restore_player(object *op)
void object_set_msg(object *op, const char *msg)
void esrv_update_item(int flags, object *pl, object *op)
int did_make_save(const object *op, int level, int bonus)
void send_rules(const object *op)
#define MSG_TYPE_ADMIN_RULES
void send_news(const object *op)
int get_randomized_dir(int dir)
#define FLAG_BEEN_APPLIED
#define CLEAR_FLAG(xyz, p)
void SockList_ResetRead(SockList *sl)
void strip_endline(char *buf)
int die_roll(int num, int size, const object *op, int goodbad)
void get_password(object *op)
int16_t last_resist[NROFATTACKS]
object * arch_to_object(archetype *at)
int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
void play_again(object *op)
player * get_player(player *p)
#define MSG_TYPE_ADMIN_LOGIN
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
int save_player(object *op, int flag)
#define ST_GET_PARTY_PASSWORD
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
int object_matches_pickup_mode(const object *item, int mode)
void object_remove(object *op)
int cure_disease(object *sufferer, object *caster, sstring skill)
void free_objectlink(objectlink *ol)
signed long object_sum_weight(object *op)
#define OB_TYPE_MOVE_BLOCK(ob1, type)
int move_player(object *op, int dir)
void remove_statbonus(object *op)
#define MSG_TYPE_ATTACK_NOATTACK
void make_path_to_file(const char *filename)