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);
545 object *
tmp = ol->
ob;
550 LOG(
llevDebug,
"get_nearest_player: Found free/non friendly object on friendly list\n");
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] =
'~';
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) {
1075 sum =
op->stats.Str+
op->stats.Dex+
op->stats.Int+
op->stats.Con+
op->stats.Wis+
op->stats.Pow+
op->stats.Cha;
1079 statsort[0] =
op->stats.Str;
1080 statsort[1] =
op->stats.Dex;
1081 statsort[2] =
op->stats.Int;
1082 statsort[3] =
op->stats.Con;
1083 statsort[4] =
op->stats.Wis;
1084 statsort[5] =
op->stats.Pow;
1085 statsort[6] =
op->stats.Cha;
1089 if (statsort[i] < statsort[i+1]) {
1091 statsort[i] = statsort[i+1];
1099 op->stats.Str = statsort[0];
1100 op->stats.Dex = statsort[1];
1101 op->stats.Con = statsort[2];
1102 op->stats.Int = statsort[3];
1103 op->stats.Wis = statsort[4];
1104 op->stats.Pow = statsort[5];
1105 op->stats.Cha = statsort[6];
1107 op->contr->orig_stats.Str =
op->stats.Str;
1108 op->contr->orig_stats.Dex =
op->stats.Dex;
1109 op->contr->orig_stats.Int =
op->stats.Int;
1110 op->contr->orig_stats.Con =
op->stats.Con;
1111 op->contr->orig_stats.Wis =
op->stats.Wis;
1112 op->contr->orig_stats.Pow =
op->stats.Pow;
1113 op->contr->orig_stats.Cha =
op->stats.Cha;
1119 op->contr->levhp[1] = 9;
1120 op->contr->levsp[1] = 6;
1121 op->contr->levgrace[1] = 3;
1124 op->stats.hp =
op->stats.maxhp;
1125 op->stats.sp =
op->stats.maxsp;
1126 op->stats.grace =
op->stats.maxgrace;
1127 op->contr->orig_stats =
op->stats;
1153 if (
op->contr->swap_first == -1) {
1154 LOG(
llevError,
"player.c:swap_stat() - swap_first is -1\n");
1168 op->stats.Str =
op->contr->orig_stats.Str;
1169 op->stats.Dex =
op->contr->orig_stats.Dex;
1170 op->stats.Con =
op->contr->orig_stats.Con;
1171 op->stats.Int =
op->contr->orig_stats.Int;
1172 op->stats.Wis =
op->contr->orig_stats.Wis;
1173 op->stats.Pow =
op->contr->orig_stats.Pow;
1174 op->stats.Cha =
op->contr->orig_stats.Cha;
1181 op->contr->levhp[1] = 9;
1182 op->contr->levsp[1] = 6;
1183 op->contr->levgrace[1] = 3;
1186 op->stats.hp =
op->stats.maxhp;
1187 op->stats.sp =
op->stats.maxsp;
1188 op->stats.grace =
op->stats.maxgrace;
1189 op->contr->orig_stats =
op->stats;
1190 op->contr->swap_first = -1;
1209 int keynum =
key-
'0';
1210 static const int8_t stat_trans[] = {
1221 if (keynum > 0 && keynum <= 7) {
1222 if (
op->contr->swap_first == -1) {
1223 op->contr->swap_first = stat_trans[keynum];
1237 if (
op->map == NULL) {
1287 if (
key ==
'q' ||
key ==
'Q') {
1292 if (
key ==
'd' ||
key ==
'D') {
1315 op->contr->last_save_tick =
pticks;
1319 "Welcome to Crossfire!\n Press `?' for help\n");
1323 "%s entered the game.",
op->name);
1349 if (oldmap !=
op->map) {
1351 op->contr->bed_x =
op->x;
1352 op->contr->bed_y =
op->y;
1370 int x =
op->x,
y =
op->y;
1379 op->stats =
op->contr->orig_stats;
1386 strncpy(
op->contr->title,
op->arch->clone.name,
sizeof(
op->contr->title)-1);
1387 op->contr->title[
sizeof(
op->contr->title)-1] =
'\0';
1394 op->stats.hp =
op->stats.maxhp;
1395 op->stats.sp =
op->stats.maxsp;
1396 op->stats.grace = 0;
1426 int i, stat, failure=0;
1498 strlcpy(
op->contr->title,
op->arch->clone.name,
sizeof(
op->contr->title));
1526 op->stats.hp =
op->stats.maxhp;
1527 op->stats.sp =
op->stats.maxsp;
1528 op->stats.grace = 0;
1564 op->contr->last_save_tick =
pticks;
1598 if (
key !=
'y' &&
key !=
'Y' &&
key !=
'q' &&
key !=
'Q') {
1601 "OK, continuing to play.");
1610 "%s quits the game.",
1613 strcpy(
op->contr->killer,
"quit");
1634 if (
op->contr->socket.account_chars != NULL) {
1639 op->contr->socket.account_chars = NULL;
1657 if (
op->stats.hp < 0) {
1663 if (
op->enemy == NULL) {
1673 if (
op->enemy->map == NULL) {
1691 for (diff = 0; diff < 3; diff++) {
1715 int j, k, wvratio, current_ratio;
1716 char putstring[128], tmpstr[16];
1743 switch (
op->contr->mode) {
1789 "item name: %s item type: %d weight/value: %d",
1794 snprintf(putstring,
sizeof(putstring),
"...flags: ");
1795 for (k = 0; k < 4; k++) {
1796 for (j = 0; j < 32; j++) {
1797 if ((
tmp->flags[k]>>j)&0x01) {
1798 snprintf(tmpstr,
sizeof(tmpstr),
"%d ", k*32+j);
1799 strcat(putstring, tmpstr);
1847 static int checks[] = {
1875 for (
int m = 0; checks[
m] != 0;
m++) {
1895 if (current_ratio >= wvratio) {
1950 object *
tmp = NULL, *ntmp;
1951 int attacknum, attacktype, betterby = 0, i;
1958 && arrow->race ==
type
1966 }
else if (arrow->type ==
ARROW && arrow->race ==
type) {
1968 if (target->
race != NULL
1969 && arrow->slaying != NULL
1970 && strstr(arrow->slaying, target->
race)) {
1977 betterby = (arrow->magic+arrow->stats.dam)*2;
1980 for (attacknum = 0; attacknum <
NROFATTACKS; attacknum++) {
1981 attacktype = 1<<attacknum;
1982 if ((arrow->attacktype&attacktype) && (target->
arch->
clone.
resist[attacknum]) < 0)
1983 if (((arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100) > betterby) {
1985 betterby = (arrow->magic+arrow->stats.dam)*(100-target->
arch->
clone.
resist[attacknum])/100;
1988 if ((2+arrow->magic+arrow->stats.dam) > betterby) {
1990 betterby = 2+arrow->magic+arrow->stats.dam;
1992 if (arrow->title && (1+arrow->magic+arrow->stats.dam) > betterby) {
1994 betterby = 1+arrow->magic+arrow->stats.dam;
2022 int i, mflags,
found, number;
2025 if (
op->map == NULL)
2030 if (number > (
op->stats.Dex+(
op->chosen_skill ?
op->chosen_skill->level :
op->level)))
2038 for (i = 0,
found = 0; i < 20; i++) {
2088 int fire_bow(
object *
op,
object *arrow,
int dir,
int wc_mod, int16_t sx, int16_t sy) {
2091 int bowspeed, mflags;
2096 "You can't shoot yourself!");
2107 LOG(
llevError,
"Range: bow without activated bow (%s).\n",
op->name);
2113 "Your %s is broken.",
2126 if (arrow == NULL) {
2128 if (arrow == NULL) {
2132 "You have no %s left.",
2149 if (arrow->
nrof == 0) {
2156 if (arrow == NULL) {
2158 "You have no %s left.",
2170 op->speed_left = 0.01-(float)
FABS(
op->speed)*100/bowspeed;
2205 int mod = bow->
magic
2212 int plmod = (
op->chosen_skill ?
op->chosen_skill->level :
op->level);
2213 if (plmod+mod > 140)
2215 else if (plmod+mod < -100)
2217 arrow->
stats.
wc = 20-(int8_t)plmod-(int8_t)mod;
2219 arrow->
level =
op->chosen_skill ?
op->chosen_skill->level :
op->level;
2272 if ((
a % 8) + 1 ==
b || (
a + 6 % 8) + 1 ==
b)
2294 int ret = 0, wcmod = 0;
2298 }
else if (
op->contr->bowtype >=
bow_n &&
op->contr->bowtype <=
bow_nw) {
2336 "You have no range item readied.");
2344 if (
item->stats.food <= 0) {
2348 "The %s goes poof.",
2352 }
else if (
item->type ==
ROD) {
2357 "The %s whines for a while, but nothing happens.",
2367 }
else if (
item->type ==
ROD) {
2387 switch (
op->contr->shoottype) {
2408 op->contr->golem_count = 0;
2414 if (!
op->chosen_skill) {
2417 "You have no applicable skill to use.");
2429 "Illegal shoot type.");
2457 if (container->
inv == NULL)
2491 if (
pl != container) {
2517 "The %s in your %s vibrates as you approach the door",
2518 name_tmp, name_cont);
2557 "You open the door with the %s",
2579 if (door->
type ==
DOOR &&
op->contr && !
op->contr->run_on) {
2607 object *
mon, *tpl, *mon_owner;
2609 int on_battleground;
2612 if (
op->contr->transport)
2613 tpl =
op->contr->transport;
2616 assert(tpl->
map != NULL);
2695 if (
op->contr->braced)
2699 if (
op->contr->tmp_invis ||
op->hide)
2711 && (
op->contr->peaceful && !on_battleground)) {
2712 if (!
op->contr->braced) {
2717 "You withhold your attack");
2719 if (
op->contr->tmp_invis ||
op->hide)
2745 if (
op->weapon_speed_left < 0) {
2746 op->speed_left = -0.01;
2749 op->weapon_speed_left -= 1.0;
2772 else if (bef != tpl->
map) {
2790 if (dir == 1 || dir == 5) {
2792 for (
y = 0;
y <= sy;
y++) {
2793 for (
x = 0;
x < sx;
x++) {
2800 }
else if (dir == 3 || dir == 7) {
2802 for (
y = 0;
y < sy;
y++) {
2803 for (
x = 0;
x <= sx;
x++) {
2813 for (part = transport; part; part = part->
more) {
2829 int x,
y, scroll_dir = 0;
2836 if (transport->
direction == 1 && dir == 8) {
2838 }
else if (transport->
direction == 2 && dir == 3) {
2840 }
else if (transport->
direction == 3 && dir == 2) {
2842 }
else if (transport->
direction == 5 && dir == 6) {
2844 }
else if (transport->
direction == 6 && dir == 5) {
2846 }
else if (transport->
direction == 7 && dir == 8) {
2848 }
else if (transport->
direction == 8 && dir == 7) {
2850 }
else if (transport->
direction == 8 && dir == 1) {
2862 if (
x != transport->
x ||
y != transport->
y) {
2868 pl->map = transport->
map;
2932 object *transport =
op->contr->transport;
2938 if ((dir < 0) || (dir >= 9)) {
2939 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
2952 if (transport->
contr !=
op->contr)
2965 if (
op->speed_left < 0.0)
2966 op->speed_left = -0.01;
2982 if (
op->contr->fire_on) {
2992 if (
op->contr->fire_on || (
op->contr->run_on && pick != 0)) {
2993 op->direction = dir;
3011 object *transport =
op->contr->transport;
3017 if ((dir < 0) || (dir >= 9)) {
3018 LOG(
llevError,
"move_player: invalid direction %d\n", dir);
3031 if (transport->
contr !=
op->contr)
3049 if (
op->contr->fire_on ||
op->contr->run_on) {
3050 op->direction = dir;
3070 if (
op->contr->hidden) {
3071 op->invisible = 1000;
3080 if (!
op->invisible) {
3083 "Your invisibility spell runs out.");
3104 op->contr->golem_count = 0;
3116 "You can stretch your stiff joints once more.");
3120 if (
op->direction && (
op->contr->run_on ||
op->contr->fire_on)) {
3129 if (
op->speed_left > 0)
3160 "Your %s vibrates violently, then evaporates.",
3165 if (
op->stats.hp < 0)
3166 op->stats.hp =
op->stats.maxhp;
3167 if (
op->stats.food < 0)
3172 LOG(
llevError,
"Error: LIFESAVE set without applied object.\n");
3222 time_t now = time(NULL);
3224 strncpy(buf2,
" R.I.P.\n\n", len);
3226 snprintf(
buf,
sizeof(
buf),
"%s the %s\n",
op->name,
op->contr->title);
3228 snprintf(
buf,
sizeof(
buf),
"%s\n",
op->name);
3229 strncat(buf2,
" ", 20-strlen(
buf)/2);
3230 strncat(buf2,
buf, len-strlen(buf2)-1);
3232 snprintf(
buf,
sizeof(
buf),
"who was in level %d when killed\n",
op->level);
3234 snprintf(
buf,
sizeof(
buf),
"who was in level %d when died.\n\n",
op->level);
3235 strncat(buf2,
" ", 20-strlen(
buf)/2);
3236 strncat(buf2,
buf, len-strlen(buf2)-1);
3238 snprintf(
buf,
sizeof(
buf),
"by %s.\n\n",
op->contr->killer);
3239 strncat(buf2,
" ", 21-strlen(
buf)/2);
3240 strncat(buf2,
buf, len-strlen(buf2)-1);
3242 strftime(
buf,
MAX_BUF,
"%b %d %Y\n", localtime(&now));
3243 strncat(buf2,
" ", 20-strlen(
buf)/2);
3244 strncat(buf2,
buf, len-strlen(buf2)-1);
3256 int last_food =
op->stats.food;
3257 int gen_hp, gen_sp, gen_grace;
3260 int rate_grace = 2000;
3265 if (
op->contr->gen_hp >= 0)
3266 gen_hp = (
op->contr->gen_hp+1)*
op->stats.maxhp;
3268 gen_hp =
op->stats.maxhp;
3269 rate_hp -= rate_hp/2*
op->contr->gen_hp;
3271 if (
op->contr->gen_sp >= 0)
3272 gen_sp = (
op->contr->gen_sp+1)*
op->stats.maxsp;
3274 gen_sp =
op->stats.maxsp;
3275 rate_sp -= rate_sp/2*
op->contr->gen_sp;
3277 if (
op->contr->gen_grace >= 0)
3278 gen_grace = (
op->contr->gen_grace+1)*
op->stats.maxgrace;
3280 gen_grace =
op->stats.maxgrace;
3281 rate_grace -= rate_grace/2*
op->contr->gen_grace;
3286 gen_sp = gen_sp*10/
MAX(
op->contr->gen_sp_armour, 10);
3287 if (
op->stats.sp <
op->stats.maxsp) {
3292 if (
op->contr->digestion < 0)
3293 op->stats.food +=
op->contr->digestion;
3294 else if (
op->contr->digestion > 0
3296 op->stats.food = last_food;
3299 op->last_sp = rate_sp/(
MAX(gen_sp, 20)+10);
3304 if (--
op->last_grace < 0) {
3305 if (
op->stats.grace <
op->stats.maxgrace/2)
3307 op->last_grace = rate_grace/(
MAX(gen_grace, 20)+10);
3313 if (
op->stats.hp <
op->stats.maxhp) {
3318 if (
op->contr->digestion < 0)
3319 op->stats.food +=
op->contr->digestion;
3320 else if (
op->contr->digestion > 0
3322 op->stats.food = last_food;
3325 op->last_heal = rate_hp/(
MAX(gen_hp, 20)+10);
3329 if (--
op->last_eat < 0) {
3330 int bonus =
MAX(
op->contr->digestion, 0);
3331 int penalty =
MAX(-
op->contr->digestion, 0);
3332 if (
op->contr->gen_hp > 0)
3333 op->last_eat = 25*(1+bonus)/(
op->contr->gen_hp+penalty+1);
3335 op->last_eat = 25*(1+bonus)/(penalty+1);
3342 if (
op->contr->state ==
ST_PLAYING &&
op->stats.food < 0 &&
op->stats.hp >= 0) {
3349 object *flesh = NULL;
3355 "You blindly grab for a bite of food.");
3357 if (
op->stats.food >= 0 ||
op->stats.hp < 0)
3366 if (
op->stats.food < 0 &&
op->stats.hp >= 0 && flesh) {
3368 "You blindly grab for a bite of food.");
3377 if (
op->stats.food < 0 &&
op->stats.hp > 0){
3379 int32_t adjust_by =
MIN(-(
op->stats.food),
op->stats.hp);
3380 op->stats.food += adjust_by;
3381 op->stats.hp -= adjust_by;
3397 if (
op->container) {
3412 if (
tmp->nrof > 1) {
3442 "Your body feels cleansed");
3453 "Your mind feels clearer");
3487 assert(trophy != NULL);
3489 "You have been defeated in combat!\n"
3490 "Local medics have saved your life...");
3495 op->stats.hp =
op->stats.maxhp;
3496 if (
op->stats.food <= 0)
3502 snprintf(
buf,
sizeof(
buf),
"%s's %s",
op->name,
tmp->name);
3505 snprintf(
buf,
sizeof(
buf),
3506 "This %s was %s %s the %s, who was defeated at level %d by %s.\n",
3507 tmp->name,
tmp->type ==
FLESH ?
"cut off" :
"taken from",
3508 op->name,
op->contr->title,
3509 (
int)(
op->level),
op->contr->killer);
3515 tmp->materialname = NULL;
3521 op->contr->braced = 0;
3529 if (
op->stats.food < 0) {
3530 snprintf(
buf,
sizeof(
buf),
"%s starved to death.",
op->name);
3531 strcpy(
op->contr->killer,
"starvation");
3533 snprintf(
buf,
sizeof(
buf),
"%s died.",
op->name);
3554 int will_kill_again;
3582 for (
z = 0;
z < num_stats_lose;
z++) {
3601 if (deparch == NULL) {
3621 if (this_stat < 0) {
3623 int keep_chance = this_stat*this_stat;
3625 if (keep_chance < 1)
3641 if (lose_this_stat) {
3651 if (this_stat >= -50) {
3667 if (god && (strcmp(god,
"none")))
3670 "For a brief moment you feel the holy presence of %s protecting you",
3675 "For a brief moment you feel a holy presence protecting you.");
3684 snprintf(
buf,
sizeof(
buf),
"%s's gravestone",
op->name);
3686 snprintf(
buf,
sizeof(
buf),
"%s's gravestones",
op->name);
3688 snprintf(
buf,
sizeof(
buf),
"RIP\nHere rests the hero %s the %s,\n"
3691 op->name,
op->contr->title,
3705 if (
op->stats.food < 100)
3706 op->stats.food = 900;
3707 op->stats.hp =
op->stats.maxhp;
3708 op->stats.sp =
MAX(
op->stats.sp,
op->stats.maxsp);
3709 op->stats.grace =
MAX(
op->stats.grace,
op->stats.maxgrace);
3727 op->contr->braced = 0;
3733 op->contr->mode = 0;
3743 will_kill_again = 0;
3746 will_kill_again |=
tmp->attacktype;
3748 if (will_kill_again) {
3755 force->speed_left = -5.0;
3758 if (will_kill_again&(1<<at))
3759 force->resist[at] = 100;
3802 op->contr->golem_count = 0;
3814 op->stats.hp =
op->stats.maxhp;
3820 sizeof(
op->contr->maplevel));
3821 if (
op->map != NULL)
3839 snprintf(
buf,
sizeof(
buf),
"%s",
op->name);
3842 tmp->level =
op->level;
3849 snprintf(ac_buf,
sizeof(ac_buf),
"%s",
op->contr->socket.account_name);
3900 object *skop, *spob;
3906 LOG(
llevError,
"Player %s lacks critical skill use_magic_item!\n",
op->name);
3909 spob = throw_ob->
inv;
3932 op->contr->tmp_invis = 0;
3933 if (
op->contr->invis_race)
3954 if (
tmp->type == 44 &&
tmp->stats.Wis)
3973 int i,
level = 0, mflag;
3976 if (!
ob || !
ob->map)
3987 level = -(10+(2*
ob->map->darkness));
4017 if (!
op || !
op->map)
4023 if (
op->type ==
PLAYER &&
op->contr->run_on) {
4024 if (!skop || num >= skop->
level) {
4026 "You ran too much! You are no longer hidden!");
4032 num +=
op->map->difficulty;
4036 || ((
op->invisible -= num) <= 0)) {
4040 "You moved out of hiding! You are visible!");
4041 }
else if (
op->type ==
PLAYER && skop) {
4055 int i, friendly = 0,
player = 0, mflags;
4068 for (i = 1; i < 9; i++) {
4130 LOG(
llevError,
"player_can_view() called for non-player object\n");
4179 if (
op->contr &&
op->contr->tmp_invis == 0)
4183 if (
op->hide || !
op->contr || (
op->contr &&
op->contr->tmp_invis)) {
4186 op->hide ?
"unhidden" :
"visible");
4225 && strcmp(
tmp->name,
"battleground") == 0
4234 if (invtmp != NULL) {
4235 if (
x != NULL &&
y != NULL)
4241 if (
x != NULL &&
y != NULL)
4246 if (trophy != NULL) {
4247 if (
tmp->other_arch) {
4248 *trophy =
tmp->other_arch;
4289 if (trlist == NULL ||
who->type !=
PLAYER)
4295 if (tr == NULL || tr->
item == NULL) {
4309 "You gained the ability of %s",
4323 if (
item->invisible) {
4326 "You gained the ability of %s",
4345 if (
item->msg != NULL)
4351 if (
item->animation) {
4353 who->animation =
item->animation;
4354 who->anim_speed =
item->anim_speed;
4375 snprintf(
buf,
sizeof(
buf),
"You feel attuned to ");
4377 if (
item->path_attuned&(1<<i)) {
4379 strcat(
buf,
" and ");
4400 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 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]
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)
void remove_friendly_object(object *op)
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)
EXTERN objectlink * first_friendly_object
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)
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)
void add_friendly_object(object *op)
#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)