Go to the documentation of this file.
70 size_t namelen = strlen(plname);
82 if (!strcmp(
name, plname))
93 if (!strncasecmp(
pl->
ob->
name, plname, namelen)) {
143 fp = fopen(
buf,
"r");
174 fp = fopen(
buf,
"r");
211 fp = fopen(
buf,
"r");
256 if (*cp ==
'-' || *cp ==
'_')
259 for (; *cp !=
'\0'; cp++)
300 while (
tmp != NULL &&
tmp->next != NULL)
338 p->last_save_tick = 9999999;
345 op->speed_left = 0.5;
369 strncpy(p->
title,
op->arch->clone.name,
sizeof(p->
title)-1);
543 for (ol =
list, lastdist = 1000; ol != NULL; ol = ol->
next) {
595 #define DETOUR_AMOUNT 2
610 #define MAX_SPACES 50
646 int lastx, lasty, dir, i, diff, firstdir = 0, lastdir,
max =
MAX_SPACES, mflags, blocked;
664 while (diff > 1 &&
max > 0) {
777 if (
pl->randomitems != NULL)
827 LOG(
llevError,
"give_initial_items: Removing duplicate object %s\n",
op->name);
900 op->chosen_skill = NULL;
906 if (
op->contr->socket.login_method == 0) {
935 if (
op->contr->socket.login_method > 0) {
949 if (
key ==
'q' ||
key ==
'Q') {
953 }
else if (
key ==
'a' ||
key ==
'A') {
955 const char *
name =
op->name;
963 op->contr->password[0] =
'~';
1019 op->contr->party_to_join = party;
1031 int roll[4], i, low_index, k;
1033 for (i = 0; i < 4; ++i)
1034 roll[i] = (
int)
RANDOM()%6+1;
1036 for (i = 0, low_index = 0, k = 7; i < 4; ++i)
1041 for (i = 0, k = 0; i < 4; ++i) {
1067 sum =
op->stats.Str+
op->stats.Dex+
op->stats.Int+
op->stats.Con+
op->stats.Wis+
op->stats.Pow+
op->stats.Cha;
1071 statsort[0] =
op->stats.Str;
1072 statsort[1] =
op->stats.Dex;
1073 statsort[2] =
op->stats.Int;
1074 statsort[3] =
op->stats.Con;
1075 statsort[4] =
op->stats.Wis;
1076 statsort[5] =
op->stats.Pow;
1077 statsort[6] =
op->stats.Cha;
1081 if (statsort[i] < statsort[i+1]) {
1083 statsort[i] = statsort[i+1];
1091 op->stats.Str = statsort[0];
1092 op->stats.Dex = statsort[1];
1093 op->stats.Con = statsort[2];
1094 op->stats.Int = statsort[3];
1095 op->stats.Wis = statsort[4];
1096 op->stats.Pow = statsort[5];
1097 op->stats.Cha = statsort[6];
1099 op->contr->orig_stats.Str =
op->stats.Str;
1100 op->contr->orig_stats.Dex =
op->stats.Dex;
1101 op->contr->orig_stats.Int =
op->stats.Int;
1102 op->contr->orig_stats.Con =
op->stats.Con;
1103 op->contr->orig_stats.Wis =
op->stats.Wis;
1104 op->contr->orig_stats.Pow =
op->stats.Pow;
1105 op->contr->orig_stats.Cha =
op->stats.Cha;
1111 op->contr->levhp[1] = 9;
1112 op->contr->levsp[1] = 6;
1113 op->contr->levgrace[1] = 3;
1116 op->stats.hp =
op->stats.maxhp;
1117 op->stats.sp =
op->stats.maxsp;
1118 op->stats.grace =
op->stats.maxgrace;
1119 op->contr->orig_stats =
op->stats;
1145 if (
op->contr->swap_first == -1) {
1146 LOG(
llevError,
"player.c:swap_stat() - swap_first is -1\n");
1160 op->stats.Str =
op->contr->orig_stats.Str;
1161 op->stats.Dex =
op->contr->orig_stats.Dex;
1162 op->stats.Con =
op->contr->orig_stats.Con;
1163 op->stats.Int =
op->contr->orig_stats.Int;
1164 op->stats.Wis =
op->contr->orig_stats.Wis;
1165 op->stats.Pow =
op->contr->orig_stats.Pow;
1166 op->stats.Cha =
op->contr->orig_stats.Cha;
1173 op->contr->levhp[1] = 9;
1174 op->contr->levsp[1] = 6;
1175 op->contr->levgrace[1] = 3;
1178 op->stats.hp =
op->stats.maxhp;
1179 op->stats.sp =
op->stats.maxsp;
1180 op->stats.grace =
op->stats.maxgrace;
1181 op->contr->orig_stats =
op->stats;
1182 op->contr->swap_first = -1;
1201 int keynum =
key-
'0';
1202 static const int8_t stat_trans[] = {
1213 if (keynum > 0 && keynum <= 7) {
1214 if (
op->contr->swap_first == -1) {
1215 op->contr->swap_first = stat_trans[keynum];
1229 if (
op->map == NULL) {
1279 if (
key ==
'q' ||
key ==
'Q') {
1284 if (
key ==
'd' ||
key ==
'D') {
1307 op->contr->last_save_tick =
pticks;
1311 "Welcome to Crossfire!\n Press `?' for help\n");
1315 "%s entered the game.",
op->name);
1341 if (oldmap !=
op->map) {
1343 op->contr->bed_x =
op->x;
1344 op->contr->bed_y =
op->y;
1362 int x =
op->x,
y =
op->y;
1371 op->stats =
op->contr->orig_stats;
1378 strncpy(
op->contr->title,
op->arch->clone.name,
sizeof(
op->contr->title)-1);
1379 op->contr->title[
sizeof(
op->contr->title)-1] =
'\0';
1386 op->stats.hp =
op->stats.maxhp;
1387 op->stats.sp =
op->stats.maxsp;
1388 op->stats.grace = 0;
1418 int i, stat, failure=0;
1490 strlcpy(
op->contr->title,
op->arch->clone.name,
sizeof(
op->contr->title));
1518 op->stats.hp =
op->stats.maxhp;
1519 op->stats.sp =
op->stats.maxsp;
1520 op->stats.grace = 0;
1556 op->contr->last_save_tick =
pticks;
1590 if (
key !=
'y' &&
key !=
'Y' &&
key !=
'q' &&
key !=
'Q') {
1593 "OK, continuing to play.");
1602 "%s quits the game.",
1605 strcpy(
op->contr->killer,
"quit");
1626 if (
op->contr->socket.account_chars != NULL) {
1631 op->contr->socket.account_chars = NULL;
1649 if (
op->stats.hp < 0) {
1655 if (
op->enemy == NULL) {
1665 if (
op->enemy->map == NULL) {
1683 for (diff = 0; diff < 3; diff++) {
1707 int j, k, wvratio, current_ratio;
1708 char putstring[128], tmpstr[16];
1735 switch (
op->contr->mode) {
1781 "item name: %s item type: %d weight/value: %d",
1786 snprintf(putstring,
sizeof(putstring),
"...flags: ");
1787 for (k = 0; k < 4; k++) {
1788 for (j = 0; j < 32; j++) {
1789 if ((
tmp->flags[k]>>j)&0x01) {
1790 snprintf(tmpstr,
sizeof(tmpstr),
"%d ", k*32+j);
1791 strcat(putstring, tmpstr);
1839 static int checks[] = {
1867 for (
int m = 0; checks[
m] != 0;
m++) {
1887 if (current_ratio >= wvratio) {
1942 object *
tmp = NULL, *ntmp;
1943 int attacknum, attacktype, betterby = 0, i;
1950 && arrow->race ==
type
1958 }
else if (arrow->type ==
ARROW && arrow->race ==
type) {
1960 if (target->
race != NULL
1961 && arrow->slaying != NULL
1962 && strstr(arrow->slaying, target->
race)) {
1969 betterby = (arrow->magic+arrow->stats.dam)*2;
1972 for (attacknum = 0; attacknum <
NROFATTACKS; attacknum++) {
1973 attacktype = 1<<attacknum;
1974 if ((arrow->attacktype&attacktype) && (target->
arch->
clone.
resist[attacknum]) < 0)
1975 if (((arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100) > betterby) {
1977 betterby = (arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100;
1980 if ((2+arrow->magic+arrow->stats.dam) > betterby) {
1982 betterby = 2+arrow->magic+arrow->stats.dam;
1984 if (arrow->title && (1+arrow->magic+arrow->stats.dam) > betterby) {
1986 betterby = 1+arrow->magic+arrow->stats.dam;
2014 int i, mflags,
found, number;
2017 if (
op->map == NULL)
2022 if (number > (
op->stats.Dex+(
op->chosen_skill ?
op->chosen_skill->level :
op->level)))
2030 for (i = 0,
found = 0; i < 20; i++) {
2080 int fire_bow(
object *
op,
object *arrow,
int dir,
int wc_mod, int16_t sx, int16_t sy) {
2083 int bowspeed, mflags;
2088 "You can't shoot yourself!");
2099 LOG(
llevError,
"Range: bow without activated bow (%s).\n",
op->name);
2105 "Your %s is broken.",
2118 if (arrow == NULL) {
2120 if (arrow == NULL) {
2124 "You have no %s left.",
2141 if (arrow->
nrof == 0) {
2148 if (arrow == NULL) {
2150 "You have no %s left.",
2162 op->speed_left = 0.01-(float)
FABS(
op->speed)*100/bowspeed;
2197 int mod = bow->
magic
2204 int plmod = (
op->chosen_skill ?
op->chosen_skill->level :
op->level);
2205 if (plmod+mod > 140)
2207 else if (plmod+mod < -100)
2209 arrow->
stats.
wc = 20-(int8_t)plmod-(int8_t)mod;
2211 arrow->
level =
op->chosen_skill ?
op->chosen_skill->level :
op->level;
2264 if ((
a % 8) + 1 ==
b || (
a + 6 % 8) + 1 ==
b)
2286 int ret = 0, wcmod = 0;
2290 }
else if (
op->contr->bowtype >=
bow_n &&
op->contr->bowtype <=
bow_nw) {
2328 "You have no range item readied.");
2336 if (
item->stats.food <= 0) {
2340 "The %s goes poof.",
2344 }
else if (
item->type ==
ROD) {
2349 "The %s whines for a while, but nothing happens.",
2359 }
else if (
item->type ==
ROD) {
2379 switch (
op->contr->shoottype) {
2400 op->contr->golem_count = 0;
2406 if (!
op->chosen_skill) {
2409 "You have no applicable skill to use.");
2421 "Illegal shoot type.");
2449 if (container->
inv == NULL)
2483 if (
pl != container) {
2509 "The %s in your %s vibrates as you approach the door",
2510 name_tmp, name_cont);
2549 "You open the door with the %s",
2571 if (door->
type ==
DOOR &&
op->contr && !
op->contr->run_on) {
2599 object *
mon, *tpl, *mon_owner;
2601 int on_battleground;
2604 if (
op->contr->transport)
2605 tpl =
op->contr->transport;
2608 assert(tpl->
map != NULL);
2687 if (
op->contr->braced)
2691 if (
op->contr->tmp_invis ||
op->hide)
2703 && (
op->contr->peaceful && !on_battleground)) {
2704 if (!
op->contr->braced) {
2709 "You withhold your attack");
2711 if (
op->contr->tmp_invis ||
op->hide)
2737 if (
op->weapon_speed_left < 0) {
2738 op->speed_left = -0.01;
2741 op->weapon_speed_left -= 1.0;
2764 else if (bef != tpl->
map) {
2782 if (dir == 1 || dir == 5) {
2784 for (
y = 0;
y <= sy;
y++) {
2785 for (
x = 0;
x < sx;
x++) {
2792 }
else if (dir == 3 || dir == 7) {
2794 for (
y = 0;
y < sy;
y++) {
2795 for (
x = 0;
x <= sx;
x++) {
2805 for (part = transport; part; part = part->
more) {
2821 int x,
y, scroll_dir = 0;
2828 if (transport->
direction == 1 && dir == 8) {
2830 }
else if (transport->
direction == 2 && dir == 3) {
2832 }
else if (transport->
direction == 3 && dir == 2) {
2834 }
else if (transport->
direction == 5 && dir == 6) {
2836 }
else if (transport->
direction == 6 && dir == 5) {
2838 }
else if (transport->
direction == 7 && dir == 8) {
2840 }
else if (transport->
direction == 8 && dir == 7) {
2842 }
else if (transport->
direction == 8 && dir == 1) {
2854 if (
x != transport->
x ||
y != transport->
y) {
2860 pl->map = transport->
map;
2924 object *transport =
op->contr->transport;
2930 if ((dir < 0) || (dir >= 9)) {
2931 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
2944 if (transport->
contr !=
op->contr)
2957 if (
op->speed_left < 0.0)
2958 op->speed_left = -0.01;
2974 if (
op->contr->fire_on) {
2984 if (
op->contr->fire_on || (
op->contr->run_on && pick != 0)) {
2985 op->direction = dir;
3003 object *transport =
op->contr->transport;
3009 if ((dir < 0) || (dir >= 9)) {
3010 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
3023 if (transport->
contr !=
op->contr)
3041 if (
op->contr->fire_on ||
op->contr->run_on) {
3042 op->direction = dir;
3062 if (
op->contr->hidden) {
3063 op->invisible = 1000;
3072 if (!
op->invisible) {
3075 "Your invisibility spell runs out.");
3096 op->contr->golem_count = 0;
3108 "You can stretch your stiff joints once more.");
3112 if (
op->direction && (
op->contr->run_on ||
op->contr->fire_on)) {
3121 if (
op->speed_left > 0)
3152 "Your %s vibrates violently, then evaporates.",
3157 if (
op->stats.hp < 0)
3158 op->stats.hp =
op->stats.maxhp;
3159 if (
op->stats.food < 0)
3164 LOG(
llevError,
"Error: LIFESAVE set without applied object.\n");
3214 time_t now = time(NULL);
3216 strncpy(buf2,
" R.I.P.\n\n", len);
3218 snprintf(
buf,
sizeof(
buf),
"%s the %s\n",
op->name,
op->contr->title);
3220 snprintf(
buf,
sizeof(
buf),
"%s\n",
op->name);
3221 strncat(buf2,
" ", 20-strlen(
buf)/2);
3222 strncat(buf2,
buf, len-strlen(buf2)-1);
3224 snprintf(
buf,
sizeof(
buf),
"who was in level %d when killed\n",
op->level);
3226 snprintf(
buf,
sizeof(
buf),
"who was in level %d when died.\n\n",
op->level);
3227 strncat(buf2,
" ", 20-strlen(
buf)/2);
3228 strncat(buf2,
buf, len-strlen(buf2)-1);
3230 snprintf(
buf,
sizeof(
buf),
"by %s.\n\n",
op->contr->killer);
3231 strncat(buf2,
" ", 21-strlen(
buf)/2);
3232 strncat(buf2,
buf, len-strlen(buf2)-1);
3234 strftime(
buf,
MAX_BUF,
"%b %d %Y\n", localtime(&now));
3235 strncat(buf2,
" ", 20-strlen(
buf)/2);
3236 strncat(buf2,
buf, len-strlen(buf2)-1);
3248 int last_food =
op->stats.food;
3249 int gen_hp, gen_sp, gen_grace;
3252 int rate_grace = 2000;
3257 if (
op->contr->gen_hp >= 0)
3258 gen_hp = (
op->contr->gen_hp+1)*
op->stats.maxhp;
3260 gen_hp =
op->stats.maxhp;
3261 rate_hp -= rate_hp/2*
op->contr->gen_hp;
3263 if (
op->contr->gen_sp >= 0)
3264 gen_sp = (
op->contr->gen_sp+1)*
op->stats.maxsp;
3266 gen_sp =
op->stats.maxsp;
3267 rate_sp -= rate_sp/2*
op->contr->gen_sp;
3269 if (
op->contr->gen_grace >= 0)
3270 gen_grace = (
op->contr->gen_grace+1)*
op->stats.maxgrace;
3272 gen_grace =
op->stats.maxgrace;
3273 rate_grace -= rate_grace/2*
op->contr->gen_grace;
3278 gen_sp = gen_sp*10/
MAX(
op->contr->gen_sp_armour, 10);
3279 if (
op->stats.sp <
op->stats.maxsp) {
3284 if (
op->contr->digestion < 0)
3285 op->stats.food +=
op->contr->digestion;
3286 else if (
op->contr->digestion > 0
3288 op->stats.food = last_food;
3291 op->last_sp = rate_sp/(
MAX(gen_sp, 20)+10);
3296 if (--
op->last_grace < 0) {
3297 if (
op->stats.grace <
op->stats.maxgrace/2)
3299 op->last_grace = rate_grace/(
MAX(gen_grace, 20)+10);
3305 if (
op->stats.hp <
op->stats.maxhp) {
3310 if (
op->contr->digestion < 0)
3311 op->stats.food +=
op->contr->digestion;
3312 else if (
op->contr->digestion > 0
3314 op->stats.food = last_food;
3317 op->last_heal = rate_hp/(
MAX(gen_hp, 20)+10);
3321 if (--
op->last_eat < 0) {
3322 int bonus =
MAX(
op->contr->digestion, 0);
3323 int penalty =
MAX(-
op->contr->digestion, 0);
3324 if (
op->contr->gen_hp > 0)
3325 op->last_eat = 25*(1+bonus)/(
op->contr->gen_hp+penalty+1);
3327 op->last_eat = 25*(1+bonus)/(penalty+1);
3334 if (
op->contr->state ==
ST_PLAYING &&
op->stats.food < 0 &&
op->stats.hp >= 0) {
3341 object *flesh = NULL;
3347 "You blindly grab for a bite of food.");
3349 if (
op->stats.food >= 0 ||
op->stats.hp < 0)
3358 if (
op->stats.food < 0 &&
op->stats.hp >= 0 && flesh) {
3360 "You blindly grab for a bite of food.");
3369 if (
op->stats.food < 0 &&
op->stats.hp > 0){
3371 int32_t adjust_by =
MIN(-(
op->stats.food),
op->stats.hp);
3372 op->stats.food += adjust_by;
3373 op->stats.hp -= adjust_by;
3389 if (
op->container) {
3404 if (
tmp->nrof > 1) {
3434 "Your body feels cleansed");
3445 "Your mind feels clearer");
3479 assert(trophy != NULL);
3481 "You have been defeated in combat!\n"
3482 "Local medics have saved your life...");
3487 op->stats.hp =
op->stats.maxhp;
3488 if (
op->stats.food <= 0)
3494 snprintf(
buf,
sizeof(
buf),
"%s's %s",
op->name,
tmp->name);
3497 snprintf(
buf,
sizeof(
buf),
3498 "This %s was %s %s the %s, who was defeated at level %d by %s.\n",
3499 tmp->name,
tmp->type ==
FLESH ?
"cut off" :
"taken from",
3500 op->name,
op->contr->title,
3501 (
int)(
op->level),
op->contr->killer);
3507 tmp->materialname = NULL;
3513 op->contr->braced = 0;
3521 if (
op->stats.food < 0) {
3522 snprintf(
buf,
sizeof(
buf),
"%s starved to death.",
op->name);
3523 strcpy(
op->contr->killer,
"starvation");
3525 snprintf(
buf,
sizeof(
buf),
"%s died.",
op->name);
3546 int will_kill_again;
3574 for (
z = 0;
z < num_stats_lose;
z++) {
3593 if (deparch == NULL) {
3613 if (this_stat < 0) {
3615 int keep_chance = this_stat*this_stat;
3617 if (keep_chance < 1)
3633 if (lose_this_stat) {
3643 if (this_stat >= -50) {
3659 if (god && (strcmp(god,
"none")))
3662 "For a brief moment you feel the holy presence of %s protecting you",
3667 "For a brief moment you feel a holy presence protecting you.");
3676 snprintf(
buf,
sizeof(
buf),
"%s's gravestone",
op->name);
3678 snprintf(
buf,
sizeof(
buf),
"%s's gravestones",
op->name);
3680 snprintf(
buf,
sizeof(
buf),
"RIP\nHere rests the hero %s the %s,\n"
3683 op->name,
op->contr->title,
3697 if (
op->stats.food < 100)
3698 op->stats.food = 900;
3699 op->stats.hp =
op->stats.maxhp;
3700 op->stats.sp =
MAX(
op->stats.sp,
op->stats.maxsp);
3701 op->stats.grace =
MAX(
op->stats.grace,
op->stats.maxgrace);
3719 op->contr->braced = 0;
3725 op->contr->mode = 0;
3735 will_kill_again = 0;
3738 will_kill_again |=
tmp->attacktype;
3740 if (will_kill_again) {
3747 force->speed_left = -5.0;
3750 if (will_kill_again&(1<<at))
3751 force->resist[at] = 100;
3794 op->contr->golem_count = 0;
3806 op->stats.hp =
op->stats.maxhp;
3812 sizeof(
op->contr->maplevel));
3813 if (
op->map != NULL)
3831 snprintf(
buf,
sizeof(
buf),
"%s",
op->name);
3834 tmp->level =
op->level;
3841 snprintf(ac_buf,
sizeof(ac_buf),
"%s",
op->contr->socket.account_name);
3892 object *skop, *spob;
3898 LOG(
llevError,
"Player %s lacks critical skill use_magic_item!\n",
op->name);
3901 spob = throw_ob->
inv;
3924 op->contr->tmp_invis = 0;
3925 if (
op->contr->invis_race)
3946 if (
tmp->type == 44 &&
tmp->stats.Wis)
3965 int i,
level = 0, mflag;
3968 if (!
ob || !
ob->map)
3979 level = -(10+(2*
ob->map->darkness));
4009 if (!
op || !
op->map)
4015 if (
op->type ==
PLAYER &&
op->contr->run_on) {
4016 if (!skop || num >= skop->
level) {
4018 "You ran too much! You are no longer hidden!");
4024 num +=
op->map->difficulty;
4028 || ((
op->invisible -= num) <= 0)) {
4032 "You moved out of hiding! You are visible!");
4033 }
else if (
op->type ==
PLAYER && skop) {
4047 int i, friendly = 0,
player = 0, mflags;
4060 for (i = 1; i < 9; i++) {
4122 LOG(
llevError,
"player_can_view() called for non-player object\n");
4171 if (
op->contr &&
op->contr->tmp_invis == 0)
4175 if (
op->hide || !
op->contr || (
op->contr &&
op->contr->tmp_invis)) {
4178 op->hide ?
"unhidden" :
"visible");
4217 && strcmp(
tmp->name,
"battleground") == 0
4226 if (invtmp != NULL) {
4227 if (
x != NULL &&
y != NULL)
4233 if (
x != NULL &&
y != NULL)
4238 if (trophy != NULL) {
4239 if (
tmp->other_arch) {
4240 *trophy =
tmp->other_arch;
4281 if (trlist == NULL ||
who->type !=
PLAYER)
4287 if (tr == NULL || tr->
item == NULL) {
4301 "You gained the ability of %s",
4315 if (
item->invisible) {
4318 "You gained the ability of %s",
4337 if (
item->msg != NULL)
4343 if (
item->animation) {
4345 who->animation =
item->animation;
4346 who->anim_speed =
item->anim_speed;
4367 snprintf(
buf,
sizeof(
buf),
"You feel attuned to ");
4369 if (
item->path_attuned&(1<<i)) {
4371 strcat(
buf,
" and ");
4392 if (
item->msg != NULL)
#define object_was_destroyed(op, old_tag)
#define ADD_PLAYER_NO_STATS_ROLL
int stand_near_hostile(object *who)
#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)
SockList ** delayed_buffers
void receive_play_again(object *op, char key)
void do_hidden_move(object *op)
void SockList_AddInt(SockList *sl, uint32_t data)
sstring add_refcount(sstring str)
void object_free(object *ob, int flags)
sstring add_string(const char *str)
object * object_find_by_flag_applied(const object *who, int flag)
void object_remove(object *op)
void remove_friendly_object(object *op)
void pets_terminate_all(object *owner)
signed long object_sum_weight(object *op)
player * get_player(player *p)
void kill_player(object *op, const object *killer)
void object_set_enemy(object *op, object *enemy)
#define MSG_TYPE_COMMAND_SUCCESS
void remove_statbonus(object *op)
void command_search_items(object *op, const char *params)
#define MSG_TYPE_ADMIN_PLAYER
static int similar_direction(int a, int b)
int monster_can_detect_enemy(object *op, object *enemy, rv_vector *rv)
void roll_again(object *op)
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
void display_motd(const object *op)
void recursive_roll(object *op, int dir, object *pusher)
void object_update(object *op, int action)
#define QUERY_FLAG(xyz, p)
archetype * get_next_archetype(archetype *current)
void remove_locked_door(object *op)
void do_learn_spell(object *op, object *spell, int special_prayer)
SockList * player_get_delayed_buffer(player *pl)
int out_of_map(mapstruct *m, int x, int y)
void esrv_new_player(player *pl, uint32_t weight)
uint64_t price_base(const object *obj)
const char *const lose_msg[NUM_STATS]
objectlink * get_friends_of(const object *owner)
object * object_new(void)
void esrv_send_inventory(object *pl, object *op)
void key_roll_stat(object *op, char key)
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
object * object_find_by_arch_name(const object *who, const char *name)
static archetype * get_player_archetype(archetype *at)
void SockList_AddString(SockList *sl, const char *data)
#define FOR_BELOW_PREPARE(op_, it_)
#define MSG_TYPE_VICTIM_DIED
int8_t blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]
void fire(object *op, int dir)
void spring_trap(object *trap, object *victim)
void apply_map_builder(object *pl, int dir)
object * arch_present_in_ob(const archetype *at, const object *op)
int object_matches_string(object *pl, object *op, const char *name)
void esrv_send_pickup(player *pl)
#define MSG_TYPE_ATTRIBUTE
player * find_player_socket(const socket_struct *ns)
#define SET_ANIMATION(ob, newanim)
void set_first_map(object *op)
int blocked_link(object *ob, mapstruct *m, int16_t sx, int16_t sy)
#define CS_QUERY_SINGLECHAR
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
uint8_t delayed_buffers_used
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
int object_can_merge(object *ob1, object *ob2)
int ob_blocked(const object *ob, mapstruct *m, int16_t x, int16_t y)
treasurelist * find_treasurelist(const char *name)
int apply_race_and_class(object *op, archetype *race, archetype *opclass, living *stats)
static int action_makes_visible(object *op)
#define SOUND_TYPE_LIVING
static const flag_definition flags[]
void player_set_own_title(struct pl *pl, const char *title)
EXTERN char first_map_path[MAX_BUF]
void roll_stats(object *op)
int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
int move_player(object *op, int dir)
#define BALSL_LOSS_CHANCE_RATIO
void send_account_players(socket_struct *ns)
int16_t last_resist[NROFATTACKS]
#define MSG_TYPE_COMMAND_ERROR
void esrv_add_spells(player *pl, object *spell)
EXTERN mapstruct * first_map
int apply_manual(object *op, object *tmp, int aflag)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
int get_dex_bonus(int stat)
int face_player(object *op, int dir)
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)
void make_path_to_file(const char *filename)
method_ret ob_process(object *op)
void player_set_state(player *pl, uint8_t state)
short freearr_x[SIZEOFFREE]
short freearr_y[SIZEOFFREE]
#define MSG_TYPE_SPELL_END
int playername_ok(const char *cp)
#define FOR_BELOW_FINISH()
int check_race_and_class(living *stats, archetype *race, archetype *opclass)
void animate_object(object *op, int dir)
void esrv_send_item(object *pl, object *op)
#define MSG_TYPE_COMMAND_DEBUG
void free_string(sstring str)
void remove_door(object *op)
static event_registration m
int handle_newcs_player(object *op)
Account_Chars * account_chars
int has_carried_lights(const object *op)
char savebed_map[MAX_BUF]
object * object_find_by_type_subtype(const object *who, int type, int subtype)
object * object_find_by_type_without_flags(const object *who, int type, int *flags, int num_flags)
void remove_unpaid_objects(object *op, object *env, int free_items)
static int save_life(object *op)
#define object_decrease_nrof_by_one(xyz)
void link_player_skills(object *op)
uint8_t balanced_stat_loss
#define BALSL_NUMBER_LOSSES_RATIO
object * object_find_by_type_and_slaying(const object *who, int type, const char *slaying)
#define MSG_TYPE_ATTRIBUTE_STAT_LOSS
#define MSG_TYPE_ADMIN_NEWS
void make_visible(object *op)
void strip_endline(char *buf)
void cast_dust(object *op, object *throw_ob, int dir)
void enter_player_savebed(object *op)
const char * determine_god(object *op)
#define MSG_TYPE_ATTRIBUTE_RACE
void move_player_attack(object *op, int dir)
int is_identifiable_type(const object *op)
#define ST_CHANGE_PASSWORD_CONFIRM
void object_copy(const object *src_ob, object *dest_ob)
int move_ob(object *op, int dir, object *originator)
#define MSG_TYPE_APPLY_SUCCESS
int player_can_view(object *pl, object *op)
void query_name(const object *op, char *buf, size_t size)
void confirm_password(object *op)
const char * unarmed_skill
void object_update_turn_face(object *op)
#define FLAG_KNOWN_CURSED
#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)
int get_randomized_dir(int dir)
void key_confirm_quit(object *op, char key)
void party_leave(object *op)
int account_remove_player(const char *account_name, const char *player_name)
#define FOR_OB_AND_BELOW_FINISH()
void fatal(enum fatal_error err)
int apply_container(object *op, object *sack, int aflags)
int object_can_pick(const object *who, const object *item)
void player_unready_range_ob(player *pl, object *ob)
void enter_player_maplevel(object *op)
static void swap_stat(object *op, int swap_second)
static void loot_object(object *op)
void SockList_AddChar(SockList *sl, unsigned char c)
player * find_player(const char *plname)
void delete_character(const char *name)
void query_short_name(const object *op, char *buf, size_t size)
int get_dam_bonus(int stat)
#define FREE_AND_COPY(sv, nv)
int get_party_password(object *op, partylist *party)
EXTERN player * first_player
void fix_object(object *op)
uint8_t stat_loss_on_death
void key_change_class(object *op, char key)
static void update_transport_block(object *transport, int dir)
void leave(player *pl, int draw_exit)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
void clear_player(player *pl)
static object * find_arrow(object *op, const char *type)
#define FLAG_UNAGGRESSIVE
bool is_criminal(object *op)
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
static object * find_better_arrow(object *op, object *target, const char *type, int *better)
void get_name(object *op)
static void kill_player_not_permadeath(object *op)
#define FIND_PLAYER_PARTIAL_NAME
#define AC_PLAYER_STAT_NO_CHANGE
#define FLAG_CAN_USE_SKILL
void apply_death_exp_penalty(object *op)
#define FOR_OB_AND_BELOW_PREPARE(op_)
int16_t SP_level_spellpoint_cost(object *caster, object *spell, int flags)
void delete_map(mapstruct *m)
void SockList_Init(SockList *sl)
static int player_fire_bow(object *op, int dir)
static void set_player_socket(player *p, socket_struct *ns)
int push_ob(object *who, int dir, object *pusher)
void object_set_owner(object *op, object *owner)
object * find_skill_by_name(object *who, const char *name)
size_t strlcpy(char *dst, const char *src, size_t size)
static int turn_transport(object *transport, object *captain, int dir)
static std::shared_ptr< inja::Environment > env
void object_get_multi_size(const object *ob, int *sx, int *sy, int *hx, int *hy)
object * create_archetype(const char *name)
int hideability(object *ob)
void clear_los(player *pl)
int transfer_ob(object *op, int x, int y, int randomly, object *originator)
#define offsetof(type, member)
void SockList_Term(SockList *sl)
#define FREE_AND_CLEAR_STR(xyz)
#define EVENT_PLAYER_DEATH
void dead_player(object *op)
int random_roll(int min, int max, const object *op, int goodbad)
#define MSG_TYPE_ITEM_ADD
#define MSG_TYPE_COMMAND_FAILURE
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
#define FLAG_KNOWN_MAGICAL
#define FIND_PLAYER_NO_HIDDEN_DM
int is_wraith_pl(object *op)
#define OUT_OF_REAL_MAP(M, X, Y)
static int player_attack_door(object *op, object *door)
struct treasurestruct * items
void object_set_msg(object *op, const char *msg)
int die_roll(int num, int size, const object *op, int goodbad)
const char *const spellpathnames[NRSPELLPATHS]
player * find_player_options(const char *plname, int options, const mapstruct *map)
#define MSG_TYPE_SKILL_FAILURE
player * find_player_partial_name(const char *plname)
const char * party_get_password(const partylist *party)
object * get_nearest_player(object *mon)
void add_friendly_object(object *op)
int fire_bow(object *op, object *arrow, int dir, int wc_mod, int16_t sx, int16_t sy)
#define ST_CONFIRM_PASSWORD
void apply_anim_suffix(object *who, const char *suffix)
#define SOUND_TYPE_GROUND
#define MSG_TYPE_ITEM_REMOVE
void LOG(LogLevel logLevel, const char *format,...)
int64_t last_skill_exp[MAX_SKILLS]
int did_make_save(const object *op, int level, int bonus)
void enter_exit(object *op, object *exit_ob)
object * check_spell_known(object *op, const char *name)
uint8_t delayed_buffers_allocated
int check_pick(object *op)
void get_password(object *op)
bool object_value_set(const object *op, const char *const key)
archetype * find_archetype(const char *name)
object * last_skill_ob[MAX_SKILLS]
void dragon_ability_gain(object *who, int atnr, int level)
void check_stat_bounds(living *stats, int8_t min_stat, int8_t max_stat)
static const char * gravestone_text(object *op, char *buf2, int len)
#define MSG_TYPE_ATTRIBUTE_GOD
void send_news(const object *op)
void esrv_update_item(int flags, object *pl, object *op)
void query_base_name(const object *op, int plural, char *buf, size_t size)
const char *const drain_msg[NUM_STATS]
#define MSG_TYPE_ADMIN_RULES
party_rejoin_mode rejoin_party
static struct Command_Line_Options options[]
#define FLAG_BEEN_APPLIED
#define CLEAR_FLAG(xyz, p)
int allowed_class(const object *op)
object * object_find_by_type(const object *who, int type)
void set_attr_value(living *stats, int attr, int8_t value)
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
object * object_insert_in_ob(object *op, object *where)
void SockList_ResetRead(SockList *sl)
const char *const short_stat_name[NUM_STATS]
void object_update_speed(object *op)
object * arch_to_object(archetype *at)
object * ranges[range_size]
void send_rules(const object *op)
#define MSG_TYPE_ADMIN_LOGIN
static void restore_player(object *op)
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
struct treasurestruct * next
int save_player(object *op, int flag)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
#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)
int8_t get_attr_value(const living *stats, int attr)
void object_free_drop_inventory(object *ob)
int object_matches_pickup_mode(const object *item, int mode)
void do_some_living(object *op)
void add_statbonus(object *op)
const char * i18n(const object *who, const char *code)
int get_thaco_bonus(int stat)
EXTERN char first_map_ext_path[MAX_BUF]
int cure_disease(object *sufferer, object *caster, sstring skill)
static object * pick_arrow_target(object *op, const char *type, int dir)
#define OB_TYPE_MOVE_BLOCK(ob1, type)
int path_to_player(object *mon, object *pl, unsigned mindiff)
int is_true_undead(object *op)
#define MSG_TYPE_ATTACK_NOATTACK
void play_again(object *op)
static void kill_player_permadeath(object *op)
void give_initial_items(object *pl, treasurelist *items)
static int turn_one_transport(object *transport, object *captain, int dir)
player * add_player(socket_struct *ns, int flags)
void drain_rod_charge(object *rod)
bool shop_contains(object *ob)
int hide(object *op, object *skill)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
void pets_control_golem(object *op, int dir)
void player_map_change_common(object *op, mapstruct *const oldmap, mapstruct *const newmap)
void account_char_save(Account_Chars *chars)
object * find_key(object *pl, object *container, object *door)
void pick_up(object *op, object *alt)
int16_t resist[NROFATTACKS]
void send_query(socket_struct *ns, uint8_t flags, const char *text)
void Send_With_Handling(socket_struct *ns, SockList *sl)
mapstruct * get_map_from_coord(mapstruct *m, int16_t *x, int16_t *y)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
#define MSG_TYPE_ITEM_INFO
void change_attr_value(living *stats, int attr, int8_t value)
static void flee_player(object *op)
#define FOR_INV_PREPARE(op_, it_)
static const int32_t MAX_FOOD
void drain_wand_charge(object *wand)
int get_rangevector_from_mapcoord(const mapstruct *m, int x, int y, const object *op2, rv_vector *retval, int flags)
void account_char_remove(Account_Chars *chars, const char *pl_name)
object * get_nearest_criminal(object *mon)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
void safe_strcat(char *dest, const char *orig, size_t *curlen, size_t maxlen)
void free_objectlink(objectlink *ol)
void events_execute_global_event(int eventcode,...)
void change_luck(object *op, int value)
void skill_attack(object *tmp, object *pl, int dir, const char *string, object *skill)
static void fire_misc_object(object *op, int dir)
object * object_get_owner(object *op)
#define CS_QUERY_HIDEINPUT