52 static int resurrect_player(
object *op,
char *playername,
object *spell,
char *accountname) {
53 FILE *deadplayer, *liveplayer;
60 const char *race = NULL;
71 LOG(
llevError,
"resurrect_player: race set to %s, but no treasurelist of that name!\n", spell->
race);
81 LOG(
llevError,
"resurrect_player: got null treasure from treasurelist %s!\n", spell->
race);
90 strcpy(newname, path);
91 strcat(newname,
".pl");
93 strcpy(oldname, newname);
94 strcat(oldname,
".dead");
96 if (!(deadplayer = fopen(oldname,
"r"))) {
98 "The soul of %s cannot be reached.",
103 if (!access(newname, 0)) {
105 "The soul of %s has already been reborn!",
111 liveplayer =
of_open(&of, newname);
112 if (liveplayer == NULL) {
114 "The soul of %s cannot be re-embodied at the moment.",
120 while (!feof(deadplayer)) {
121 fgets(buf, 255, deadplayer);
122 sscanf(buf,
"%s", buf2);
123 if (!(strcmp(buf2,
"exp"))) {
124 sscanf(buf,
"%s %"FMT64, buf2, &exp);
130 if (!(strcmp(buf2,
"Con"))) {
131 sscanf(buf,
"%s %d", buf2, &Con);
135 snprintf(buf,
sizeof(buf),
"Con %d\n", Con);
137 if (race && !strcmp(buf2,
"race")) {
138 snprintf(buf,
sizeof(buf),
"race %s\n", race);
140 fputs(buf, liveplayer);
144 "The soul of %s cannot be re-embodied at the moment.",
182 object *temp, *newob;
183 char name_to_resurrect[
MAX_BUF];
184 char *corpse_account = NULL;
185 int leveldead = 25, mflags, clevel;
188 int spell_success = 0;
199 safe_strncpy(name_to_resurrect, arg,
sizeof(name_to_resurrect));
214 if (tmp->type ==
CORPSE) {
223 "You need a body for this spell.");
231 if (corpse_account) strcpy(corpse_account, temp->
slaying);
235 if (temp && temp->
map) {
240 leveldead = temp->
level;
255 spell_success =
resurrect_player(op, name_to_resurrect, spell, corpse_account);
258 free(corpse_account);
259 return spell_success;
280 chance += levelcaster-leveldead;
283 if (chance >
rndm(0, 19))
302 strcpy(filename, path);
303 strcat(filename,
".pl");
304 strcpy(newname, filename);
305 strcat(newname,
".dead");
307 if (rename(filename, newname) != 0) {
308 LOG(
llevError,
"Cannot rename dead player's file %s into %s: %s\n", filename, newname, strerror(errno));
313 LOG(
llevError,
"Could not edit the account to indicate permanent death for %s!\n", op->
name);
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
int make_perma_dead(object *op)
archetype * find_archetype(const char *name)
int caster_level(const object *caster, const object *spell)
static int resurrect_player(object *op, char *playername, object *spell, char *accountname)
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_t type, uint8_t subtype, const char *message)
short freearr_y[SIZEOFFREE]
int rndm(int min, int max)
void object_free_drop_inventory(object *ob)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
#define MSG_TYPE_SPELL_SUCCESS
int unmake_perma_dead(char *account, char *player)
int summon_hostile_monsters(object *op, int n, const char *monstername)
static int resurrection_fails(int levelcaster, int leveldead)
int of_close(OutputFile *of)
struct treasurestruct * items
void dead_player(object *op)
FILE * of_open(OutputFile *of, const char *fname)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
int cast_raise_dead_spell(object *op, object *caster, object *spell, int dir, const char *arg)
void LOG(LogLevel logLevel, const char *format,...)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
struct treasurestruct * next
object * arch_to_object(archetype *at)
void object_remove(object *op)