/* ************************************************************************ * File: act.other.c Part of CircleMUD * * Usage: Miscellaneous player-level commands * * * * All rights reserved. See license.doc for complete information. * * * * Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * ************************************************************************ */ #define __ACT_OTHER_C__ #include "conf.h" #include "sysdep.h" #include "structs.h" #include "utils.h" #include "comm.h" #include "interpreter.h" #include "handler.h" #include "db.h" #include "spells.h" #include "screen.h" #include "house.h" #include "constants.h" #include "dg_scripts.h" #include "money.h" /* extern variables */ extern struct room_data *world; extern struct descriptor_data *descriptor_list; extern struct spell_info_type spell_info[]; extern struct index_data *mob_index; extern char *class_abbrevs[]; extern int free_rent; extern int pt_allowed; extern int max_filesize; extern int nameserver_is_slow; extern int auto_save; extern int track_through_doors; /* extern procedures */ void list_skills(struct char_data * ch); void appear(struct char_data * ch); void write_aliases(struct char_data *ch); void perform_immort_vis(struct char_data *ch); SPECIAL(shop_keeper); ACMD(do_gen_comm); void die(struct char_data * ch, struct char_data * killer); void Crash_rentsave(struct char_data * ch, int cost); /* local functions */ ACMD(do_quit); ACMD(do_save); ACMD(do_not_here); ACMD(do_sneak); ACMD(do_hide); ACMD(do_steal); ACMD(do_practice); ACMD(do_visible); ACMD(do_title); int perform_group(struct char_data *ch, struct char_data *vict); void print_group(struct char_data *ch); ACMD(do_group); ACMD(do_ungroup); ACMD(do_report); ACMD(do_split); ACMD(do_use); ACMD(do_wimpy); ACMD(do_display); ACMD(do_gen_write); ACMD(do_gen_tog); ACMD(do_warsong); ACMD(do_quit) { struct descriptor_data *d, *next_d; bool in_house = FALSE; room_rnum save_room; if (IS_NPC(ch) || !ch->desc) return; if (ROOM_FLAGGED(ch->in_room, ROOM_HOUSE) || ROOM_FLAGGED(ch->in_room, ROOM_CLAN_ROOM) ) in_house = TRUE; if (!in_house) { one_argument(argument, arg); if ( (!*arg) || LOWER(*arg) != 'y') { send_to_char("Rent here is incredibly cheap. But if you really wish to\r\n", ch); send_to_char("give up, then simply type 'Quit y'\r\n", ch); return; } } if (GET_POS(ch) == POS_FIGHTING) send_to_char("No way! You're fighting for your life!\r\n", ch); else if (GET_POS(ch) < POS_STUNNED) { send_to_char("You die before your time...\r\n", ch); die(ch, NULL); } else { if (!GET_INVIS_LEV(ch)) act("$n has left the game.", TRUE, ch, 0, 0, TO_ROOM); sprintf(buf, "%s has quit the game.", GET_NAME(ch)); mudlog(buf, NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE); if (in_house) send_to_char("Goodbye good friend...\r\n", ch); else send_to_char("Quitters never win...\r\n", ch); /* * kill off all sockets connected to the same player as the one who is * trying to quit. Helps to maintain sanity as well as prevent duping. */ for (d = descriptor_list; d; d = next_d) { next_d = d->next; if (d == ch->desc) continue; if (d->character && (GET_IDNUM(d->character) == GET_IDNUM(ch))) STATE(d) = CON_DISCONNECT; } if (in_house) { Crash_rentsave(ch, 0); save_room = ch->in_room; extract_char(ch); save_char(ch, save_room); } else extract_char(ch); /* Char is saved in extract char */ } } ACMD(do_save) { if (IS_NPC(ch) || !ch->desc) return; /* Only tell the char we're saving if they actually typed "save" */ if (cmd) { /* * This prevents item duplication by two PC's using coordinated saves * (or one PC with a house) and system crashes. Note that houses are * still automatically saved without this enabled. This code assumes * that guest immortals aren't trustworthy. If you've disabled guest * immortal advances from mortality, you may want < instead of <=. */ if (auto_save && GET_LEVEL(ch) <= LVL_IMMORT) { send_to_char("Saving aliases.\r\n", ch); write_aliases(ch); return; } sprintf(buf, "Saving %s and aliases.\r\n", GET_NAME(ch)); send_to_char(buf, ch); } write_aliases(ch); save_char(ch, NOWHERE); Crash_crashsave(ch); if (ROOM_FLAGGED(ch->in_room, ROOM_HOUSE_CRASH)) House_crashsave(GET_ROOM_VNUM(IN_ROOM(ch))); } /* generic function for commands which are normally overridden by special procedures - i.e., shop commands, mail commands, etc. */ ACMD(do_not_here) { send_to_char("Sorry, but you cannot do that here!\r\n", ch); } ACMD(do_sneak) { struct affected_type af; byte percent; if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_SNEAK)) { send_to_char("You have no idea how to do that.\r\n", ch); return; } send_to_char("Okay, you'll try to move silently for a while.\r\n", ch); if (AFF_FLAGGED(ch, AFF_SNEAK)) affect_from_char(ch, SKILL_SNEAK); percent = number(1, 101); /* 101% is a complete failure */ if (percent > GET_SKILL(ch, SKILL_SNEAK) + dex_app_skill[GET_DEX(ch)].sneak) return; af.type = SKILL_SNEAK; af.duration = GET_LEVEL(ch); af.modifier = 0; af.location = APPLY_NONE; af.bitvector = AFF_SNEAK; affect_to_char(ch, &af); } ACMD(do_hide) { byte percent; if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_HIDE)) { send_to_char("You have no idea how to do that.\r\n", ch); return; } send_to_char("You attempt to hide yourself.\r\n", ch); if (AFF_FLAGGED(ch, AFF_HIDE)) REMOVE_BIT(AFF_FLAGS(ch), AFF_HIDE); percent = number(1, 101); /* 101% is a complete failure */ if (percent > GET_SKILL(ch, SKILL_HIDE) + dex_app_skill[GET_DEX(ch)].hide) return; SET_BIT(AFF_FLAGS(ch), AFF_HIDE); } ACMD(do_steal) { struct char_data *vict; struct obj_data *obj; char vict_name[MAX_INPUT_LENGTH], obj_name[MAX_INPUT_LENGTH]; int percent, gold, pcsteal = 0, ohoh = 0, type = 0; if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_STEAL)) { send_to_char("You have no idea how to do that.\r\n", ch); return; } if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) { send_to_char("This room just has such a peaceful, easy feeling...\r\n", ch); return; } two_arguments(argument, obj_name, vict_name); if (!(vict = get_char_vis(ch, vict_name, FIND_CHAR_ROOM))) { send_to_char("Steal what from who?\r\n", ch); return; } else if (vict == ch) { send_to_char("Come on now, that's rather stupid!\r\n", ch); return; } /* 101% is a complete failure */ percent = number(1, 101) - dex_app_skill[GET_DEX(ch)].p_pocket; if (!pt_allowed && !IS_NPC(vict)) pcsteal = 1; if (!AWAKE(vict)) /* Easier to steal from sleeping people. */ percent -= 50; /* NO NO With Imp's and Shopkeepers, and if player thieving is not allowed */ if (GET_LEVEL(vict) >= LVL_IMMORT || GET_MOB_SPEC(vict) == shop_keeper) percent = 101; /* Failure */ obj = get_obj_in_list_vis(ch, obj_name, vict->carrying); if (!obj) { act("$E hasn't got that item.", FALSE, ch, 0, vict, TO_CHAR); return; } percent += GET_OBJ_WEIGHT(obj); /* Make heavy harder */ /* Character failed the attempt */ if (percent < GET_SKILL(ch, SKILL_STEAL)) { ohoh = TRUE; if (AWAKE(vict)) send_to_char("Oops...you were noticed\r\n", ch); else send_to_char("Oops...You appear to have awakend them!\r\n", ch); act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT); act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT); if (pcsteal) SET_BIT(PLR_FLAGS(ch), PLR_THIEF); witness_mtrigger(ch, vict, 2); if (IS_NPC(vict) && AWAKE(vict)) hit(vict, ch, TYPE_UNDEFINED); return; } if ((IS_CARRYING_N(ch) + 1 > CAN_CARRY_N(ch)) && (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) > CAN_CARRY_W(ch))) { send_to_char("You cannot carry that much.\r\n", ch); return; } /* Object char is stealing is money */ if (GET_OBJ_TYPE(obj) == ITEM_MONEY) { type = get_money_type(obj); gold = number(1, GET_OBJ_VAL(obj, type)); gold = MIN(1782, gold); if (gold > 1) { sprintf(buf, "Bingo! You got %d %s coins.\r\n", gold, coin_types[type]); send_to_char(buf, ch); } else if (gold == 1) send_to_char("You manage to swipe a solitary coin.\r\n", ch); else send_to_char("You couldn't get any money...\r\n", ch); add_cash_to_char(ch, gold, type); sub_cash_from_char(vict, gold, type); return; } else { /* Just a regular object. */ obj_from_char(obj); obj_to_char(obj, ch); send_to_char("Got it!\r\n", ch); } } ACMD(do_practice) { if (IS_NPC(ch)) return; one_argument(argument, arg); if (*arg) send_to_char("You can only practice skills in your guild.\r\n", ch); else list_skills(ch); } ACMD(do_visible) { if (GET_LEVEL(ch) >= LVL_IMMORT) { perform_immort_vis(ch); return; } if AFF_FLAGGED(ch, AFF_INVISIBLE) { appear(ch); send_to_char("You break the spell of invisibility.\r\n", ch); } else send_to_char("You are already visible.\r\n", ch); } ACMD(do_title) { skip_spaces(&argument); delete_doubledollar(argument); if (IS_NPC(ch)) send_to_char("Your title is fine... go away.\r\n", ch); else if (PLR_FLAGGED(ch, PLR_NOTITLE)) send_to_char("You can't title yourself -- you shouldn't have abused it!\r\n", ch); else if ((strstr(argument, "(") || strstr(argument, ")")) && GET_LEVEL(ch) < 32) send_to_char("Titles can't contain the ( or ) characters.\r\n", ch); else if (strlen(argument) > MAX_TITLE_LENGTH) { sprintf(buf, "Sorry, titles can't be longer than %d characters.\r\n", MAX_TITLE_LENGTH); send_to_char(buf, ch); } else { set_title(ch, argument); sprintf(buf, "Okay, you're now %s %s.\r\n", GET_NAME(ch), GET_TITLE(ch)); send_to_char(buf, ch); } } int perform_group(struct char_data *ch, struct char_data *vict) { if (AFF_FLAGGED(vict, AFF_GROUP) || !CAN_SEE(ch, vict)) return (0); SET_BIT(AFF_FLAGS(vict), AFF_GROUP); if (ch != vict) act("$N is now a member of your group.", FALSE, ch, 0, vict, TO_CHAR); act("You are now a member of $n's group.", FALSE, ch, 0, vict, TO_VICT); act("$N is now a member of $n's group.", FALSE, ch, 0, vict, TO_NOTVICT); return (1); } void print_group(struct char_data *ch) { struct char_data *k; struct follow_type *f; if (!AFF_FLAGGED(ch, AFF_GROUP)) send_to_char("But you are not the member of a group!\r\n", ch); else { send_to_char("Your group consists of:\r\n", ch); k = (ch->master ? ch->master : ch); if (AFF_FLAGGED(k, AFF_GROUP)) { sprintf(buf, " [%3dH %3dM %3dV] [%2d %s] $N (Head of group)", GET_HIT(k), GET_MANA(k), GET_MOVE(k), GET_LEVEL(k), CLASS_ABBR(k)); act(buf, FALSE, ch, 0, k, TO_CHAR); } for (f = k->followers; f; f = f->next) { if (!AFF_FLAGGED(f->follower, AFF_GROUP)) continue; sprintf(buf, " [%3dH %3dM %3dV] [%2d %s] $N", GET_HIT(f->follower), GET_MANA(f->follower), GET_MOVE(f->follower), GET_LEVEL(f->follower), CLASS_ABBR(f->follower)); act(buf, FALSE, ch, 0, f->follower, TO_CHAR); } } } ACMD(do_group) { struct char_data *vict; struct follow_type *f; int found; one_argument(argument, buf); if (!*buf) { print_group(ch); return; } if (ch->master) { act("You can not enroll group members without being head of a group.", FALSE, ch, 0, 0, TO_CHAR); return; } if (!str_cmp(buf, "all")) { perform_group(ch, ch); for (found = 0, f = ch->followers; f; f = f->next) found += perform_group(ch, f->follower); if (!found) send_to_char("Everyone following you is already in your group.\r\n", ch); return; } if (!(vict = get_char_vis(ch, buf, FIND_CHAR_ROOM))) send_to_char(NOPERSON, ch); else if ((vict->master != ch) && (vict != ch)) act("$N must follow you to enter your group.", FALSE, ch, 0, vict, TO_CHAR); else { if (!AFF_FLAGGED(vict, AFF_GROUP)) perform_group(ch, vict); else { if (ch != vict) act("$N is no longer a member of your group.", FALSE, ch, 0, vict, TO_CHAR); act("You have been kicked out of $n's group!", FALSE, ch, 0, vict, TO_VICT); act("$N has been kicked out of $n's group!", FALSE, ch, 0, vict, TO_NOTVICT); REMOVE_BIT(AFF_FLAGS(vict), AFF_GROUP); } } } ACMD(do_ungroup) { struct follow_type *f, *next_fol; struct char_data *tch; one_argument(argument, buf); if (!*buf) { if (ch->master || !(AFF_FLAGGED(ch, AFF_GROUP))) { send_to_char("But you lead no group!\r\n", ch); return; } sprintf(buf2, "%s has disbanded the group.\r\n", GET_NAME(ch)); for (f = ch->followers; f; f = next_fol) { next_fol = f->next; if (AFF_FLAGGED(f->follower, AFF_GROUP)) { REMOVE_BIT(AFF_FLAGS(f->follower), AFF_GROUP); send_to_char(buf2, f->follower); if (!AFF_FLAGGED(f->follower, AFF_CHARM)) stop_follower(f->follower); } } REMOVE_BIT(AFF_FLAGS(ch), AFF_GROUP); send_to_char("You disband the group.\r\n", ch); return; } if (!(tch = get_char_vis(ch, buf, FIND_CHAR_ROOM))) { send_to_char("There is no such person!\r\n", ch); return; } if (tch->master != ch) { send_to_char("That person is not following you!\r\n", ch); return; } if (!AFF_FLAGGED(tch, AFF_GROUP)) { send_to_char("That person isn't in your group.\r\n", ch); return; } REMOVE_BIT(AFF_FLAGS(tch), AFF_GROUP); act("$N is no longer a member of your group.", FALSE, ch, 0, tch, TO_CHAR); act("You have been kicked out of $n's group!", FALSE, ch, 0, tch, TO_VICT); act("$N has been kicked out of $n's group!", FALSE, ch, 0, tch, TO_NOTVICT); if (!AFF_FLAGGED(tch, AFF_CHARM)) stop_follower(tch); } ACMD(do_report) { struct char_data *k; struct follow_type *f; if (!AFF_FLAGGED(ch, AFF_GROUP)) { send_to_char("But you are not a member of any group!\r\n", ch); return; } sprintf(buf, "%s reports: %d/%dH, %d/%dM, %d/%dV\r\n", GET_NAME(ch), GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch), GET_MOVE(ch), GET_MAX_MOVE(ch)); CAP(buf); k = (ch->master ? ch->master : ch); for (f = k->followers; f; f = f->next) if (AFF_FLAGGED(f->follower, AFF_GROUP) && f->follower != ch) send_to_char(buf, f->follower); if (k != ch) send_to_char(buf, k); send_to_char("You report to the group.\r\n", ch); } ACMD(do_split) { int amount, num, share, rest; struct char_data *k; struct follow_type *f; char coin_string[MAX_STRING_LENGTH]; int type; if (IS_NPC(ch)) return; two_arguments(argument, buf, coin_string); if (is_number(buf)) { amount = atoi(buf); if (amount <= 0) { send_to_char("Sorry, you can't do that.\r\n", ch); return; } type = parse_cash_type(coin_string); if (type == -1) { send_to_char("What kind of coins do you want to split?\r\n", ch); return; } if (amount > get_money(ch, type)) { send_to_char("You don't seem to have that much to split.\r\n", ch); return; } k = (ch->master ? ch->master : ch); if (AFF_FLAGGED(k, AFF_GROUP) && (k->in_room == ch->in_room)) num = 1; else num = 0; for (f = k->followers; f; f = f->next) if (AFF_FLAGGED(f->follower, AFF_GROUP) && (!IS_NPC(f->follower)) && (f->follower->in_room == ch->in_room)) num++; if (num && AFF_FLAGGED(ch, AFF_GROUP)) { share = amount / num; rest = amount % num; } else { send_to_char("With whom do you wish to share your money?\r\n", ch); return; } sub_cash_from_char(ch, share * (num - 1), type); sprintf(buf, "%s splits %d %s coins; you receive %d.\r\n", GET_NAME(ch), amount, coin_types[type], share); if (rest) { sprintf(buf + strlen(buf), "%d coin%s %s not splitable, so %s " "keeps the money.\r\n", rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch)); } if (AFF_FLAGGED(k, AFF_GROUP) && (k->in_room == ch->in_room) && !(IS_NPC(k)) && k != ch) { add_cash_to_char(k, share, type); send_to_char(buf, k); } for (f = k->followers; f; f = f->next) { if (AFF_FLAGGED(f->follower, AFF_GROUP) && (!IS_NPC(f->follower)) && (f->follower->in_room == ch->in_room) && f->follower != ch) { add_cash_to_char(f->follower, share, type); send_to_char(buf, f->follower); } } sprintf(buf, "You split %d %s coins among %d members -- %d coins each.\r\n", amount, coin_types[type], num, share); if (rest) { sprintf(buf + strlen(buf), "%d coin%s %s not splitable, so you keep " "the money.\r\n", rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were"); add_cash_to_char(ch, rest, type); } send_to_char(buf, ch); } else { send_to_char("How many coins do you wish to split with your group?\r\n", ch); return; } } ACMD(do_use) { struct obj_data *mag_item, *it_obj = NULL; half_chop(argument, arg, buf); if (!*arg) { sprintf(buf2, "What do you want to %s?\r\n", CMD_NAME); send_to_char(buf2, ch); return; } mag_item = GET_EQ(ch, WEAR_HOLD); if (!str_cmp(buf, "it")) it_obj = GET_OBJ_IT(ch); if (!mag_item || !isname(arg, mag_item->name)) { switch (subcmd) { case SCMD_RECITE: case SCMD_QUAFF: if (!(mag_item = get_obj_in_list_vis(ch, arg, ch->carrying))) { sprintf(buf2, "You don't seem to have %s %s.\r\n", AN(arg), arg); send_to_char(buf2, ch); return; } break; case SCMD_USE: sprintf(buf2, "You don't seem to be holding %s %s.\r\n", AN(arg), arg); send_to_char(buf2, ch); return; default: log("SYSERR: Unknown subcmd %d passed to do_use.", subcmd); return; } } switch (subcmd) { case SCMD_QUAFF: if (GET_OBJ_TYPE(mag_item) != ITEM_POTION) { send_to_char("You can only quaff potions.\r\n", ch); return; } break; case SCMD_RECITE: if (GET_OBJ_TYPE(mag_item) != ITEM_SCROLL) { send_to_char("You can only recite scrolls.\r\n", ch); return; } break; case SCMD_USE: if ((GET_OBJ_TYPE(mag_item) != ITEM_WAND) && (GET_OBJ_TYPE(mag_item) != ITEM_STAFF)) { send_to_char("You can't seem to figure out how to use it.\r\n", ch); return; } break; } if (!str_cmp(buf, "it")) GET_OBJ_IT(ch) = it_obj; mag_objectmagic(ch, mag_item, buf); } ACMD(do_wimpy) { int wimp_lev; /* 'wimp_level' is a player_special. -gg 2/25/98 */ if (IS_NPC(ch)) return; one_argument(argument, arg); if (!*arg) { if (GET_WIMP_LEV(ch)) { sprintf(buf, "Your current wimp level is %d hit points.\r\n", GET_WIMP_LEV(ch)); send_to_char(buf, ch); return; } else { send_to_char("At the moment, you're not a wimp. (sure, sure...)\r\n", ch); return; } } if (isdigit(*arg)) { if ((wimp_lev = atoi(arg)) != 0) { if (wimp_lev < 0) send_to_char("Heh, heh, heh.. we are jolly funny today, eh?\r\n", ch); else if (wimp_lev > GET_MAX_HIT(ch)) send_to_char("That doesn't make much sense, now does it?\r\n", ch); else if (wimp_lev > (GET_MAX_HIT(ch) / 2)) send_to_char("You can't set your wimp level above half your hit points.\r\n", ch); else { sprintf(buf, "Okay, you'll wimp out if you drop below %d hit points.\r\n", wimp_lev); send_to_char(buf, ch); GET_WIMP_LEV(ch) = wimp_lev; } } else { send_to_char("Okay, you'll now tough out fights to the bitter end.\r\n", ch); GET_WIMP_LEV(ch) = 0; } } else send_to_char("Specify at how many hit points you want to wimp out at. (0 to disable)\r\n", ch); } ACMD(do_display) { size_t i; if (IS_NPC(ch)) { send_to_char("Mosters don't need displays. Go away.\r\n", ch); return; } skip_spaces(&argument); if (!*argument) { send_to_char("Usage: prompt { { H | M | V } | all | none }\r\n", ch); return; } if (!str_cmp(argument, "on") || !str_cmp(argument, "all")) SET_BIT(PRF_FLAGS(ch), PRF_DISPHP | PRF_DISPMANA | PRF_DISPMOVE); else if (!str_cmp(argument, "off") || !str_cmp(argument, "none")) REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPHP | PRF_DISPMANA | PRF_DISPMOVE); else { REMOVE_BIT(PRF_FLAGS(ch), PRF_DISPHP | PRF_DISPMANA | PRF_DISPMOVE); for (i = 0; i < strlen(argument); i++) { switch (LOWER(argument[i])) { case 'h': SET_BIT(PRF_FLAGS(ch), PRF_DISPHP); break; case 'm': SET_BIT(PRF_FLAGS(ch), PRF_DISPMANA); break; case 'v': SET_BIT(PRF_FLAGS(ch), PRF_DISPMOVE); break; default: send_to_char("Usage: prompt { { H | M | V } | all | none }\r\n", ch); return; } } } send_to_char(OK, ch); } ACMD(do_gen_write) { FILE *fl; char *tmp, buf[MAX_STRING_LENGTH]; const char *filename; struct stat fbuf; time_t ct; switch (subcmd) { case SCMD_BUG: filename = BUG_FILE; break; case SCMD_TYPO: filename = TYPO_FILE; break; case SCMD_IDEA: filename = IDEA_FILE; break; default: return; } ct = time(0); tmp = asctime(localtime(&ct)); if (IS_NPC(ch)) { send_to_char("Monsters can't have ideas - Go away.\r\n", ch); return; } skip_spaces(&argument); delete_doubledollar(argument); if (!*argument) { send_to_char("That must be a mistake...\r\n", ch); return; } sprintf(buf, "%s %s: %s", GET_NAME(ch), CMD_NAME, argument); mudlog(buf, CMP, LVL_IMMORT, FALSE); if (stat(filename, &fbuf) < 0) { perror("SYSERR: Can't stat() file"); return; } if (fbuf.st_size >= max_filesize) { send_to_char("Sorry, the file is full right now.. try again later.\r\n", ch); return; } if (!(fl = fopen(filename, "a"))) { perror("SYSERR: do_gen_write"); send_to_char("Could not open the file. Sorry.\r\n", ch); return; } fprintf(fl, "%-8s (%6.6s) [%5d] %s\n", GET_NAME(ch), (tmp + 4), GET_ROOM_VNUM(IN_ROOM(ch)), argument); fclose(fl); send_to_char("Okay. Thanks!\r\n", ch); } #define TOG_OFF 0 #define TOG_ON 1 #define PRF_TOG_CHK(ch,flag) ((TOGGLE_BIT(PRF_FLAGS(ch), (flag))) & (flag)) ACMD(do_gen_tog) { long result; const char *tog_messages[][2] = { {"You are now safe from summoning by other players.\r\n", "You may now be summoned by other players.\r\n"}, {"Nohassle disabled.\r\n", "Nohassle enabled.\r\n"}, {"Brief mode off.\r\n", "Brief mode on.\r\n"}, {"Compact mode off.\r\n", "Compact mode on.\r\n"}, {"You can now hear tells.\r\n", "You are now deaf to tells.\r\n"}, {"You can now hear auctions.\r\n", "You are now deaf to auctions.\r\n"}, {"You can now hear shouts.\r\n", "You are now deaf to shouts.\r\n"}, {"You can now hear gossip.\r\n", "You are now deaf to gossip.\r\n"}, {"You can now hear the congratulation messages.\r\n", "You are now deaf to the congratulation messages.\r\n"}, {"You can now hear the Wiz-channel.\r\n", "You are now deaf to the Wiz-channel.\r\n"}, {"You are no longer part of the Quest.\r\n", "Okay, you are part of the Quest!\r\n"}, {"You will no longer see the room flags.\r\n", "You will now see the room flags.\r\n"}, {"You will now have your communication repeated.\r\n", "You will no longer have your communication repeated.\r\n"}, {"HolyLight mode off.\r\n", "HolyLight mode on.\r\n"}, {"Nameserver_is_slow changed to NO; IP addresses will now be resolved.\r\n", "Nameserver_is_slow changed to YES; sitenames will no longer be resolved.\r\n"}, {"Autoexits disabled.\r\n", "Autoexits enabled.\r\n"}, {"Will no longer track through doors.\r\n", "Will now track through doors.\r\n"}, {"AutoLooting disabled.\r\n", "AutoLooting enabled.\r\n"}, {"AutoTitle disabled.\r\n", "Autotitle enabled.\r\n"} }; if (IS_NPC(ch)) return; switch (subcmd) { case SCMD_NOSUMMON: result = PRF_TOG_CHK(ch, PRF_SUMMONABLE); break; case SCMD_NOHASSLE: result = PRF_TOG_CHK(ch, PRF_NOHASSLE); break; case SCMD_BRIEF: result = PRF_TOG_CHK(ch, PRF_BRIEF); break; case SCMD_COMPACT: result = PRF_TOG_CHK(ch, PRF_COMPACT); break; case SCMD_NOTELL: result = PRF_TOG_CHK(ch, PRF_NOTELL); break; case SCMD_NOAUCTION: result = PRF_TOG_CHK(ch, PRF_NOAUCT); break; case SCMD_DEAF: result = PRF_TOG_CHK(ch, PRF_DEAF); break; case SCMD_NOGOSSIP: result = PRF_TOG_CHK(ch, PRF_NOGOSS); break; case SCMD_NOGRATZ: result = PRF_TOG_CHK(ch, PRF_NOGRATZ); break; case SCMD_NOWIZ: result = PRF_TOG_CHK(ch, PRF_NOWIZ); break; case SCMD_QUEST: result = PRF_TOG_CHK(ch, PRF_QUEST); break; case SCMD_ROOMFLAGS: result = PRF_TOG_CHK(ch, PRF_ROOMFLAGS); break; case SCMD_NOREPEAT: result = PRF_TOG_CHK(ch, PRF_NOREPEAT); break; case SCMD_HOLYLIGHT: result = PRF_TOG_CHK(ch, PRF_HOLYLIGHT); break; case SCMD_SLOWNS: result = (nameserver_is_slow = !nameserver_is_slow); break; case SCMD_AUTOEXIT: result = PRF_TOG_CHK(ch, PRF_AUTOEXIT); break; case SCMD_TRACK: result = (track_through_doors = !track_through_doors); break; case SCMD_AUTOLOOT: result = PRF_TOG_CHK(ch, PRF_AUTOLOOT); break; case SCMD_AUTOTITLE: result = PRF_TOG_CHK(ch, PRF_AUTOTITLE); break; default: log("SYSERR: Unknown subcmd %d in do_gen_toggle.", subcmd); return; } if (result) send_to_char(tog_messages[subcmd][TOG_ON], ch); else send_to_char(tog_messages[subcmd][TOG_OFF], ch); return; } ACMD(do_warsong) { struct char_data *tch, *k; struct follow_type *f, *f_next; if (!GET_SKILL(ch, SKILL_WARSONG)) { send_to_char("Say what?\r\n",ch); return; } if (!AFF_FLAGGED(ch, AFF_GROUP)) { send_to_char("&rYou sing the anchient song of battle...\r\n&n", ch); send_to_char("&rToo bad there's no group to impress...\r\n&n", ch); return; } if (GET_MOVE(ch) < 51) { send_to_char("You do not have the energy to sing such an emotional song.\r\n", ch); return; } GET_MOVE(ch) -= 50; send_to_char("&rYou sing the anchient song of battle...\r\n&n", ch); act("$n dances around singing an anchient song of battle.",FALSE, ch,0,0,TO_ROOM); if (ch->master != NULL) k = ch->master; else k = ch; for (f = k->followers; f; f = f_next) { f_next = f->next; tch = f->follower; if (tch->in_room != ch->in_room) continue; if (!AFF_FLAGGED(tch, AFF_GROUP)) continue; if (ch == tch) continue; call_magic(ch, tch, 0, SPELL_ENRAGE, 30, CAST_SPELL); } return; } ACMD(do_tag) { struct char_data *victim; if (FIGHTING(ch)) { send_to_char("No time for games now, you're fighting stupid!\r\n",ch); return; } one_argument(argument, arg); if (!*arg) send_to_char("Whom do you wish to tag?\r\n",ch); else if (!(victim = get_char_room_vis(ch, arg))) send_to_char(NOPERSON, ch); else if (!PLR_FLAGGED(ch, PLR_IT) && GET_LEVEL(ch) < 32) send_to_char("Idiot, you can't tag someone unless you're it!\r\n",ch); else if (victim == ch) send_to_char("Playing with yourself will get you nowhere.\r\n",ch); else if (IS_NPC(victim)) send_to_char("The mobile quickly tags you back. Oh darn.\r\n",ch); else if (GET_LEVEL(victim) < 3) send_to_char("You can only tag chars level 3 and above.\r\n",ch); else { REMOVE_BIT(PLR_FLAGS(ch), PLR_IT); SET_BIT(PLR_FLAGS(victim), PLR_IT); act("You run up to $n and tag them! They're IT!\r\n",FALSE,victim, 0, ch, TO_VICT); act("$n runs up to $N and tags them.", FALSE, ch, 0, victim, TO_NOTVICT); act("$n runs up and tags you.", FALSE, ch, 0, victim, TO_VICT); act("$n with a serious look yells, 'Tag! You're IT!\r\n", FALSE,ch, 0, 0, TO_ROOM); send_to_char("&rTAG! You're IT!\r\n&n", victim); } return; } ACMD(do_piss) { bool seen_public = FALSE; struct char_data *tch, *tch_next; /* Mob's can't piss */ if (IS_NPC(ch)) return; if ((GET_COND(ch, THIRST) < 4) || (GET_COND(ch, THIRST) > 7)) { send_to_char("You try to piss, but can't right now.\n\r", ch); return; } GET_COND(ch, THIRST) = 3; send_to_char("Ahhhh, you feel relieved.\n\r", ch); for (tch = world[ch->in_room].people; tch; tch = tch_next) { tch_next = tch->next_in_room; if (!IS_NPC(tch) && AWAKE(tch)) seen_public = TRUE; } if (seen_public) { if (!number(0,20)) { GET_CHA(ch) -= 1; if (GET_CHA(ch) < 3) GET_CHA(ch) = 3; send_to_char("You were spotted! Your public image suffers!\n\r", ch); act("You notice $n pissing nonchalantly in a corner!" , FALSE, ch, 0, 0, TO_ROOM); } } } ACMD(do_search) { int door, percent, prob, found; if (!GET_SKILL(ch, SKILL_SEARCH)) { send_to_char("Your thorough search has revealed nothing.\r\n",ch); return; } if (AFF_FLAGGED(ch, AFF_BLIND)) { send_to_char("You can't see a damned thing, you're blind!\r\n", ch); return; } if (GET_MOVE(ch) < 25) { send_to_char("You do not have the energy to search the room.\r\n", ch); return; } GET_MOVE(ch) -= 25; prob = GET_SKILL(ch, SKILL_SEARCH); found = percent = 0; act("$n starts to search the area.",FALSE, ch,0,0,TO_ROOM); for (door = 0; door < NUM_OF_DIRS; door++) { if (EXIT(ch, door) && (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN)) ) { percent = number(1, 101); /* 101% is a complete failure */ if (percent < prob) { found++; REMOVE_BIT(EXIT(ch, door)->exit_info, EX_HIDDEN); send_to_char("Your thorough search reveals a hidden exit!\r\n", ch); act("$n has discovered a hidden exit!",FALSE, ch,0,0,TO_ROOM); } } } if (!found) send_to_char("Your thorough search reveals nothing.\r\n", ch); }