void hunt_victim(struct char_data *ch) { int dir; byte found; struct char_data *tmp; if (!ch || !HUNTING(ch) || FIGHTING(ch)) return; /* make sure the char still exists */ for (found = FALSE, tmp = character_list; tmp && !found; tmp = tmp->next) if (HUNTING(ch) == tmp) found = TRUE; if (!found) { do_say(ch, "Damn! My prey is gone!", 0, 0); HUNTING(ch) = NULL; return; } if ((dir = find_first_step(IN_ROOM(ch), IN_ROOM(HUNTING(ch)))) < 0) { sprintf(buf, "Damn! I lost %s!", HMHR(HUNTING(ch))); do_say(ch, buf, 0, 0); HUNTING(ch) = NULL; } else { perform_move(ch, dir, 1); if (IN_ROOM(ch) == IN_ROOM(HUNTING(ch))) hit(ch, HUNTING(ch), TYPE_UNDEFINED); } }
int puff(struct char_data *ch, int cmd, char *arg) { void do_say(struct char_data *ch, char *argument, int cmd); if (cmd) return(0); switch (number(0, 60)) { case 0: do_say(ch, "My god! It's full of stars!", 0); return(1); case 1: do_say(ch, "How'd all those fish get up here?", 0); return(1); case 2: do_say(ch, "I'm a very female dragon.", 0); return(1); case 3: do_say(ch, "I've got a peaceful, easy feeling.", 0); return(1); default: return(0); } }
int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr) { if (shop_index[shop_nr].open1>time_info.hours){ do_say(keeper, "Come back later!",17); return(FALSE); } else if (shop_index[shop_nr].close1<time_info.hours) { if (shop_index[shop_nr].open2>time_info.hours){ do_say(keeper, "Sorry, we have closed, but come back later.",17); return(FALSE); } else if (shop_index[shop_nr].close2<time_info.hours){ do_say(keeper, "Sorry, come back tomorrow.",17); return(FALSE); }; } if(!(CAN_SEE(keeper,ch))) { do_say(keeper, "I don't trade with someone I can't see!",17); return(FALSE); }; switch(shop_index[shop_nr].with_who){ case 0 : return(TRUE); case 1 : return(TRUE); default : return(TRUE); }; }
int Moribondo( struct char_data *pChar, int nCmd, const char *szArg, struct char_data *pMob, int nType ) { if( pMob == NULL || pChar == NULL ) { mudlog( LOG_SYSERR, "pMob == NULL || pChar == NULL in Moribondo( carceri.h )" ); return FALSE; } if( nType == EVENT_TICK ) { switch( pMob->generic ) { case 0: GET_HIT( pMob ) = -3; GET_POS( pMob ) = POSITION_INCAP; pMob->generic = 1; break; case 1: if( GET_HIT( pMob ) > 0 && !pMob->specials.fighting ) { do_say( pMob, "Grazie! Grazie! Chiunque sia stato.", 0 ); if( pMob->player.description ) free( pMob->player.description ); pMob->player.description = strdup( "Il piccolo nano e` contento e " "grato a chi lo ha aiutato.\n\r" ); pMob->generic = 2; } else if( !pMob->specials.fighting ) { MakeNoise( pMob->in_room, NULL, "Senti qualcuno lamentarsi.\n\r" ); } break; case 2: if( !pMob->specials.fighting ) { do_say( pMob, "Guardate vicino al letto. C'e` un passaggio segreto!", 0 ); pMob->generic = 3; } break; default: if( !number( 0, 5 ) && !pMob->specials.fighting ) { do_say( pMob, "Guardate vicino al letto. C'e` un passaggio segreto!", 0 ); } break; } } return FALSE; }
int is_ok_char(struct char_data * keeper, struct char_data * ch, int shop_nr) { char buf[200]; if (!(CAN_SEE(keeper, ch))) { do_say(keeper, MSG_NO_SEE_CHAR, cmd_say, 0); return (FALSE); } if (IS_GOD(ch)) return (TRUE); if ((IS_GOOD(ch) && NOTRADE_GOOD(shop_nr)) || (IS_EVIL(ch) && NOTRADE_EVIL(shop_nr)) || (IS_NEUTRAL(ch) && NOTRADE_NEUTRAL(shop_nr))) { sprintf(buf, "%s %s", GET_NAME(ch), MSG_NO_SELL_ALIGN); do_tell(keeper, buf, cmd_tell, 0); return (FALSE); } if (IS_NPC(ch)) return (TRUE); if ((IS_MAGIC_USER(ch) && NOTRADE_MAGIC_USER(shop_nr)) || (IS_CLERIC(ch) && NOTRADE_CLERIC(shop_nr)) || (IS_THIEF(ch) && NOTRADE_THIEF(shop_nr)) || (IS_WARRIOR(ch) && NOTRADE_WARRIOR(shop_nr))) { sprintf(buf, "%s %s", GET_NAME(ch), MSG_NO_SELL_CLASS); do_tell(keeper, buf, cmd_tell, 0); return (FALSE); } return (TRUE); }
void do_enrage(CHAR_DATA *ch, char *argument) { char arg[MAX_INPUT_LENGTH]; CHAR_DATA *victim; argument = one_argument( argument, arg ); if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_TANARRI)) { send_to_char("Huh?\n\r",ch); return; } if (!IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_ENRAGE)) { send_to_char("you don't have that power yet.\n\r",ch); return; } if ((victim = get_char_room(ch, arg)) == NULL) { send_to_char("They are not here.\n\r", ch); return; } if (IS_NPC(victim) || victim->level < 3) { send_to_char("Not on them\n\r",ch); return; } do_say(ch, "Kara, Kara, Xenos!"); if (number_percent() > 40) do_berserk2(victim,""); else send_to_char("#RSomeone is trying to control your actions!!!#n\n\r",victim); WAIT_STATE(ch,18); return; }
bool spec_police_attack(CHAR_DATA * ch) { CHAR_DATA *victim; CHAR_DATA *v_next; int vip; char buf[MAX_STRING_LENGTH]; if (!IS_AWAKE(ch) || ch->fighting) return FALSE; for (victim = ch->in_room->first_person; victim; victim = v_next) { v_next = victim->next_in_room; if (IS_NPC(victim)) continue; if (!can_see(ch, victim)) continue; if (number_bits(1) == 0) continue; for (vip = 0; vip < 32; vip++) if (IS_SET(ch->vip_flags, 1 << vip) && IS_SET(victim->pcdata->wanted_flags, 1 << vip)) { sprintf(buf, "Hey you're wanted on %s!", planet_flags[vip]); do_say(ch, buf); REMOVE_BIT(victim->pcdata->wanted_flags, 1 << vip); multi_hit(ch, victim, TYPE_UNDEFINED); return TRUE; } } return FALSE; }
static int say_full(struct ast_channel *chan, const char *string, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) { say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; return do_say(&a, string, options, 0); }
void do_balance( CHAR_DATA * ch, char *argument ) { CHAR_DATA *banker; char buf[MAX_STRING_LENGTH]; if( !( banker = find_banker( ch ) ) ) { send_to_char( "&WYou're not in a bank!&w\r\n", ch ); return; } if( IS_NPC( ch ) ) { sprintf( buf, "Sorry, %s, we don't do business with mobs.", ch->short_descr ); do_say( banker, buf ); return; } set_char_color( AT_WHITE, ch ); send_to_char( "Your account value is:\r\n", ch ); sprintf( buf, "&YGold: %ld.\r\n&WSilver: %ld.\r\n&RCopper: %ld.\r\n\r\n", ch->pcdata->gbalance, ch->pcdata->sbalance, ch->pcdata->balance ); send_to_char( buf, ch ); return; }
bool spec_police_fine( CHAR_DATA * ch ) { CHAR_DATA *victim; CHAR_DATA *v_next; int vip; char buf[MAX_STRING_LENGTH]; if( !IS_AWAKE( ch ) || ch->fighting ) return FALSE; for( victim = ch->in_room->first_person; victim; victim = v_next ) { v_next = victim->next_in_room; if( IS_NPC( victim ) ) continue; if( !can_see( ch, victim ) ) continue; if( number_bits( 1 ) == 0 ) continue; for( vip = 0; vip <= 31; vip++ ) if( IS_SET( ch->vip_flags, 1 << vip ) && IS_SET( victim->pcdata->wanted_flags, 1 << vip ) ) { sprintf( buf, "Hey you're wanted on %s!", planet_flags[vip] ); do_say( ch, buf ); act( AT_ACTION, "$n fines $N an enormous amount of money.", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "$n fines you an enourmous amount of money.", ch, NULL, victim, TO_VICT ); victim->gold /= 2; REMOVE_BIT( victim->pcdata->wanted_flags, 1 << vip ); return TRUE; } } return FALSE; }
void soul_sword (CHAR_DATA *ch) { //Soul Sword can rarely kill victims outright, and does 1 dmg, and is VERY unlikely to hit. UNGODLY Expensive CHAR_DATA *victim; OBJ_DATA *katana; char buf[MAX_STRING_LENGTH]; int thebonus = 0; if (IS_NPC(ch)) return; katana = get_eq_char(ch, WEAR_WIELD); if ((victim = ch->fighting) == NULL) { send_to_char("You find no need for this now.\n\r",ch); return; } if (IS_NPC(victim)) thebonus = 45; else thebonus = 7; if (ch->mana < 30000) { send_to_char("You have not the 30000 mana power to use this.\n\r",ch); return; } if ((katana == NULL) || (katana->pIndexData->vnum != 33176)) { send_to_char("Without a proper katana the energy will destroy your weapon.\n\r",ch); return; } ch->mana -= 30000; send_to_char("You channel mystical energy into your katana.\n\r",ch); do_say(ch,"#0SOUL #nSWORD!"); act("A bolt of light shoots out of your katana and into $N",ch, NULL, victim, TO_CHAR); act("A bolt of light shoots out of $n's katana and into you!", ch, NULL, victim, TO_VICT); act("A bolt of light shoots out of $n's katana and into $N!", ch, NULL, victim, TO_NOTVICT); if (number_range(0,250) > (4 + thebonus)) // Was .5% now it's 5%/20% { act("Your attack was ineffective.", ch, NULL, victim, TO_CHAR); act("$n looks confused as nothing happens.", ch, NULL, NULL, TO_ROOM); multi_hit( ch, victim, TYPE_UNDEFINED ); WAIT_STATE(ch, (PULSE_VIOLENCE * 5)); return; } xprintf(buf,"$N screams as $E is ripped apart by the dark energy. #R[#y#b MORTAL #n#R]#n"); act(buf, ch, NULL, victim, TO_CHAR); xprintf(buf,"$n looks on as you start screaming while dark energy rips you apart from the inside out. #R[#y#b MORTAL #n#R]#n"); act(buf, ch, NULL, victim, TO_VICT); send_to_char("You crumple to the ground.\n\r", victim); act("$n looks on as $N starts screaming. Weakened $N crumples to the ground.", ch, NULL, victim, TO_NOTVICT); WAIT_STATE(ch, (PULSE_VIOLENCE * 5)); victim->hit = -10; hurt_person(ch, victim, 1); return; }
void drain_sword (CHAR_DATA *ch) { //Drain Sword sucks health from a victim, and is moderately likely to hit. Avg Expense, Low Dmg CHAR_DATA *victim; OBJ_DATA *katana; char buf[MAX_STRING_LENGTH]; int dmg; int heal; if (IS_NPC(ch)) return; katana = get_eq_char(ch, WEAR_WIELD); if ((victim = ch->fighting) == NULL) { send_to_char("You find no need for this now.\n\r",ch); return; } if (ch->mana < 4000) { send_to_char("You have not the 4000 mystical power to use this.\n\r",ch); return; } if ((katana == NULL) || (katana->pIndexData->vnum != 33176)) { send_to_char("Without a proper katana the energy will destroy your weapon.\n\r",ch); return; } ch->mana -= 4000; send_to_char("You channel mystical energy into your katana.\n\r",ch); do_say(ch,"#nD#0R#yA#0I#nN #nSWORD!"); send_to_char("A wave of energy launches itself from your katana.\n\r",ch); act("A wave of energy launches itself from $n's katana!", ch, NULL, NULL, TO_ROOM); if (number_range(0,100) < 20) { act("Your wave of energy goes through $N, continues on a bit then fades.", ch, NULL, victim, TO_CHAR); act("The wave of energy goes through you, continues on a bit then fades.", ch, NULL, victim, TO_VICT); act("The wave of energy goes through $N, continues on a bit then fades.", ch, NULL, victim, TO_NOTVICT); return; } dmg = number_range(ch->wpn[1], ch->wpn[1] * 2); heal = number_range(dmg / 3, dmg / 2); xprintf(buf,"Your wave of energy enters $N's body and drains %d health painfully from $N. #R[#R#b %d #n#R]#n", heal, dmg); act(buf, ch, NULL, victim, TO_CHAR); xprintf(buf,"$n's wave of energy enters your body and drains you painfully. #R[#R#b %d #n#R]#n", dmg); act(buf, ch, NULL, victim, TO_VICT); act("$n's wave of energy enters $N's body causing $N to look weak.", ch, NULL, victim, TO_NOTVICT); hurt_person(ch, victim, dmg); ch->hit += heal; if (ch->hit > ch->max_hit) ch->hit = ch->max_hit; WAIT_STATE(ch, (PULSE_VIOLENCE * 3)); return; }
static int say_enumeration_full(struct ast_channel *chan, int num, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) { char buf[64]; say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; snprintf(buf, sizeof(buf), "enum:%d", num); return do_say(&a, buf, options, 0); }
void fire_sword (CHAR_DATA *ch) { //Flame Cone Sword sets victim aflame, and is VERY likely to hit. More Expense, Low Dmg CHAR_DATA *victim; OBJ_DATA *katana; char buf[MAX_STRING_LENGTH]; int dmg; if (IS_NPC(ch)) return; katana = get_eq_char(ch, WEAR_WIELD); if ((victim = ch->fighting) == NULL) { send_to_char("You find no need for this now.\n\r",ch); return; } if (ch->mana < 3500) { send_to_char("You have not the 3500 mystical power to use this.\n\r",ch); return; } if ((katana == NULL) || (katana->pIndexData->vnum != 33176)) { send_to_char("Without a proper katana the energy will destroy your weapon.\n\r",ch); return; } ch->mana -= 3500; send_to_char("You channel mystical energy into your katana.\n\r",ch); do_say(ch,"#rF#RIR#rE #nSWORD!"); send_to_char("A tremendous cone of flame shoots from your katana.\n\r",ch); act("A tremendous cone of flame shoots from $n's katana!", ch, NULL, NULL, TO_ROOM); if (number_range(0,100) < 5) { act("Your cone of flame flashes past $N and scorches the ground.", ch, NULL, victim, TO_CHAR); act("The cone of flame flashes past you and scorches the ground.", ch, NULL, victim, TO_VICT); act("The cone of flame flashes past $N and scorches the ground.", ch, NULL, victim, TO_NOTVICT); return; } dmg = number_range(ch->wpn[1], ch->wpn[1] * 2); xprintf(buf,"Your cone of flame engulfs $N's in a sheet of flame. #R[#R#b %d #n#R]#n", dmg); act(buf, ch, NULL, victim, TO_CHAR); xprintf(buf,"$n's cone of flame engulfs you in a sheet of flame. #R[#R#b %d #n#R]#n", dmg); act(buf, ch, NULL, victim, TO_VICT); act("$n's engulfs $N's in a sheet of flame.", ch, NULL, victim, TO_NOTVICT); hurt_person(ch, victim, dmg); WAIT_STATE(ch, (PULSE_VIOLENCE * 3)); if (!IS_SET(victim->affected_by, AFF_FLAMING)) SET_BIT(victim->affected_by, AFF_FLAMING); return; }
void lightning_sword (CHAR_DATA *ch) { //Lightning Stuns Victim and is fairly likely to hit, Avg Expense, Avg Damage CHAR_DATA *victim; OBJ_DATA *katana; char buf[MAX_STRING_LENGTH]; int dmg; if (IS_NPC(ch)) return; katana = get_eq_char(ch, WEAR_WIELD); if ((victim = ch->fighting) == NULL) { send_to_char("You find no need for this now.\n\r",ch); return; } if (ch->mana < 2500) { send_to_char("You have not the 2500 mana to use this.\n\r",ch); return; } if ((katana == NULL) || (katana->pIndexData->vnum != 33176)) { send_to_char("Without a proper katana the energy will destroy your weapon.\n\r",ch); return; } ch->mana -= 2500; send_to_char("You channel mystical energy into your katana.\n\r",ch); do_say(ch,"#b#cL#CI#cG#CH#cT#CN#cI#CN#cG #nSWORD!"); send_to_char("A humongous bolt of lightning blasts from your katana.\n\r",ch); act("A humongous bolt of lightning blasts from $n's katana!", ch, NULL, NULL, TO_ROOM); if (number_range(0,100) < 16) { act("Your lightning blast flies past $N and is absorbed by the ground.", ch, NULL, victim, TO_CHAR); act("The lightning blast slams into the ground and is absorbed.", ch, NULL, NULL, TO_ROOM); return; } dmg = number_range(ch->wpn[1], ch->wpn[1] * 3); xprintf(buf,"Your lightning blast slams into $N's and crackles around $S body sending them sprawling. #R[#C#b %d #n#R]#n", dmg); act(buf, ch, NULL, victim, TO_CHAR); xprintf(buf,"$n's lightning blast slams into you and crackles around your body sending you sprawling. #R[#C#b %d #n#R]#n", dmg); act(buf, ch, NULL, victim, TO_VICT); act("$n's lightning blast slams into $N's and crackles around $S body sending $N sprawling.", ch, NULL, victim, TO_NOTVICT); hurt_person(ch, victim, dmg); WAIT_STATE(ch, (PULSE_VIOLENCE * 3)); if (victim->position > POS_STUNNED) victim->position = POS_STUNNED; return; }
/* * repair commands. */ CHAR_DATA *find_fixer( CHAR_DATA *ch ) { CHAR_DATA *keeper; REPAIR_DATA *rShop; rShop = NULL; for ( keeper = ch->in_room->first_person; keeper; keeper = keeper->next_in_room ) if ( IS_NPC(keeper) && (rShop = keeper->pIndexData->rShop) != NULL ) break; if ( !rShop ) { send_to_char( "You can't do that here.\n\r", ch ); return NULL; } /* * Shop hours. */ if ( time_info.hour < rShop->open_hour ) { do_say( keeper, "Sorry, come back later." ); return NULL; } if ( time_info.hour > rShop->close_hour ) { do_say( keeper, "Sorry, come back tomorrow." ); return NULL; } if ( !knows_language( keeper, ch->speaking, ch ) ) { do_say( keeper, "I can't understand you." ); return NULL; } return keeper; }
void do_enmity(CHAR_DATA *ch, char *argument) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; CHAR_DATA *victim1; CHAR_DATA *victim2; argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_TANARRI)) { send_to_char("Huh?\n\r",ch); return; } if (!IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_EMNITY)) { send_to_char("you don't have that power yet.\n\r",ch); return; } if ((victim1 = get_char_room(ch, NULL, arg1)) == NULL) { send_to_char("They are not here.\n\r", ch); return; } if ((victim2 = get_char_room(ch, NULL, arg2)) == NULL) { send_to_char("They are not here.\n\r", ch); return; } if (IS_NPC(victim1) || IS_NPC(victim2)) { send_to_char("Not on NPC's\n\r",ch); return; } do_say(ch,"Xenus, Morkain, Hau!"); if (number_percent() > 60) { SET_BIT(victim1->pcdata->tempflag, TEMP_AGGRESSIVE); do_kill(victim1, victim2->pcdata->switchname); REMOVE_BIT(victim1->pcdata->tempflag, TEMP_AGGRESSIVE); } else send_to_char("#RSomeone is trying to control your actions!!!#n\n\r",victim1); if (number_percent() > 60) { SET_BIT(victim2->pcdata->tempflag, TEMP_AGGRESSIVE); do_kill(victim2, victim1->pcdata->switchname); REMOVE_BIT(victim2->pcdata->tempflag, TEMP_AGGRESSIVE); } else send_to_char("#RSomeone is trying to control your actions!!!#n\n\r",victim2); WAIT_STATE(ch,24); return; }
void newbie_help( CHAR_DATA * ch, char * argument ) { NEWBIE_DATA * pNewbie; CHAR_DATA * helper; bool found = FALSE; char buf[ MAX_STRING_LENGTH ]; /* Check for newbie helper in the same room as ch */ for ( helper = ch->in_room->people; helper; helper = helper->next_in_room ) { if ( IS_NPC( helper ) && ( CHECK_BIT( helper->act, ACT_NEWBIE ) ) ) { break; } } if ( !helper ) { return; } for ( pNewbie = newbie_first; pNewbie; pNewbie = pNewbie->next ) { if ( argument[ 0 ] == pNewbie->keyword[ 0 ] && !str_cmp( argument, pNewbie->keyword ) ) { found = TRUE; break; } } /* if keyword not found, have 30% chance that helper says something -- don't want mob responding to every say not found as a keyword */ if ( !found ) { if ( chance( 30 ) ) { act( AT_WHITE, "$n tells you 'I'm not sure if I can help you. Try being more specific.'", helper, buf, ch, TO_VICT ); } } else if ( chance( 50 ) ) { do_say( helper, pNewbie->answer2 ); } else { do_say( helper, pNewbie->answer1 ); } return; }
static int say_full(struct ast_channel *chan, const char *string, const char *ints, const char *lang, const char *options, int audiofd, int ctrlfd) { say_args_t a = { chan, ints, lang, audiofd, ctrlfd }; if (!say_cfg) { ast_log(LOG_WARNING, "no say.conf, cannot spell '%s'\n", string); return -1; } return do_say(&a, string, options, 0); }
/* * repair commands. */ CHAR_DATA *find_fixer( CHAR_DATA * ch ) { CHAR_DATA *keeper = NULL; REPAIR_DATA *rShop = NULL; for( keeper = ch->in_room->first_person; keeper; keeper = keeper->next_in_room ) if( IS_NPC( keeper ) && ( rShop = keeper->pIndexData->rShop ) != NULL ) break; if( !rShop ) { send_to_char( "You can't do that here.\r\n", ch ); return NULL; } /* * Shop hours. */ if( time_info.hour < rShop->open_hour ) { char buf[MAX_STRING_LENGTH]; snprintf( buf, MAX_STRING_LENGTH, "%s", "Sorry, come back later." ); do_say( keeper, buf ); return NULL; } if( time_info.hour > rShop->close_hour ) { char buf[MAX_STRING_LENGTH]; snprintf( buf, MAX_STRING_LENGTH, "%s", "Sorry, come back tomorrow." ); do_say( keeper, buf ); return NULL; } return keeper; }
int is_open(struct char_data * keeper, int shop_nr, int msg) { char buf[200]; *buf = 0; if (SHOP_OPEN1(shop_nr) > time_info.hours) strcpy(buf, MSG_NOT_OPEN_YET); else if (SHOP_CLOSE1(shop_nr) < time_info.hours) { if (SHOP_OPEN2(shop_nr) > time_info.hours) strcpy(buf, MSG_NOT_REOPEN_YET); else if (SHOP_CLOSE2(shop_nr) < time_info.hours) strcpy(buf, MSG_CLOSED_FOR_DAY); } if (!(*buf)) return (TRUE); if (msg) do_say(keeper, buf, cmd_tell, 0); return (FALSE); }
char_data* find_keeper( char_data* ch ) { char_data* keeper = NULL; for( int i = 0; ; i++ ) { if( i >= *ch->array ) { if( is_set( &ch->in_room->room_flags, RFLAG_PET_SHOP ) || is_set( &ch->in_room->room_flags, RFLAG_SHOP ) ) { send( ch, "The shop keeper is not around right now.\r\n" ); return NULL; } send( ch, "You are not in a shop.\r\n" ); return NULL; } if( ( keeper = mob( ch->array->list[i] ) ) != NULL && keeper->pShop != NULL ) break; } if( !IS_AWAKE( keeper ) ) { send( ch, "The shopkeeper seems to be asleep.\r\n" ); return NULL; } if( !ch->Seen( keeper ) && ch->shdata->level < LEVEL_APPRENTICE ) { do_say( keeper, "I don't trade with folks I can't see." ); return NULL; } if( ch->species != NULL && !is_set( &ch->species->act_flags, ACT_HUMANOID ) ) { send( ch, "You can't carry anything so shopping is rather pointless.\r\n" ); return NULL; } return keeper; }
static int say_date_generic(struct ast_channel *chan, time_t t, const char *ints, const char *lang, const char *format, const char *timezone, const char *prefix) { char buf[128]; struct tm tm; say_args_t a = { chan, ints, lang, -1, -1 }; if (format == NULL) format = ""; ast_localtime(&t, &tm, NULL); snprintf(buf, sizeof(buf), "%s:%s:%04d%02d%02d%02d%02d.%02d-%d-%3d", prefix, format, tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_wday, tm.tm_yday); return do_say(&a, buf, NULL, 0); }
bool papuguj( CHAR_DATA *ch, char *argument ) { char buf[ 2 * MAX_INPUT_LENGTH ]; if ( !IS_AWAKE( ch ) ) return FALSE; buf[ 0 ] = '\0'; if ( argument ) { char *arg = last_word( argument ); if ( !arg || ( UPPER( *arg ) < 'A' || UPPER( *arg ) > 'Z' ) ) return FALSE; arg = przeciagaj( arg ); sprintf( buf, "%s! %s!", arg, arg ); } else { switch ( number_bits( 3 ) ) { case 0: case 1: case 2: strcat( buf, "Rrrrwa ma`c!" ); break; case 3: case 4: strcat( buf, "Daaaj orzeszka! Daaaj orzeszka!" ); break; case 5: strcat( buf, "Brrrawo! Brrawo!" ); break; case 6: strcat( buf, "Rrrratunku! Ucieka`c!" ); break; default:strcat( buf, "Grrrrratuluj`e!" ); } } do_say( ch, buf ); return TRUE; }
/*! \brief * the string is 'prefix:data' or prefix:fmt:data' * with ':' being invalid in strings. */ static int do_say(say_args_t *a, const char *s, const char *options, int depth) { struct ast_variable *v; char *lang, *x, *rule = NULL; int ret = 0; struct varshead head = { .first = NULL, .last = NULL }; struct ast_var_t *n; ast_debug(2, "string <%s> depth <%d>\n", s, depth); if (depth++ > 10) { ast_log(LOG_WARNING, "recursion too deep, exiting\n"); return -1; } else if (!say_cfg) { ast_log(LOG_WARNING, "no say.conf, cannot spell '%s'\n", s); return -1; } /* scan languages same as in file.c */ if (a->language == NULL) a->language = "en"; /* default */ ast_debug(2, "try <%s> in <%s>\n", s, a->language); lang = ast_strdupa(a->language); for (;;) { for (v = ast_variable_browse(say_cfg, lang); v ; v = v->next) { if (ast_extension_match(v->name, s)) { rule = ast_strdupa(v->value); break; } } if (rule) break; if ( (x = strchr(lang, '_')) ) *x = '\0'; /* try without suffix */ else if (strcmp(lang, "en")) lang = "en"; /* last resort, try 'en' if not done yet */ else break; } if (!rule) return 0; /* skip up to two prefixes to get the value */ if ( (x = strchr(s, ':')) ) s = x + 1; if ( (x = strchr(s, ':')) ) s = x + 1; ast_debug(2, "value is <%s>\n", s); n = ast_var_assign("SAY", s); if (!n) { ast_log(LOG_ERROR, "Memory allocation error in do_say\n"); return -1; } AST_LIST_INSERT_HEAD(&head, n, entries); /* scan the body, one piece at a time */ while ( !ret && (x = strsep(&rule, ",")) ) { /* exit on key */ char fn[128]; const char *p, *fmt, *data; /* format and data pointers */ /* prepare a decent file name */ x = ast_skip_blanks(x); ast_trim_blanks(x); /* replace variables */ pbx_substitute_variables_varshead(&head, x, fn, sizeof(fn)); ast_debug(2, "doing [%s]\n", fn); /* locate prefix and data, if any */ fmt = strchr(fn, ':'); if (!fmt || fmt == fn) { /* regular filename */ ret = s_streamwait3(a, fn); continue; } fmt++; data = strchr(fmt, ':'); /* colon before data */ if (!data || data == fmt) { /* simple prefix-fmt */ ret = do_say(a, fn, options, depth); continue; } /* prefix:fmt:data */ for (p = fmt; p < data && ret <= 0; p++) { char fn2[sizeof(fn)]; if (*p == ' ' || *p == '\t') /* skip blanks */ continue; if (*p == '\'') {/* file name - we trim them */ char *y; strcpy(fn2, ast_skip_blanks(p+1)); /* make a full copy */ y = strchr(fn2, '\''); if (!y) { p = data; /* invalid. prepare to end */ break; } *y = '\0'; ast_trim_blanks(fn2); p = strchr(p+1, '\''); ret = s_streamwait3(a, fn2); } else { int l = fmt-fn; strcpy(fn2, fn); /* copy everything */ /* after prefix, append the format */ fn2[l++] = *p; strcpy(fn2 + l, data); ret = do_say(a, fn2, options, depth); } if (ret) { break; } } } ast_var_delete(n); return ret; }
void do_guild (CHAR_DATA * ch, char *argy) { int i; CHAR_DATA *mob; char buf[STD_LENGTH]; char arg1[SML_LENGTH]; DEFINE_COMMAND ("guild", do_guild, POSITION_STANDING, 0, LOG_NORMAL, "This command allows you to perform guild options at a guild house.") if (IS_MOB (ch)) return; argy = one_argy(argy, arg1); if (!str_cmp (arg1, "info") || !str_cmp(arg1, "cost") || !str_cmp(arg1, "costs")) { show_guild_costs(ch, ""); return; } for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room) { if (IS_MOB (mob) && ( IS_SET (mob->pIndexData->act3, ACT3_TINKER) || IS_SET (mob->pIndexData->act3, ACT3_WARRIOR) || IS_SET (mob->pIndexData->act3, ACT3_HEALER) || IS_SET (mob->pIndexData->act3, ACT3_WIZARD) || IS_SET (mob->pIndexData->act3, ACT3_THIEFG) || IS_SET (mob->pIndexData->act3, ACT3_RANGER) || IS_SET (mob->pIndexData->act3, ACT3_ROGUE) || IS_SET (mob->pIndexData->act3, ACT3_MYSTIC) || IS_SET (mob->pIndexData->act3, ACT3_CONJURER) || IS_SET (mob->pIndexData->act3, ACT3_BATTLEMASTER) || IS_SET (mob->pIndexData->act3, ACT3_NECROMANCER) || IS_SET (mob->pIndexData->act3, ACT3_MONK) ) ) break; } if (mob == NULL) { send_to_char ("There is no guildmaster present here!\n\r", ch); return; } if (arg1[0] == '\0') { send_to_char ("\n\rOptions:\n\r---> Guild leave\n\r---> Guild info\n\r---> Guild join\n\r---> Guild status\n\r", ch); return; } /*end of GUILD INFO */ if (!str_cmp (arg1, "status")) { if (!IS_SET (ch->pcdata->guilds, (mob->pIndexData->act3))) { send_to_char ("You are not a member of our guild!\n\r", ch); return; } send_to_char ("You are an highly respected member of the guild.\n\r", ch); return; } /*end of GUILD STATUS */ if (!str_cmp (arg1, "leave")) { if (!is_member (ch, (mob->pIndexData->act3))) { send_to_char ("You aren't even a member!!\n\r", ch); return; } for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++) { if (IS_SET(mob->pIndexData->act3, guild_data[i].mob_guildmaster_bit)) { ch->pcdata->stat[guild_data[i].stat_modified]--; REMOVE_BIT(ch->pcdata->guilds, guild_data[i].player_guild_bit); send_to_char("You are no longer a member of the guild.", ch); player_preset(ch, "Zlughlkheyn"); do_remove(ch, "all"); break; } } } /*end of GUILD LEAVE */ if (!str_cmp(arg1, "replace")) { char arg2[STD_LENGTH]; char arg3[STD_LENGTH]; int oldnum = -1; int newnum = -1; argy = one_argy(argy, arg2); argy = one_argy(argy, arg3); if (arg2[0] == '\0' || arg3[0] == '\0') { send_to_char("Syntax: Guild Replace <old_guild> <new_guild>\n\r", ch); return; } for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++) { if (!str_cmp(guild_data[i].what_you_type, arg2)) { oldnum = guild_data[i].mob_guildmaster_bit; break; } } for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++) { if (!str_cmp(guild_data[i].what_you_type, arg3)) { newnum = guild_data[i].mob_guildmaster_bit; break; } } if (oldnum == -1 || newnum == -1) { send_to_char("You need to check those names again. I don't know which guilds you are talking about.\n\r", ch); return; } if (!IS_SET(ch->pcdata->guilds, oldnum)) { send_to_char("You don't have that guild so how do you expect to replace it?\n\r", ch); return; } if (newnum == oldnum) { send_to_char("You are not changing anything!! Get a clue.\n\r", ch); return; } if (!IS_SET(mob->pIndexData->act3, newnum)) { send_to_char("This guildmaster cannot add you. You must find the proper guildmaster for the guild you wish to join.\n\r", ch); return; } if (is_member(ch, newnum)) { send_to_char("You are already a member of that guild!\n\r", ch); return; } if (ch->pcdata->bank < 60000) { send_to_char("You need 60000 coins in the bank for this to be done.\n\r", ch); return; } if(ch->pcdata->warpoints < 100) { send_to_char("You need 100 warpoints for this to be done.\n\r", ch); return; } ch->pcdata->bank -= 60000; ch->pcdata->warpoints -= 100; for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++) { if (IS_SET(oldnum, guild_data[i].mob_guildmaster_bit)) { ch->pcdata->stat[guild_data[i].stat_modified]--; REMOVE_BIT(ch->pcdata->guilds, guild_data[i].player_guild_bit); break; } } for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++) { if (IS_SET(newnum, guild_data[i].mob_guildmaster_bit)) { ch->pcdata->stat[guild_data[i].stat_modified]++; SET_BIT(ch->pcdata->guilds, guild_data[i].player_guild_bit); break; } } sprintf(buf, "Congratulations! You are now a member of the %s!\n\r", guild_data[i].what_you_see); send_to_char(buf, ch); sprintf (buf, "Welcome to our guild, %s!", NAME (ch)); do_say (mob, buf); player_preset(ch, "Zlughlkheyn"); fix_char(ch); send_to_char("Ok, the guilds have been switched.\n\r", ch); return; } if (!str_cmp (arg1, "join")) { int num = get_num_guilds(ch); int remorts = pow.guild_info[num][0]; int lvl = pow.guild_info[num][1]; int cst = (pow.guild_info[num][2] * 100); int wps = pow.guild_info[num][3]; int kps = pow.guild_info[num][4]; bool can_join = TRUE; if (IS_SET (ch->pcdata->guilds, mob->pIndexData->act3 )) { send_to_char ("You are already a member of our guild!\n\r", ch); return; } if (ch->pcdata->remort_times < remorts) { sprintf (buf, "You need to have at least %d remorts to join this guild!\n\r", remorts); send_to_char (buf, ch); can_join = FALSE; } // Commented out because i replaced it with the code below. /* if (LEVEL (ch) < lvl) { sprintf (buf, "You need to be level %d to join the guild!\n\r", lvl); send_to_char (buf, ch); can_join = FALSE; }*/ //Added so if the player has a remort that they can join even if they don't meet the level req. //Sabelis 1-18-2006 if ((LEVEL (ch) >lvl) || (ch->pcdata->remort_times>0)) { can_join = TRUE; } else if (LEVEL (ch) < lvl) { sprintf (buf, "You need to be level %d to join the guild!\n\r", lvl); send_to_char (buf, ch); can_join = FALSE; } if (tally_coins (ch) < cst) { sprintf (buf, "We need a payment of %d coins before we can let you join.\n\r", cst); send_to_char (buf, ch); can_join = FALSE; } if (ch->pcdata->warpoints < wps) { sprintf (buf, "You need to have at least %d warpoints to join this guild!\n\r", wps); send_to_char (buf, ch); can_join = FALSE; } if (ch->pcdata->killpoints < kps) { sprintf (buf, "You need to have at least %d killpoints to join this guild!\n\r", kps); send_to_char (buf, ch); can_join = FALSE; } if (!can_join) return; ch->pcdata->warpoints -= wps; ch->pcdata->killpoints -= kps; sub_coins (cst, ch); for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++) { if (IS_SET(mob->pIndexData->act3, guild_data[i].mob_guildmaster_bit)) { ch->pcdata->stat[guild_data[i].stat_modified]++; SET_BIT(ch->pcdata->guilds, guild_data[i].player_guild_bit); break; } } sprintf(buf, "Congratulations! You are now a member of the %s!\n\r", guild_data[i].what_you_see); send_to_char(buf, ch); sprintf (buf, "Welcome to our guild, %s!", NAME (ch)); do_say (mob, buf); } return; }
void do_dragonx (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_SKYBLADE)) { stc("Huh?\n\r",ch); return; } if (ch->pcdata->powers[SKYBLADE_SKILLS] < 8) { send_to_char("You haven't mastered that skill yet.\n\r",ch); return; } if (ch->pcdata->powers[SKYBLADE_DTIMER] != 10) { send_to_char("Your dragon power has not fully charged.\n\r",ch); return; } if (( victim = get_char_room(ch, NULL, arg1)) == NULL) { if (( victim = ch->fighting) == NULL) { send_to_char("Use the power of the dragon on whom?\n\r",ch); return; } else victim = ch->fighting; } if (is_safe(ch, victim)) { send_to_char("They are safe from such a hostile action.\n\r",ch); return; } if (ch->mana < 10000) { send_to_char("You do not have the 10000 mana required to call on the dragon.\n\r",ch); return; } dam = victim->hit/3; if (IS_NPC(victim)) dam = victim->hit * .9; if (ch->pcdata->powers[SKYBLADE_MAGIC] >= 5) dam *= 1.5; if (IS_NPC(victim)) { if (dam > 15000) dam = 5000 + (number_range(1,5) * number_range(1,7)); } else { if (dam > 6000) dam = 6000 + (number_range(1,5) * number_range(1,7)); } do_say(ch, "#LMighty dragon give me your POWER!!!!!!#n"); act("#C$n #Lleaps high into the air.......#n\n\r",ch,NULL,victim,TO_ROOM); stc("#LYou leap high into the air!#n\n\r",ch); act("#0The #ylightning crackles#0 as a large dragon is seen in the horizon.#n\n\r",ch,NULL,victim,TO_ROOM); WAIT_STATE(ch, 6); WAIT_STATE(victim, 6); stc("#LYou charge down upon your victim riding a huge dragon!#n\n\r",ch); act("#C$n #0charges down upon you, riding a huge dragon!#n\n\r",ch,NULL,victim,TO_VICT); act("#C$n #0charges down upon $N, riding a huge dragon!#n\n\r",ch,NULL,victim,TO_NOTVICT); ch->mana -= 10000; ch->pcdata->powers[SKYBLADE_DTIMER] = 0; WAIT_STATE(ch, 12); WAIT_STATE(victim, 12); xprintf(buf, "#LYou return to the ground and your dragon fades away.#W[%d]\n\r",dam); stc(buf,ch); xprintf(buf, "#L%s returns to the ground and the dragon fades away.#W[%d]\n\r",ch->name,dam); stc(buf, victim); hurt_person(ch, victim, dam); WAIT_STATE(ch, 8); if (ch->fighting == NULL) ch->fighting = victim; return; }
void hunt_victim( CHAR_DATA * ch ) { bool found; CHAR_DATA *tmp; EXIT_DATA *pexit; short ret; if( !ch || !ch->hunting || ch->position < 5 ) return; /* * make sure the char still exists */ for( found = FALSE, tmp = first_char; tmp && !found; tmp = tmp->next ) if( ch->hunting->who == tmp ) found = TRUE; if( !found ) { do_say( ch, "Damn! My prey is gone!!" ); stop_hunting( ch ); return; } if( ch->in_room == ch->hunting->who->in_room ) { if( ch->fighting ) return; found_prey( ch, ch->hunting->who ); return; } ret = find_first_step( ch->in_room, ch->hunting->who->in_room, 500 + ch->level * 25 ); if( ret < 0 ) { do_say( ch, "Damn! Lost my prey!" ); stop_hunting( ch ); return; } else { if( ( pexit = get_exit( ch->in_room, ret ) ) == NULL ) { bug( "%s", "Hunt_victim: lost exit?" ); return; } move_char( ch, pexit, FALSE ); /* * Crash bug fix by Shaddai */ if( char_died( ch ) ) return; if( !ch->hunting ) { if( !ch->in_room ) { bug( "Hunt_victim: no ch->in_room! Mob #%d, name: %s. Placing mob in limbo.", ch->pIndexData->vnum, ch->name ); char_to_room( ch, get_room_index( ROOM_VNUM_LIMBO ) ); return; } do_say( ch, "Damn! Lost my prey!" ); return; } if( ch->in_room == ch->hunting->who->in_room ) found_prey( ch, ch->hunting->who ); else { CHAR_DATA *vch; /* * perform a ranged attack if possible */ /* * Changed who to name as scan_for_victim expects the name and * * Not the char struct. --Shaddai */ if( ( vch = scan_for_victim( ch, pexit, ch->hunting->name ) ) != NULL ) { if( !mob_fire( ch, ch->hunting->who->name ) ) { /* * ranged spell attacks go here */ } } } return; } }
void found_prey( CHAR_DATA * ch, CHAR_DATA * victim ) { char buf[MAX_STRING_LENGTH]; char victname[MAX_STRING_LENGTH]; if( victim == NULL ) { bug( "%s", "Found_prey: null victim" ); return; } if( victim->in_room == NULL ) { bug( "%s", "Found_prey: null victim->in_room" ); return; } mudstrlcpy( victname, IS_NPC( victim ) ? victim->short_descr : victim->name, MAX_STRING_LENGTH ); if( !can_see( ch, victim ) ) { if( number_percent( ) < 90 ) return; switch ( number_bits( 2 ) ) { case 0: snprintf( buf, MAX_STRING_LENGTH, "Don't make me find you, %s!", victname ); do_say( ch, buf ); break; case 1: act( AT_ACTION, "$n sniffs around the room for $N.", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You sniff around the room for $N.", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n sniffs around the room for you.", ch, NULL, victim, TO_VICT ); do_say( ch, "I can smell your blood!" ); break; case 2: snprintf( buf, MAX_STRING_LENGTH, "I'm going to tear %s apart!", victname ); do_yell( ch, buf ); break; case 3: do_say( ch, "Just wait until I find you..." ); break; } return; } if( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) ) { if( number_percent( ) < 90 ) return; switch ( number_bits( 2 ) ) { case 0: do_say( ch, "C'mon out, you coward!" ); snprintf( buf, MAX_STRING_LENGTH, "%s is a bloody coward!", victname ); do_yell( ch, buf ); break; case 1: snprintf( buf, MAX_STRING_LENGTH, "Let's take this outside, %s", victname ); do_say( ch, buf ); break; case 2: snprintf( buf, MAX_STRING_LENGTH, "%s is a yellow-bellied wimp!", victname ); do_yell( ch, buf ); break; case 3: act( AT_ACTION, "$n takes a few swipes at $N.", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You try to take a few swipes $N.", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n takes a few swipes at you.", ch, NULL, victim, TO_VICT ); break; } return; } switch ( number_bits( 2 ) ) { case 0: snprintf( buf, MAX_STRING_LENGTH, "Your blood is mine, %s!", victname ); do_yell( ch, buf ); break; case 1: snprintf( buf, MAX_STRING_LENGTH, "Alas, we meet again, %s!", victname ); do_say( ch, buf ); break; case 2: snprintf( buf, MAX_STRING_LENGTH, "What do you want on your tombstone, %s?", victname ); do_say( ch, buf ); break; case 3: act( AT_ACTION, "$n lunges at $N from out of nowhere!", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You lunge at $N catching $M off guard!", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n lunges at you from out of nowhere!", ch, NULL, victim, TO_VICT ); } stop_hunting( ch ); set_fighting( ch, victim ); multi_hit( ch, victim, TYPE_UNDEFINED ); return; }
// New do_gain version by SinaC 2001 void do_gain( CHAR_DATA *ch, const char *argument ) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; CHAR_DATA *trainer; int gn = 0, sn = 0; int col; bool found; if (IS_NPC(ch)) return; //log_stringf("%s ==> %d",NAME(ch),class_max_casting_rule( ch )); // find a trainer for ( trainer = ch->in_room->people; trainer != NULL; trainer = trainer->next_in_room) if (IS_NPC(trainer) && IS_SET(trainer->act,ACT_GAIN)) break; if (trainer == NULL || !can_see(ch,trainer)) { send_to_char("You can't do that here.\n\r",ch); return; } one_argument(argument,arg); if (arg[0] == '\0') { do_say(trainer,"Pardon me?"); return; } if (!str_prefix(arg,"list")) { send_to_char("This command has been modified.(check help about gain)\n\r" "Use gain skills\n\r" " gain spells\n\r" " gain powers\n\r" " gain songs\n\r" " gain groups instead.\n\r", ch ); return; } if (!str_prefix(arg,"groups")){ col = 0; sprintf(buf, "{W%-20s %-2s %-20s %-2s %-20s %-2s{x\n\r" "----------------------- ----------------------- -----------------------\n\r", "group","tp","group","tp","group","tp"); send_to_char(buf,ch); found = FALSE; for (gn = 0; gn < MAX_GROUP; gn++) { if (!ch->pcdata->group_known[gn] && class_grouprating(ch->bstat(classes),gn) > 0 // Added by SinaC 2003 && god_grouprating(ch,gn) > 0 ) { found = TRUE; sprintf(buf,"{y%-20s {c%-2d{x ", group_table[gn].name,class_grouprating(ch->bstat(classes),gn)); send_to_char(buf,ch); if (++col % 3 == 0) send_to_char("\n\r",ch); } } if (col % 3 != 0) send_to_char("\n\r",ch); if (!found) send_to_char("You can't learn any groups.\n\r",ch); return; } if (!str_prefix(arg,"skills")){ col = 0; sprintf(buf, "{W%-20s %-2s %-3s %-20s %-2s %-3s{x\n\r" "--------------------------- ---------------------------\n\r", "skill","tp","lvl","skill","tp","lvl"); send_to_char(buf,ch); found = FALSE; for (sn = 0; sn < MAX_ABILITY; sn++) { if (ability_table[sn].name == NULL) break; /* Modified by SinaC 2001 // Modified by SinaC 2000 if ( ( !ch->pcdata->ability_info[sn].learned || check_prereq(ch,sn) ) && class_abilityrating(ch,sn) > 0 && ability_table[sn].spell_fun == spell_null) */ if ( can_gain( ch, sn ) == ERR_OK // Modified by SinaC 2001 //&& ability_table[sn].spell_fun == spell_null ) { && ability_table[sn].type == TYPE_SKILL ) { found = TRUE; if ( ability_table[sn].nb_casting_level > 0 ) sprintf(buf,"{y%-20s {c%-2d {g%3d{x ", ability_table[sn].name, // Modified by SinaC 2003 class_abilityrating(ch,sn,ch->pcdata->ability_info[sn].casting_level+1), ch->pcdata->ability_info[sn].casting_level+1); else sprintf(buf,"{y%-20s {c%-2d{x ", ability_table[sn].name, // Modified by SinaC 2003 class_abilityrating(ch,sn, 1) ); send_to_char(buf,ch); if (++col % 2 == 0) send_to_char("\n\r",ch); } } if (col % 2 != 0) send_to_char("\n\r",ch); if (!found) send_to_char("You can't learn any skills.\n\r",ch); return; } // Added by SinaC 2000 if (!str_prefix(arg,"spells")){ col = 0; sprintf(buf, "{W%-20s %-2s %-3s %-20s %-2s %-3s{x\n\r" "--------------------------- ---------------------------\n\r", "spell","tp","lvl","spell","tp","lvl"); send_to_char(buf,ch); found = FALSE; for (sn = 0; sn < MAX_ABILITY; sn++) { if (ability_table[sn].name == NULL) break; /* Modified by SinaC 2001 // Modified by SinaC 2000 if ( ( !ch->pcdata->ability_info[sn].learned || check_prereq(ch,sn) ) && class_abilityrating(ch,sn) > 0 && ability_table[sn].spell_fun != spell_null) */ if ( can_gain( ch, sn ) == ERR_OK //&& ability_table[sn].spell_fun != spell_null // Modified by SinaC 2001 for mental user && ability_table[sn].type == TYPE_SPELL ) { found = TRUE; if ( ability_table[sn].nb_casting_level > 0 ) sprintf(buf,"{y%-20s {c%-2d {g%3d{x ", ability_table[sn].name, // Modified by SinaC 2003 class_abilityrating(ch,sn,ch->pcdata->ability_info[sn].casting_level+1), ch->pcdata->ability_info[sn].casting_level+1); else sprintf(buf,"{y%-20s {c%-2d{x ", ability_table[sn].name, // Modified by SinaC 2003 class_abilityrating(ch,sn,1) ); send_to_char(buf,ch); if (++col % 2 == 0) send_to_char("\n\r",ch); } } if (col % 2 != 0) send_to_char("\n\r",ch); if (!found) send_to_char("You can't learn any spells.\n\r",ch); return; } // Added by SinaC 2000 if (!str_prefix(arg,"powers")){ col = 0; sprintf(buf, "{W%-20s %-2s %-3s %-20s %-2s %-3s{x\n\r" "--------------------------- ---------------------------\n\r", "power","tp","lvl","power","tp","lvl"); send_to_char(buf,ch); found = FALSE; for (sn = 0; sn < MAX_ABILITY; sn++) { if (ability_table[sn].name == NULL) break; /* Modified by SinaC 2001 // Modified by SinaC 2000 if ( ( !ch->pcdata->ability_info[sn].learned || check_prereq(ch,sn) ) && class_abilityrating(ch,sn) > 0 && ability_table[sn].spell_fun != spell_null) */ if ( can_gain( ch, sn ) == ERR_OK //&& ability_table[sn].spell_fun != spell_null // Modified by SinaC 2001 for mental user && ability_table[sn].type == TYPE_POWER ) { found = TRUE; if ( ability_table[sn].nb_casting_level > 0 ) sprintf(buf,"{y%-20s {c%-2d {g%3d{x ", ability_table[sn].name, // Modified by SinaC 2003 class_abilityrating(ch,sn,ch->pcdata->ability_info[sn].casting_level+1), ch->pcdata->ability_info[sn].casting_level+1); else sprintf(buf,"{y%-20s {c%-2d{x ", ability_table[sn].name, // Modified by SinaC 2003 class_abilityrating(ch,sn,1) ); send_to_char(buf,ch); if (++col % 2 == 0) send_to_char("\n\r",ch); } } if (col % 2 != 0) send_to_char("\n\r",ch); if (!found) send_to_char("You can't learn any powers.\n\r",ch); return; } // Added by SinaC 2003 for bard (songs) if (!str_prefix(arg,"songs")){ col = 0; sprintf(buf, "{W%-20s %-2s %-3s %-20s %-2s %-3s{x\n\r" "--------------------------- ---------------------------\n\r", "song","tp","lvl","song","tp","lvl"); send_to_char(buf,ch); found = FALSE; for (sn = 0; sn < MAX_ABILITY; sn++) { if (ability_table[sn].name == NULL) break; if ( can_gain( ch, sn ) == ERR_OK && ability_table[sn].type == TYPE_SONG ) { found = TRUE; if ( ability_table[sn].nb_casting_level > 0 ) sprintf(buf,"{y%-20s {c%-2d {g%3d{x ", ability_table[sn].name, class_abilityrating(ch,sn,ch->pcdata->ability_info[sn].casting_level+1), ch->pcdata->ability_info[sn].casting_level+1); else sprintf(buf,"{y%-20s {c%-2d{x ", ability_table[sn].name, class_abilityrating(ch,sn,1) ); send_to_char(buf,ch); if (++col % 2 == 0) send_to_char("\n\r",ch); } } if (col % 2 != 0) send_to_char("\n\r",ch); if (!found) send_to_char("You can't learn any songs.\n\r",ch); return; } if (!str_prefix(arg,"convert")) { if (ch->practice < 10) { act("$N tells you 'You are not yet ready.'", ch,NULL,trainer,TO_CHAR); return; } act("$N helps you apply your practice to training.", ch,NULL,trainer,TO_CHAR); ch->practice -= 10; ch->train +=1 ; return; } // Added by SinaC 2000 if (!str_prefix(arg,"revert")) { if (ch->train < 1 ) { act("$N tells you 'You are not yet ready.'", ch,NULL,trainer,TO_CHAR); return; } act("$N helps you apply your train to practicing.", ch,NULL,trainer,TO_CHAR); ch->practice += 10; ch->train -=1 ; return; } if (!str_prefix(arg,"points")) { // //send_to_char("This option has been removed for the moment!\n\r",ch); // return; // if (ch->train < 2) { act("$N tells you 'You are not yet ready.'", ch,NULL,trainer,TO_CHAR); return; } if (ch->pcdata->points <= 40) { act("$N tells you 'There would be no point in that.'", ch,NULL,trainer,TO_CHAR); return; } act("$N trains you, and you feel more at ease with your skills.", ch,NULL,trainer,TO_CHAR); ch->train -= 2; ch->pcdata->points -= 1; // modified by SinaC 2000, Modified again by SinaC 2000 // xp = ch->exp - (ch-level * exp_per_level(ch,ch->pcdata->points); // ^^^ before the points are changed.. // and after the new ch->exp is calculated.. add this // ch->exp += xp; ch->exp = exp_per_level(ch,ch->pcdata->points) * ch->level; // //int xp; // //xp = ch->exp - (ch->level*exp_per_level(ch,ch->pcdata->points)); //ch->exp += xp; // return; } // else add a group/skill gn = group_lookup(argument); if (gn > 0) { if (ch->pcdata->group_known[gn]) { act("$N tells you 'You already know that group!'", ch,NULL,trainer,TO_CHAR); return; } if (class_grouprating( ch->bstat(classes), gn) <= 0) { act("$N tells you 'That group is beyond your powers.'", ch,NULL,trainer,TO_CHAR); return; } // Added by SinaC 2003 if ( god_grouprating(ch,gn) <= 0 ) { act("$N tells you 'That group can only be learned by follower of a certain god.'", ch, NULL, trainer, TO_CHAR ); return; } if (ch->train < class_grouprating(ch->bstat(classes),gn) ) { act("$N tells you 'You are not yet ready for that group.'", ch,NULL,trainer,TO_CHAR); return; } // add the group gn_add(ch,gn); act("$N trains you in the art of '$t'", ch,group_table[gn].name,trainer,TO_CHAR); ch->train -= class_grouprating(ch->bstat(classes),gn); return; } sn = ability_lookup(argument); if (sn > -1) { // Modified by SinaC 2000, spells can be gained without learning the full group //if (ability_table[sn].spell_fun != spell_null) // { // act("$N tells you 'You must learn the full group.'", // ch,NULL,trainer,TO_CHAR); // return; // } // char sname[MAX_INPUT_LENGTH]; char sname_level_current[MAX_INPUT_LENGTH]; char sname_level_next[MAX_INPUT_LENGTH]; sprintf( sname, "'%s'", ability_table[sn].name ); if ( ch->pcdata->ability_info[sn].casting_level == 0 ) { sprintf( sname_level_current, "'%s'", ability_table[sn].name ); sprintf( sname_level_next, "'%s'", ability_table[sn].name ); } else { sprintf( sname_level_current, "'%s (level %d)'", ability_table[sn].name, ch->pcdata->ability_info[sn].casting_level); sprintf( sname_level_next, "'%s (level %d)'", ability_table[sn].name, ch->pcdata->ability_info[sn].casting_level+1); } int can_gain_code = can_gain( ch, sn ); if ( can_gain_code != ERR_OK ) { switch( can_gain_code ) { // Added by SinaC 2003 case ERR_STUDIED_SPELL: sprintf( buf, "$N tells you 'You can't get a higher level in %s'", sname ); act( buf, ch, NULL, trainer, TO_CHAR ); break; case ERR_LEVEL_TOO_LOW: sprintf( buf, "$N tells you 'You aren't level high enough to learn %s.'", sname ); act( buf, ch, NULL, trainer, TO_CHAR ); break; case ERR_GOD_CLAN_RACE: sprintf( buf, "$N tells you '%s is already a special ability for you.'", sname ); act( buf, ch, NULL, trainer, TO_CHAR ); break; case ERR_NOT_FIT_PREREQ: sprintf( buf, "$N tells you 'You don't fit prereqs to learn %s.'", sname_level_next ); act( buf, ch, NULL, trainer, TO_CHAR ); break; case ERR_CANT_LEARN: sprintf( buf, "$N tells you 'You can't learn %s.'", sname ); act( buf, ch, NULL, trainer, TO_CHAR ); break; case ERR_SPELL_NO_LEVEL: sprintf( buf, "$N tells you 'You already known %s.'", sname ); act( buf, ch, NULL, trainer, TO_CHAR ); break; case ERR_ALREADY_MASTER: sprintf( buf, "$N tells you 'You already are a master of %s.'", sname_level_current ); act( buf, ch, NULL, trainer, TO_CHAR ); break; case ERR_ALREADY_MAX_LEVEL: sprintf( buf, "$N tells you 'You can't learn that many high level skills/spells." ); act( buf, ch, NULL, trainer, TO_CHAR ); break; case ERR_NOT_ENOUGH_PERC: sprintf( buf, "$N tells you 'You haven't practiced enough %s.", sname_level_current ); act( buf, ch, NULL, trainer, TO_CHAR ); break; default: act( "DO_GAIN BUG: Warn an immortal", ch, NULL, trainer, TO_CHAR ); break; } return; } // Modified by SinaC 2003 if ( ch->train < class_abilityrating( ch, sn, ch->pcdata->ability_info[sn].casting_level+1 ) ) { if ( ability_table[sn].nb_casting_level <= 1 ) sprintf( buf, "$N tells you 'You don't have enough train sessions to gain %s.", sname ); else sprintf( buf, "$N tells you 'You don't have enough train sessions to gain %s.", sname_level_next ); act( buf, ch, NULL, trainer, TO_CHAR ); return; } // Modified by SinaC 2003 // add the skill ch->train -= class_abilityrating(ch,sn,ch->pcdata->ability_info[sn].casting_level+1); ch->pcdata->ability_info[sn].learned = 1; if ( ability_table[sn].nb_casting_level != 0 ) ch->pcdata->ability_info[sn].casting_level++; if ( ability_table[sn].nb_casting_level <= 1 ) act("$N trains you in the art of $t", ch,sname,trainer,TO_CHAR); else act("$N trains you in the art of $t", ch,sname_level_next,trainer,TO_CHAR); return; } act("$N tells you 'I do not understand...'",ch,NULL,trainer,TO_CHAR); }