void do_setquest( CHAR_DATA *ch, char *argument ) { char arg1[MIL], arg2[MIL], arg3[MIL], arg4[MIL]; QUEST_DATA *quest; int x; set_char_color( AT_PLAIN, ch ); if ( IS_NPC( ch ) ) { error( ch ); return; } if ( !IS_IMMORTAL( ch ) ) { error( ch ); return; } if ( !ch->desc ) { bug( "%s", "do_setquest (desc): no descriptor" ); return; } switch ( ch->substate ) { default: break; case SUB_QUEST_DESC: if ( !ch->dest_buf || !( quest = ( QUEST_DATA * ) ch->dest_buf ) ) { bug( "%s: sub_quest_desc: NULL ch->dest_buf", __FUNCTION__ ); ch->substate = SUB_NONE; return; } ch->dest_buf = NULL; if ( VLD_STR( quest->desc ) ) STRFREE( quest->desc ); quest->desc = copy_buffer( ch ); stop_editing( ch ); write_quest_list( ); ch->substate = SUB_NONE; return; } argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); if ( arg1[0] == '\0' ) { send_to_char( "&cUsage: setquest save all\r\n", ch ); send_to_char( " setquest <&Cqname&c> create\r\n", ch ); send_to_char( " setquest <&Cqname&c> delete\r\n", ch ); send_to_char( " setquest <&Cqname&c> chapter <#> delete\r\n", ch ); send_to_char( " setquest <&Cqname&c> desc\r\n", ch ); send_to_char( " setquest <&Cqname&c> <&Cfield&c>\r\n", ch ); send_to_char( " setquest <&Cquest&c> remove <&Cplayer&c>\r\n", ch ); send_to_char( " showquest <&Cqname&c>\r\n", ch ); send_to_char( " Field being one of:\r\n", ch ); send_to_char( "level svnum stype chapters chapter timelimit skipchapters glory\r\n", ch ); send_to_char( "\r\nchapter <n> <field2>\r\n", ch ); send_to_char( " Field2 being one of:\r\n", ch ); send_to_char( "create delete svnum stype\r\n", ch ); send_to_char( "name timelimit level kamount\r\n", ch ); send_to_char( "Note: 3600 = 1 hour timelimit\r\n", ch ); return; } if ( ( !str_cmp( arg1, "tutorial" ) && ch->level < 108 ) || ( !str_cmp( arg1, "etutorial" ) && ch->level < 108 ) || ( !str_cmp( arg1, "dtutorial" ) && ch->level < 108 ) ) { send_to_char( "You need Vladaar's permission to change anything with tutorials.\r\n", ch ); return; } if ( !str_cmp( arg1, "save" ) ) { if ( !str_cmp( arg2, "all" ) ) { write_quest_list( ); send_to_char( "All quests saved.\r\n", ch ); return; } } quest = get_quest_from_name( arg1 ); if ( !str_cmp( arg2, "create" ) ) { if ( quest && VLD_STR( quest->name ) && !str_cmp( quest->name, arg1 ) ) { ch_printf( ch, "(%s): quest already exists!\r\n", quest->name ); return; } CREATE( quest, QUEST_DATA, 1 ); quest->name = STRALLOC( arg1 ); quest->number = -1; add_new_quest( ch, quest ); write_quest_list( ); return; } if ( !quest ) { send_to_char( "No quest by that name.\r\n", ch ); return; } if ( !str_cmp( arg2, "desc" ) ) { if ( !ch->desc ) { bug( "%s", "do_setquest (desc): no descriptor" ); return; } ch->substate = SUB_QUEST_DESC; ch->dest_buf = quest; start_editing( ch, quest->desc ); return; } if ( !str_cmp( arg2, "delete" ) ) { free_quest( quest ); send_to_char( "Deleted.\r\n", ch ); return; } if ( !str_cmp( arg2, "skipchapters" ) ) { quest->skipchapters = !quest->skipchapters; ch_printf( ch, "That quest will %s allow chapters to be skipped.\r\n", quest->skipchapters ? "now" : "no longer" ); return; } if ( !str_cmp( arg2, "chapters" ) ) { x = atoi( argument ); if ( x < 0 || x > 30 ) { send_to_char( "Chapters must be between 0 and 30.\r\n", ch ); return; } quest->chapters = x; send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "svnum" ) ) { quest->svnum = atoi( argument ); ch_printf( ch, "That quest's svnum (starting vnum) is set to %d.\r\n", quest->svnum ); return; } if ( !str_cmp( arg2, "stype" ) ) { x = atoi( argument ); if ( x < 0 || x > 2 ) { send_to_char ( "Can only set stype (starting type) to 0 for Mobiles, 1 for Objects, 2 for Rooms.\r\n", ch ); return; } quest->stype = x; ch_printf( ch, "That quest's stype (starting type) is set to %d[%s].\r\n", quest->stype, ( quest->stype == 0 ) ? "Mobile" : ( quest->stype == 1 ) ? "Object" : ( quest->stype == 2 ) ? "Room" : "Unknown" ); return; } if ( !str_cmp( arg2, "glory" ) ) { x = atoi( argument ); if ( x < 0 || x > 1 ) { send_to_char( "Can only set 0 for no glory, or 1 for glory.\r\n", ch ); return; } quest->glory = x; return; } if ( !str_cmp( arg2, "chapter" ) ) { CHAP_DATA *chap = NULL; argument = one_argument( argument, arg3 ); argument = one_argument( argument, arg4 ); int chapno = atoi( arg3 ); if ( chapno < 1 || chapno > MAX_CHAPTERS ) { ch_printf( ch, "Chapter range is 1 to %d.\r\n", MAX_CHAPTERS ); return; } if ( !str_cmp( arg4, "create" ) ) { if ( get_chap_from_quest( chapno, quest ) ) { send_to_char( "That chapter already exists!\r\n", ch ); return; } if ( !get_chap_from_quest( ( chapno - 1 ), quest ) && chapno > 1 ) { ch_printf( ch, "How can you create chapter %d before chapter %d even exists?\r\n", chapno, chapno - 1 ); return; } if ( chapno > quest->chapters ) { ch_printf( ch, "How can you create chapter %d when there are only %d chapters?\r\n", chapno, quest->chapters ); send_to_char( "Set more - 'setquest (questname) chapters (number)'.\r\n", ch ); return; } CREATE( chap, CHAP_DATA, 1 ); chap->number = chapno; add_chapter( quest, chap ); send_to_char( "New chapter added.\r\n", ch ); write_quest_list( ); return; } chap = get_chap_from_quest( chapno, quest ); if ( !chap ) { send_to_char( "No such chapter.\r\n", ch ); return; } if ( !str_cmp( arg4, "delete" ) ) { free_chapter( quest, chap ); send_to_char( "Chapter Deleted.\r\n", ch ); return; } if ( !str_cmp( arg4, "name" ) ) { if ( VLD_STR( chap->desc ) ) STRFREE( chap->desc ); if ( VLD_STR( argument ) ) { if ( strlen( argument ) > 50 ) argument[50] = '\0'; chap->desc = STRALLOC( argument ); } write_quest_list( ); send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg4, "timelimit" ) ) { x = atoi( argument ); if ( x < 0 || x > 3600 ) { send_to_char( "Time limit is between 0 and 3600 (one hour).\r\n", ch ); return; } chap->timelimit = x; send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg4, "kamount" ) ) { int kamount = atoi( argument ); if ( kamount < 0 ) { send_to_char( "You have to set kamount to 0 or higher.\r\n", ch ); return; } chap->kamount = kamount; send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg4, "level" ) ) { int level = atoi( argument ); if ( level < 0 || level > MAX_LEVEL ) { ch_printf( ch, "Level range is between 0 and %d.\r\n", MAX_LEVEL ); return; } chap->level = level; send_to_char( "Done.\r\n", ch ); return; } do_setquest( ch, ( char * ) "" ); return; } if ( !str_cmp( arg2, "level" ) ) { x = atoi( argument ); if ( x < 1 || x > MAX_LEVEL ) { send_to_char( "Quest level must be between 1 and max.\r\n", ch ); return; } quest->level = x; send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "timelimit" ) ) { x = atoi( argument ); if ( x < 0 || x > 3600 ) { send_to_char ( "Quest time limit must be between 0 (no timer) and 3600 seconds (1 hour).\r\n", ch ); return; } quest->timelimit = x; send_to_char( "Done.\r\n", ch ); return; } if ( !str_cmp( arg2, "remove" ) ) { CHAR_DATA *victim; CHQUEST_DATA *chquest; if ( ( victim = get_char_world( ch, argument ) ) != NULL && !IS_NPC( victim ) ) { x = get_number_from_quest( quest ); for ( chquest = victim->pcdata->first_quest; chquest; chquest = chquest->next ) { if ( chquest->questnum != quest->number ) continue; UNLINK( chquest, victim->pcdata->first_quest, victim->pcdata->last_quest, next, prev ); DISPOSE( chquest ); ch_printf( ch, "You remove quest %s from %s.\r\n", quest->name, victim->name ); ch_printf( victim, "Quest %s has been removed from your journal.\r\n", quest->name ); return; } send_to_char( "That player isn't currently on that quest.\r\n", ch ); return; } else send_to_char( "That player isn't currently online.\r\n", ch ); return; } do_setquest( ch, ( char * ) "" ); return; }
void do_rpalignment( CHAR_DATA *ch, char *argument ) { char buf[MSL]; char arg[MAX_INPUT_LENGTH]; one_argument( argument, arg ); if (IS_NPC(ch)) return; if (!IS_CLASS(ch,CLASS_RPONLY)) { ch->pcdata->rpalign=RPALIGN_NONE; return; } if ( arg[0] == '\0' ) { send_to_char( "Please enter 'light', 'merc', 'none', or 'dark'.\n\r",ch ); return; } if (!str_cmp(arg,"light")) { //if(ch->pcdata->quest >=10000){ // ch->pcdata->quest -= 10000; ch->pcdata->rpalign = RPALIGN_LIGHT; send_to_char( "DDAlignment is now for the light.\n\r", ch ); sprintf(buf,"%s has chosen to be a warrior for the light.\n\r",ch->name); do_info(NULL,buf); } //else //send_to_char("You do not have the needed 10K qps.\n\r",ch);} else if (!str_cmp(arg,"dark")) { //if(ch->pcdata->quest >=10000){ //ch->pcdata->quest -= 10000; ch->pcdata->rpalign = RPALIGN_DARK; send_to_char( "DDAlignment is now for the dark.\n\r", ch ); sprintf(buf,"%s has chosen to be a warrior for the darkness.\n\r",ch->name); do_info(NULL,buf); } // }else //send_to_char("You do not have the needed 10K qps.\n\r",ch);} else if(!str_cmp(arg,"merc")) { //if(ch->pcdata->quest >=10000){ // ch->pcdata->quest -= 10000; ch->pcdata->rpalign = RPALIGN_NEUTRAL; send_to_char( "DDAlignment is now for neither light nor dark.\n\r", ch ); sprintf(buf,"%s has chosen to be a warrior for themselves.\n\r",ch->name); do_info(NULL,buf); } // } else //send_to_char("You do not have the needed 10K qps.\n\r",ch);} else if(!str_cmp(arg,"love")) { if(ch->pcdata->quest >=1000000) { ch->pcdata->quest -= 1000000; ch->pcdata->rpalign = RPALIGN_LOVE; send_to_char( "DDAlignment is now for the heart and the soul.\n\r", ch ); sprintf(buf,"%s has chosen to be a warrior for Love.\n\r",ch->name); do_info(NULL,buf); } else send_to_char("You do not have the needed 1000K qps.\n\r",ch); } else if(!str_cmp(arg,"none")) { //if(ch->pcdata->quest >=20000){ //ch->pcdata->quest -= 20000; ch->pcdata->rpalign = RPALIGN_NONE; send_to_char( "Alignment is now none.\n\r", ch ); sprintf(buf,"%s has given up in the war between the light and dark.\n\r",ch->name); do_info(NULL,buf); } //}else //send_to_char("You do not have the needed 20K qps.\n\r",ch);} else { send_to_char( "Please enter 'light', 'merc', 'none', or 'dark'.\n\r", ch ); return; } return; }
void do_finger( CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; CHAR_DATA *victim; FILE *fp; bool fOld; one_argument( argument, arg ); if ( arg[0] == '\0' ) { send_to_char( "Finger whom?\n\r", ch ); return; } if ( ( victim = get_char_world( ch, arg ) ) != NULL) { if (!IS_NPC(victim)) { act( "$N is on right now!", ch, NULL, victim, TO_CHAR ); return; } } if(!check_valid_name(arg) && !IS_IMMORTAL(ch)) { send_to_char("That's not a valid name.\n\r",ch); } victim = new_char(); victim->pcdata = new_pcdata(); fOld = FALSE; fclose( fpReserve ); sprintf( buf, "%s%s", PLAYER_DIR, capitalize( arg ) ); if ( ( fp = fopen( buf, "r" ) ) != NULL ) { int iNest; for ( iNest = 0; iNest < MAX_NEST; iNest++ ) rgObjNest[iNest] = NULL; fOld = TRUE; for ( ; ; ) { char letter; char *word; letter = fread_letter( fp ); if ( letter == '*' ) { fread_to_eol( fp ); continue; } if ( letter != '#' ) { bug( "do_finger: Load_char_obj: # not found.", 0 ); break; } word = fread_word( fp ); if ( !str_cmp( word, "PLAYER" ) ) fread_char( victim, fp ); else if ( !str_cmp( word, "OBJECT" ) ) break; else if ( !str_cmp( word, "O" ) ) break; else if ( !str_cmp( word, "PET" ) ) break; else if ( !str_cmp( word, "BANK-ACCOUNT" ) ) break; else if ( !str_cmp( word, "END" ) ) break; else { bug( "Load_char_obj: bad section.", 0 ); break; } } fclose( fp ); } fpReserve = fopen( NULL_FILE, "r" ); if ( !fOld ) { send_to_char("No player by that name exists.\n\r",ch); free_pcdata(victim->pcdata); free_char(victim); return; } if ( (victim->level > LEVEL_HERO) && (victim->level > ch->level) ) { send_to_char("The gods wouldn't like that.\n\r",ch); free_pcdata(victim->pcdata); free_char(victim); return; } sprintf(buf,"%s last logged off on %s\n\r", victim->name, (char *) ctime(&victim->llogoff)); send_to_char(buf,ch); if(get_trust(ch) == MAX_LEVEL) { sprintf(buf, "Last IP: %s\n\r", victim->pcdata->last_ip); send_to_char(buf,ch); } free_pcdata(victim->pcdata); free_char(victim); return; }
bool check_social (CHAR_DATA * ch, char *command, char *argument) { char arg[MAX_INPUT_LENGTH]; CHAR_DATA *victim; int cmd; bool found; found = FALSE; for (cmd = 0; social_table[cmd].name[0] != '\0'; cmd++) { if (command[0] == social_table[cmd].name[0] && !str_prefix (command, social_table[cmd].name)) { found = TRUE; break; } } if (!found) return FALSE; if (!IS_NPC (ch) && IS_SET (ch->comm, COMM_NOEMOTE)) { send_to_char ("You are anti-social!\n\r", ch); return TRUE; } switch (ch->position) { case POS_DEAD: send_to_char ("Lie still; you are DEAD.\n\r", ch); return TRUE; case POS_INCAP: case POS_MORTAL: send_to_char ("You are hurt far too bad for that.\n\r", ch); return TRUE; case POS_STUNNED: send_to_char ("You are too stunned to do that.\n\r", ch); return TRUE; case POS_SLEEPING: /* * I just know this is the path to a 12" 'if' statement. :( * But two players asked for it already! -- Furey */ if (!str_cmp (social_table[cmd].name, "snore")) break; send_to_char ("In your dreams, or what?\n\r", ch); return TRUE; } one_argument (argument, arg); victim = NULL; if (arg[0] == '\0') { act (social_table[cmd].others_no_arg, ch, NULL, victim, TO_ROOM); act (social_table[cmd].char_no_arg, ch, NULL, victim, TO_CHAR); } else if ((victim = get_char_room (ch, arg)) == NULL) { send_to_char ("They aren't here.\n\r", ch); } else if (victim == ch) { act (social_table[cmd].others_auto, ch, NULL, victim, TO_ROOM); act (social_table[cmd].char_auto, ch, NULL, victim, TO_CHAR); } else { act (social_table[cmd].others_found, ch, NULL, victim, TO_NOTVICT); act (social_table[cmd].char_found, ch, NULL, victim, TO_CHAR); act (social_table[cmd].vict_found, ch, NULL, victim, TO_VICT); if (!IS_NPC (ch) && IS_NPC (victim) && !IS_AFFECTED (victim, AFF_CHARM) && IS_AWAKE (victim) && victim->desc == NULL) { switch (number_bits (4)) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: act (social_table[cmd].others_found, victim, NULL, ch, TO_NOTVICT); act (social_table[cmd].char_found, victim, NULL, ch, TO_CHAR); act (social_table[cmd].vict_found, victim, NULL, ch, TO_VICT); break; case 9: case 10: case 11: case 12: act ("$n slaps $N.", victim, NULL, ch, TO_NOTVICT); act ("You slap $N.", victim, NULL, ch, TO_CHAR); act ("$n slaps you.", victim, NULL, ch, TO_VICT); break; } } } return TRUE; }
bool sp_damage( OBJ_DATA * obj, CHAR_DATA * ch, CHAR_DATA * victim, int dam, int type, int sn, bool show_msg ) { int ch_strong, ch_weak, ch_race, ch_suscept, ch_resist, vi_strong, vi_weak, vi_race, vi_suscept, vi_resist; float dam_modifier = 1.0; float tmp = 0; bool can_reflect = TRUE; bool can_absorb = TRUE; if ( victim == NULL ) return FALSE; /* * First, check caster's strengths and weaknesses. * */ if ( IS_SET( type, NO_REFLECT ) ) { REMOVE_BIT( type, NO_REFLECT ); can_reflect = FALSE; } if ( IS_SET( type, NO_ABSORB ) ) { REMOVE_BIT( type, NO_ABSORB ); can_absorb = FALSE; } if ( obj == NULL ) { if ( ( can_reflect ) && ( skill_table[sn].target == TAR_CHAR_OFFENSIVE ) && ( IS_AFFECTED( victim, AFF_CLOAK_REFLECTION ) ) && ( ch != victim ) && ( number_percent( ) < ( victim->get_level("psuedo") - 70 ) ) ) { act( "@@N$n's @@lc@@el@@ro@@ya@@ak@@N glows brightly as $Nn's spell hits it, and the spell is reflected@@N!!", ch, victim, NULL, TO_ROOM ); act( "@@N$N's @@lc@@el@@ro@@ya@@ak@@N glows brightly, and reflects your spell back on you@@N!!", ch, NULL, victim, TO_CHAR ); act( "@@NYour @@lc@@el@@ro@@ya@@ak@@N glows brightly, and reflects the spell back on $N@@N!!!", victim, NULL, ch, TO_CHAR ); ( *skill_table[sn].spell_fun ) ( sn, 60, ch, ( void * )ch, NULL ); return FALSE; } else if ( ( can_reflect ) && ( skill_table[sn].target == TAR_CHAR_OFFENSIVE ) && ( IS_AFFECTED( victim, AFF_CLOAK_ABSORPTION ) ) && ( ch != victim ) && ( number_percent( ) < ( victim->get_level("psuedo") - 55 ) ) ) { int mana; mana = mana_cost( ch, sn ); victim->mana = UMIN( victim->max_mana, victim->mana + mana ); act( "@@N$n's @@lcloak@@N glows brightly as $N's spell hits it, then fades@@N!!", victim, NULL, ch, TO_ROOM ); act( "@@N$N's @@lcloak@@N glows brightly, and absorbs your spell@@N!!", ch, NULL, victim, TO_CHAR ); act( "@@NYour @@lcloak@@N glows brightly, and absorbs $N's spell@@N!!!", victim, NULL, ch, TO_CHAR ); return FALSE; } ch_strong = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].strong_realms : ch->npcdata->strong_magic ) : race_table[ch->race].strong_realms ); ch_resist = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].resist_realms : ch->npcdata->resist ) : race_table[ch->race].resist_realms ); ch_weak = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].weak_realms : ch->npcdata->weak_magic ) : race_table[ch->race].weak_realms ); ch_suscept = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].suscept_realms : ch->npcdata->suscept ) : race_table[ch->race].suscept_realms ); ch_race = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].race_flags : ch->race_mods ) : race_table[ch->race].race_flags ); if ( IS_SET( ch_strong, type ) ) { dam_modifier += .35; } else if ( IS_SET( ch_weak, type ) ) { dam_modifier -= .35; } if ( IS_SET( ch_race, RACE_MOD_STRONG_MAGIC ) ) { dam_modifier += .25; } else if ( IS_SET( ch_race, RACE_MOD_WEAK_MAGIC ) ) { dam_modifier -= .25; } else if ( IS_SET( ch_race, RACE_MOD_NO_MAGIC ) ) { dam_modifier -= .50; } if ( ch->stance == STANCE_CASTER ) dam_modifier += .10; else if ( ch->stance == STANCE_WIZARD ) dam_modifier += .25; else if ( ch->stance == STANCE_MAGI ) dam_modifier += .30; if ( ( !IS_NPC( ch ) ) && ( !IS_SET( type, REALM_MIND ) ) ) { if ( ch->pcdata->learned[gsn_potency] > 0 ) { dam_modifier += ( get_curr_int( ch ) * ch->pcdata->learned[gsn_potency] / 5000 ); } if ( ch->pcdata->learned[gsn_thaumatergy] > 0 ) { dam_modifier += ( get_curr_int( ch ) * ch->pcdata->learned[gsn_thaumatergy] / 2500 ); } } if ( is_affected( ch, skill_lookup( "mystical focus" ) ) ) { dam_modifier += .5; } } /* obj == NULL */ else if ( obj->carried_by != NULL ) { ch = obj->carried_by; } else { snprintf( log_buf, (2 * MIL), "Error, object %s casting spell, but not carried by anyone.", obj->short_descr ); monitor_chan( log_buf, MONITOR_DEBUG ); return FALSE; } /* * Next, the victim * */ vi_strong = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].strong_realms : victim->npcdata->strong_magic ) : race_table[victim->race].strong_realms ); vi_resist = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].resist_realms : victim->npcdata->resist ) : race_table[victim->race].resist_realms ); vi_weak = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].weak_realms : victim->npcdata->weak_magic ) : race_table[victim->race].weak_realms ); vi_suscept = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].suscept_realms : victim->npcdata->suscept ) : race_table[victim->race].suscept_realms ); vi_race = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].race_flags : victim->race_mods ) : race_table[victim->race].race_flags ); if ( IS_SET( vi_suscept, type ) ) { dam_modifier += .45; } else if ( IS_SET( vi_resist, type ) ) { dam_modifier -= .45; } else if ( IS_SET( vi_race, RACE_MOD_NO_MAGIC ) ) { dam_modifier -= .25; } if ( MAGIC_STANCE( ch ) ) dam_modifier += .15; if ( ( IS_SET( type, REALM_MIND ) ) && ( !HAS_MIND( victim ) ) ) dam_modifier = 0.0; else if ( ( ( IS_SET( type, REALM_IMPACT ) ) || ( IS_SET( type, REALM_ACID ) ) || ( IS_SET( type, REALM_GAS ) ) ) && ( !HAS_BODY( victim ) ) ) dam_modifier = 0.0; if ( ( IS_SET( type, REALM_POISON ) ) && ( IS_SET( vi_race, RACE_MOD_IMMUNE_POISON ) ) ) dam_modifier = 0.0; if ( ( IS_SET( type, REALM_DRAIN ) ) && ( IS_UNDEAD( victim ) ) ) dam_modifier = 0.0; tmp = dam; tmp *= dam_modifier; if ( check_charm_aff(ch, CHARM_AFF_MAGE) ) tmp *= ((100 + get_charm_bonus(ch, CHARM_AFF_MAGE)) / 100); dam = static_cast<int>(tmp); dam += number_range(static_cast<int>((dam * -0.10)), static_cast<int>((dam * 0.10))); /* Lets add a little randomness to things. --Kline */ if ( victim != ch ) { /* * Certain attacks are forbidden. * Most other attacks are returned. */ if ( is_safe( ch, victim ) ) return FALSE; if ( victim != ch->fighting ) check_killer( ch, victim ); if ( victim->position > POS_STUNNED ) { if ( victim->fighting == NULL ) set_fighting( victim, ch, FALSE ); victim->position = POS_FIGHTING; } if ( victim->position > POS_STUNNED ) { if ( ch->fighting == NULL ) { set_fighting( ch, victim, TRUE ); } /* * If victim is charmed, ch might attack victim's master. */ if ( IS_NPC( ch ) && IS_NPC( victim ) && IS_AFFECTED( victim, AFF_CHARM ) && victim->master != NULL && victim->master->in_room == ch->in_room && number_bits( 3 ) == 0 ) { stop_fighting( ch ); one_hit( ch, victim->master, TYPE_UNDEFINED ); } } /* * More charm stuff. */ if ( victim->master == ch ) stop_follower( victim ); /* * Inviso attacks ... not. */ if ( IS_AFFECTED( ch, AFF_INVISIBLE ) ) { affect_strip( ch, gsn_invis ); affect_strip( ch, gsn_mass_invis ); REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); act( "$n shimmers into existence.", ch, NULL, NULL, TO_ROOM ); } /* * Damage modifiers. */ if ( dam < 0 ) dam = 0; /* * Stop up any residual loopholes. */ if ( dam > sysdata.damcap ) { char buf[MAX_STRING_LENGTH]; snprintf( buf, MSL, "Spell: %d damage by %s, spell %s", dam, ( obj == NULL ) ? ch->get_name() : obj->short_descr, skill_table[sn].name ); if ( ch->level < 82 ) monitor_chan( buf, MONITOR_MAGIC ); log_f( "%s", buf ); dam = sysdata.damcap; } if ( ( show_msg ) && ( dam >= 0 ) ) sp_dam_message( obj, ch, victim, dam, type, sn ); } /* * Hurt the victim. * Inform the victim of his new state. */ victim->hit -= dam; if ( !IS_NPC(ch) ) { if ( dam > ch->pcdata->records->mdam_amt ) { send_to_char("@@yYou've broken your magical damage record!@@N\r\n", ch); ch->pcdata->records->mdam_amt = dam; ch->pcdata->records->mdam_gsn = sn; } } if ( !IS_NPC( victim ) ) check_adrenaline( victim, dam ); if ( !IS_NPC( victim ) && IS_WOLF( victim ) && ( dam > 350 ) ) do_rage( victim, "FORCE" ); update_pos( victim ); if ( ( IS_NPC( victim ) || !IS_VAMP( victim ) ) && !( deathmatch ) ) { switch ( victim->position ) { case POS_MORTAL: act( "$n is mortally wounded, and will die soon, if not aided.", victim, NULL, NULL, TO_ROOM ); send_to_char( "You are mortally wounded, and will die soon, if not aided.\r\n", victim ); break; case POS_INCAP: act( "$n is incapacitated and will slowly die, if not aided.", victim, NULL, NULL, TO_ROOM ); send_to_char( "You are incapacitated and will slowly die, if not aided.\r\n", victim ); break; case POS_STUNNED: act( "$n is too stunned to do anything!", victim, NULL, NULL, TO_ROOM ); send_to_char( "You are too stunned to do anything!\r\n", victim ); break; case POS_DEAD: act( "$n is DEAD!!", victim, 0, 0, TO_ROOM ); send_to_char( "You have been KILLED!!\r\n\r\n", victim ); break; default: if ( dam > victim->max_hit / 4 ) send_to_char( "That really did HURT!\r\n", victim ); if ( victim->hit < victim->max_hit / 4 ) send_to_char( "You sure are BLEEDING!\r\n", victim ); break; } } /* end of if statement */ /* * Sleep spells and extremely wounded folks. */ if ( !IS_AWAKE( victim ) ) stop_fighting( victim ); /* * Payoff for killing things. */ if ( victim->position == POS_DEAD && ( IS_NPC( victim ) || !IS_VAMP( victim ) || ( deathmatch ) ) ) { group_gain( ch, victim ); /* * Sort out kill counts..... */ if ( !IS_NPC( ch ) ) { if ( !IS_NPC( victim ) ) ch->pcdata->records->pk++; else ch->pcdata->records->mk++; } if ( !IS_NPC( victim ) ) { if ( !IS_NPC( ch ) ) victim->pcdata->records->pd++; else victim->pcdata->records->md++; } if ( !IS_NPC( victim ) || victim->act.test(ACT_INTELLIGENT) ) { snprintf( log_buf, (2 * MIL), "%s killed by %s at %d", victim->get_name(), ch->get_name(), victim->in_room->vnum ); log_string( log_buf ); notify( log_buf, 82 ); /* * As level gain is no longer automatic, a dead char loses * * 1/2 their gained exp. -S- * * Fixed my bug here too, hehe! */ if ( victim->exp > 0 ) { int lose = (victim->exp / 2); lose *= -1; victim->gain_exp(lose); } } if ( IS_NPC( ch ) ) raw_kill( victim, "" ); else { char name_buf[MAX_STRING_LENGTH]; snprintf( name_buf, MSL, "%s", ch->name.c_str() ); raw_kill( victim, name_buf ); } if ( deathmatch && !IS_NPC( victim ) ) do_quit( victim, "" ); if ( IS_NPC( ch ) && IS_NPC( victim ) && ch->act.test(ACT_INTELLIGENT) ) { do_get( ch, "all corpse" ); do_sacrifice( ch, "corpse" ); } if ( !IS_NPC( ch ) && IS_NPC( victim ) ) { if ( ch->act.test(ACT_AUTOLOOT) ) do_get( ch, "all corpse" ); else do_look( ch, "in corpse" ); if ( ch->act.test(ACT_AUTOSAC) ) do_sacrifice( ch, "corpse" ); } return FALSE; } if ( victim == ch ) return TRUE; /* * Take care of link dead people. */ if ( !IS_NPC( victim ) && victim->desc == NULL ) { if ( number_range( 0, victim->wait ) == 0 ) { do_recall( victim, "" ); return TRUE; } } /* * Wimp out? */ if ( IS_NPC( victim ) && dam > 0 ) { if ( ( victim->act.test(ACT_WIMPY) && number_bits( 1 ) == 0 && victim->hit < victim->max_hit / 2 ) || ( IS_AFFECTED( victim, AFF_CHARM ) && victim->master != NULL && victim->master->in_room != victim->in_room ) ) do_flee( victim, "" ); } if ( !IS_NPC( victim ) && victim->hit > 0 && victim->hit <= victim->wimpy && victim->wait == 0 ) do_flee( victim, "" ); return TRUE; }
/* do_simple_move assumes * 1. That there is no master and no followers. * 2. That the direction exists. * * Returns : * 1 : If succes. * 0 : If fail */ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) { char throwaway[MAX_INPUT_LENGTH] = ""; /* Functions assume writable. */ room_rnum was_in; int need_movement, moveadd = 0; struct obj_data *k; /* * Check for special routines (North is 1 in command list, but 0 here) Note * -- only check if following; this avoids 'double spec-proc' bug */ if (need_specials_check && special(ch, dir + 1, throwaway)) return (0); /* blocked by a leave trigger ? */ if (!leave_mtrigger(ch, dir)) return 0; if (!leave_wtrigger(&world[IN_ROOM(ch)], ch, dir)) return 0; /* charmed? */ if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && IN_ROOM(ch) == IN_ROOM(ch->master)) { send_to_char(ch, "The thought of leaving your master makes you weep.\r\n"); act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM); return (0); } /* if this room or the one we're going to needs a boat, check for one */ if ((SECT(IN_ROOM(ch)) == SECT_WATER_NOSWIM) || (SECT(EXIT(ch, dir)->to_room) == SECT_WATER_NOSWIM)) { if (!has_boat(ch)) { send_to_char(ch, "You need a boat to go there.\r\n"); return (0); } } /* move points needed is avg. move loss for src and destination sect type * You know .. I don't like this system, let's base this not ONLY on terrain type * but also on dex of char. * Needs to adjust on max abils * Original: * need_movement = (movement_loss[SECT(IN_ROOM(ch))] + movement_loss[SECT(EXIT(ch, dir)->to_room)]) / 2; */ if (GET_DEX(ch) <= 5) /* 0(1?)-5 Dex */ moveadd = 8; if ((GET_DEX(ch) >= 6) && (GET_DEX(ch) <= 10)) /* 6-10 Dex */ moveadd = 6; if ((GET_DEX(ch) >= 11) && (GET_DEX(ch) <= 15)) /* 11-15 Dex */ moveadd = 4; if (GET_DEX(ch) >= 16) /* 16+ Up to ..? Dex */ moveadd = 2; need_movement = (movement_loss[SECT(IN_ROOM(ch))] + movement_loss[SECT(EXIT(ch, dir)->to_room)] + moveadd) / 2; if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) { if (need_specials_check && ch->master) send_to_char(ch, "You are too exhausted to follow.\r\n"); else send_to_char(ch, "You are too exhausted.\r\n"); return (0); } if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_ATRIUM)) { if (!House_can_enter(ch, GET_ROOM_VNUM(EXIT(ch, dir)->to_room))) { send_to_char(ch, "That's private property -- no trespassing!\r\n"); return (0); } } if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_TUNNEL) && num_pc_in_room(&(world[EXIT(ch, dir)->to_room])) >= tunnel_size) { if (tunnel_size > 1) send_to_char(ch, "There isn't enough room for you to go there!\r\n"); else send_to_char(ch, "There isn't enough room there for more than one person!\r\n"); return (0); } /* Room big enough for you? */ if ((SIZE(EXIT(ch, dir)->to_room) < GET_SIZE(ch)) && (SIZE(EXIT(ch, dir)->to_room) != SIZE_SPECIAL) && (GET_LEVEL(ch) < LVL_GOD)) { //GOD+ can enter any room send_to_char(ch, "You are too big to fit in there!\r\n"); return (0); } /* Mortals and low level gods cannot enter greater god rooms. */ /* irrelevant because of min/max level -mak 8.21.05 -reinstated 2.9.06 if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD) { send_to_char(ch, "You aren't godly enough to use that room!\r\n"); return (0); } uncomment to fix GODROOM */ /* No access for non-IMPs */ if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_IMPROOM) && GET_LEVEL(ch) < LVL_IMPL) { send_to_char(ch, "You dare not disturb the Implementors!\r\n"); return (0); } if (GET_LEVEL(ch) < ROOM_MIN_LEVEL(EXIT(ch, dir)->to_room)) { if (world[EXIT(ch, dir)->to_room].max_level_message ) { send_to_char(ch, world[EXIT(ch, dir)->to_room].min_level_message); send_to_char(ch, "\r\n"); } else send_to_char(ch, "You are not experienced enough to enter that room.\r\n"); return 0; } if (ROOM_MAX_LEVEL(EXIT(ch, dir)->to_room) > 0) { if (GET_LEVEL(ch) > ROOM_MAX_LEVEL(EXIT(ch, dir)->to_room) && GET_LEVEL(ch) < LVL_SAINT ) { if (world[EXIT(ch, dir)->to_room].max_level_message ){ send_to_char(ch, world[EXIT(ch, dir)->to_room].max_level_message); send_to_char(ch, "\r\n"); } else send_to_char(ch, "You are too experienced to enter that room.\r\n"); return 0; } } if (AFF_FLAGGED(ch, AFF_FLEET_FEET)) { need_movement = need_movement / 2; if (need_movement < 2) need_movement = 1;} if (AFF_FLAGGED(ch, AFF_AIRWALK)) need_movement = 1; /* Now we know we're allowed to go into the room. */ if (GET_LEVEL(ch) < LVL_SAINT && !IS_NPC(ch)) GET_MOVE(ch) -= need_movement; if (!AFF_FLAGGED(ch, AFF_SNEAK)) { char buf2[MAX_STRING_LENGTH]; snprintf(buf2, sizeof(buf2), "$n leaves %s.", dirs[dir]); act(buf2, TRUE, ch, 0, 0, TO_ROOM); } was_in = IN_ROOM(ch); char_from_room(ch); char_to_room(ch, world[was_in].dir_option[dir]->to_room); /* move them first, then move them back if they aren't allowed to go. */ /* see if an entry trigger disallows the move */ if (!entry_mtrigger(ch) || !enter_wtrigger(&world[IN_ROOM(ch)], ch, dir)) { char_from_room(ch); char_to_room(ch, was_in); return 0; } if (!AFF_FLAGGED(ch, AFF_SNEAK)) act("$n has arrived.", TRUE, ch, 0, 0, TO_ROOM); if (ch->desc != NULL) look_at_room(IN_ROOM(ch), ch, 0); if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH) && GET_LEVEL(ch) < LVL_SAINT) { clanlog(ch, "%s entered a Death Room", GET_NAME(ch)); was_in = IN_ROOM(ch); log_death_trap(ch); death_cry(ch); /* Fix the PCs size first if it needs fixing */ fix_size(ch); extract_char(ch); for (k = world[was_in].contents; k; k = world[was_in].contents) extract_obj(k); return (0); } entry_memory_mtrigger(ch); if (!greet_mtrigger(ch, dir)) { char_from_room(ch); char_to_room(ch, was_in); look_at_room(IN_ROOM(ch), ch, 0); } else greet_memory_mtrigger(ch); /* send warning message if moves are getting low */ if ( GET_MOVE(ch) < (GET_MAX_MOVE(ch) / 10) ) { send_to_char(ch, "You cannot go much further.\r\n"); } return (1); }
void perform_psidrain(struct creature *ch, struct creature *vict) { int find_distance(struct room_data *tmp, struct room_data *location); int dist, drain, prob, percent; if (!can_psidrain(ch, vict, &dist, true)) return; if (AFF3_FLAGGED(vict, AFF3_PSISHIELD) && creature_distrusts(vict, ch)) { prob = CHECK_SKILL(ch, SKILL_PSIDRAIN) + GET_INT(ch); prob += skill_bonus(ch, SKILL_PSIDRAIN); percent = skill_bonus(vict, SPELL_PSISHIELD); percent += number(1, 120); if (mag_savingthrow(vict, GET_LEVEL(ch), SAVING_PSI)) percent *= 2; if (GET_INT(vict) > GET_INT(ch)) percent += (GET_INT(vict) - GET_INT(ch)) * 8; if (percent >= prob) { act("Your attack is deflected by $N's psishield!", false, ch, NULL, vict, TO_CHAR); act("$n's psychic attack is deflected by your psishield!", false, ch, NULL, vict, TO_VICT); act("$n staggers under an unseen force.", true, ch, NULL, vict, TO_NOTVICT); return; } } if (GET_MANA(vict) <= 0) { act("$E is completely drained of psychic energy.", true, ch, NULL, vict, TO_CHAR); return; } drain = dice(GET_LEVEL(ch), GET_INT(ch) + GET_REMORT_GEN(ch)) + CHECK_SKILL(ch, SKILL_PSIDRAIN); if (dist > 0) drain /= dist + 1; drain /= 4; drain = MAX(0, MIN(GET_MANA(vict), drain)); prob = CHECK_SKILL(ch, SKILL_PSIDRAIN) + GET_INT(ch) + (AFF3_FLAGGED(vict, AFF3_PSISHIELD) ? -20 : 0); if (is_fighting(vict)) prob += 15; if (dist > 0) prob -= dist * 3; act("$n strains against an unseen force.", false, ch, NULL, vict, TO_ROOM); // // failure // if (number(0, 121) > prob) { send_to_char(ch, "You are unable to create the drainage link!\r\n"); WAIT_STATE(ch, 2 RL_SEC); if (IS_NPC(vict) && !is_fighting(vict)) { if (ch->in_room == vict->in_room) { add_combat(vict, ch, false); add_combat(ch, vict, true); } else { remember(vict, ch); if (NPC2_FLAGGED(vict, NPC2_HUNT)) start_hunting(vict, ch); } } } // // success // else { act("A torrent of psychic energy is ripped out of $N's mind!", false, ch, NULL, vict, TO_CHAR); if (ch->in_room != vict->in_room && GET_LEVEL(vict) + number(0, CHECK_SKILL(vict, SKILL_PSIDRAIN)) > GET_LEVEL(ch)) act("Your psychic energy is ripped from you from afar!", false, ch, NULL, vict, TO_VICT); else act("Your psychic energy is ripped from you by $n!", false, ch, NULL, vict, TO_VICT); GET_MANA(vict) -= drain; GET_MANA(ch) = MIN(GET_MAX_MANA(ch), GET_MANA(ch) + drain); GET_MOVE(ch) -= 20; WAIT_STATE(vict, 1 RL_SEC); WAIT_STATE(ch, 5 RL_SEC); gain_skill_prof(ch, SKILL_PSIDRAIN); if (IS_NPC(vict) && !(is_fighting(vict))) { if (ch->in_room == vict->in_room) { remember(vict, ch); if (NPC2_FLAGGED(vict, NPC2_HUNT)) start_hunting(vict, ch); add_combat(vict, ch, false); add_combat(ch, vict, true); } } } }
void do_track( CHAR_DATA *ch, char *argument ) { char buf [ MAX_STRING_LENGTH ]; char arg [ MAX_STRING_LENGTH ]; CHAR_DATA *victim; int direction, skill; bool fArea=TRUE; skill=get_skill(ch, gsn_track); if (IS_NPC(ch)) { return; } if ( ch->mount ) { send_to_char( "Najpierw zsi±d¼ ze swojego wierzchowca.\n\r", ch ); return; } if ( !IS_IMMORTAL( ch ) && IS_AFFECTED( ch, AFF_BLIND ) ) { act("$n klêka i bezradnie potrz±sa g³ow±.",ch,NULL,NULL,TO_ROOM); send_to_char("Klekasz, ale przecie¿ niczego nie widzisz.\n\r",ch); return; } if ( room_is_dark( ch, ch->in_room ) && !(IS_AFFECTED( ch, AFF_DARK_VISION ) || IS_IMMORTAL( ch ) )) { send_to_char("Klekasz, ale jest tu tak ciemno, ¿e niczego nie widzisz.\n\r",ch); return; } // wycinamy niektóre ze sektorów switch ( ch->in_room->sector_type ) { case 6: //woda p³yw case 7: //woda niep case 19: //rzeka case 20: //jezioro case 21: //morze case 22: //ocean case 23: //lawa case 24: //ruchome piaski case 25: //gor±ce ¼ród³o case 34: //pod wod± case 37: //ciemna woda case 39: //podziemne jezioro send_to_char( "Tutaj chyba nie da siê szukaæ ¶ladów.\n\r", ch ); return; } // komunikaty dla tych, którzy nie umiej± szukaæ ¶ladów if ( skill == 0 ) { switch (number_range(1,7)) { case 1: act("$n klêka i nie wie co robiæ dalej.",ch,NULL,NULL,TO_ROOM); send_to_char("Klêkasz i nie za bardzo wiesz co robiæ dalej.\n\r",ch); break; case 2: act("$n klêka i niczego nie widzi.",ch,NULL,NULL,TO_ROOM); send_to_char("Klêkasz i niczego nie widzisz.\n\r",ch); break; case 3: act("$n mocno tupie, klêka i przygl±da siê ¶ladom.",ch,NULL,NULL,TO_ROOM); send_to_char("Mocno tupiesz, klêkasz i przygl±dasz siê ¶ladom.\n\r",ch); break; case 4: act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM); send_to_char("Klêkasz i ¶ledzisz tropy, choæ nie masz o tym zielonego pojêcia.\n\r",ch); break; case 5: act("$n klêka i robi nieszczê¶liw± minê.",ch,NULL,NULL,TO_ROOM); send_to_char("Klêkasz i robisz nieszczê¶liw± minê.\n\r",ch); break; case 6: act("$n rozgl±da siê dooko³a.",ch,NULL,NULL,TO_ROOM); send_to_char("Rozgl±dasz siê dooko³a, ale to nie pomaga.\n\r",ch); break; case 7: act("$n zastanawia siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.",ch,NULL,NULL,TO_ROOM); send_to_char("Zastanawiasz siê nad tym, ¿e tropienie to niez³a umiejêtno¶æ.\n\r",ch); break; default : send_to_char( "Nie masz pojêcia jak to siê robi.\n\r", ch ); act("$n klêka i ¶ledzi tropy, ale nie ma o tym zielonego pojêcia.",ch,NULL,NULL,TO_ROOM); break; } return; } // bonus/kara od dobrej lokacji s± wiêksze ni¿ od z³ej if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_CONSECRATE )) { if (IS_EVIL( ch ) ) skill -= number_range(1,5); if (IS_GOOD( ch ) ) skill += number_range(1,5); } if ( EXT_IS_SET( ch->in_room->room_flags, ROOM_DESECRATE )) { if (IS_EVIL( ch ) ) skill += number_range(0,4); if (IS_GOOD( ch ) ) skill -= number_range(0,4); } // sprawdzamy czy skill nie zrobi³ siê nam mniejszy ni¿ 1 if (skill < 1) { skill = 1; } // no to zaczynamy w³a¶ciwe trackowanie :D one_argument( argument, arg ); #ifdef ENABLE_NEW_TRACK if(MAX_TRACK_LEN > 0) { track_new(ch, skill, argument); return; } #endif if ( arg[0] == '\0' ) { act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM); act("Klêkasz i z uwag± przygl±dasz siê ¶ladom.",ch,NULL,NULL,TO_CHAR); return; } if ( fArea ) { victim = get_char_area( ch, arg ); } else { victim = get_char_world( ch, arg ); } if ( !victim ) { act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM); act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR); WAIT_STATE( ch, skill_table[gsn_track].beats ); return; } if(victim==ch) { act("Zastanawiasz siê przez chwilê czy to ma sens, no có¿...",ch,NULL,NULL,TO_CHAR); return; } if ( ch->in_room == victim->in_room ) { act( "Klêkasz i badasz trop, po chwili zdajesz sobie sprawê, ¿e $N stoi ko³o ciebie.", ch, NULL, victim, TO_CHAR ); act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM); return; } if ( skill < number_range( 20, 40 ) ) { act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM); act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR); WAIT_STATE( ch, skill_table[gsn_track].beats ); check_improve(ch, NULL, gsn_track, FALSE, 12); return; } if ( IS_AFFECTED ( victim, AFF_SPIRIT_WALK ) ) { act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM); act("Klêkasz, przygl±dasz siê ¶ladom, ale nie znajdujesz ¿adnego tropu.",ch,NULL,NULL,TO_CHAR); WAIT_STATE( ch, skill_table[gsn_track].beats ); return; } else { act("$n klêka i zaczyna z uwag± przygl±daæ siê ¶ladom.",ch,NULL,NULL,TO_ROOM); act("Klêkasz i przygladasz siê ¶ladom, chyba widzisz jaki¶ trop.",ch,NULL,NULL,TO_CHAR); } WAIT_STATE( ch, skill_table[gsn_track].beats ); direction = find_path( ch->in_room->vnum, victim->in_room->vnum, ch, -40000, fArea ); if ( direction == -1 ) { act( "Niestety, nie mo¿esz nic wiêcej odczytaæ ze ¶ladów.", ch, NULL, victim, TO_CHAR ); return; } if ( direction < 0 || direction >= MAX_DIR ) { send_to_char( "Hmm... co¶ jest nie tak.\n\r", ch ); return; } /* * Give a random direction if the player misses the die roll. */ if ( number_percent() > skill ) { do { direction = number_door( ); } while ( !( ch->in_room->exit[direction] ) || !( ch->in_room->exit[direction]->u1.to_room ) ); } check_improve(ch, NULL, gsn_track, TRUE, 9); /* * Display the results of the search. */ sprintf( buf, "Znajdujesz ¶lady $Z prowadz±ce na %s.", direction == 4 ? "górê" : dir_name[direction] ); act( buf, ch, NULL, victim, TO_CHAR ); return; }
void hunt_victim( CHAR_DATA *ch ) { CHAR_DATA *tmp; int dir,chance; bool found; if ( !ch || !ch->hunting ) { return; } /* * Make sure the victim still exists. */ for ( found = FALSE, tmp = char_list; tmp && !found; tmp = tmp->next ) { if ( ch->hunting == tmp ) { found = TRUE; } } if ( !can_move( ch) || !found || !can_see( ch, ch->hunting ) ) { stop_hunting( ch ); return; } if ( ch->in_room == ch->hunting->in_room ) { if ( ch->fighting ) return; found_prey( ch, ch->hunting ); return; } if ( !IS_NPC ( ch ) ) { WAIT_STATE( ch, skill_table[gsn_track].beats ); } dir = find_path( ch->in_room->vnum, ch->hunting->in_room->vnum, ch, -40000, TRUE ); if ( dir < 0 || dir >= MAX_DIR ) { stop_hunting( ch ); return; } /* * Give a random direction if the mob misses the die roll. * * 20% for PC * 2% for NPC */ chance = IS_NPC ( ch ) ? 2 : 20; if ( number_percent( ) < chance + 1 ) { do { dir = number_door( ); } while ( !( ch->in_room->exit[dir] ) || !( ch->in_room->exit[dir]->u1.to_room ) ); } if ( IS_SET(ch->in_room->exit[dir]->exit_info, EX_SECRET) && !IS_SET(ch->in_room->exit[dir]->exit_info, EX_HIDDEN) && IS_AFFECTED(ch, AFF_DETECT_HIDDEN) ) { // do_secret(ch, (char *)dir_name[dir]); return; } if ( IS_SET( ch->in_room->exit[dir]->exit_info, EX_CLOSED ) ) { do_open( ch, (char *) dir_name[dir] ); return; } if( IS_SET(sector_table[ch->in_room->exit[dir]->u1.to_room->sector_type].flag, SECT_UNDERWATER) || IS_SET(ch->in_room->exit[dir]->exit_info, EX_NO_MOB) || EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags, ROOM_NO_MOB) || ( EXT_IS_SET(ch->act, ACT_STAY_AREA) && ch->in_room->exit[dir]->u1.to_room->area != ch->in_room->area ) || ( EXT_IS_SET(ch->act, ACT_STAY_SECTOR) && ch->in_room->exit[dir]->u1.to_room->sector_type != ch->in_room->sector_type ) || ( EXT_IS_SET(ch->act, ACT_OUTDOORS) && EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags,ROOM_INDOORS)) || ( EXT_IS_SET(ch->act, ACT_INDOORS) && EXT_IS_SET(ch->in_room->exit[dir]->u1.to_room->room_flags,ROOM_INDOORS))) return; move_char( ch, dir, FALSE, NULL ); if ( !ch->hunting ) { if ( !ch->in_room ) { char buf [ MAX_STRING_LENGTH ]; sprintf( buf, "Hunt_victim: no ch->in_room! Mob #%d, name: %s. Placing mob in limbo (char_to_room).", ch->pIndexData->vnum, ch->name ); bug( buf, 0 ); char_to_room( ch, get_room_index( ROOM_VNUM_LIMBO ) ); return; } return; } if ( ch->in_room == ch->hunting->in_room ) found_prey( ch, ch->hunting ); return; }
void do_mposet( CHAR_DATA * ch, const char *argument ) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char arg3[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; OBJ_DATA *obj; char outbuf[MAX_STRING_LENGTH]; int value, tmp; /* * A desc means switched.. too many loopholes if we allow that.. */ if ( !IS_NPC( ch ) || IS_AFFECTED( ch, AFF_CHARM ) || ch->desc ) { send_to_char( "Huh?\r\n", ch ); return; } smash_tilde( argument ); argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); mudstrlcpy( arg3, argument, MAX_INPUT_LENGTH ); if ( !*arg1 ) { progbug( "MpOset: no args", ch ); return; } if ( ( obj = get_obj_here( ch, arg1 ) ) == NULL ) { progbug( "MpOset: no object", ch ); return; } if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) ) { progbug( "MpOset: can't set prototype items", ch ); return; } separate_obj( obj ); value = atoi( arg3 ); if ( !str_cmp( arg2, "value0" ) || !str_cmp( arg2, "v0" ) ) { obj->value[0] = value; return; } if ( !str_cmp( arg2, "value1" ) || !str_cmp( arg2, "v1" ) ) { obj->value[1] = value; return; } if ( !str_cmp( arg2, "value2" ) || !str_cmp( arg2, "v2" ) ) { obj->value[2] = value; return; } if ( !str_cmp( arg2, "value3" ) || !str_cmp( arg2, "v3" ) ) { obj->value[3] = value; return; } if ( !str_cmp( arg2, "value4" ) || !str_cmp( arg2, "v4" ) ) { obj->value[4] = value; return; } if ( !str_cmp( arg2, "value5" ) || !str_cmp( arg2, "v5" ) ) { obj->value[5] = value; return; } if ( !str_cmp( arg2, "type" ) ) { if ( !argument || argument[0] == '\0' ) { progbug( "MpOset: no type", ch ); return; } value = get_otype( argument ); if ( value < 1 ) { progbug( "MpOset: Invalid type", ch ); return; } obj->item_type = ( short ) value; return; } if ( !str_cmp( arg2, "flags" ) ) { if ( !argument || argument[0] == '\0' ) { progbug( "MpOset: no flags", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_oflag( arg3 ); if ( value < 0 || value >= MAX_BITS ) progbug( "MpOset: Invalid flag", ch ); else { if ( value == ITEM_PROTOTYPE ) progbug( "MpOset: can't set prototype flag", ch ); else xTOGGLE_BIT( obj->extra_flags, value ); } } return; } if ( !str_cmp( arg2, "wear" ) ) { if ( !argument || argument[0] == '\0' ) { progbug( "MpOset: no wear", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_wflag( arg3 ); if ( value < 0 || value > 31 ) progbug( "MpOset: Invalid wear", ch ); else TOGGLE_BIT( obj->wear_flags, 1 << value ); } return; } if ( !str_cmp( arg2, "level" ) ) { obj->level = value; return; } if ( !str_cmp( arg2, "weight" ) ) { obj->weight = value; return; } if ( !str_cmp( arg2, "cost" ) ) { obj->cost = value; return; } if ( !str_cmp( arg2, "timer" ) ) { obj->timer = value; return; } if ( !str_cmp( arg2, "name" ) ) { STRFREE( obj->name ); obj->name = STRALLOC( arg3 ); return; } if ( !str_cmp( arg2, "short" ) ) { STRFREE( obj->short_descr ); obj->short_descr = STRALLOC( arg3 ); if ( obj == supermob_obj ) { STRFREE( supermob->short_descr ); supermob->short_descr = QUICKLINK( obj->short_descr ); } /* * Feature added by Narn, Apr/96 * * If the item is not proto, add the word 'rename' to the keywords * * if it is not already there. */ if ( str_infix( "mprename", obj->name ) ) { snprintf( buf, MAX_STRING_LENGTH, "%s %s", obj->name, "mprename" ); STRFREE( obj->name ); obj->name = STRALLOC( buf ); } return; } if ( !str_cmp( arg2, "long" ) ) { STRFREE( obj->description ); mudstrlcpy( buf, arg3, MAX_STRING_LENGTH ); obj->description = STRALLOC( buf ); return; } if ( !str_cmp( arg2, "actiondesc" ) ) { if ( strstr( arg3, "%n" ) || strstr( arg3, "%d" ) || strstr( arg3, "%l" ) ) { progbug( "MpOset: Illegal actiondesc", ch ); return; } STRFREE( obj->action_desc ); obj->action_desc = STRALLOC( arg3 ); return; } if ( !str_cmp( arg2, "affect" ) ) { AFFECT_DATA *paf; short loc; int bitv; argument = one_argument( argument, arg2 ); if ( arg2[0] == '\0' || !argument || argument[0] == 0 ) { progbug( "MpOset: Bad affect syntax", ch ); send_to_char( "Usage: oset <object> affect <field> <value>\r\n", ch ); return; } loc = get_atype( arg2 ); if ( loc < 1 ) { progbug( "MpOset: Invalid affect field", ch ); return; } if ( loc >= APPLY_AFFECT && loc < APPLY_WEAPONSPELL ) { bitv = 0; while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); if ( loc == APPLY_AFFECT ) value = get_aflag( arg3 ); else value = get_risflag( arg3 ); if ( value < 0 || value > 31 ) progbug( "MpOset: bad affect flag", ch ); else SET_BIT( bitv, 1 << value ); } if ( !bitv ) return; value = bitv; } else { argument = one_argument( argument, arg3 ); value = atoi( arg3 ); } CREATE( paf, AFFECT_DATA, 1 ); paf->type = -1; paf->duration = -1; paf->location = loc; paf->modifier = value; xCLEAR_BITS( paf->bitvector ); paf->next = NULL; LINK( paf, obj->first_affect, obj->last_affect, next, prev ); ++top_affect; return; } if ( !str_cmp( arg2, "rmaffect" ) ) { AFFECT_DATA *paf; short loc, count; if ( !argument || argument[0] == '\0' ) { progbug( "MpOset: no rmaffect", ch ); return; } loc = atoi( argument ); if ( loc < 1 ) { progbug( "MpOset: Invalid rmaffect", ch ); return; } count = 0; for ( paf = obj->first_affect; paf; paf = paf->next ) { if ( ++count == loc ) { UNLINK( paf, obj->first_affect, obj->last_affect, next, prev ); DISPOSE( paf ); send_to_char( "Removed.\r\n", ch ); --top_affect; return; } } progbug( "MpOset: rmaffect not found", ch ); return; } /* * save some finger-leather */ if ( !str_cmp( arg2, "ris" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect resistant %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect immune %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect susceptible %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "r" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect resistant %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "i" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect immune %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "s" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect susceptible %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "ri" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect resistant %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect immune %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "rs" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect resistant %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect susceptible %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } if ( !str_cmp( arg2, "is" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s affect immune %s", arg1, arg3 ); do_mposet( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s affect susceptible %s", arg1, arg3 ); do_mposet( ch, outbuf ); return; } /* * Make it easier to set special object values by name than number * -Thoric */ tmp = -1; switch ( obj->item_type ) { case ITEM_WEAPON: if ( !str_cmp( arg2, "weapontype" ) ) { unsigned int x; value = -1; for ( x = 0; x < sizeof( attack_table ) / sizeof( attack_table[0] ); x++ ) if ( !str_cmp( arg3, attack_table[x] ) ) value = x; if ( value < 0 ) { progbug( "MpOset: Invalid weapon type", ch ); return; } tmp = 3; break; } if ( !str_cmp( arg2, "condition" ) ) tmp = 0; break; case ITEM_ARMOR: if ( !str_cmp( arg2, "condition" ) ) tmp = 3; if ( !str_cmp( arg2, "ac" ) ) tmp = 1; break; case ITEM_SALVE: if ( !str_cmp( arg2, "slevel" ) ) tmp = 0; if ( !str_cmp( arg2, "maxdoses" ) ) tmp = 1; if ( !str_cmp( arg2, "doses" ) ) tmp = 2; if ( !str_cmp( arg2, "delay" ) ) tmp = 3; if ( !str_cmp( arg2, "spell1" ) ) tmp = 4; if ( !str_cmp( arg2, "spell2" ) ) tmp = 5; if ( tmp >= 4 && tmp <= 5 ) value = skill_lookup( arg3 ); break; case ITEM_SCROLL: case ITEM_POTION: case ITEM_PILL: if ( !str_cmp( arg2, "slevel" ) ) tmp = 0; if ( !str_cmp( arg2, "spell1" ) ) tmp = 1; if ( !str_cmp( arg2, "spell2" ) ) tmp = 2; if ( !str_cmp( arg2, "spell3" ) ) tmp = 3; if ( tmp >= 1 && tmp <= 3 ) value = skill_lookup( arg3 ); break; case ITEM_STAFF: case ITEM_WAND: if ( !str_cmp( arg2, "slevel" ) ) tmp = 0; if ( !str_cmp( arg2, "spell" ) ) { tmp = 3; value = skill_lookup( arg3 ); } if ( !str_cmp( arg2, "maxcharges" ) ) tmp = 1; if ( !str_cmp( arg2, "charges" ) ) tmp = 2; break; case ITEM_CONTAINER: if ( !str_cmp( arg2, "capacity" ) ) tmp = 0; if ( !str_cmp( arg2, "cflags" ) ) tmp = 1; if ( !str_cmp( arg2, "key" ) ) tmp = 2; break; case ITEM_SWITCH: case ITEM_LEVER: case ITEM_PULLCHAIN: case ITEM_BUTTON: if ( !str_cmp( arg2, "tflags" ) ) { tmp = 0; value = get_trigflag( arg3 ); } break; } if ( tmp >= 0 && tmp <= 3 ) { obj->value[tmp] = value; return; } progbug( "MpOset: Invalid field", ch ); return; }
void do_mapout( CHAR_DATA* ch, const char* argument) { char arg[MAX_INPUT_LENGTH]; OBJ_DATA *map_obj; /* an obj made with map as an ed */ OBJ_INDEX_DATA *map_obj_index; /* obj_index for previous */ EXTRA_DESCR_DATA *ed; /* the ed for it to go in */ int rooms, rows, cols, avail_rooms; if( !ch ) { bug( "%s", "do_mapout: null ch" ); return; } if( IS_NPC( ch ) ) { send_to_char( "Not in mobs.\r\n", ch ); return; } if( !ch->desc ) { bug( "%s", "do_mapout: no descriptor" ); return; } switch ( ch->substate ) { default: break; case SUB_WRITING_NOTE: if( ch->dest_buf != ch->pnote ) bug( "%s", "do_mapout: sub_writing_map: ch->dest_buf != ch->pnote" ); STRFREE( ch->pnote->text ); ch->pnote->text = copy_buffer( ch ); stop_editing( ch ); return; } set_char_color( AT_NOTE, ch ); argument = one_argument( argument, arg ); smash_tilde( argument ); if( !str_cmp( arg, "stat" ) ) { if( !ch->pnote ) { send_to_char( "You have no map in progress.\r\n", ch ); return; } map_stats( ch, &rooms, &rows, &cols ); ch_printf( ch, "Map represents %d rooms, %d rows, and %d columns\r\n", rooms, rows, cols ); avail_rooms = num_rooms_avail( ch ); ch_printf( ch, "You currently have %d unused rooms.\r\n", avail_rooms ); act( AT_ACTION, "$n glances at an etherial map.", ch, NULL, NULL, TO_ROOM ); return; } if( !str_cmp( arg, "write" ) ) { note_attach( ch ); ch->substate = SUB_WRITING_NOTE; ch->dest_buf = ch->pnote; start_editing( ch, ch->pnote->text ); return; } if( !str_cmp( arg, "clear" ) ) { if( !ch->pnote ) { send_to_char( "You have no map in progress\r\n", ch ); return; } STRFREE( ch->pnote->text ); STRFREE( ch->pnote->subject ); STRFREE( ch->pnote->to_list ); STRFREE( ch->pnote->date ); STRFREE( ch->pnote->sender ); DISPOSE( ch->pnote ); ch->pnote = NULL; send_to_char( "Map cleared.\r\n", ch ); return; } if( !str_cmp( arg, "show" ) ) { if( !ch->pnote ) { send_to_char( "You have no map in progress.\r\n", ch ); return; } send_to_char( ch->pnote->text, ch ); do_mapout( ch, "stat" ); return; } if( !str_cmp( arg, "create" ) ) { if( !ch->pnote ) { send_to_char( "You have no map in progress.\r\n", ch ); return; } map_stats( ch, &rooms, &rows, &cols ); avail_rooms = num_rooms_avail( ch ); /* * check for not enough rooms */ if( rooms > avail_rooms ) { send_to_char( "You don't have enough unused rooms allocated!\r\n", ch ); return; } act( AT_ACTION, "$n warps the very dimensions of space!", ch, NULL, NULL, TO_ROOM ); map_to_rooms( ch, NULL ); /* this does the grunt work */ map_obj_index = get_obj_index( 91 ); if( map_obj_index ) { map_obj = create_object( map_obj_index, 0 ); ed = SetOExtra( map_obj, "runes map scrawls" ); STRFREE( ed->description ); ed->description = QUICKLINK( ch->pnote->text ); obj_to_char( map_obj, ch ); } else { send_to_char( "Couldn't give you a map object. Need Great Eastern Desert\r\n", ch ); return; } do_mapout( ch, "clear" ); send_to_char( "Ok.\r\n", ch ); return; } send_to_char( "mapout write: create a map in edit buffer.\r\n", ch ); send_to_char( "mapout stat: get information about a written, but not yet created map.\r\n", ch ); send_to_char( "mapout clear: clear a written, but not yet created map.\r\n", ch ); send_to_char( "mapout show: show a written, but not yet created map.\r\n", ch ); send_to_char( "mapout create: turn a written map into rooms in your assigned room vnum range.\r\n", ch ); return; }
void do_mpmset( CHAR_DATA * ch, const char *argument ) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char arg3[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; char log_buf[MAX_STRING_LENGTH]; char outbuf[MAX_STRING_LENGTH]; CHAR_DATA *victim; int value, v2; int minattr, maxattr; /* * A desc means switched.. too many loopholes if we allow that.. */ if ( !IS_NPC( ch ) || IS_AFFECTED( ch, AFF_CHARM ) || ch->desc ) { send_to_char( "Huh?\r\n", ch ); return; } smash_tilde( argument ); argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); mudstrlcpy( arg3, argument, MAX_INPUT_LENGTH ); if ( !*arg1 ) { progbug( "MpMset: no args", ch ); return; } if ( ( victim = get_char_room( ch, arg1 ) ) == NULL ) { progbug( "MpMset: no victim", ch ); return; } if ( IS_IMMORTAL( victim ) ) { send_to_char( "You can't do that!\r\n", ch ); return; } if ( IS_NPC( victim ) && xIS_SET( victim->act, ACT_PROTOTYPE ) ) { progbug( "MpMset: victim is proto", ch ); return; } if ( IS_NPC( victim ) ) { minattr = 1; maxattr = 25; } else { minattr = 3; maxattr = 18; } value = is_number( arg3 ) ? atoi( arg3 ) : -1; if ( atoi( arg3 ) < -1 && value == -1 ) value = atoi( arg3 ); if ( !str_cmp( arg2, "str" ) ) { if ( value < minattr || value > maxattr ) { progbug( "MpMset: Invalid str", ch ); return; } victim->perm_str = value; return; } if ( !str_cmp( arg2, "int" ) ) { if ( value < minattr || value > maxattr ) { progbug( "MpMset: Invalid int", ch ); return; } victim->perm_int = value; return; } if ( !str_cmp( arg2, "wis" ) ) { if ( value < minattr || value > maxattr ) { progbug( "MpMset: Invalid wis", ch ); return; } victim->perm_wis = value; return; } if ( !str_cmp( arg2, "dex" ) ) { if ( value < minattr || value > maxattr ) { progbug( "MpMset: Invalid dex", ch ); return; } victim->perm_dex = value; return; } if ( !str_cmp( arg2, "con" ) ) { if ( value < minattr || value > maxattr ) { progbug( "MpMset: Invalid con", ch ); return; } victim->perm_con = value; return; } if ( !str_cmp( arg2, "cha" ) ) { if ( value < minattr || value > maxattr ) { progbug( "MpMset: Invalid cha", ch ); return; } victim->perm_cha = value; return; } if ( !str_cmp( arg2, "lck" ) ) { if ( value < minattr || value > maxattr ) { progbug( "MpMset: Invalid lck", ch ); return; } victim->perm_lck = value; return; } if ( !str_cmp( arg2, "sav1" ) ) { if ( value < -30 || value > 30 ) { progbug( "MpMset: Invalid sav1", ch ); return; } victim->saving_poison_death = value; return; } if ( !str_cmp( arg2, "sav2" ) ) { if ( value < -30 || value > 30 ) { progbug( "MpMset: Invalid sav2", ch ); return; } victim->saving_wand = value; return; } if ( !str_cmp( arg2, "sav3" ) ) { if ( value < -30 || value > 30 ) { progbug( "MpMset: Invalid sav3", ch ); return; } victim->saving_para_petri = value; return; } if ( !str_cmp( arg2, "sav4" ) ) { if ( value < -30 || value > 30 ) { progbug( "MpMset: Invalid sav4", ch ); return; } victim->saving_breath = value; return; } if ( !str_cmp( arg2, "sav5" ) ) { if ( value < -30 || value > 30 ) { progbug( "MpMset: Invalid sav5", ch ); return; } victim->saving_spell_staff = value; return; } if ( !str_cmp( arg2, "sex" ) ) { if ( value < 0 || value > 2 ) { progbug( "MpMset: Invalid sex", ch ); return; } victim->sex = value; return; } if ( !str_cmp( arg2, "class" ) ) { if ( IS_NPC( victim ) ) /* Broken by Haus... fixed by Thoric */ { if ( value >= MAX_NPC_CLASS || value < 0 ) { progbug( "MpMset: Invalid npc class", ch ); return; } victim->Class = value; return; } progbug( "MpMset: can't set pc class", ch ); } if ( !str_cmp( arg2, "race" ) ) { value = get_npc_race( arg3 ); if ( value < 0 ) value = atoi( arg3 ); if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc race", ch ); return; } if ( value < 0 || value >= MAX_NPC_RACE ) { progbug( "MpMset: Invalid npc race", ch ); return; } victim->race = value; return; } if ( !str_cmp( arg2, "armor" ) ) { if ( value < -300 || value > 300 ) { send_to_char( "AC range is -300 to 300.\r\n", ch ); return; } victim->armor = value; return; } if ( !str_cmp( arg2, "level" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc level", ch ); return; } if ( value < 0 || value > LEVEL_AVATAR + 5 ) { progbug( "MpMset: Invalid npc level", ch ); return; } victim->level = value; return; } if ( !str_cmp( arg2, "numattacks" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc numattacks", ch ); return; } if ( value < 0 || value > 20 ) { progbug( "MpMset: Invalid npc numattacks", ch ); return; } victim->numattacks = value; return; } if ( !str_cmp( arg2, "gold" ) ) { victim->gold = value; return; } if ( !str_cmp( arg2, "hitroll" ) ) { victim->hitroll = URANGE( 0, value, 85 ); return; } if ( !str_cmp( arg2, "damroll" ) ) { victim->damroll = URANGE( 0, value, 65 ); return; } if ( !str_cmp( arg2, "hp" ) ) { if ( value < 1 || value > 32700 ) { progbug( "MpMset: Invalid hp", ch ); return; } victim->max_hit = value; return; } if ( !str_cmp( arg2, "mana" ) ) { if ( value < 0 || value > 30000 ) { progbug( "MpMset: Invalid mana", ch ); return; } victim->max_mana = value; return; } if ( !str_cmp( arg2, "move" ) ) { if ( value < 0 || value > 30000 ) { progbug( "MpMset: Invalid move", ch ); return; } victim->max_move = value; return; } if ( !str_cmp( arg2, "practice" ) ) { if ( value < 0 || value > 100 ) { progbug( "MpMset: Invalid practice", ch ); return; } victim->practice = value; return; } if ( !str_cmp( arg2, "align" ) ) { if ( value < -1000 || value > 1000 ) { progbug( "MpMset: Invalid align", ch ); return; } victim->alignment = value; return; } /* non-functional for now -- Blod if ( !str_cmp( arg2, "quest" ) ) { if ( IS_NPC(victim) ) { progbug("MpMset: can't set npc quest", ch); return; } if ( value < 0 || value > 500 ) { progbug("MpMset: Invalid pc quest", ch); return; } victim->pcdata->quest = value; return; } */ if ( !str_cmp( arg2, "questplus" ) ) { if ( IS_NPC( victim ) ) { progbug( "MpMset: can't set npc qp", ch ); return; } if ( value < 0 || value > 5000 ) { progbug( "MpMset: Invalid pc qp", ch ); return; } snprintf( log_buf, MAX_STRING_LENGTH, "%s raising glory of %s by %d ...", ch->name, victim->name, value ); log_string( log_buf ); victim->pcdata->quest_curr += value; victim->pcdata->quest_accum += value; return; } if ( !str_cmp( arg2, "favor" ) ) { if ( IS_NPC( victim ) ) { progbug( "MpMset: can't set npc favor", ch ); return; } if ( value < -2500 || value > 2500 ) { progbug( "MpMset: Invalid pc favor", ch ); return; } victim->pcdata->favor = value; return; } if ( !str_cmp( arg2, "mentalstate" ) ) { if ( value < -100 || value > 100 ) { progbug( "MpMset: Invalid mentalstate", ch ); return; } victim->mental_state = value; return; } if ( !str_cmp( arg2, "emotion" ) ) { if ( value < -100 || value > 100 ) { progbug( "MpMset: Invalid emotion", ch ); return; } victim->emotional_state = value; return; } if ( !str_cmp( arg2, "thirst" ) ) { if ( IS_NPC( victim ) ) { progbug( "MpMset: can't set npc thirst", ch ); return; } if ( value < 0 || value > 100 ) { progbug( "MpMset: Invalid pc thirst", ch ); return; } victim->pcdata->condition[COND_THIRST] = value; return; } if ( !str_cmp( arg2, "drunk" ) ) { if ( IS_NPC( victim ) ) { progbug( "MpMset: can't set npc drunk", ch ); return; } if ( value < 0 || value > 100 ) { progbug( "MpMset: Invalid pc drunk", ch ); return; } victim->pcdata->condition[COND_DRUNK] = value; return; } if ( !str_cmp( arg2, "full" ) ) { if ( IS_NPC( victim ) ) { progbug( "MpMset: can't set npc full", ch ); return; } if ( value < 0 || value > 100 ) { progbug( "MpMset: Invalid pc full", ch ); return; } victim->pcdata->condition[COND_FULL] = value; return; } if ( !str_cmp( arg2, "blood" ) ) { if ( IS_NPC( victim ) ) { progbug( "MpMset: can't set npc blood", ch ); return; } if ( value < 0 || value > MAX_LEVEL + 10 ) { progbug( "MpMset: Invalid pc blood", ch ); return; } victim->pcdata->condition[COND_BLOODTHIRST] = value; return; } if ( !str_cmp( arg2, "name" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc name", ch ); return; } STRFREE( victim->name ); victim->name = STRALLOC( arg3 ); return; } if ( !str_cmp( arg2, "deity" ) ) { DEITY_DATA *deity; if ( IS_NPC( victim ) ) { progbug( "MpMset: can't set npc deity", ch ); return; } if ( arg3[0] == '\0' ) { STRFREE( victim->pcdata->deity_name ); victim->pcdata->deity_name = STRALLOC( "" ); victim->pcdata->deity = NULL; return; } deity = get_deity( arg3 ); if ( !deity ) { progbug( "MpMset: Invalid deity", ch ); return; } STRFREE( victim->pcdata->deity_name ); victim->pcdata->deity_name = QUICKLINK( deity->name ); victim->pcdata->deity = deity; return; } if ( !str_cmp( arg2, "short" ) ) { STRFREE( victim->short_descr ); victim->short_descr = STRALLOC( arg3 ); return; } if ( !str_cmp( arg2, "long" ) ) { STRFREE( victim->long_descr ); mudstrlcpy( buf, arg3, MAX_STRING_LENGTH ); mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH ); victim->long_descr = STRALLOC( buf ); return; } if ( !str_cmp( arg2, "title" ) ) { if ( IS_NPC( victim ) ) { progbug( "MpMset: can't set npc title", ch ); return; } set_title( victim, arg3 ); return; } if ( !str_cmp( arg2, "spec" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc spec", ch ); return; } if ( !str_cmp( arg3, "none" ) ) { victim->spec_fun = NULL; return; } if ( ( victim->spec_fun = spec_lookup( arg3 ) ) == 0 ) { progbug( "MpMset: Invalid spec", ch ); return; } return; } if ( !str_cmp( arg2, "flags" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc flags", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no flags", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_actflag( arg3 ); if ( value < 0 || value >= MAX_BITS ) progbug( "MpMset: Invalid flag", ch ); else { if ( value == ACT_PROTOTYPE ) progbug( "MpMset: can't set prototype flag", ch ); else if ( value == ACT_IS_NPC ) progbug( "MpMset: can't remove npc flag", ch ); else xTOGGLE_BIT( victim->act, value ); } } return; } if ( !str_cmp( arg2, "affected" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't modify pc affected", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no affected", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_aflag( arg3 ); if ( value < 0 || value >= MAX_BITS ) progbug( "MpMset: Invalid affected", ch ); else xTOGGLE_BIT( victim->affected_by, value ); } return; } /* * save some more finger-leather for setting RIS stuff * Why there's can_modify checks here AND in the called function, Ill * never know, so I removed them.. -- Alty */ if ( !str_cmp( arg2, "r" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 ); do_mpmset( ch, outbuf ); return; } if ( !str_cmp( arg2, "i" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 ); do_mpmset( ch, outbuf ); return; } if ( !str_cmp( arg2, "s" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 ); do_mpmset( ch, outbuf ); return; } if ( !str_cmp( arg2, "ri" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 ); do_mpmset( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 ); do_mpmset( ch, outbuf ); return; } if ( !str_cmp( arg2, "rs" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 ); do_mpmset( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 ); do_mpmset( ch, outbuf ); return; } if ( !str_cmp( arg2, "is" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 ); do_mpmset( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 ); do_mpmset( ch, outbuf ); return; } if ( !str_cmp( arg2, "ris" ) ) { snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 ); do_mpmset( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 ); do_mpmset( ch, outbuf ); snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 ); do_mpmset( ch, outbuf ); return; } if ( !str_cmp( arg2, "resistant" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc resistant", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no resistant", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_risflag( arg3 ); if ( value < 0 || value > 31 ) progbug( "MpMset: Invalid resistant", ch ); else TOGGLE_BIT( victim->resistant, 1 << value ); } return; } if ( !str_cmp( arg2, "immune" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc immune", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no immune", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_risflag( arg3 ); if ( value < 0 || value > 31 ) progbug( "MpMset: Invalid immune", ch ); else TOGGLE_BIT( victim->immune, 1 << value ); } return; } if ( !str_cmp( arg2, "susceptible" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc susceptible", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no susceptible", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_risflag( arg3 ); if ( value < 0 || value > 31 ) progbug( "MpMset: Invalid susceptible", ch ); else TOGGLE_BIT( victim->susceptible, 1 << value ); } return; } if ( !str_cmp( arg2, "part" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc part", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no part", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_partflag( arg3 ); if ( value < 0 || value > 31 ) progbug( "MpMset: Invalid part", ch ); else TOGGLE_BIT( victim->xflags, 1 << value ); } return; } if ( !str_cmp( arg2, "attack" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc attack", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no attack", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_attackflag( arg3 ); if ( value < 0 ) progbug( "MpMset: Invalid attack", ch ); else xTOGGLE_BIT( victim->attacks, value ); } return; } if ( !str_cmp( arg2, "defense" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc defense", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no defense", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_defenseflag( arg3 ); if ( value < 0 || value >= MAX_BITS ) progbug( "MpMset: Invalid defense", ch ); else xTOGGLE_BIT( victim->defenses, value ); } return; } if ( !str_cmp( arg2, "pos" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc pos", ch ); return; } if ( value < 0 || value > POS_STANDING ) { progbug( "MpMset: Invalid pos", ch ); return; } victim->position = value; return; } if ( !str_cmp( arg2, "defpos" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc defpos", ch ); return; } if ( value < 0 || value > POS_STANDING ) { progbug( "MpMset: Invalid defpos", ch ); return; } victim->defposition = value; return; } if ( !str_cmp( arg2, "speaks" ) ) { if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no speaks", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_langflag( arg3 ); v2 = get_langnum( arg3 ); if ( value == LANG_UNKNOWN ) progbug( "MpMset: Invalid speaks", ch ); else if ( !IS_NPC( victim ) ) { if ( !( value &= VALID_LANGS ) ) { progbug( "MpMset: Invalid player language", ch ); continue; } if ( v2 == -1 ) ch_printf( ch, "Unknown language: %s\r\n", arg3 ); else TOGGLE_BIT( victim->speaks, 1 << v2 ); } else { if ( v2 == -1 ) ch_printf( ch, "Unknown language: %s\r\n", arg3 ); else TOGGLE_BIT( victim->speaks, 1 << v2 ); } } if ( !IS_NPC( victim ) ) { REMOVE_BIT( victim->speaks, race_table[victim->race]->language ); if ( !knows_language( victim, victim->speaking, victim ) ) victim->speaking = race_table[victim->race]->language; } return; } if ( !str_cmp( arg2, "speaking" ) ) { if ( !IS_NPC( victim ) ) { progbug( "MpMset: can't set pc speaking", ch ); return; } if ( !argument || argument[0] == '\0' ) { progbug( "MpMset: no speaking", ch ); return; } while ( argument[0] != '\0' ) { argument = one_argument( argument, arg3 ); value = get_langflag( arg3 ); if ( value == LANG_UNKNOWN ) progbug( "MpMset: Invalid speaking", ch ); else { v2 = get_langnum( arg3 ); if ( v2 == -1 ) ch_printf( ch, "Unknown language: %s\r\n", arg3 ); else TOGGLE_BIT( victim->speaks, 1 << v2 ); } } return; } progbug( "MpMset: Invalid field", ch ); return; }
void do_journal( CHAR_DATA *ch, char *argument ) { QUEST_DATA *quest; CHQUEST_DATA *chquest; CHAP_DATA *chap; char arg1[MIL], arg2[MIL]; char *chapdesc; int x = 0, total = 0, cando = 0, done = 0, num = 0, progress = 0, avail = 0; bool found = FALSE, completed = FALSE; set_char_color( AT_PLAIN, ch ); if ( IS_NPC( ch ) ) { error( ch ); return; } argument = one_argument( argument, arg1 ); if ( VLD_STR( arg1 ) && !str_cmp( arg1, "completados" ) ) { completed = TRUE; argument = one_argument( argument, arg1 ); } argument = one_argument( argument, arg2 ); if ( !arg1 || arg1[0] == '\0' ) { char questtime[MSL] = ""; char chaptime[MSL] = ""; char minsecs[MSL] = ""; int time = 0, mins = 0, secs = 0; ch_printf( ch, "\r\n&YQUESTS De %s&D\r\n\r\n", ch->name ); send_to_char( "&cNIV Quest Capítulo Progreso&D\r\n", ch ); for ( quest = first_quest; quest; quest = quest->next ) { num = quest->number; total++; if ( ch->level < quest->level ) continue; cando++; for ( chquest = ch->pcdata->first_quest; chquest; chquest = chquest->next ) { if ( chquest->questnum == quest->number ) { progress = chquest->progress; break; } } if ( !progress || !chquest ) continue; chap = get_chap_from_quest( progress, quest ); if ( !completed ) { if ( progress > quest->chapters ) { done++; continue; } if ( !chap ) continue; if ( chap && chap->desc ) chapdesc = chap->desc; else chapdesc = ( char * ) "NULL: No desc for this chapter."; } else { /* Only show completed quest */ if ( progress > quest->chapters ) { chapdesc = ( char * ) "¡quest completado!"; done++; } else continue; } avail++; if ( ch->level == quest->level ) send_to_char( "&Y", ch ); else if ( quest->level >= ( ch->level - 3 ) ) send_to_char( "&G", ch ); else send_to_char( "&z", ch ); ch_printf( ch, "%3d %20s %7d %s", quest->level, capitalize( quest->name ), progress, chapdesc ); if ( chquest->kamount > 0 ) ch_printf( ch, "&R(%d)&D", chquest->kamount ); send_to_char( "\r\n", ch ); if ( chquest->chaplimit > 0 ) ch_printf( ch, "Te queda %s para completar el capítulo.\r\n", show_timeleft( chquest->chaplimit ) ); if ( chquest->questlimit > 0 ) ch_printf( ch, "Te queda %s para finalizar el quest.\r\n", show_timeleft( chquest->questlimit ) ); } if ( avail == 0 && done == 0 ) send_to_char( "&B¡No has terminado ningún quest! ¡Ve a explorar!&D", ch ); send_to_char( "\r\n\r\n", ch ); if ( IS_IMMORTAL( ch ) ) ch_printf( ch, "&cquest disponibles: &C%d\r\n", total ); ch_printf( ch, "&cQuests encontrado: &C%d &cQuests Finalizados: &C%d&D\r\n", avail, done ); send_to_char( "\r\n&GMás información de un quest: &WDiario <nombre>&D\r\n", ch ); send_to_char( "\r\n&Gpara ver los quest completados: &Wdiario completados&D\r\n", ch ); return; } quest = get_quest_from_name( arg1 ); if ( !quest ) { send_to_char( "&Gsintaxis: diario \r\n diario <nombre del quest>&D\r\n", ch ); return; } for ( chquest = ch->pcdata->first_quest; chquest; chquest = chquest->next ) { if ( chquest->questnum != quest->number ) continue; send_to_char( "&GLeyendo la descripción del quest...\r\n", ch ); pager_printf( ch, "&W%s&D\r\n", quest->desc ? quest->desc : "(Not created!)" ); found = TRUE; break; } if ( !found ) send_to_char( "¡Este no es un quest de tu diario!\r\n", ch ); }
void do_showquest( CHAR_DATA *ch, char *argument ) { char arg[MSL], arg2[MSL]; CHAP_DATA *chap; int count = 0; QUEST_DATA *quest; int x, y; if ( !ch || IS_NPC( ch ) ) return; argument = one_argument( argument, arg ); argument = one_argument( argument, arg2 ); if ( !arg || arg[0] == '\0' ) { ch_printf( ch, "&Y%4s %3s %20s %4s %3s %5s %6s %s&D\r\n", "Num", "Lvl", "Name", "Desc", "Cha", "Lmt", "Type", "Vnum" ); for ( quest = first_quest; quest; quest = quest->next ) { count++; ch_printf( ch, "&G%4d &R%3d &W%20s %s &R%3d %5d &W%6s &w%d%s &w%d&D\r\n", quest->number, quest->level, quest->name, quest->desc ? " &GY" : " &RN", quest->chapters, quest->timelimit, ( quest->stype == 0 ) ? "Mobile" : ( quest->stype == 1 ) ? "Object" : ( quest->stype == 2 ) ? "Room" : "Unknown", quest->svnum, quest->skipchapters ? " &GCan Skip" : "", quest->glory ); } ch_printf( ch, "\r\n&G%d &wquests.&D\r\n", count ); return; } quest = get_quest_from_name( arg ); if ( !quest ) { send_to_char( "No such quest. Use 'showquest [(questname)] [(chapter #)]'.\r\n", ch ); return; } ch_printf( ch, "\r\n&zName:&w %s\r\n", quest->name ); ch_printf( ch, "&zMin Level:&w %-3d &zChapters:&w %-3d &zTime Limit:&w %-5d\r\n", quest->level, quest->chapters, quest->timelimit ); ch_printf( ch, "&zSkipChapters: &w%s\r\n", quest->skipchapters ? "Yes" : "No" ); ch_printf( ch, "&zGlory: %d\r\n", quest->glory ); if ( !arg2 || arg2[0] == '\0' ) { for ( chap = quest->first_chapter; chap; chap = chap->next ) ch_printf( ch, "&c - Chapter &C%d&c - Minlev: &C%d &cTLimit: &C%d &cKAmount: &C%d &cName:&C %s\r\n", chap->number, chap->level, chap->timelimit, chap->kamount, chap->desc ); return; } if ( !is_number( arg2 ) ) { send_to_char( "Use 'showquest [(questname)] [(chapter #)]'.\r\n", ch ); return; } chap = get_chap_from_quest( atoi( arg2 ), quest ); if ( !chap ) { send_to_char( "No such chapter to display.\r\n", ch ); return; } ch_printf( ch, "&c - Chapter &C%d&c - Name:&C %s\r\n\r\n&cDESC - &C%s", chap->number, chap->desc, chap->bio ? chap->bio : "(not yet entered)" ); }
void do_dismount( CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; bool show; int skill = get_skill( ch, gsn_riding ); if ( (victim = ch->mount) == NULL ) { send_to_char( "Przecie¿ nie dosiadasz teraz ¿adnego wierzchowca.\n\r", ch ); return; } if ( ch->position == POS_SLEEPING ) { send_to_char( "¦nisz o zsiadaniu z konia.\n\r", ch ); return; } do_dismount_body(ch); ch->position = POS_STANDING; show = TRUE; if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_DISMOUNT ) ) { show = !mp_percent_trigger( victim, ch, NULL, NULL, &TRIG_DISMOUNT ); } if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_MOUNT ) ) { show = FALSE; } if ( show ) { if ( skill == 0 || number_percent() > skill + 5 ) { act( "Nieudolnie próbujesz zsi±¶æ z grzbietu $Z i po chwili l±dujesz na ziemi.", ch, NULL, victim, TO_CHAR ); act( "$n nieudolnie próbuje zsi±¶æ z grzbietu $Z i po chwili l±duje na ziemi.", ch, NULL, victim, TO_NOTVICT ); ch->position = POS_SITTING; ch->move -= number_range(0,4); if ( ch->weight > 900 ) { ch->move -= number_range(0,2); } if ( ch->move < 0 ) { ch->move = 0; } check_improve( ch, NULL, gsn_riding, TRUE, 80 ); } else { act("Zrêcznie zeskakujesz z grzbietu $Z.", ch, NULL, victim, TO_CHAR ); act("$n zrêcznie zeskakuje z grzbietu $Z.", ch, NULL, victim, TO_NOTVICT ); check_improve( ch, NULL, gsn_riding, TRUE, 70 ); } } return; }
/* ========================================================================= NAME : use_tattoo() DESCRIPTION: RETURNS : TRUE if a tattoo was used WARNINGS : HISTORY : Created by dlkarnes 970417 OTHER : ========================================================================= */ int use_tattoo( struct char_data *ch ) { void add_follower_quiet(struct char_data *ch, struct char_data *leader); if (ch && !IS_NPC(ch)) { if (TAT_TIMER(ch)) { char mybuf[256]; sprintf(mybuf, "You can't use your tattoo's magick for " "%d more hour%s.\r\n", TAT_TIMER(ch),TAT_TIMER(ch)>1?"s":""); send_to_char(mybuf, ch); return(FALSE); } switch (GET_TATTOO(ch)) { case TATTOO_NONE: send_to_char ("You don't have a tattoo.\r\n", ch); break; case TATTOO_SKULL: { struct char_data *skull = read_mobile(9, VIRTUAL); struct affected_type af; char_to_room(skull, ch->in_room); add_follower_quiet(skull, ch); IS_CARRYING_W(skull) = 0; IS_CARRYING_N(skull) = 0; af.type = SPELL_CHARM; af.duration = 20; af.modifier = 0; af.location = 0; af.bitvector = AFF_CHARM; affect_to_char(skull, &af); act("$n's tattoo glows brightly for a second, and $N appears!", TRUE, ch, 0, skull, TO_ROOM); act("Your tattoo glows brightly for a second, and $N appears!", TRUE, ch, 0, skull, TO_CHAR); } break; case TATTOO_EYE: call_magic(ch, ch, NULL, SPELL_GREATPERCEPT, DEFAULT_WAND_LVL, CAST_WAND); break; case TATTOO_SHIP: call_magic(ch, ch, NULL, SPELL_CHANGE_DENSITY, DEFAULT_WAND_LVL, CAST_WAND); break; case TATTOO_ANGEL: call_magic(ch, ch, NULL, SPELL_BLESS, DEFAULT_WAND_LVL, CAST_WAND); break; default: send_to_char("Your tattoo can't be 'use'd.\r\n", ch); return (FALSE); } TAT_TIMER(ch)=24; } return(FALSE); }
/** Wierzchowce i wszystkie moby z mountable. W dzisiejszych czasach u¿ywa siê ich jako przeno¶ne stoiska z floatem, dlatego chcia³bym poruszyæ pare spraw, które byæ mo¿e zaprocentuj± kiedy¶ zmianami w systemie wierzchowców. ¯eby nie przeci±¿aæ systemu, zmiany mo¿na by wprowadzaæ po kolei: I. Zmêczenie Konie powinny mieæ swoj± pule mv, które traci³y by przy przechodzeniu z lokacji do lokacji. Gracz niewprawiony w je¼dzie konnej ( i nie tylko konnej ) oczywi¶cie te¿ by siê mêczy³, ale do¶wiadczony je¼dzieæ traci³by mv bardzo wolno. Maj±c mistrza w Ridingu, stosunek by³by 10:1 - czyli 10 mv wierzchowca na 1 mv je¼dzca. Koñ który straci³by ca³e mv, musia³by odpocz±æ, tak samo jak cz³owiek ( chocia¿ si³y regenerowa³ by szybciej ). ¯eby nie bawiæ siê w dodatkowe pola, mv moba by³y by naliczane na podstawie jego kondycji, rasy i size'u. Komendy: mount <nazwa> rest, mount <nazwa> stand Zmiany: Riding, Mount. II. Opieka nad Wierzchowcem Oprócz oczywistych rzeczy, takich jak odpoczynek, koñ ( czy ichnia bestia ) potrzebuje jedzenia i picia. Z piciem jest ³atwo, starczy trafiæ na jak±¶ rzeczke przep³ywaj±c± przez trakt czy zaprowadziæ konia do koryta w stajni ( nie radze poiæ z buk³aków ). Jednak z jedzeniem s± ju¿ pewne komplikacje. Wyró¼niamy podzia³ na pare typów: 1. herbivorous - ro¶lino¿erne, pare sektorów naturalnych lub pasza. 2. carnivorous - mieso¿erne, trup animala lub surowe miêso. 3. omnivorous - wszystko¿erne, sektory naturalne, pasza, miêso lub trup zwierzecia. 4. unfeedable - Nie potrzebuje je¶æ i piæ, dotyczy istot pozasferowych, nieo¿ywionych czy przywo³anych. Oprócz tego w zale¿no¶ci od size moba, jedzenie czy picie bêdzie uzupe³niaæ pewien procent paska. Np. koñ o size normal jedz±c pasze uzupe³ni 50% paska g³odu, inny koñ o size large uzupe³ni ju¿ tylko 40%. Gdyby by³ jaki¶ koñ o size gigant, pasza uzupe³ni³a by mu tylko 10%. Dzia³a te¿ w drug± strone. Tak wiêc trzeba by by³o dbaæ o wieszchowca, by on by³ zdatny do ¿ycia. Oczywi¶cie nie musze dodawaæ, ¿e g³odny i spragniony wierzchowiec wolniej regenerowa³ by mv? Komendy: mount <nazwa> feed, mount <nazwa> feed <item>, mount <nazwa> water, mount <nazwa> water <item> Zmiany: Mount, Otype food ( dodaæ podzia³ na rodzaj po¿ywienia, np. miêso, pasza, zielenina, racja podró¼na ), naliczanie g³odu i pragnienia, size. */ void do_mount( CHAR_DATA *ch, char *argument ){ char horsename [ MAX_STRING_LENGTH ]; char order [ MAX_STRING_LENGTH ]; char item [ MAX_STRING_LENGTH ]; CHAR_DATA *horse = NULL; argument = one_argument( argument, horsename ); argument = one_argument( argument, order ); argument = one_argument( argument, item ); horse = get_char_room( ch, horsename ); if(!horse){ print_char(ch, "Nie ma tu nikogo takiego!\n\r"); return; } if ( !IS_NPC(horse) || !EXT_IS_SET(horse->act, ACT_MOUNTABLE ) ) { print_char(ch, "Czy %s wygl±da jak co¶, na czym mo¿na je¼dziæ?!\n\r", horse->short_descr ); return; } //jesli tylko jeden argument, to normalny mount if(!strcmp(order, "")){ //V. Stajnie // if(str_prefix(horsename, "list")) // do_mount_list(ch); // if(str_prefix(horsename, "offer")) // do_mount_offer(ch); // else do_mount_on(ch, horse); } else { //I. Zmêczenie if(!str_prefix(order, "stand")){ if(horse->mounting){ print_char(ch, "Przecie¿ %s ma je¼d¼ca!\n\r", horse->name2 ); return; } do_stand(horse, ""); horse->default_pos = POS_STANDING; } else if(!str_prefix(order, "rest")){ if(ch->mount){ print_char(ch, "Zsi±d¼ najpierw z %s!\n\r", horse->name2 ); return; } if(horse->mounting){ print_char(ch, "Przecie¿ %s ma je¼d¼ca!\n\r", horse->name2 ); return; } do_rest(horse, ""); horse->default_pos = POS_RESTING; } //II. Opieka nad Wierzchowcem else if(!str_prefix(order, "feed")){ do_feed_body(ch, horse->name, item); } else if(!str_prefix(order, "water")) do_water_body(ch, horse->name, item); //III. Prowadzenie wierzchowca // else if(str_prefix(order, "follow")) // do_rest(horse, ""); // else if(str_prefix(order, "nofollow")) // do_rest(horse, ""); // else if(str_prefix(order, "stay")) // do_rest(horse, ""); //IV. Przedmioty // else if(str_prefix(order, "check")) // do_rest(horse, ""); // else if(str_prefix(order, "put")) // do_rest(horse, ""); // else if(str_prefix(order, "get")) // do_rest(horse, ""); // else if(str_prefix(order, "equip")) // do_rest(horse, ""); // else if(str_prefix(order, "remove")) // do_rest(horse, ""); //V. Stajnie // else if(str_prefix(order, "rent")) // do_rest(horse, ""); // else if(str_prefix(order, "bring")) // do_rest(horse, ""); else print_char(ch, "Co?!\n\r" ); } }
/** Move a PC/NPC character from their current location to a new location. This * is the standard movement locomotion function that all normal walking * movement by characters should be sent through. This function also defines * the move cost of normal locomotion as: * ( (move cost for source room) + (move cost for destination) ) / 2 * * @pre Function assumes that ch has no master controlling character, that * ch has no followers (in other words followers won't be moved by this * function) and that the direction traveled in is one of the valid, enumerated * direction. * @param ch The character structure to attempt to move. * @param dir The defined direction (NORTH, SOUTH, etc...) to attempt to * move into. * @param need_specials_check If TRUE will cause * @retval int 1 for a successful move (ch is now in a new location) * or 0 for a failed move (ch is still in the original location). */ int do_simple_move(struct char_data *ch, int dir, int need_specials_check) { /* Begin Local variable definitions */ /*---------------------------------------------------------------------*/ /* Used in our special proc check. By default, we pass a NULL argument * when checking for specials */ char spec_proc_args[MAX_INPUT_LENGTH] = ""; /* The room the character is currently in and will move from... */ room_rnum was_in = IN_ROOM(ch); /* ... and the room the character will move into. */ room_rnum going_to = EXIT(ch, dir)->to_room; /* How many movement points are required to travel from was_in to going_to. * We redefine this later when we need it. */ int need_movement = 0; /* Contains the "leave" message to display to the was_in room. */ char leave_message[SMALL_BUFSIZE]; /*---------------------------------------------------------------------*/ /* End Local variable definitions */ /* Begin checks that can prevent a character from leaving the was_in room. */ /* Future checks should be implemented within this section and return 0. */ /*---------------------------------------------------------------------*/ /* Check for special routines that might activate because of the move and * also might prevent the movement. Special requires commands, so we pass * in the "command" equivalent of the direction (ie. North is '1' in the * command list, but NORTH is defined as '0'). * Note -- only check if following; this avoids 'double spec-proc' bug */ if (need_specials_check && special(ch, dir + 1, spec_proc_args)) return 0; /* Leave Trigger Checks: Does a leave trigger block exit from the room? */ if (!leave_mtrigger(ch, dir) || IN_ROOM(ch) != was_in) /* prevent teleport crashes */ return 0; if (!leave_wtrigger(&world[IN_ROOM(ch)], ch, dir) || IN_ROOM(ch) != was_in) /* prevent teleport crashes */ return 0; if (!leave_otrigger(&world[IN_ROOM(ch)], ch, dir) || IN_ROOM(ch) != was_in) /* prevent teleport crashes */ return 0; /* Charm effect: Does it override the movement? */ if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && was_in == IN_ROOM(ch->master)) { send_to_char(ch, "The thought of leaving your master makes you weep.\r\n"); act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM); return (0); } /* Water, No Swimming Rooms: Does the deep water prevent movement? */ if ((SECT(was_in) == SECT_WATER_NOSWIM) || (SECT(going_to) == SECT_WATER_NOSWIM)) { if (!has_boat(ch)) { send_to_char(ch, "You need a boat to go there.\r\n"); return (0); } } /* Flying Required: Does lack of flying prevent movement? */ if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING)) { if (!has_flight(ch)) { send_to_char(ch, "You need to be flying to go there!\r\n"); return (0); } } /* Underwater Room: Does lack of underwater breathing prevent movement? */ if ((SECT(was_in) == SECT_UNDERWATER) || (SECT(going_to) == SECT_UNDERWATER)) { if (!has_scuba(ch) && !IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) { send_to_char(ch, "You need to be able to breathe water to go there!\r\n"); return (0); } } /* Houses: Can the player walk into the house? */ if (ROOM_FLAGGED(was_in, ROOM_ATRIUM)) { if (!House_can_enter(ch, GET_ROOM_VNUM(going_to))) { send_to_char(ch, "That's private property -- no trespassing!\r\n"); return (0); } } /* Check zone level recommendations */ if ((ZONE_MINLVL(GET_ROOM_ZONE(going_to)) != -1) && ZONE_MINLVL(GET_ROOM_ZONE(going_to)) > GET_LEVEL(ch)) { send_to_char(ch, "This zone is above your recommended level.\r\n"); } /* Check zone flag restrictions */ if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_CLOSED)) { send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n"); return (0); } if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_NOIMMORT) && (GET_ADMLEVEL(ch) >= ADMLVL_IMMORT) && (GET_ADMLEVEL(ch) < ADMLVL_GRGOD)) { send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n"); return (0); } /* Room Size Capacity: Is the room full of people already? */ if (ROOM_FLAGGED(going_to, ROOM_TUNNEL) && num_pc_in_room(&(world[going_to])) >= CONFIG_TUNNEL_SIZE) { if (CONFIG_TUNNEL_SIZE > 1) send_to_char(ch, "There isn't enough room for you to go there!\r\n"); else send_to_char(ch, "There isn't enough room there for more than one person!\r\n"); return (0); } /* Room Level Requirements: Is ch privileged enough to enter the room? */ if (ROOM_FLAGGED(going_to, ROOM_GODROOM) && GET_ADMLEVEL(ch) < ADMLVL_GOD) { send_to_char(ch, "You aren't godly enough to use that room!\r\n"); return (0); } /* All checks passed, nothing will prevent movement now other than lack of * move points. */ /* move points needed is avg. move loss for src and destination sect type */ need_movement = (movement_loss[SECT(was_in)] + movement_loss[SECT(going_to)]) / 2; /* Move Point Requirement Check */ if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) { if (need_specials_check && ch->master) send_to_char(ch, "You are too exhausted to follow.\r\n"); else send_to_char(ch, "You are too exhausted.\r\n"); return (0); } /*---------------------------------------------------------------------*/ /* End checks that can prevent a character from leaving the was_in room. */ /* Begin: the leave operation. */ /*---------------------------------------------------------------------*/ /* If applicable, subtract movement cost. */ if (GET_ADMLEVEL(ch) < ADMLVL_IMMORT && !IS_NPC(ch)) GET_MOVE(ch) -= need_movement; /* Generate the leave message and display to others in the was_in room. */ if (!AFF_FLAGGED(ch, AFF_SNEAK)) { snprintf(leave_message, sizeof(leave_message), "$n leaves %s.", dirs[dir]); act(leave_message, TRUE, ch, 0, 0, TO_ROOM); } char_from_room(ch); char_to_room(ch, going_to); /*---------------------------------------------------------------------*/ /* End: the leave operation. The character is now in the new room. */ /* Begin: Post-move operations. */ /*---------------------------------------------------------------------*/ /* Post Move Trigger Checks: Check the new room for triggers. * Assumptions: The character has already truly left the was_in room. If * the entry trigger "prevents" movement into the room, it is the triggers * job to provide a message to the original was_in room. */ if (!entry_mtrigger(ch) || !enter_wtrigger(&world[going_to], ch, dir)) { char_from_room(ch); char_to_room(ch, was_in); return 0; } /* Display arrival information to anyone in the destination room... */ if (!AFF_FLAGGED(ch, AFF_SNEAK)) act("$n has arrived.", TRUE, ch, 0, 0, TO_ROOM); /* ... and the room description to the character. */ if (ch->desc != NULL) look_at_room(ch, 0); /* ... and Kill the player if the room is a death trap. */ if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_ADMLEVEL(ch) < ADMLVL_IMMORT) { mudlog(BRF, ADMLVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to), world[going_to].name); death_cry(ch); extract_char(ch); return (0); } /* At this point, the character is safe and in the room. */ /* Fire memory and greet triggers, check and see if the greet trigger * prevents movement, and if so, move the player back to the previous room. */ entry_memory_mtrigger(ch); if (!greet_mtrigger(ch, dir)) { char_from_room(ch); char_to_room(ch, was_in); look_at_room(ch, 0); /* Failed move, return a failure */ return (0); } else greet_memory_mtrigger(ch); /*---------------------------------------------------------------------*/ /* End: Post-move operations. */ /* Only here is the move successful *and* complete. Return success for * calling functions to handle post move operations. */ return (1); }
/* RT Enter portals */ void do_enter( CHAR_DATA *ch, char *argument) { ROOM_INDEX_DATA *location; if ( ch->fighting != NULL ) return; /* nifty portal stuff */ if (argument[0] != '\0') { ROOM_INDEX_DATA *old_room; OBJ_DATA *portal; CHAR_DATA *fch, *fch_next; old_room = ch->in_room; portal = get_obj_list( ch, argument, ch->in_room->contents ); if (portal == NULL) { send_to_char("You don't see that here.\n\r",ch); return; } if (portal->item_type != ITEM_PORTAL || (IS_SET(portal->value[1],EX_CLOSED) && !IS_TRUSTED(ch,ANGEL))) { send_to_char("You can't seem to find a way in.\n\r",ch); return; } if (!IS_TRUSTED(ch,ANGEL) && !IS_SET(portal->value[2],GATE_NOCURSE) && (IS_AFFECTED(ch,AFF_CURSE) || IS_SET(old_room->room_flags,ROOM_NO_RECALL))) { send_to_char("Something prevents you from leaving...\n\r",ch); return; } if (IS_SET(portal->value[2],GATE_RANDOM) || portal->value[3] == -1) { location = get_random_room(ch); portal->value[3] = location->vnum; /* for record keeping :) */ } else if (IS_SET(portal->value[2],GATE_BUGGY) && (number_percent() < 5)) location = get_random_room(ch); else location = get_room_index(portal->value[3]); if (location == NULL || location == old_room || !can_see_room(ch,location) || (room_is_private(location) && !IS_TRUSTED(ch,IMPLEMENTOR))) { act("$p doesn't seem to go anywhere.",ch,portal,NULL,TO_CHAR); return; } if (IS_NPC(ch) && IS_SET(ch->act,ACT_AGGRESSIVE) && IS_SET(location->room_flags,ROOM_LAW)) { send_to_char("Something prevents you from leaving...\n\r",ch); return; } act("$n steps into $p.",ch,portal,NULL,TO_ROOM); if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) act("You enter $p.",ch,portal,NULL,TO_CHAR); else act("You walk through $p and find yourself somewhere else...", ch,portal,NULL,TO_CHAR); char_from_room(ch); char_to_room(ch, location); if (IS_SET(portal->value[2],GATE_GOWITH)) /* take the gate along */ { obj_from_room(portal); obj_to_room(portal,location); } if (IS_SET(portal->value[2],GATE_NORMAL_EXIT)) act("$n has arrived.",ch,portal,NULL,TO_ROOM); else act("$n has arrived through $p.",ch,portal,NULL,TO_ROOM); do_function(ch, &do_look, "auto"); /* charges */ if (portal->value[0] > 0) { portal->value[0]--; if (portal->value[0] == 0) portal->value[0] = -1; } /* protect against circular follows */ if (old_room == location) return; for ( fch = old_room->people; fch != NULL; fch = fch_next ) { fch_next = fch->next_in_room; if (portal == NULL || portal->value[0] == -1) /* no following through dead portals */ continue; if ( fch->master == ch && IS_AFFECTED(fch,AFF_CHARM) && fch->position < POS_STANDING) do_function(fch, &do_stand, ""); if ( fch->master == ch && fch->position == POS_STANDING) { if (IS_SET(ch->in_room->room_flags,ROOM_LAW) && (IS_NPC(fch) && IS_SET(fch->act,ACT_AGGRESSIVE))) { act("You can't bring $N into the city.", ch,NULL,fch,TO_CHAR); act("You aren't allowed in the city.", fch,NULL,NULL,TO_CHAR); continue; } act( "You follow $N.", fch, NULL, ch, TO_CHAR ); do_function(fch, &do_enter, argument); } } if (portal != NULL && portal->value[0] == -1) { act("$p fades out of existence.",ch,portal,NULL,TO_CHAR); if (ch->in_room == old_room) act("$p fades out of existence.",ch,portal,NULL,TO_ROOM); else if (old_room->people != NULL) { act("$p fades out of existence.", old_room->people,portal,NULL,TO_CHAR); act("$p fades out of existence.", old_room->people,portal,NULL,TO_ROOM); } extract_obj(portal); } return; } send_to_char("Nope, can't do it.\n\r",ch); return; }
int perform_move(struct char_data *ch, int dir, int need_specials_check) { room_rnum was_in; struct follow_type *k, *next; if (ch == NULL || dir < 0 || dir >= NUM_OF_DIRS || FIGHTING(ch)) return (0); else if (!CONFIG_DIAGONAL_DIRS && IS_DIAGONAL(dir)) send_to_char(ch, "Alas, you cannot go that way...\r\n"); else if ((!EXIT(ch, dir) && !buildwalk(ch, dir)) || EXIT(ch, dir)->to_room == NOWHERE) send_to_char(ch, "Alas, you cannot go that way...\r\n"); else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (GET_ADMLEVEL(ch) < ADMLVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) { if (EXIT(ch, dir)->keyword) send_to_char(ch, "The %s seems to be closed.\r\n", fname(EXIT(ch, dir)->keyword)); else send_to_char(ch, "It seems to be closed.\r\n"); } else { if (!ch->followers) return (do_simple_move(ch, dir, need_specials_check)); was_in = IN_ROOM(ch); if (!do_simple_move(ch, dir, need_specials_check)) return (0); for (k = ch->followers; k; k = next) { next = k->next; if ((IN_ROOM(k->follower) == was_in) && (GET_POS(k->follower) >= POS_STANDING)) { act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR); perform_move(k->follower, dir, 1); } } return (1); } return (0); }
/* * The main entry point for executing commands. * Can be recursively called from 'at', 'order', 'force'. */ void interpret (CHAR_DATA * ch, char *argument) { char command[MAX_INPUT_LENGTH]; char logline[MAX_INPUT_LENGTH]; int cmd; int trust; bool found; /* * Strip leading spaces. */ while (isspace (*argument)) argument++; if (argument[0] == '\0') return; /* * No hiding. */ REMOVE_BIT (ch->affected_by, AFF_HIDE); /* * Implement freeze command. */ if (!IS_NPC (ch) && IS_SET (ch->act, PLR_FREEZE)) { send_to_char ("You're totally frozen!\n\r", ch); return; } /* * Grab the command word. * Special parsing so ' can be a command, * also no spaces needed after punctuation. */ strcpy (logline, argument); if (!isalpha (argument[0]) && !isdigit (argument[0])) { command[0] = argument[0]; command[1] = '\0'; argument++; while (isspace (*argument)) argument++; } else { argument = one_argument (argument, command); } /* * Look for command in command table. */ found = FALSE; trust = get_trust (ch); for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++) { if (command[0] == cmd_table[cmd].name[0] && !str_prefix (command, cmd_table[cmd].name) && cmd_table[cmd].level <= trust) { found = TRUE; break; } } /* * Log and snoop. */ smash_dollar(logline); if (cmd_table[cmd].log == LOG_NEVER) strcpy (logline, ""); /* Replaced original block of code with fix from Edwin * to prevent crashes due to dollar signs in logstrings. * I threw in the above call to smash_dollar() just for * the sake of overkill :) JR -- 10/15/00 */ if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) ) || fLogAll || cmd_table[cmd].log == LOG_ALWAYS ) { char s[2*MAX_INPUT_LENGTH],*ps; int i; ps=s; sprintf( log_buf, "Log %s: %s", ch->name, logline ); /* Make sure that was is displayed is what is typed */ for (i=0;log_buf[i];i++) { *ps++=log_buf[i]; if (log_buf[i]=='$') *ps++='$'; if (log_buf[i]=='{') *ps++='{'; } *ps=0; wiznet(s,ch,NULL,WIZ_SECURE,0,get_trust(ch)); log_string( log_buf ); } if (ch->desc != NULL && ch->desc->snoop_by != NULL) { write_to_buffer (ch->desc->snoop_by, "% ", 2); write_to_buffer (ch->desc->snoop_by, logline, 0); write_to_buffer (ch->desc->snoop_by, "\n\r", 2); } if (!found) { /* * Look for command in socials table. */ if (!check_social (ch, command, argument) ) send_to_char ("Huh?\n\r", ch); return; } /* * Character not in position for command? */ if (ch->position < cmd_table[cmd].position) { switch (ch->position) { case POS_DEAD: send_to_char ("Lie still; you are DEAD.\n\r", ch); break; case POS_MORTAL: case POS_INCAP: send_to_char ("You are hurt far too bad for that.\n\r", ch); break; case POS_STUNNED: send_to_char ("You are too stunned to do that.\n\r", ch); break; case POS_SLEEPING: send_to_char ("In your dreams, or what?\n\r", ch); break; case POS_RESTING: send_to_char ("Nah... You feel too relaxed...\n\r", ch); break; case POS_SITTING: send_to_char ("Better stand up first.\n\r", ch); break; case POS_FIGHTING: send_to_char ("No way! You are still fighting!\n\r", ch); break; } return; } /* * Dispatch the command. */ (*cmd_table[cmd].do_fun) (ch, argument); tail_chain (); return; }
static int find_door(struct char_data *ch, const char *type, char *dir, const char *cmdname) { int door; if (*dir) { /* a direction was specified */ if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */ if ((door = search_block(dir, autoexits, FALSE)) == -1) { /* Check 'short' dirs too */ send_to_char(ch, "That's not a direction.\r\n"); return (-1); } } if (EXIT(ch, door)) { /* Braces added according to indent. -gg */ if (EXIT(ch, door)->keyword) { if (is_name(type, EXIT(ch, door)->keyword)) return (door); else { send_to_char(ch, "I see no %s there.\r\n", type); return (-1); } } else return (door); } else { send_to_char(ch, "I really don't see how you can %s anything there.\r\n", cmdname); return (-1); } } else { /* try to locate the keyword */ if (!*type) { send_to_char(ch, "What is it you want to %s?\r\n", cmdname); return (-1); } for (door = 0; door < DIR_COUNT; door++) { if (EXIT(ch, door)) { if (EXIT(ch, door)->keyword) { if (isname(type, EXIT(ch, door)->keyword)) { if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR))) return door; else if (is_abbrev(cmdname, "open")) { if (IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) return door; else if (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) return door; } else if ((is_abbrev(cmdname, "close")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))) ) return door; else if ((is_abbrev(cmdname, "lock")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))) ) return door; else if ((is_abbrev(cmdname, "unlock")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) ) return door; else if ((is_abbrev(cmdname, "pick")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) ) return door; } } } } if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR))) send_to_char(ch, "There doesn't seem to be %s %s here.\r\n", AN(type), type); else if (is_abbrev(cmdname, "open")) send_to_char(ch, "There doesn't seem to be %s %s that can be opened.\r\n", AN(type), type); else if (is_abbrev(cmdname, "close")) send_to_char(ch, "There doesn't seem to be %s %s that can be closed.\r\n", AN(type), type); else if (is_abbrev(cmdname, "lock")) send_to_char(ch, "There doesn't seem to be %s %s that can be locked.\r\n", AN(type), type); else if (is_abbrev(cmdname, "unlock")) send_to_char(ch, "There doesn't seem to be %s %s that can be unlocked.\r\n", AN(type), type); else send_to_char(ch, "There doesn't seem to be %s %s that can be picked.\r\n", AN(type), type); return (-1); } }
/* * Reset one room. */ void reset_room( ROOM_INDEX_DATA *room ) { RESET_DATA *pReset, *tReset, *gReset; OBJ_DATA *nestmap[MAX_NEST]; CHAR_DATA *mob; OBJ_DATA *obj, *lastobj, *to_obj; ROOM_INDEX_DATA *pRoomIndex = NULL; MOB_INDEX_DATA *pMobIndex = NULL; OBJ_INDEX_DATA *pObjIndex = NULL, *pObjToIndex; EXIT_DATA *pexit; const char *filename = room->area->filename; int level = 0, n, num = 0, lastnest, onreset = 0;; mob = NULL; obj = NULL; lastobj = NULL; if( !room->first_reset ) return; level = 0; for( pReset = room->first_reset; pReset; pReset = pReset->next ) { ++onreset; switch ( pReset->command ) { default: bug( "%s: %s: bad command %c.", __FUNCTION__, filename, pReset->command ); break; case 'M': if( !( pMobIndex = get_mob_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'M': bad mob vnum %d.", __FUNCTION__, filename, pReset->arg1 ); continue; } if( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'M': bad room vnum %d.", __FUNCTION__, filename, pReset->arg3 ); continue; } if( !pReset->sreset ) { mob = NULL; break; } mob = create_mobile( pMobIndex ); { // ROOM_INDEX_DATA *pRoomPrev = get_room_index( pReset->arg3 - 1 ); // if( pRoomPrev && IS_SET( pRoomPrev->room_flags, ROOM_PET_SHOP ) ) // SET_BIT( mob->act, ACT_PET ); } if( room_is_dark( pRoomIndex ) ) SET_BIT( mob->affected_by, AFF_INFRARED ); mob->resetvnum = pRoomIndex->vnum; mob->resetnum = onreset; pReset->sreset = FALSE; char_to_room( mob, pRoomIndex ); level = URANGE( 0, mob->top_level - 2, LEVEL_AVATAR ); if( pReset->first_reset ) { for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset ) { ++onreset; switch( tReset->command ) { case 'G': case 'E': if( !( pObjIndex = get_obj_index( tReset->arg1 ) ) ) { bug( "%s: %s: 'E' or 'G': bad obj vnum %d.", __FUNCTION__, filename, tReset->arg1 ); continue; } if( !mob ) { lastobj = NULL; break; } if( mob->pIndexData->pShop ) { int olevel = generate_itemlevel( room->area, pObjIndex ); obj = create_object( pObjIndex, olevel ); SET_BIT( obj->extra_flags, ITEM_INVENTORY ); } else obj = create_object( pObjIndex, number_fuzzy( level ) ); obj->level = URANGE( 0, obj->level, LEVEL_AVATAR ); obj = obj_to_char( obj, mob ); if( tReset->command == 'E' ) { if( obj->carried_by != mob ) { bug( "'E' reset: can't give object %d to mob %d.", obj->pIndexData->vnum, mob->pIndexData->vnum ); break; } equip_char( mob, obj, tReset->arg3 ); } for( n = 0; n < MAX_NEST; n++ ) nestmap[n] = NULL; nestmap[0] = obj; lastobj = nestmap[0]; lastnest = 0; if( tReset->first_reset ) { for( gReset = tReset->first_reset; gReset; gReset = gReset->next_reset ) { int iNest; to_obj = lastobj; ++onreset; switch( gReset->command ) { case 'H': if( !lastobj ) break; SET_BIT( lastobj->extra_flags, ITEM_HIDDEN ); break; case 'P': if( !( pObjIndex = get_obj_index( gReset->arg1 ) ) ) { bug( "%s: %s: 'P': bad obj vnum %d.", __FUNCTION__, filename, gReset->arg1 ); continue; } iNest = gReset->extra; if( !( pObjToIndex = get_obj_index( gReset->arg3 ) ) ) { bug( "%s: %s: 'P': bad objto vnum %d.", __FUNCTION__, filename, gReset->arg3 ); continue; } if( iNest >= MAX_NEST ) { bug( "%s: %s: 'P': Exceeded nesting limit of %d", __FUNCTION__, filename, MAX_NEST ); obj = NULL; break; } if( count_obj_list( pObjIndex, to_obj->first_content ) > 0 ) { obj = NULL; break; } if( iNest < lastnest ) to_obj = nestmap[iNest]; else if( iNest == lastnest ) to_obj = nestmap[lastnest]; else to_obj = lastobj; obj = create_object( pObjIndex, number_fuzzy( UMAX( generate_itemlevel( room->area, pObjIndex ), to_obj->level ) ) ); if( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = gReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->count = gReset->arg2; obj_to_obj( obj, to_obj ); if( iNest > lastnest ) { nestmap[iNest] = to_obj; lastnest = iNest; } lastobj = obj; // Hackish fix for nested puts if( gReset->arg3 == OBJ_VNUM_MONEY_ONE ) gReset->arg3 = to_obj->pIndexData->vnum; break; } } } break; } } } break; case 'O': if( !( pObjIndex = get_obj_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'O': bad obj vnum %d.", __FUNCTION__, filename, pReset->arg1 ); continue; } if( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'O': bad room vnum %d.", __FUNCTION__, filename, pReset->arg3 ); continue; } if( count_obj_list( pObjIndex, pRoomIndex->first_content ) < 1 ) { obj = create_object( pObjIndex, number_fuzzy( generate_itemlevel( room->area, pObjIndex ) ) ); if( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = pReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->cost = 0; obj_to_room( obj, pRoomIndex ); } else { int x; if( !( obj = get_obj_room( pObjIndex, pRoomIndex ) ) ) { obj = NULL; lastobj = NULL; break; } obj->extra_flags = pObjIndex->extra_flags; for( x = 0; x < 6; ++x ) obj->value[x] = pObjIndex->value[x]; } for( n = 0; n < MAX_NEST; n++ ) nestmap[n] = NULL; nestmap[0] = obj; lastobj = nestmap[0]; lastnest = 0; if( pReset->first_reset ) { for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset ) { int iNest; to_obj = lastobj; ++onreset; switch( tReset->command ) { case 'H': if( !lastobj ) break; SET_BIT( lastobj->extra_flags, ITEM_HIDDEN ); break; case 'T': if( !IS_SET( tReset->extra, TRAP_OBJ ) ) { bug( "%s: Room reset found on object reset list", __FUNCTION__ ); break; } else { /* * We need to preserve obj for future 'T' checks */ OBJ_DATA *pobj; if( tReset->arg3 > 0 ) { if( !( pObjToIndex = get_obj_index( tReset->arg3 ) ) ) { bug( "%s: %s: 'T': bad objto vnum %d.", __FUNCTION__, filename, tReset->arg3 ); continue; } if( room->area->nplayer > 0 || !( to_obj = get_obj_type( pObjToIndex ) ) || ( to_obj->carried_by && !IS_NPC( to_obj->carried_by ) ) || is_trapped( to_obj ) ) break; } else { if( !lastobj || !obj ) break; to_obj = obj; } pobj = make_trap( tReset->arg2, tReset->arg1, number_fuzzy( to_obj->level ), tReset->extra ); obj_to_obj( pobj, to_obj ); } break; case 'P': if( !( pObjIndex = get_obj_index( tReset->arg1 ) ) ) { bug( "%s: %s: 'P': bad obj vnum %d.", __FUNCTION__, filename, tReset->arg1 ); continue; } iNest = tReset->extra; if( !( pObjToIndex = get_obj_index( tReset->arg3 ) ) ) { bug( "%s: %s: 'P': bad objto vnum %d.", __FUNCTION__, filename, tReset->arg3 ); continue; } if( iNest >= MAX_NEST ) { bug( "%s: %s: 'P': Exceeded nesting limit of %d. Room %d.", __FUNCTION__, filename, MAX_NEST, room->vnum ); obj = NULL; break; } if( count_obj_list( pObjIndex, to_obj->first_content ) > 0 ) { obj = NULL; break; } if( iNest < lastnest ) to_obj = nestmap[iNest]; else if( iNest == lastnest ) to_obj = nestmap[lastnest]; else to_obj = lastobj; obj = create_object( pObjIndex, number_fuzzy( UMAX( generate_itemlevel( room->area, pObjIndex ), to_obj->level ) ) ); if( num > 1 ) pObjIndex->count += ( num - 1 ); obj->count = tReset->arg2; obj->level = UMIN( obj->level, LEVEL_AVATAR ); obj->count = tReset->arg2; obj_to_obj( obj, to_obj ); if( iNest > lastnest ) { nestmap[iNest] = to_obj; lastnest = iNest; } lastobj = obj; // Hackish fix for nested puts if( tReset->arg3 == OBJ_VNUM_MONEY_ONE ) tReset->arg3 = to_obj->pIndexData->vnum; break; } } } break; case 'T': if( IS_SET( pReset->extra, TRAP_OBJ ) ) { bug( "%s: Object trap found in room %d reset list", __FUNCTION__, room->vnum ); break; } else { if( !( pRoomIndex = get_room_index( pReset->arg3 ) ) ) { bug( "%s: %s: 'T': bad room %d.", __FUNCTION__, filename, pReset->arg3 ); continue; } if( room->area->nplayer > 0 || count_obj_list( get_obj_index( OBJ_VNUM_TRAP ), pRoomIndex->first_content ) > 0 ) break; to_obj = make_trap( pReset->arg1, pReset->arg1, 10, pReset->extra ); obj_to_room( to_obj, pRoomIndex ); } break; case 'D': if( !( pRoomIndex = get_room_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'D': bad room vnum %d.", __FUNCTION__, filename, pReset->arg1 ); continue; } if( !( pexit = get_exit( pRoomIndex, pReset->arg2 ) ) ) break; switch ( pReset->arg3 ) { case 0: REMOVE_BIT( pexit->exit_info, EX_CLOSED ); REMOVE_BIT( pexit->exit_info, EX_LOCKED ); break; case 1: SET_BIT( pexit->exit_info, EX_CLOSED ); REMOVE_BIT( pexit->exit_info, EX_LOCKED ); if( IS_SET( pexit->exit_info, EX_xSEARCHABLE ) ) SET_BIT( pexit->exit_info, EX_SECRET ); break; case 2: SET_BIT( pexit->exit_info, EX_CLOSED ); SET_BIT( pexit->exit_info, EX_LOCKED ); if( IS_SET( pexit->exit_info, EX_xSEARCHABLE ) ) SET_BIT( pexit->exit_info, EX_SECRET ); break; } break; case 'R': if( !( pRoomIndex = get_room_index( pReset->arg1 ) ) ) { bug( "%s: %s: 'R': bad room vnum %d.", __FUNCTION__, filename, pReset->arg1 ); continue; } randomize_exits( pRoomIndex, pReset->arg2 - 1 ); break; } } return; }
void do_email( CHAR_DATA * ch, char * argument ) { /* interface for setting up email addresses */ char arg1[MSL]; char arg2[MSL]; char outbuf[MSL]; char catbuf[MSL]; bool valid_email = FALSE; if ( IS_NPC( ch ) ) return; argument = one_argument( argument, arg1 ); if ( arg1[0] == '\0' ) { sprintf( outbuf, "%s", "Syntax for email:\n\r" ); sprintf( catbuf, "%s", "set <email address>\n\r" ); safe_strcat( MSL, outbuf, catbuf ); if ( ch->pcdata->valid_email ) { sprintf( catbuf, "Your email address is currently set to %s.\n\r", ch->pcdata->email_address ); safe_strcat( MSL, outbuf, catbuf ); } else { if ( !str_cmp( ch->pcdata->email_address, "not set" ) ) safe_strcat(MSL, outbuf, "Your email address has not been set.\n\r" ); else { sprintf( catbuf, "Your email address has been set to %s, but has not been authorized by an Implementor.\n\r", ch->pcdata->email_address ); safe_strcat( MSL, outbuf, catbuf ); } } send_to_char( outbuf, ch ); return; } argument = one_argument( argument, arg2 ); if ( arg2[0] == '\0' ) { do_email( ch, "" ); return; } if ( !str_cmp( arg1, "set" ) ) { valid_email = valid_email_addy( arg2 ); if ( valid_email ) { free_string( ch->pcdata->email_address ); ch->pcdata->email_address = str_dup( arg2 ); ch->pcdata->valid_email = TRUE; do_save( ch, "" ); sprintf( outbuf, "Your email address has been set to %s.\n\r", ch->pcdata->email_address ); send_to_char( outbuf, ch ); return; } else { sprintf( outbuf, "%s is not an acceptable email address.\n\r", arg2 ); send_to_char( outbuf, ch ); return; } } /* if ( !str_cmp( arg1, "validate" ) ) { if ( get_trust( ch ) < MAX_LEVEL ) { send_to_char( "Only Implementors may use this command.\n\r", ch ); return; } else { CHAR_DATA *victim; DESCRIPTOR_DATA d; BRAND_DATA * brand; DL_LIST * brand_list; bool logged_in = FALSE; if ( arg2[0] == '\0' ) { send_to_char( "Authorize email for whom?\n\r", ch ); return; } if ( ( victim = get_char_world( ch, arg2 ) ) == NULL ) { bool found = FALSE; found = load_char_obj( &d, arg2, TRUE ); if (!found) { char buf[MSL]; sprintf( buf, "No pFile found for '%s'.\n\r", capitalize( arg2 ) ); send_to_char( buf, ch ); free_char( d.character ); return; } victim = d.character; d.character = NULL; victim->desc = NULL; LINK( victim, first_char, last_char, next, prev ); } else { logged_in = TRUE; } victim->pcdata->valid_email = TRUE; send_to_char( "OK.\n\r", ch ); for ( brand_list = first_brand; brand_list; brand_list = brand_list->next ) { brand = brand_list->this_one; if ( ( !str_cmp( brand->branded, victim->name ) ) && ( !str_cmp( brand->priority, "Email Validation" ) ) ) break; } if ( brand_list != NULL ) { UNLINK( brand_list, first_brand, last_brand, next, prev ); brand = brand_list->this_one; PUT_FREE(brand, brand_data_free); brand_list->this_one = NULL; PUT_FREE( brand_list, dl_list_free ); save_brands( ); } if ( !logged_in ) do_quit( victim, "" ); return; } } */ do_email( ch, "" ); return; }
/* czy ten mob sie nadaje do tankowania*/ int check_tank(CHAR_DATA *ch) { int average_hp, hp_percent; average_hp = get_max_hp(ch)/UMAX(1, ch->level); hp_percent = (100*ch->hit)/UMAX(1, get_max_hp(ch)); /* jesli ma ponizej 30%hp */ if( hp_percent < 30 ) return 0; if(!IS_NPC(ch)) { if( average_hp < 15) return 1; switch(average_hp) { case 15: case 16: case 17: return 2; case 18: case 19: case 20: return 3; case 21: case 22: case 23: return 4; default: return 5; } return 0; } if( average_hp < 20) return 1; switch(average_hp) { case 20: case 21: case 22: case 23: case 24: return 2; case 25: case 26: case 27: case 28: case 29: return 3; case 30: case 31: case 32: case 33: case 34: case 35: return 4; default: return 5; } return 0; }
int mag_affect_char(struct spell_info_type *sinfo, int affect_flag, struct char_data *caster, struct char_data *vict, int level) { struct affected_type af; int i; int spell = 0; int unaffect = 0; int circle = (level + 4) / 5; /* innate */ if (level == -1) { SET_BIT(AFF_FLAGS(vict), affect_flag); return 1; } if (sinfo->unaffect) { spell = spells[find_spell_num(sinfo->unaffect)].spellindex; unaffect = 1; } if (!unaffect) { af.type = sinfo->spellindex; af.bitvector = sinfo->spell_plr_bit; af.bitvector2 = sinfo->spell_plr_bit2; af.bitvector3 = sinfo->spell_plr_bit3; if (sinfo->spell_duration) af.duration = sinfo->spell_duration * 12; else af.duration = (SECS_PER_MUD_HOUR * level) / 15; /* level/3 mud hours duration */ af.duration = modBySpecialization(caster, sinfo, af.duration); gain_exp(caster, af.duration * 2); if (strcmp(sinfo->command, "stoneskin") == 0) af.duration = level * 5; for (i = 0; i < NUM_MODIFY; i++) { af.modifier[i] = 0; af.location[i] = 0; } for (i = 0; i < NUM_MODIFY; i++) { if (sinfo->plr_aff[i].location) { if (strcmp(sinfo->command, "vitality") == 0 || strcmp(sinfo->command, "vigorize") == 0) af.modifier[i] = (sinfo->plr_aff[i].modifier * level); else if (strcmp(sinfo->command, "barkskin") == 0) { af.modifier[i] = (sinfo->plr_aff[i].modifier - (3.5 * circle)); } else af.modifier[i] = sinfo->plr_aff[i].modifier; af.location[i] = sinfo->plr_aff[i].location; } } if (IS_NPC(vict) && IS_AFFECTED(vict, sinfo->spell_plr_bit) && IS_AFFECTED2(vict, sinfo->spell_plr_bit2) && IS_AFFECTED3(vict, sinfo->spell_plr_bit3) && !affected_by_spell(vict, sinfo->spellindex)) return 0; if (affected_by_spell(vict, sinfo->spellindex) && !(sinfo->accum_duration || sinfo->accum_affect)) return 0; affect_join(vict, &af, sinfo->accum_duration, sinfo->avg_duration, sinfo->accum_affect, sinfo->avg_affect); } else { if (affected_by_spell(vict, sinfo->spellindex) && !(sinfo->accum_duration || sinfo->accum_affect)) return 0; affect_from_char(vict, spell); } return 1; }
void do_mount( char_data* ch, char* argument ) { char_data* victim; if( IS_NPC( ch ) || ch->shdata->skill[SKILL_RIDING] == 0 ) { send( ch, "You don't know how to ride.\r\n" ); return; } if( ch->mount != NULL ) { send( ch, "You are already riding %s.\r\n", ch->mount ); return; } if( ( victim = one_character( ch, argument, "mount", ch->array ) ) == NULL ) return; if( IS_SET( ch->in_room->room_flags, RFLAG_NO_MOUNT ) ) { send( "You can't mount here.\r\n", ch ); return; } if( victim->rider != NULL ) { send( ch, "Someone else is already riding them.\r\n" ); return; } if( victim->leader != ch || !is_set( &victim->status, STAT_PET ) || !is_set( &victim->species->act_flags, ACT_MOUNT ) ) { send( ch, "%s refuses to let you mount %s.\r\n", victim, victim->Him_Her( ) ); return; } if( victim->fighting != NULL ) { send( ch, "It is impossible to mount a fighting beast.\r\n" ); return; } if( victim->Size( ) < ch->Size( )+1 ) { send( ch, "%s is too small to carry your weight.\r\n", victim ); return; } if( victim->position != POS_STANDING ) { send( ch, "You can only mount a beast while it is standing.\r\n" ); return; } leave_shadows( ch ); if( ch->pcdata != NULL ) remove_bit( ch->pcdata->pfile->flags, PLR_SNEAK ); send( ch, "You mount %s.\r\n", victim ); send( *ch->array, "%s mounts %s.\r\n", ch, victim ); ch->mount = victim; victim->rider = ch; ch->improve_skill( SKILL_RIDING ); return; }
void do_mount_on( CHAR_DATA *ch, CHAR_DATA *horse ) { bool show; int skill = get_skill( ch, gsn_riding ); if ( ch->mount ) { print_char(ch, "Przecie¿ dosiadasz ju¿ %s!\n\r", ch->mount->name4); return; } if ( horse == ch ) { send_to_char( "Czego chcesz dosi±¶æ?\n\r", ch ); return; } if ( !IS_NPC(horse) || !EXT_IS_SET(horse->act, ACT_MOUNTABLE ) ) { print_char(ch, "Nie mo¿esz dosi±¶æ %s!\n\r", horse->name2 ); return; } if ( horse->mounting ) { print_char(ch, "%s ju¿ ma je¼dzca.\n\r", horse->short_descr ); return; } if ( horse->master && horse->master != ch ) { act("$N nie pozwala ci na to.", ch, NULL, horse->master, TO_CHAR ); return; } if ( horse->position < POS_STANDING ) { send_to_char( "Wierzchowiec musi staæ, aby mo¿na by³o na niego wsi±¶æ.\n\r", ch ); return; } if ( horse->fighting ) { print_char(ch, "%s teraz walczy, nie dasz rady wsi±¶æ.\n\r", horse->short_descr ); return; } if ( is_fearing( horse, ch ) ) { print_char(ch, "%s zbyt siê ciebie boi, nie dasz rady wsi±¶æ.\n\r", horse->short_descr ); if ( number_percent() < 5 ) { one_hit( horse, ch, TYPE_UNDEFINED, FALSE ); } return; } if ( ch->move <= 0 ) { act( "Jeste¶ zbyt zmêczon<&y/a/e> by dosi±¶æ wierzchowca.", ch, NULL, horse, TO_CHAR ); return; } if (IS_AFFECTED(ch, AFF_SNEAK) || IS_AFFECTED(ch, AFF_HIDE)) { switch (horse->sex) { case SEX_NEUTRAL: act( "Próbujesz dosi±¶æ $C, ale robisz to tak niespodziewanie, ¿e $N umyka przestraszone.", ch, NULL, horse, TO_CHAR ); break; case SEX_MALE: act( "Próbujesz dosi±¶æ $C, ale robisz to tak niespodziewanie, ¿e $N umyka przestraszony.", ch, NULL, horse, TO_CHAR ); break; case SEX_FEMALE: default : act( "Próbujesz dosi±¶æ $C, ale robisz to tak niespodziewanie, ¿e $N umyka przestraszona.", ch, NULL, horse, TO_CHAR ); break; } ch->move -= number_range(1,4); if ( ch->move < 0 ) { ch->move = 0; } return; } if(IS_AFFECTED(ch, AFF_FLYING)) { affect_strip(ch, gsn_fly); } if(IS_AFFECTED(ch, AFF_FLOAT)) { affect_strip(ch, gsn_float); } if ( skill == 0 || number_percent() > skill + 5 ) { act( "Nieudolnie próbujesz dosi±¶æ $C i po chwili l±dujesz na ziemi.", ch, NULL, horse, TO_CHAR ); act( "$n nieudolnie próbuje dosi±¶æ $C i po chwili l±duje na ziemi.", ch, NULL, horse, TO_NOTVICT ); ch->position = POS_SITTING; ch->move -= number_range(0,4); if ( ch->weight > 900 ) { ch->move -= number_range(0,2); } ch->move = UMAX(0,ch->move); check_improve( ch, NULL, gsn_riding, TRUE, 70 ); return; } ch->mount = horse; horse->mounting = ch; horse->default_pos = POS_STANDING; horse->position = POS_STANDING; show = TRUE; if ( IS_NPC( horse ) && HAS_TRIGGER( horse, TRIG_MOUNT ) ) { show = !mp_percent_trigger( horse, ch, NULL, NULL, &TRIG_MOUNT ); } if ( IS_NPC( horse ) && HAS_TRIGGER( horse, TRIG_DISMOUNT ) ) { show = FALSE; } if ( show ) { act( "Umiejêtnie dosiadasz $C.", ch, NULL, horse, TO_CHAR ); act( "$n umiejêtnie dosiada $C.", ch, NULL, horse, TO_NOTVICT ); check_improve( ch, NULL, gsn_riding, TRUE, 10 ); } return; }
void do_icelance( CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char arg1[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; int dam; argument = one_argument( argument, arg1 ); if (IS_NPC(ch) ) return; if (!IS_CLASS(ch, CLASS_WIZARD)) { send_to_char("Huh?\n\r",ch); return; } if ( arg1[0] == '\0') { send_to_char( "#RUse icelance on who?\n\r", ch ); return; } if ( ( victim = get_char_room( ch, arg1 ) ) == NULL ) { send_to_char( "#RThey aren't here.#n\n\r", ch ); return; } if ((victim == ch)) { stc("#RYeah ok...\n\r",ch); return; } if (ch->pcdata->stats[WL_SPELLS] < 4) { stc("#RYou do not yet have mastery of this spell.\n\r",ch); return; } if (ch->mana < 5000) { stc("#RYou do not have the required 5000 mana.\n\r",ch); return; } dam = number_range(1000, 2000); if (ch->pcdata->powers[WL_SKILLS] > 3) { dam += number_range( 1000, 2000 ); } if (IS_NPC(victim)) { dam *= 1.5; } act("#y$n#R points $s hands towards #y$N#R and sends forth a wicked spear of ice.", ch, NULL, victim, TO_NOTVICT); sprintf( buf, "#RYou point your hands toward %s and sends forth a wicked spear of ice#n #y[#C%d#y]#n\n\r", victim->name, dam); stc( buf, ch); sprintf( buf, "#y%s#R points his hands towards you and sends forth a wicked spear.#n #y[#C%d#y]#n\n\r", ch->name, dam); stc( buf, victim); ch->mana -= 5000; victim->hit -= dam; if (!IS_BLEEDING(victim, BLEEDING_THROAT)) SET_BIT(victim->loc_hp[6], BLEEDING_THROAT); if (victim->hit < -10) victim->hit = -10; WAIT_STATE(ch, PULSE_VIOLENCE); if (ch->fighting == NULL) ch->fighting = victim; return; }
/* Affects-at-a-glance, Blodkai */ void do_affected( CHAR_DATA* ch, const char* argument) { char arg[MAX_INPUT_LENGTH]; AFFECT_DATA *paf; SKILLTYPE *skill; if( IS_NPC( ch ) ) return; set_char_color( AT_SCORE, ch ); argument = one_argument( argument, arg ); if( !str_cmp( arg, "by" ) ) { send_to_char_color( "\r\n&BImbued with:\r\n", ch ); ch_printf_color( ch, "&C%s\r\n", !xIS_EMPTY( ch->affected_by ) ? affect_bit_name( &ch->affected_by ) : "nothing" ); if( ch->level >= 20 ) { send_to_char( "\r\n", ch ); if( ch->resistant > 0 ) { send_to_char_color( "&BResistances: ", ch ); ch_printf_color( ch, "&C%s\r\n", flag_string( ch->resistant, ris_flags ) ); } if( ch->immune > 0 ) { send_to_char_color( "&BImmunities: ", ch ); ch_printf_color( ch, "&C%s\r\n", flag_string( ch->immune, ris_flags ) ); } if( ch->susceptible > 0 ) { send_to_char_color( "&BSuscepts: ", ch ); ch_printf_color( ch, "&C%s\r\n", flag_string( ch->susceptible, ris_flags ) ); } } return; } if( !ch->first_affect ) { send_to_char_color( "\r\n&CNo cantrip or skill affects you.\r\n", ch ); } else { send_to_char( "\r\n", ch ); for( paf = ch->first_affect; paf; paf = paf->next ) if( ( skill = get_skilltype( paf->type ) ) != NULL ) { set_char_color( AT_BLUE, ch ); send_to_char( "Affected: ", ch ); set_char_color( AT_SCORE, ch ); if( ch->level >= 20 || IS_PKILL( ch ) ) { if( paf->duration < 25 ) set_char_color( AT_WHITE, ch ); if( paf->duration < 6 ) set_char_color( AT_WHITE + AT_BLINK, ch ); ch_printf( ch, "(%5d) ", paf->duration ); } ch_printf( ch, "%-18s\r\n", skill->name ); } } return; }