void check_idling(struct char_data * ch) { if (++(ch->char_specials.timer) > idle_void) { if (GET_WAS_IN(ch) == NOWHERE && IN_ROOM(ch) != NOWHERE) { GET_WAS_IN(ch) = IN_ROOM(ch); if (FIGHTING(ch)) { stop_fighting(FIGHTING(ch)); stop_fighting(ch); } act("$n disappears into the void.", TRUE, ch, 0, 0, TO_ROOM); send_to_char("You have been idle, and are pulled into a void.\r\n", ch); save_char(ch, NOWHERE); Crash_crashsave(ch); char_from_room(ch); char_to_room(ch, 1); } else if (ch->char_specials.timer > idle_rent_time) { if (IN_ROOM(ch) != NOWHERE) char_from_room(ch); char_to_room(ch, 3); if (ch->desc) { STATE(ch->desc) = CON_DISCONNECT; /* * For the 'if (d->character)' test in close_socket(). * -gg 3/1/98 (Happy anniversary.) */ ch->desc->character = NULL; ch->desc = NULL; } if (free_rent) Crash_rentsave(ch, 0); else Crash_idlesave(ch); sprintf(buf, "%s force-rented and extracted (idle).", GET_NAME(ch)); mudlog(buf, CMP, LVL_GOD, TRUE); extract_char(ch); } } }
void check_idling( CharData * ch ) { #define VOID_TIME 8 #define EXTRACT_TIME 32 void Crash_rentsave(CharData *ch, int cost); void Crash_cryosave(CharData *ch, int cost); /* ** CONJURED timer */ int i = 0; for(;i < 4;i++) { if( GET_CONJ_CNT(ch, i) > 0) { SET_CONJ_CNT(ch, i) -= 1; if(SET_CONJ_CNT(ch, i) == 0) switch(GET_CLASS(ch)) { case CLASS_RANGER: sendChar( ch, "The creatures of the wild will answer your call again.\r\n" ); break; case CLASS_NECROMANCER: sendChar(ch, "The dead will heed your summons once more.\r\n"); case CLASS_MAGIC_USER: switch(i) { case TIMER_GATE: sendChar(ch, "Demons will answer your summons again.\r\n"); break; case TIMER_MONSTER: sendChar(ch, "Monsters will answer your summons again.\r\n"); break; case TIMER_ELEMENTAL: sendChar(ch, "Elementals will answer your summons again.\r\n"); break; } break; default: sendChar( ch, "Conjured creatures will answer your summons again.\r\n" ); } } } /* ** HUNTED timer */ if( IS_SET_AR( PLR_FLAGS(ch), PLR_HUNTED ) && ch->desc && (--(ch)->player_specials->saved.phunt_countdown <= 0)) { sendChar( ch, "You are no longer hunted.\r\n" ); unset_hunted_player(ch); } /* ** THIEF timer */ if( IS_SET_AR(PLR_FLAGS(ch), PLR_THIEF) && ch->desc && (--(ch)->player_specials->saved.pthief_countdown <= 0)) { REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_THIEF); send_to_char("You are no longer a registered thief.\r\n", ch); (ch)->player_specials->saved.pthief_countdown = 0; } /* KILLER timer */ if (IS_SET_AR(PLR_FLAGS(ch), PLR_KILLER) && (--(ch)->player_specials->saved.pkill_countdown <= 0)) { REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_KILLER); send_to_char("You are no longer a registered killer.\r\n", ch); (ch)->player_specials->saved.pkill_countdown = 0; } /* JAILED timer */ if (IS_SET_AR(PLR_FLAGS(ch), PLR_JAILED) && (--(ch)->player_specials->saved.jail_timer <= 0)) { int jail_exit_room; REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_JAILED); if (PRF_FLAGGED(ch, PRF_GOLD_TEAM) && IN_ROOM(ch) == real_room(GOLD_TEAM_JAIL)) { jail_exit_room = real_room(GOLD_TEAM_START_ROOM); GET_HIT(ch) = GET_MAX_HIT(ch); GET_MANA(ch) = GET_MAX_MANA(ch); GET_MOVE(ch) = GET_MAX_MOVE(ch); char_from_room(ch); char_to_room(ch, jail_exit_room); look_at_room(ch, 0); } if (PRF_FLAGGED(ch, PRF_BLACK_TEAM) && IN_ROOM(ch) == real_room(BLACK_TEAM_JAIL)) { jail_exit_room = real_room(BLACK_TEAM_START_ROOM); GET_HIT(ch) = GET_MAX_HIT(ch); GET_MANA(ch) = GET_MAX_MANA(ch); GET_MOVE(ch) = GET_MAX_MOVE(ch); char_from_room(ch); char_to_room(ch, jail_exit_room); look_at_room(ch, 0); } if (PRF_FLAGGED(ch, PRF_ROGUE_TEAM) && IN_ROOM(ch) == real_room(ROGUE_TEAM_JAIL)) { jail_exit_room = real_room(ROGUE_TEAM_START_ROOM); GET_HIT(ch) = GET_MAX_HIT(ch); GET_MANA(ch) = GET_MAX_MANA(ch); GET_MOVE(ch) = GET_MAX_MOVE(ch); char_from_room(ch); char_to_room(ch, jail_exit_room); look_at_room(ch, 0); } sendChar(ch, "Your imprisonement is over.\r\n"); // if (PRF_FLAGGED(ch, PRF_GOLD_TEAM)) // jail_exit_room = IN_ROOM(ch); // else if (PRF_FLAGGED(ch, PRF_BLACK_TEAM)) // jail_exit_room = IN_ROOM(ch); // else if (PRF_FLAGGED(ch, PRF_ROGUE_TEAM)) // jail_exit_room = IN_ROOM(ch); // else // jail_exit_room = getStartRoom(ch); // char_to_room(ch, jail_exit_room); // look_at_room(ch, 0); } /* ** If your hunted there is NO escape. */ if(( ++(ch->char_specials.timer) > VOID_TIME ) && !IS_SET_AR(PLR_FLAGS(ch), PLR_HUNTED)) { if (GET_WAS_IN(ch) == NOWHERE && ch->in_room != NOWHERE) { GET_WAS_IN(ch) = ch->in_room; end_fight(ch); act("$n disappears into the void.", TRUE, ch, 0, 0, TO_ROOM); send_to_char("You have been idle, and are pulled into a void.\r\n", ch); save_char(ch, NOWHERE); Crash_crashsave(ch); GET_WAS_IN(ch) = ch->in_room; char_from_room(ch); char_to_room(ch, 1); } //else if (ch->char_specials.timer > EXTRACT_TIME) //{ //if (ch->in_room != NOWHERE) //char_from_room(ch); //char_to_room(ch, 1); //if (ch->desc) //SET_DCPENDING(ch->desc); //ch->desc = NULL; //Crash_idlesave(ch); /* apparently causing problems? */ //crashRentSave(ch, -1); //mudlog( NRM, LVL_LRGOD, TRUE, "%s force-rented and extracted (idle).", GET_NAME(ch)); //extract_char(ch); //} } #undef VOID_TIME #undef EXTRACT_TIME }
/* * Alert: As of bpl14, this function returns the following codes: * < 0 Victim died. * = 0 No damage. * > 0 How much damage done. */ int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype) { if (GET_POS(victim) <= POS_DEAD) { /* This is "normal"-ish now with delayed extraction. -gg 3/15/2001 */ if (PLR_FLAGGED(victim, PLR_NOTDEADYET) || MOB_FLAGGED(victim, MOB_NOTDEADYET)) return (-1); log("SYSERR: Attempt to damage corpse '%s' in room #%d by '%s'.", GET_NAME(victim), GET_ROOM_VNUM(IN_ROOM(victim)), GET_NAME(ch)); die(victim); return (-1); /* -je, 7/7/92 */ } /* peaceful rooms */ if (ch != victim && ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) { send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n"); return (0); } /* shopkeeper protection */ if (!ok_damage_shopkeeper(ch, victim)) return (0); /* You can't damage an immortal! */ if (!IS_NPC(victim) && (GET_LEVEL(victim) >= LVL_IMMORT)) dam = 0; if (victim != ch) { /* Start the attacker fighting the victim */ if (GET_POS(ch) > POS_STUNNED && (FIGHTING(ch) == NULL)) set_fighting(ch, victim); /* Start the victim fighting the attacker */ if (GET_POS(victim) > POS_STUNNED && (FIGHTING(victim) == NULL)) { set_fighting(victim, ch); if (MOB_FLAGGED(victim, MOB_MEMORY) && !IS_NPC(ch)) remember(victim, ch); } } /* If you attack a pet, it hates your guts */ if (victim->master == ch) stop_follower(victim); /* If the attacker is invisible, he becomes visible */ if (AFF_FLAGGED(ch, AFF_INVISIBLE | AFF_HIDE)) appear(ch); /* Cut damage in half if victim has sanct, to a minimum 1 */ if (AFF_FLAGGED(victim, AFF_SANCTUARY) && dam >= 2) dam /= 2; /* Check for PK if this is not a PK MUD */ if (!pk_allowed) { check_killer(ch, victim); if (PLR_FLAGGED(ch, PLR_KILLER) && (ch != victim)) dam = 0; } /* Set the maximum damage per round and subtract the hit points */ dam = MAX(MIN(dam, 100), 0); GET_HIT(victim) -= dam; /* Gain exp for the hit */ if (ch != victim) gain_exp(ch, GET_LEVEL(victim) * dam); update_pos(victim); /* * skill_message sends a message from the messages file in lib/misc. * dam_message just sends a generic "You hit $n extremely hard.". * skill_message is preferable to dam_message because it is more * descriptive. * * If we are _not_ attacking with a weapon (i.e. a spell), always use * skill_message. If we are attacking with a weapon: If this is a miss or a * death blow, send a skill_message if one exists; if not, default to a * dam_message. Otherwise, always send a dam_message. */ if (!IS_WEAPON(attacktype)) skill_message(dam, ch, victim, attacktype); else { if (GET_POS(victim) == POS_DEAD || dam == 0) { if (!skill_message(dam, ch, victim, attacktype)) dam_message(dam, ch, victim, attacktype); } else { dam_message(dam, ch, victim, attacktype); } } /* Use send_to_char -- act() doesn't send message if you are DEAD. */ switch (GET_POS(victim)) { case POS_MORTALLYW: act("$n is mortally wounded, and will die soon, if not aided.", TRUE, victim, 0, 0, CommTarget::TO_ROOM); send_to_char(victim, "You are mortally wounded, and will die soon, if not aided.\r\n"); break; case POS_INCAP: act("$n is incapacitated and will slowly die, if not aided.", TRUE, victim, 0, 0, CommTarget::TO_ROOM); send_to_char(victim, "You are incapacitated an will slowly die, if not aided.\r\n"); break; case POS_STUNNED: act("$n is stunned, but will probably regain consciousness again.", TRUE, victim, 0, 0, CommTarget::TO_ROOM); send_to_char(victim, "You're stunned, but will probably regain consciousness again.\r\n"); break; case POS_DEAD: act("$n is dead! R.I.P.", FALSE, victim, 0, 0, CommTarget::TO_ROOM); send_to_char(victim, "You are dead! Sorry...\r\n"); break; default: /* >= POSITION SLEEPING */ if (dam > (GET_MAX_HIT(victim) / 4)) send_to_char(victim, "That really did HURT!\r\n"); if (GET_HIT(victim) < (GET_MAX_HIT(victim) / 4)) { send_to_char(victim, "%sYou wish that your wounds would stop BLEEDING so much!%s\r\n", CCRED(victim, C_SPR), CCNRM(victim, C_SPR)); if (ch != victim && MOB_FLAGGED(victim, MOB_WIMPY)) do_flee(victim, NULL, 0, 0); } if (!IS_NPC(victim) && GET_WIMP_LEV(victim) && (victim != ch) && GET_HIT(victim) < GET_WIMP_LEV(victim) && GET_HIT(victim) > 0) { send_to_char(victim, "You wimp out, and attempt to flee!\r\n"); do_flee(victim, NULL, 0, 0); } break; } /* Help out poor linkless people who are attacked */ if (!IS_NPC(victim) && !(victim->desc) && GET_POS(victim) > POS_STUNNED) { do_flee(victim, NULL, 0, 0); if (!FIGHTING(victim)) { act("$n is rescued by divine forces.", FALSE, victim, 0, 0, CommTarget::TO_ROOM); GET_WAS_IN(victim) = IN_ROOM(victim); char_from_room(victim); char_to_room(victim, 0); } } /* stop someone from fighting if they're stunned or worse */ if (GET_POS(victim) <= POS_STUNNED && FIGHTING(victim) != NULL) stop_fighting(victim); /* Uh oh. Victim died. */ if (GET_POS(victim) == POS_DEAD) { if (ch != victim && (IS_NPC(victim) || victim->desc)) { if (AFF_FLAGGED(ch, AFF_GROUP)) group_gain(ch, victim); else solo_gain(ch, victim); } if (!IS_NPC(victim)) { mudlog(BRF, LVL_IMMORT, TRUE, "%s killed by %s at %s", GET_NAME(victim), GET_NAME(ch), world[IN_ROOM(victim)].name); if (MOB_FLAGGED(ch, MOB_MEMORY)) forget(ch, victim); } die(victim); return (-1); } return (dam); }