void do_whisper(struct char_data *ch, char *argument, int cmd) { struct char_data *vict; char name[100], message[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH]; half_chop(argument,name,message); if(!*name || !*message) send_to_char("Who do you want to whisper to.. and what??\n\r", ch); else if (!(vict = get_char_room_vis(ch, name))) send_to_char("No-one by that name here..\n\r", ch); else if (vict == ch) { act("$n whispers quietly to $mself.",FALSE,ch,0,0,TO_ROOM); send_to_char( "You can't seem to get your mouth close enough to your ear...\n\r", ch); } else { sprintf(buf,"$n whispers to you, '%s'",message); act(buf, FALSE, ch, 0, vict, TO_VICT); send_to_char("Ok.\n\r", ch); act("$n whispers something to $N.", FALSE, ch, 0, vict, TO_NOTVICT); } }
struct char_data *get_char_vis(struct char_data *ch, char *name) { struct char_data *i; int j, number; char tmpname[MAX_INPUT_LENGTH]; char *tmp; /* check location */ if ( ( i = get_char_room_vis(ch, name) ) != 0 ) return(i); strcpy(tmpname,name); tmp = tmpname; if(!(number = get_number(&tmp))) return(0); for (i = character_list, j = 1; i && (j <= number); i = i->next) if (isname(tmp, GET_NAME(i))) if (CAN_SEE(ch, i)) { if (j == number) return(i); j++; } return(0); }
void do_ask(struct char_data *ch, char *argument, int cmd) { struct char_data *vict; char name[100], message[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH]; half_chop(argument,name,message); if(!*name || !*message) send_to_char("Who do you want to ask something.. and what??\n\r", ch); else if (!(vict = get_char_room_vis(ch, name))) send_to_char("No-one by that name here..\n\r", ch); else if (vict == ch) { act("$n quietly asks $mself a question.",FALSE,ch,0,0,TO_ROOM); send_to_char("You think about it for a while...\n\r", ch); } else { sprintf(buf,"$n asks you '%s'",message); act(buf, FALSE, ch, 0, vict, TO_VICT); send_to_char("Ok.\n\r", ch); act("$n asks $N a question.",FALSE,ch,0,vict,TO_NOTVICT); } }
struct char_data *get_char_world_vis(struct char_data *ch, char *name, int *number) { struct char_data *i; int num; if (!number) { number = # num = get_number(&name); } if ((i = get_char_room_vis(ch, name, number)) != NULL) return (i); if (*number == 0) return get_player_vis(ch, name, NULL, 0); for (i = character_list; i && *number; i = i->next) { if (IN_ROOM(ch) == IN_ROOM(i)) continue; if (!isname(name, i->player.name)) continue; if (!CAN_SEE(ch, i)) continue; if (--(*number) != 0) continue; return (i); } return (NULL); }
struct char_data *get_char_vis(struct char_data *ch, char *name, int *number, int where) { if (where == FIND_CHAR_ROOM) return get_char_room_vis(ch, name, number); else if (where == FIND_CHAR_WORLD) return get_char_world_vis(ch, name, number); else return (NULL); }
struct char_data *get_char_vis(struct char_data *ch, char *name) { struct char_data *i; /* check location */ if (i = get_char_room_vis(ch, name)) return(i); return get_char_vis_world(ch,name, NULL); }
void do_disband (CHAR_DATA *ch, char *argument, int cmd) { CHAR_DATA *pal = NULL; char buf [MAX_STRING_LENGTH] = {'\0'}; argument = one_argument (argument, buf); if ( !*buf || !str_cmp (buf, "all") ) { act ("$n motions to $s clanmates.", FALSE, ch, 0, 0, TO_ROOM | TO_ACT_FORMAT); act ("You motion to your clanmates.", FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT); for ( pal = ch->room->people; pal; pal = pal->next_in_room ) { if ( pal->following != ch || !IS_NPC (pal) ) continue; if ( is_leader (ch, pal) && AWAKE (pal) ) { act ("$N motions to you to stop following.", FALSE, pal, 0, ch, TO_CHAR | TO_ACT_FORMAT); act ("$n falls out of step.", FALSE, pal, 0, ch, TO_ROOM | TO_ACT_FORMAT); pal->following = NULL; } } return; } if ( !(pal = get_char_room_vis (ch, buf)) ) { send_to_char ("Nobody is here by that name.\n\r", ch); return; } if ( pal->following != ch ) { act ("$N is not following you.", FALSE, ch, 0, pal, TO_CHAR); return; } if ( !is_leader (ch, pal) ) { act ("You can't give $N orders.", FALSE, ch, 0, pal, TO_CHAR); return; } if ( !IS_NPC (pal) ) { send_to_char ("This command does not work on PCs.\n", ch); return; } pal->following = NULL; act ("You motion to $N.", FALSE, ch, 0, pal, TO_CHAR | TO_ACT_FORMAT); act ("$N motions to $n.", FALSE, pal, 0, ch, TO_NOTVICT | TO_ACT_FORMAT); act ("$N motions to you to stop following.", FALSE, pal, 0, ch, TO_CHAR); act ("$n falls out of step.", FALSE, pal, 0, ch, TO_ROOM | TO_ACT_FORMAT); }
struct char_data *get_char_vis(struct char_data *ch, char *name, int where) { struct char_data *i; int j = 0, number; char tmpname[MAX_INPUT_LENGTH]; char *tmp = tmpname; /* check the room first */ if (where == FIND_CHAR_ROOM) return get_char_room_vis(ch, name); else if (where == FIND_CHAR_WORLD) { if ((i = get_char_room_vis(ch, name)) != NULL) return (i); strcpy(tmp, name); if (!(number = get_number(&tmp))) return get_player_vis(ch, tmp, 0); for (i = character_list; i && (j <= number); i = i->next) { if (PRF_FLAGGED(i, PRF_NOTSELF) && !PRF_FLAGGED(ch, PRF_DETECT) && !IS_NPC(ch)) { if (isname(tmp, i->char_specials.name_dis) && CAN_SEE(ch, i)) if (++j == number) return (i); } else if (!IS_APPROVED(i) && !IS_NPC(i)) { GET_NAME(i, chname); if ((isname(tmp, current_short_desc(i)) || isname(tmp, chname)) && CAN_SEE(ch, i)) if (++j == number) return (i); FREE_NAME(chname); } else { if (isname(tmp, i->player.name) && CAN_SEE(ch, i)) if (++j == number) return (i); } } } return (NULL); }
/* Generic Find, designed to find any object orcharacter. * *arg is the pointer containing the string to be searched for. * This string doesn't have to be a single word, the routine * extracts the next word itself. * bitv.. All those bits that you want to "search through". * Bit found will be result of the function * *ch This is the person that is trying to "find" * **tar_ch Will be NULL if no character was found, otherwise points * **tar_obj Will be NULL if no object was found, otherwise points * * The routine used to return a pointer to the next word in *arg (just * like the one_argument routine), but now it returns an integer that * describes what it filled in. */ int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch, struct char_data **tar_ch, struct obj_data **tar_obj) { int i, found, number; char name_val[MAX_INPUT_LENGTH]; char *name = name_val; *tar_ch = NULL; *tar_obj = NULL; one_argument(arg, name); if (!*name) return (0); if (!(number = get_number(&name))) return (0); if (IS_SET(bitvector, FIND_CHAR_ROOM)) { /* Find person in room */ if ((*tar_ch = get_char_room_vis(ch, name, &number)) != NULL) return (FIND_CHAR_ROOM); } if (IS_SET(bitvector, FIND_CHAR_WORLD)) { if ((*tar_ch = get_char_world_vis(ch, name, &number)) != NULL) return (FIND_CHAR_WORLD); } if (IS_SET(bitvector, FIND_OBJ_EQUIP)) { for (found = FALSE, i = 0; i < NUM_WEARS && !found; i++) if (GET_EQ(ch, i) && isname(name, GET_EQ(ch, i)->name) && --number == 0) { *tar_obj = GET_EQ(ch, i); found = TRUE; } if (found) return (FIND_OBJ_EQUIP); } if (IS_SET(bitvector, FIND_OBJ_INV)) { if ((*tar_obj = get_obj_in_list_vis(ch, name, &number, ch->carrying)) != NULL) return (FIND_OBJ_INV); } if (IS_SET(bitvector, FIND_OBJ_ROOM)) { if ((*tar_obj = get_obj_in_list_vis(ch, name, &number, world[IN_ROOM(ch)].contents)) != NULL) return (FIND_OBJ_ROOM); } if (IS_SET(bitvector, FIND_OBJ_WORLD)) { if ((*tar_obj = get_obj_vis(ch, name, &number))) return (FIND_OBJ_WORLD); } return (0); }
void do_medit(struct char_data *ch, char *argument, int cmd) { char name[20]; struct char_data *mob; int i; if(IS_NPC(ch)) return; if ((IS_NPC(ch)) || (GetMaxLevel(ch)<CREATOR)) return; if (!ch->desc) /* someone is forced to do something. can be bad! */ return; /* the ch->desc->str field will cause problems... */ for (i = 0; *(argument + i) == ' '; i++); if (!*(argument + i)) { send_to_char("Medit who?\n\r", ch); return; } argument = one_argument(argument, name); if (!(mob = (struct char_data *)get_char_room_vis(ch, name))) { send_to_char("I don't see that mobile here.\n\r",ch); return; } if(IS_PC(mob)) { send_to_char("You can not mobedit players.\n\r",ch); return; } if (GetMaxLevel(ch) < GOD && !IS_SET(ch->player.user_flags,CAN_MOB_EDIT)) { send_to_char("You do not have access to edit mobiles.\n\r",ch); return; } ch->specials.mobedit=mob; ch->specials.medit = MOB_MAIN_MENU; ch->desc->connected = CON_MOB_EDITING; act("$n has begun editing a mobile.", FALSE, ch, 0, 0, TO_ROOM); GET_POS(ch)=POSITION_SLEEPING; UpdateMobMenu(ch); }
void do_initiate (CHAR_DATA *ch, char *argument, int cmd) { char arg1 [MAX_INPUT_LENGTH]; char arg2 [MAX_INPUT_LENGTH]; char buf [MAX_STRING_LENGTH]; char *target_name; CHAR_DATA *target; int to_circle; int circle_levs [] = { 0, 36, 42, 48, 52, 57, 60, 65, 70, 100 }; /** skill in Ritual must meet circle_levs[to_circle] to be promoted to that circle **/ argument = one_argument (argument, arg1); argument = one_argument (argument, arg2); if ( !ch->deity ) { send_to_char ("Be careful you don't attract the wrath of a god.\n\r", ch); return; } if ( strtol(arg1, NULL, 10)) { to_circle = strtol(arg1, NULL, 10); target_name = arg2; } else if ( strtol(arg2, NULL, 10)) { to_circle = strtol(arg2, NULL, 10); target_name = arg1; } else { send_to_char ("You must follow the exact time honored rituals when " "initiating a brother\n\ror sister.\n\r", ch); return; } if ( to_circle < 1 || to_circle > 9 ) { send_to_char ("$g doesn't recognize that circle.\n\r", ch); return; } if ( !(target = get_char_room_vis (ch, target_name)) ) { send_to_char ("They aren't here.\n\r", ch); return; } if ( to_circle >= ch->circle ) { send_to_char ("You cannot initiate at or above your circle.\n\r", ch); return; } if ( target->deity != ch->deity ) { act ("Your lesson is lost on $N.", FALSE, ch, 0, target, TO_CHAR); return; } if ( target->circle + 1 < to_circle ) { act ("$N is not ready for that circle.\n\r", FALSE, ch, 0, target, TO_CHAR); return; } else if ( target->circle + 1 > to_circle ) { act ("$N is beyond those teachings.", FALSE, ch, 0, target, TO_CHAR); return; } if ( target->skills [SKILL_RITUAL] < circle_levs [to_circle] ) { act ("$N cannot be initiated to that circle.", FALSE, ch, 0, target, TO_CHAR); return; } target->circle++; snprintf (buf, MAX_STRING_LENGTH, "You quietly instruct $N in the secrets " "of the %d%s circle of $G.", target->circle, target->circle == 1 ? "st" : target->circle == 2 ? "nd" : target->circle == 3 ? "rd" : "th"); act (buf, FALSE, ch, 0, target, TO_CHAR); snprintf (buf, MAX_STRING_LENGTH, "$N quietly instructs you in the secrets " "of the %d%s circle of $g.", target->circle, target->circle == 1 ? "st" : target->circle == 2 ? "nd" : target->circle == 3 ? "rd" : "th"); act (buf, FALSE, target, 0, ch, TO_CHAR); return; }
void do_castout (CHAR_DATA *ch, char *argument, int cmd) { int clan_flags = 0; int clan_flags2 = 0; CHAR_DATA *victim = NULL; CLAN_DATA *clan = NULL; char *p; char clan_name [80]; char buf [MAX_STRING_LENGTH] = {'\0'}; argument = one_argument (argument, buf); if ( !*buf ) { send_to_char ("Castout whom?\n\r", ch); return; } if ( !(victim = get_char_room_vis (ch, buf)) ) { send_to_char ("Nobody is here by that name.\n\r", ch); return; } argument = one_argument (argument, buf); p = ch->clans; if ( !*buf ) { if ( !get_next_leader (&p, clan_name, &clan_flags) ) { send_to_char ("You are not a leader in that clan. You can't cast out anybody.\n", ch); return; } clan = get_clandef(clan_name); if ( !clan ) { send_to_char ("No such clan, I am afraid.\n", ch); return; } strcpy (clan_name, clan->name); } else if ( get_clan_long_short (ch, buf, &clan_flags) ) { if ( !IS_SET (clan_flags, CLAN_LEADER) && (clan_flags < CLAN_SERGEANT || clan_flags > CLAN_COMMANDER) && !IS_SET (clan_flags, CLAN_MASTER) ) { send_to_char ("You are not a leader in that clan. You cannot cast anyone out.\n", ch); return; } clan = get_clandef_long(buf); if ( !clan ) { send_to_char ("No such clan, I am afraid.\n", ch); return; } strcpy (clan_name, clan->name); } else { send_to_char ("You are not a member of such a clan.\n", ch); return; } if ( !get_clan (victim, clan_name, &clan_flags2) ) { act ("$N is not part of your clan.\n", FALSE, ch, 0, victim, TO_CHAR); return; } if ( IS_SET (clan_flags, CLAN_LEADER) || clan_flags <= clan_flags2 ) { act ("You are not of sufficient rank to cast $N from the clan.\n", FALSE, ch, 0, victim, TO_CHAR | TO_ACT_FORMAT); return; } remove_clan (victim, clan_name); snprintf (buf, MAX_STRING_LENGTH, "$N is no longer a part of %s.", clan->literal); act (buf, FALSE, ch, 0, victim, TO_CHAR); snprintf (buf, MAX_STRING_LENGTH, "$n has stripped you of your clan membership in %s.", clan->literal); act (buf, FALSE, ch, 0, victim, TO_VICT | TO_ACT_FORMAT); snprintf (buf, MAX_STRING_LENGTH, "$n has stripped $N of membership in %s.", clan->literal); act ("$n has stripped $N of clan membership.", FALSE, ch, 0, victim, TO_NOTVICT | TO_ACT_FORMAT); }
void do_recruit (CHAR_DATA *ch, char *argument, int cmd) { CHAR_DATA *pal = NULL; char buf [MAX_STRING_LENGTH]; argument = one_argument (argument, buf); if ( !*buf ) { for ( pal = ch->room->people; pal; pal = pal->next_in_room ) { if ( IS_NPC (pal) && pal->following != ch && is_leader (ch, pal) ) break; } if ( !pal ) { send_to_char ("Nobody else here will follow you.\n\r", ch); return; } pal->following = ch; act ("$N nods to you to follow.", FALSE, pal, 0, ch, TO_CHAR | TO_ACT_FORMAT); act ("$N motions to $S clanmates.", FALSE, pal, 0, ch, TO_NOTVICT | TO_ACT_FORMAT); act ("$n falls in.", FALSE, pal, 0, ch, TO_ROOM | TO_ACT_FORMAT); return; } if ( !str_cmp (buf, "all") ) { act ("$n motions to $s clanmates.", FALSE, ch, 0, 0, TO_ROOM | TO_ACT_FORMAT); for ( pal = ch->room->people; pal; pal = pal->next_in_room ) { if ( IS_NPC (pal) && pal->following != ch && is_leader (ch, pal) ) { pal->following = ch; act ("$N nods to you to follow.", FALSE, pal, 0, ch, TO_CHAR | TO_ACT_FORMAT); act ("$n falls in.", FALSE, pal, 0, ch, TO_ROOM | TO_ACT_FORMAT); } } if ( !pal ) { send_to_char ("Nobody else here will follow you.\n\r", ch); return; } return; } if ( !(pal = get_char_room_vis (ch, buf)) ) { send_to_char ("Nobody is here by that name.\n\r", ch); return; } if ( pal == ch ) { send_to_char ("Not yourself.\n\r", ch); return; } if ( !is_leader (ch, pal) ) { act ("You don't have the authority to recruit $N.", FALSE, ch, 0, pal, TO_CHAR); return; } if ( pal->following == ch ) { act ("$N is already following you.", FALSE, ch, 0, pal, TO_CHAR); return; } pal->following = ch; act ("$N motions to $S clanmates.", FALSE, pal, 0, ch, TO_NOTVICT | TO_ACT_FORMAT); act ("$n falls in.", FALSE, pal, 0, ch, TO_VICT | TO_ACT_FORMAT); act ("$N nods to you to follow.", FALSE, pal, 0, ch, TO_CHAR); return; }
void do_invite (CHAR_DATA *ch, char *argument, int cmd) { int clan_flags = 0; char *p = NULL; CHAR_DATA *tch = NULL; CLAN_DATA *clan = NULL; char buf [MAX_STRING_LENGTH] = {'\0'}; char clan_name [MAX_STRING_LENGTH] = {'\0'}; argument = one_argument (argument, buf); if ( !*buf ) { send_to_char ("Invite who?\n\r", ch); return; } if ( !(tch = get_char_room_vis (ch, buf)) ) { send_to_char ("Nobody is here by that name.\n", ch); return; } if ( tch == ch ) { send_to_char ("You can't invite yourself.\n", ch); return; } argument = one_argument (argument, buf); if ( !*buf ) { p = ch->clans; if ( !get_next_leader (&p, clan_name, &clan_flags) ) { send_to_char ("You are not an initiated leader of any clan.\n", ch); return; } if ( (clan = get_clandef (clan_name)) ) { send_to_char ("That clan could not be found in the database.\n", ch); return; } strcpy (buf, clan->name); } else { if ( !get_clan_long_short (ch, buf, &clan_flags) ) { send_to_char ("You are not a member of such a clan.\n", ch); return; } if ( !IS_SET (clan_flags, CLAN_LEADER) && (clan_flags < CLAN_CORPORAL || clan_flags > CLAN_COMMANDER) && !IS_SET (clan_flags, CLAN_MASTER) ) { send_to_char ("You are not a leader of that clan.\n", ch); return; } /* Keep clan_name as the short name */ if ( (clan = get_clandef_long (buf)) ) strcpy (buf, clan->name); } if ( get_clan (tch, buf, &clan_flags) ) { act ("$N is already a clan member.", FALSE, ch, 0, tch, TO_CHAR); return; } if ( tch->delay || tch->fighting ) { act ("$N is busy right now.", FALSE, ch, 0, tch, TO_CHAR); return; } if ( !AWAKE (tch) ) { act ("$N isn't conscious right now.", FALSE, ch, 0, tch, TO_CHAR); return; } clan = get_clandef (buf); tch->delay = IS_NPC (tch) && !tch->desc ? 3 : 120; tch->delay_type = DEL_INVITE; tch->delay_ch = ch; tch->delay_who = str_dup (buf); snprintf (buf, MAX_STRING_LENGTH, "You invite $N to join %s.", clan ? clan->literal : clan_name); act (buf, FALSE, ch, 0, tch, TO_CHAR); snprintf (buf, MAX_STRING_LENGTH, "$N invites you to join %s.", clan ? clan->literal : clan_name); act (buf, FALSE, tch, 0, ch, TO_CHAR); act ("$N whispers something to $n about joining a clan.", FALSE, tch, 0, ch, TO_NOTVICT | TO_ACT_FORMAT); }
void do_promote (CHAR_DATA *ch, char *argument, int cmd) { int clan_flags = 0; CHAR_DATA *tch = NULL; CLAN_DATA *clan = NULL; char buf [MAX_STRING_LENGTH] = {'\0'}; char clan_name [MAX_STRING_LENGTH] = {'\0'}; int flags = 0; char *temp_arg = NULL; argument = one_argument (argument, buf); if ( !*buf ) { send_to_char ("Promote whom?\n\r", ch); return; } if ( !(tch = get_char_room_vis (ch, buf)) ) { send_to_char ("Nobody is here by that name.\n", ch); return; } if ( tch == ch ) { send_to_char ("Sorry - unfortunately, promotions just don't work that way...\n", ch); return; } argument = one_argument (argument, clan_name); if ( !*clan_name ) { send_to_char ("Which clan did you wish to make the promotion in?\n", ch); return; } if ( !get_clan_long_short (ch, clan_name, &clan_flags) ) { send_to_char ("You are not a member of such a clan.\n", ch); return; } if ( !IS_SET (clan_flags, CLAN_LEADER) && (clan_flags < CLAN_SERGEANT || clan_flags > CLAN_COMMANDER) && !IS_SET (clan_flags, CLAN_MASTER) ) { send_to_char ("You are not a leader of that clan.\n", ch); return; } /* Keep clan_name as the short name */ if ( (clan = get_clandef_long (clan_name)) ) strcpy (clan_name, clan->name); argument = one_argument (argument, buf); if ( !(flags = clan_flags_to_value (buf)) ) { send_to_char ("I don't recognize the specified rank.\n", ch); return; } if ( clan_flags >= CLAN_SERGEANT && clan_flags <= CLAN_COMMANDER && (flags < CLAN_RECRUIT || flags > CLAN_COMMANDER) ) { send_to_char ("You'll need to specify a military rank, e.g. Recruit, Private, etc.\n", ch); return; } else if ( clan_flags >= CLAN_APPRENTICE && clan_flags <= CLAN_MASTER && (flags < CLAN_APPRENTICE || flags > CLAN_MASTER) ) { send_to_char ("You'll need to specify a guild rank, e.g. Apprentice, Journeyman, etc.\n", ch); return; } if ( flags >= clan_flags ) { send_to_char ("You do not have the authority to make this promotion.\n", ch); return; } temp_arg = get_clan_rank_name(flags); snprintf (buf, MAX_STRING_LENGTH, "You promote $N to the rank of %s.", temp_arg); act (buf, FALSE, ch, 0, tch, TO_CHAR | TO_ACT_FORMAT); temp_arg = get_clan_rank_name(flags); snprintf (buf, MAX_STRING_LENGTH, "$n has promoted you to the rank of %s.", temp_arg); act (buf, FALSE, ch, 0, tch, TO_VICT | TO_ACT_FORMAT); act ("$n has promoted $N.", FALSE, ch, 0, tch, TO_NOTVICT | TO_ACT_FORMAT); add_clan (tch, clan_name, flags); return; }
int Piovra( struct char_data *pChar, int nCmd, const char *szArg, struct char_data *pMob, int nType ) { struct room_data *pRoom; if( pMob == NULL ) { mudlog( LOG_SYSERR, "pMob == NULL in Piovra( carceri.h )" ); return FALSE; } if( ( pRoom = real_roomp( pMob->in_room ) ) != NULL ) { if( nType == EVENT_TICK && pMob->generic < 8 && AWAKE( pMob ) ) { struct char_data *pNext, *pTar; for( pTar = pRoom->people; pTar; pTar = pNext ) { pNext = pTar->next_in_room; if( IS_PC( pTar ) && IS_SET( pTar->specials.act, PLR_NOHASSLE ) ) continue; /* Ignora chi e` in NOHASSLE */ if( pTar->specials.fighting && mob_index[ pTar->specials.fighting->nr ].iVNum == TENTACOLI && CAN_SEE( pMob, pTar ) ) AddHated( pMob, pTar ); if( ( pTar->specials.fighting == pMob || Hates( pMob, pTar ) ) && CAN_SEE( pMob, pTar ) && ( !pTar->attackers || ( pTar->attackers == 1 && pMob->specials.fighting == pTar ) ) ) { struct char_data *pTentacolo = read_mobile( TENTACOLI, VIRTUAL ); if( pTentacolo ) { char_to_room( pTentacolo, pMob->in_room ); hit( pTentacolo, pTar, TYPE_CRUSH ); pMob->generic++; if( pMob->mult_att > 1 ) pMob->mult_att--; } else mudlog( LOG_ERROR, "Cannot load mob Tentacolo in Piovra(carceri.c)" ); } else if( mob_index[ pTar->nr ].iVNum == TENTACOLI && !pTar->specials.fighting && pTar->attackers <= 0 ) { extract_char( pTar ); pMob->generic--; if( pMob->mult_att < 6 ) pMob->mult_att++; } } } else if( nType == EVENT_DEATH ) { struct char_data *pNext, *pTar; for( pTar = pRoom->people; pTar; pTar = pNext ) { pNext = pTar->next_in_room; if( mob_index[ pTar->nr ].iVNum == TENTACOLI ) extract_char( pTar ); } } else if( nType == EVENT_COMMAND && nCmd == CMD_BASH ) { while( isspace( *szArg ) ) szArg++; if( ( !*szArg && pChar->specials.fighting == pMob ) || ( *szArg && get_char_room_vis( pChar, szArg ) == pMob ) ) { act( "Cerchi di colpire $N ma rimbalzi contro il suo corpo morbido.", TRUE, pChar, 0, pMob, TO_CHAR ); act( "$n cerca di colpire $N ma rimbalza contro il suo corpo morbido.", TRUE, pChar, 0, pMob, TO_ROOM ); WAIT_STATE( pChar, PULSE_VIOLENCE * 2 ); GET_POS( pChar ) = POSITION_SITTING; if( AWAKE( pMob ) ) AddHated( pMob, pChar ); return TRUE; } } } else mudlog( LOG_SYSERR, "pMob in invalid room in Piovra( carceri.c )" ); return FALSE; }
void sub_write(char *arg, char_data *ch, byte find_invis, int targets) { char str[MAX_INPUT_LENGTH * 2]; char type[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH]; char *tokens[MAX_INPUT_LENGTH], *s, *p; void *otokens[MAX_INPUT_LENGTH]; char_data *to; obj_data *obj; int i, tmp; int to_sleeping = 1; /* mainly for windows compiles */ if (!arg) return; tokens[0] = str; for (i = 0, p = arg, s = str; *p;) { switch (*p) { case '~': case '|': case '^': case '&': case '*': /* get char_data, move to next token */ type[i] = *p; *s = '\0'; p = any_one_name(++p, name); otokens[i] = find_invis ? (void *)get_char_in_room(&world[IN_ROOM(ch)], name) : (void *)get_char_room_vis(ch, name, NULL); tokens[++i] = ++s; break; case '`': /* get obj_data, move to next token */ type[i] = *p; *s = '\0'; p = any_one_name(++p, name); if (find_invis) obj = get_obj_in_room(&world[IN_ROOM(ch)], name); else if (!(obj = get_obj_in_list_vis(ch, name, NULL, world[IN_ROOM(ch)].contents))) ; else if (!(obj = get_obj_in_equip_vis(ch, name, &tmp, ch->equipment))) ; else obj = get_obj_in_list_vis(ch, name, NULL, ch->carrying); otokens[i] = (void *)obj; tokens[++i] = ++s; break; case '\\': p++; *s++ = *p++; break; default: *s++ = *p++; } } *s = '\0'; tokens[++i] = NULL; if (IS_SET(targets, TO_CHAR) && SENDOK(ch)) sub_write_to_char(ch, tokens, otokens, type); if (IS_SET(targets, TO_ROOM)) for (to = world[IN_ROOM(ch)].people; to; to = to->next_in_room) if (to != ch && SENDOK(to)) sub_write_to_char(to, tokens, otokens, type); }
void sub_write(char *arg, char_data *ch, byte find_invis, int targets) { char str[MAX_INPUT_LENGTH * 2]; char type[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH]; char *tokens[MAX_INPUT_LENGTH], *s, *p; void *otokens[MAX_INPUT_LENGTH]; char_data *to; obj_data *obj; int i; int to_sleeping = 1, is_spammy = 0; /* mainly for windows compiles */ if (!arg) return; tokens[0] = str; for (i = 0, p = arg, s = str; *p;) { switch (*p) { case '~': case '|': case '^': // case '&': // removed this because it conflicts with color codes case '*': { /* get char_data, move to next token */ type[i] = *p; *s = '\0'; p = any_one_name(++p, name); otokens[i] = find_invis ? get_char_in_room(IN_ROOM(ch), name) : get_char_room_vis(ch, name); tokens[++i] = ++s; break; } case '@': { /* get obj_data, move to next token */ type[i] = *p; *s = '\0'; p = any_one_name(++p, name); if (find_invis) obj = get_obj_in_room(IN_ROOM(ch), name); else if (!(obj = get_obj_in_list_vis(ch, name, ROOM_CONTENTS(IN_ROOM(ch))))) { // nothing } else if (!(obj = get_obj_in_equip_vis(ch, name, ch->equipment))) { // nothing } else { obj = get_obj_in_list_vis(ch, name, ch->carrying); } otokens[i] = obj; tokens[++i] = ++s; break; } case '\\': { p++; *s++ = *p++; break; } default: { *s++ = *p++; } } } *s = '\0'; tokens[++i] = NULL; if (IS_SET(targets, TO_CHAR) && SENDOK(ch) && (AWAKE(ch) || IS_SET(targets, TO_SLEEP))) sub_write_to_char(ch, tokens, otokens, type); if (IS_SET(targets, TO_ROOM)) { for (to = ROOM_PEOPLE(IN_ROOM(ch)); to; to = to->next_in_room) { if (to != ch && SENDOK(to) && (AWAKE(to) || IS_SET(targets, TO_SLEEP))) { sub_write_to_char(to, tokens, otokens, type); } } } }
void sub_write(char *arg, char_data *ch, byte find_invis, int targets) { char str[MAX_INPUT_LENGTH * 2]; char type[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH]; char *tokens[MAX_INPUT_LENGTH], *s, *p; void *otokens[MAX_INPUT_LENGTH]; char_data *to; obj_data *obj; int i, tmp; int to_sleeping = 1; /* mainly for windows compiles */ if (!arg) return; tokens[0] = str; for (i = 0, p = arg, s = str; *p;) { switch (*p) { case '~': case '@': case '^': case '&': case '*': /* get char_data, move to next token */ type[i] = *p; *s = '\0'; p = any_one_name(++p, name); /* 20-10-15 changed the following line due to compiler error (char_data *)otokens[i] = */ otokens[i] = find_invis ? get_char(name) : get_char_room_vis(ch, name); tokens[++i] = ++s; break; case '`': /* get obj_data, move to next token */ type[i] = *p; *s = '\0'; p = any_one_name(++p, name); /* 20-10-2015 updated following line due to compiler errors (obj_data *)otokens[i] = */ otokens[i] = (void*) find_invis ? (obj = get_obj(name)) : ((obj = get_obj_in_list_vis(ch, name, world[IN_ROOM(ch)].contents)) ? obj : (obj = get_object_in_equip_vis(ch, name, ch->equipment, &tmp)) ? obj : (obj = get_obj_in_list_vis(ch, name, ch->carrying))); /* 20-10-15 Updated the following line due to comp error (obj_data *)otokens[i] = obj; */ otokens[i] = (void*) obj; tokens[++i] = ++s; break; case '\\': p++; *s++ = *p++; break; default: *s++ = *p++; } } *s = '\0'; tokens[++i] = NULL; if (IS_SET(targets, TO_CHAR) && SENDOK(ch)) sub_write_to_char(ch, tokens, otokens, type); if (IS_SET(targets, TO_ROOM)) for (to = world[IN_ROOM(ch)].people; to; to = to->next_in_room) if (to != ch && SENDOK(to)) sub_write_to_char(to, tokens, otokens, type); }
void do_hex (CHAR_DATA * ch, char *argument, int cmd) { int sn; int duration, modifier; CHAR_DATA *tch; char buf[MAX_STRING_LENGTH]; if (!real_skill (ch, SKILL_HEX)) { send_to_char ("You shiver at the thought.\n\r", ch); return; } argument = one_argument (argument, buf); if (!(tch = get_char_room_vis (ch, buf))) { send_to_char ("You don't see that person here.\n\r", ch); return; } if (IS_MORTAL (ch) && !IS_MORTAL (tch)) { send_to_char ("Immortals are total losers. It can't get any worse for them.\n\r", ch); return; } if (GET_HIT (ch) + GET_MOVE (ch) <= 35) { send_to_char ("You can't concentrate hard enough for that right now.\n\r", ch); return; } sprintf (buf, "Hexing %s", tch->tname); weaken (ch, 0, 20, buf); sense_activity (ch, SKILL_HEX); if (!skill_use (ch, SKILL_HEX, 0)) { send_to_char ("You lose your concentration, and your malignant energies dissipate.\n", ch); return; } act ("You channel a stream of malignant psychic energy into $N, entwining $M in an ethereal web of ill-fortune and grief.", false, ch, 0, tch, TO_CHAR | _ACT_FORMAT); act ("A chill runs down your spine.", false, ch, 0, tch, TO_VICT); sn = spell_lookup ("curse"); modifier = ch->skills[SKILL_HEX] / 5 + number (1, 10); duration = ch->skills[SKILL_HEX] / 5 + number (1, 48); magic_add_affect (tch, MAGIC_AFFECT_CURSE, duration, modifier, 0, 0, sn); tch->curse += ch->skills[SKILL_HEX] / 5 + number (1, 5); }
int social (CHAR_DATA * ch, char *argument) { char buf[MAX_INPUT_LENGTH]; SOCIAL_DATA *action; CHAR_DATA *victim; int i; argument = one_argument (argument, buf); if (ch->room->nVirtual == AMPITHEATRE && IS_MORTAL (ch)) { if (!get_obj_in_list_num (VNUM_SPEAKER_TOKEN, ch->right_hand) && !get_obj_in_list_num (VNUM_SPEAKER_TOKEN, ch->left_hand)) { send_to_char ("You decide against making a commotion. PETITION to request to speak.\n", ch); return 0; } } for (i = 0; i < list_top; i++) { if (is_abbrev (buf, social_messages[i].social_command)) break; } if (i == list_top) return 0; action = &social_messages[i]; if (action->char_found) one_argument (argument, buf); else *buf = '\0'; if (!*buf) { send_to_char (action->char_no_arg, ch); send_to_char ("\n\r", ch); if (action->others_no_arg) act (action->others_no_arg, action->hide, ch, 0, 0, TO_ROOM); return 1; } if (!(victim = get_char_room_vis (ch, buf))) { send_to_char (action->not_found, ch); send_to_char ("\n\r", ch); } else if (victim == ch) { send_to_char (action->char_auto, ch); send_to_char ("\n\r", ch); if (action->others_auto) act (action->others_auto, action->hide, ch, 0, 0, TO_ROOM); } else if (GET_POS (victim) < action->min_victim_position) act ("$N is not in a proper position for that.", false, ch, 0, victim, TO_CHAR); else { if (action->char_found) act (action->char_found, 0, ch, 0, victim, TO_CHAR); if (action->others_found) act (action->others_found, action->hide, ch, 0, victim, TO_NOTVICT); if (action->vict_found) act (action->vict_found, action->hide, ch, 0, victim, TO_VICT); } return 1; }
int generic_find(char *arg, int bitvector, struct char_data *ch, struct char_data **tar_ch, struct obj_data **tar_obj) { static char *ignore[] = { "the", "in", "on", "at", "\n" }; int i; char name[256]; bool found; found = FALSE; /* Eliminate spaces and "ignore" words */ while (*arg && !found) { for(; *arg == ' '; arg++) ; for(i=0; (name[i] = *(arg+i)) && (name[i]!=' '); i++) ; name[i] = 0; arg+=i; if (search_block(name, ignore, TRUE) > -1) found = TRUE; } if (!name[0]) return(0); *tar_ch = 0; *tar_obj = 0; if (IS_SET(bitvector, FIND_CHAR_ROOM)) { /* Find person in room */ if (*tar_ch = get_char_room_vis(ch, name)) { return(FIND_CHAR_ROOM); } } if (IS_SET(bitvector, FIND_CHAR_WORLD)) { if (*tar_ch = get_char_vis(ch, name)) { return(FIND_CHAR_WORLD); } } if (IS_SET(bitvector, FIND_OBJ_EQUIP)) { for(found=FALSE, i=0; i<MAX_WEAR && !found; i++) if (ch->equipment[i] && str_cmp(name, ch->equipment[i]->name) == 0) { *tar_obj = ch->equipment[i]; found = TRUE; } if (found) { return(FIND_OBJ_EQUIP); } } if (IS_SET(bitvector, FIND_OBJ_INV)) { if (IS_SET(bitvector, FIND_OBJ_ROOM)) { if (*tar_obj = get_obj_vis_accessible(ch, name)) { return(FIND_OBJ_INV); } } else { if (*tar_obj = get_obj_in_list_vis(ch, name, ch->carrying)) { return(FIND_OBJ_INV); } } } if (IS_SET(bitvector, FIND_OBJ_ROOM)) { if (*tar_obj = get_obj_in_list_vis(ch, name, real_roomp(ch->in_room)->contents)) { return(FIND_OBJ_ROOM); } } if (IS_SET(bitvector, FIND_OBJ_WORLD)) { if (*tar_obj = get_obj_vis(ch, name)) { return(FIND_OBJ_WORLD); } } return(0); }
void do_disarm(struct char_data *ch, char *argument, int cmd) { char name[30]; int percent; struct char_data *victim; struct obj_data *w; int chance; int cost; if (check_peaceful(ch,"You feel too peaceful to contemplate violence.\n\r")) return; only_argument(argument, name); if (!(victim = get_char_room_vis(ch, name))) { if (ch->specials.fighting) { victim = ch->specials.fighting; } else { send_to_char("Disarm who?\n\r", ch); return; } } if (victim == ch) { send_to_char("Aren't we funny today...\n\r", ch); return; } if(!CheckKill(ch,victim)) return; if(ch->attackers > 3) { send_to_char("There is no room to disarm!\n\r", ch); return; } if(victim->attackers > 3) { send_to_char("There is no room to disarm!\n\r",ch); return; } cost = 25 - (GET_LEVEL(ch,BestFightingClass(ch))/10); if(GET_MANA(ch)<cost) { send_to_char("You trip and fall while trying to disarm.\n\r",ch); return; } percent=number(1,101); /* 101% is a complete failure */ percent -= dex_app[GET_DEX(ch)].reaction; percent += dex_app[GET_DEX(victim)].reaction; if(!ch->equipment[WIELD] && !ch->equipment[WIELD_TWOH]) { percent -= 50; } if(percent > ch->skills[SKILL_DISARM].learned) { /* failure */ GET_MANA(ch) -= 10; act("You try to disarm $N, but fail miserably.",TRUE,ch,0,victim,TO_CHAR); if((ch->equipment[WIELD]) && (number(1,10) > 8)) { send_to_char("Your weapon flies from your hand while trying!\n\r",ch); w = unequip_char(ch,WIELD); obj_from_char(w); obj_to_room(w,ch->in_room); act("$n tries to disarm $N, but $n loses his weapon!",TRUE,ch,0,victim,TO_ROOM); } else if((ch->equipment[WIELD_TWOH]) && (number(1,10) > 9)) { send_to_char("Your weapon slips from your hands while trying!\n\r",ch); w = unequip_char(ch,WIELD_TWOH); obj_from_char(w); obj_to_room(w,ch->in_room); act("$n tries to disarm $N, but $n loses his weapon!",TRUE,ch,0,victim,TO_ROOM); } GET_POS(ch) = POSITION_SITTING; if((IS_NPC(victim)) && (GET_POS(victim) > POSITION_SLEEPING) && (!victim->specials.fighting)) { set_fighting(victim, ch); } WAIT_STATE(ch, PULSE_VIOLENCE*2); } else { if(victim->equipment[WIELD]) { GET_MANA(ch) -= 25; w = unequip_char(victim, WIELD); act("$n makes an impressive fighting move.",TRUE, ch, 0, 0, TO_ROOM); act("You send $p flying from $N's grasp.", TRUE, ch, w, victim, TO_CHAR); act("$p flies from your grasp.", TRUE, ch, w, victim, TO_VICT); obj_from_char(w); obj_to_room(w, victim->in_room); if(ch->skills[SKILL_DISARM].learned < 50) ch->skills[SKILL_DISARM].learned += 2; } else if(victim->equipment[WIELD_TWOH]) { GET_MANA(ch) -= cost; if(IS_NPC(victim)) chance = 70; else chance = victim->skills[SKILL_TWO_HANDED].learned; percent=number(1,101); /* 101% is a complete failure */ if(percent > chance) { w = unequip_char(victim, WIELD_TWOH); act("$n makes a very impressive fighting move.",TRUE, ch, 0, 0, TO_ROOM); act("You send $p flying from $N's grasp.", TRUE, ch, w, victim, TO_CHAR); act("$p flies from your grasp.", TRUE, ch, w, victim, TO_VICT); obj_from_char(w); obj_to_room(w, victim->in_room); if(ch->skills[SKILL_DISARM].learned < 50) ch->skills[SKILL_DISARM].learned += 4; } else { act("You try to disarm $N, but fail miserably.",TRUE,ch,0,victim,TO_CHAR); } } else { act("You try to disarm $N, but $E doesn't have a weapon.", TRUE, ch, 0, victim, TO_CHAR); act("$n makes an impressive fighting move, but does little more.", TRUE, ch, 0, 0, TO_ROOM); } if ((IS_NPC(victim)) && (GET_POS(victim) > POSITION_SLEEPING) && (!victim->specials.fighting)) { set_fighting(victim, ch); } WAIT_STATE(ch, PULSE_VIOLENCE*1); } }
/* Execute a social command. */ void exec_social(struct char_data *npc, char *cmd, int next_line, int *cur_line, void **thing) { bool ok; void do_move(struct char_data *ch, char *argument, int cmd); void do_open(struct char_data *ch, char *argument, int cmd); void do_lock(struct char_data *ch, char *argument, int cmd); void do_unlock(struct char_data *ch, char *argument, int cmd); void do_close(struct char_data *ch, char *argument, int cmd); if (GET_POS(npc) == POSITION_FIGHTING) return; ok = TRUE; switch (*cmd) { case 'G' : *cur_line = next_line; return; case 'g' : *cur_line += next_line; return; case 'e' : act(cmd+1, FALSE, npc, *thing, *thing, TO_ROOM); break; case 'E' : act(cmd+1, FALSE, npc, 0, *thing, TO_VICT); break; case 'B' : act(cmd+1, FALSE, npc, 0, *thing, TO_NOTVICT); break; case 'm' : do_move(npc, "", *(cmd+1)-'0'+1); break; case 'w' : if (GET_POS(npc) != POSITION_SLEEPING) ok = FALSE; else GET_POS(npc) = POSITION_STANDING; break; case 's' : if (GET_POS(npc) <= POSITION_SLEEPING) ok = FALSE; else GET_POS(npc) = POSITION_SLEEPING; break; case 'c' : /* Find char in room */ *thing = get_char_room_vis(npc, cmd+1); ok = (*thing != 0); break; case 'o' : /* Find object in room */ *thing = get_obj_in_list_vis(npc, cmd+1, world[npc->in_room].contents); ok = (*thing != 0); break; case 'r' : /* Test if in a certain room */ ok = (npc->in_room == atoi(cmd+1)); break; case 'O' : /* Open something */ do_open(npc, cmd+1, 0); break; case 'C' : /* Close something */ do_close(npc, cmd+1, 0); break; case 'L' : /* Lock something */ do_lock(npc, cmd+1, 0); break; case 'U' : /* UnLock something */ do_unlock(npc, cmd+1, 0); break; case '?' : /* Test a random number */ if (atoi(cmd+1) <= number(1,100)) ok = FALSE; break; default: break; } /* End Switch */ if (ok) (*cur_line)++; else (*cur_line) += next_line; }