63 FILE *deadplayer, *liveplayer;
70 const char *race = NULL;
81 LOG(
llevError,
"resurrect_player: race set to %s, but no treasurelist of that name!\n", spell->
race);
91 LOG(
llevError,
"resurrect_player: got null treasure from treasurelist %s!\n", spell->
race);
100 strcpy(newname, path);
101 strcat(newname,
".pl");
103 strcpy(oldname, newname);
104 strcat(oldname,
".dead");
106 if (!(deadplayer = fopen(oldname,
"r"))) {
108 "The soul of %s cannot be reached.",
109 "The soul of %s cannot be reached.",
114 if (!access(newname, 0)) {
116 "The soul of %s has already been reborn!",
117 "The soul of %s has already been reborn!",
123 if (!(liveplayer = fopen(newname,
"w"))) {
125 "The soul of %s cannot be re-embodied at the moment.",
126 "The soul of %s cannot be re-embodied at the moment.",
128 LOG(
llevError,
"Cannot write player in resurrect_player!\n");
133 while (!feof(deadplayer)) {
134 fgets(buf, 255, deadplayer);
135 sscanf(buf,
"%s", buf2);
136 if (!(strcmp(buf2,
"exp"))) {
137 sscanf(buf,
"%s %"FMT64, buf2, &exp);
140 snprintf(buf,
sizeof(buf),
"exp %"FMT64
"\n", exp);
143 if (!(strcmp(buf2,
"Con"))) {
144 sscanf(buf,
"%s %d", buf2, &Con);
148 snprintf(buf,
sizeof(buf),
"Con %d\n", Con);
150 if (race && !strcmp(buf2,
"race")) {
151 snprintf(buf,
sizeof(buf),
"race %s\n", race);
153 fputs(buf, liveplayer);
187 object *temp, *newob;
188 char name_to_resurrect[
MAX_BUF];
189 int leveldead = 25, mflags, clevel;
203 strcpy(name_to_resurrect, arg);
223 "You need a body for this spell.", NULL);
226 strcpy(name_to_resurrect, temp->
name);
230 if (temp && temp->
map) {
238 leveldead = temp->
level;
277 chance += levelcaster-leveldead;
280 if (chance >
rndm(0, 19))
299 strcpy(filename, path);
300 strcat(filename,
".pl");
301 strcpy(newname, filename);
302 strcat(newname,
".dead");
304 if (rename(filename, newname) != 0) {
305 LOG(
llevError,
"Cannot rename dead player's file %s into %s: %s\n", filename, newname,
strerror_local(errno, path,
sizeof(path)));
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
archetype * find_archetype(const char *name)
int caster_level(const object *caster, const object *spell)
treasurelist * find_treasurelist(const char *name)
#define MSG_TYPE_SPELL_FAILURE
struct treasureliststruct * randomitems
short freearr_x[SIZEOFFREE]
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
short freearr_y[SIZEOFFREE]
int rndm(int min, int max)
void remove_ob(object *op)
int summon_hostile_monsters(object *op, int n, const char *monstername)
static int resurrection_fails(int levelcaster, int leveldead)
object * insert_ob_in_map(object *op, mapstruct *m, object *originator, int flag)
struct treasurestruct * items
void dead_player(object *op)
int snprintf(char *dest, int max, const char *format,...)
#define MSG_TYPE_SPELL_SUCCESS
#define GET_MAP_OB(M, X, Y)
int cast_raise_dead_spell(object *op, object *caster, object *spell, int dir, const char *arg)
void LOG(LogLevel logLevel, const char *format,...)
static int resurrect_player(object *op, char *playername, object *spell)
void free_object(object *ob)
char * strerror_local(int errnum, char *buf, size_t size)
struct treasurestruct * next
object * arch_to_object(archetype *at)