/* use for processing a skill or group for addition */ void group_add( CHAR_DATA *ch, const char *name, bool deduct) { int sn,gn; if (IS_NPC(ch)) /* NPCs do not have skills */ return; sn = skill_lookup(name); if (sn != -1 && sn != gsn_gladiator_skill && sn != gsn_duelist_skill && sn != gsn_barbarian_skill && sn != gsn_dragoon_skill && sn != gsn_skirmisher_skill && sn != gsn_tactician_skill) { if (ch->pcdata->learned[sn] == 0) { ch->pcdata->learned[sn] = 1; } return; } /* now check groups */ gn = group_lookup(name); if (gn != -1) { if (ch->pcdata->group_known[gn] == FALSE) { ch->pcdata->group_known[gn] = TRUE; } gn_add(ch,gn); /* make sure all skills in the group are known */ } }
/* use for processing a skill or group for addition */ void group_add( CHAR_DATA *ch, const char *name, bool deduct) { int sn = skill_lookup(name); int gn = group_lookup(name); if (IS_NPC(ch)) /* NPCs do not have skills */ return; if (sn != -1) { if (ch->pcdata->learned[sn] == 0) /* i.e. not known */ { ch->pcdata->learned[sn] = 1; if (deduct) ch->pcdata->points += skill_table[sn].rating[ch->iclass]; } return; } /* now check groups */ if (gn != -1) { if (ch->pcdata->group_known[gn] == FALSE) { ch->pcdata->group_known[gn] = TRUE; if (deduct) ch->pcdata->points += group_table[gn].rating[ch->iclass]; } gn_add(ch,gn); /* make sure all skills in the group are known */ } }
// 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); }
/* this procedure handles the input parsing for the skill generator */ bool parse_gen_groups(CHAR_DATA *ch,const char *argument) { char arg[MAX_INPUT_LENGTH]; char buf[100]; int gn,sn,i; if (argument[0] == '\0') return FALSE; argument = one_argument(argument,arg); if (!str_prefix(arg,"help")) { if (argument[0] == '\0') { do_help(ch,"group help"); return TRUE; } do_help(ch,argument); return TRUE; } // Removed by SinaC 2001, replaced with help /* // Added by Sinac 1997 if (!str_prefix(arg,"level")) { do_level(ch,argument); return TRUE; } */ // Added by SinaC 2001, so spells can be gained one by one not only by group if (!str_prefix(arg,"spell")) { list_spell_costs(ch); return TRUE; } // Added by SinaC 2001, so powers can be gained one by one not only by group if (!str_prefix(arg,"power")) { list_power_costs(ch); return TRUE; } // Added by SinaC 2003 if (!str_prefix(arg,"song")) { list_song_costs(ch); return TRUE; } if (!str_prefix(arg,"add")) { if (argument[0] == '\0') { send_to_char("You must provide a skill/spell or group name.\n\r",ch); return TRUE; } gn = group_lookup(argument); if (gn != -1) { if (ch->gen_data->group_chosen[gn] || ch->pcdata->group_known[gn]) { send_to_char("You already know that group!\n\r",ch); return TRUE; } if (class_grouprating( ch->bstat(classes), gn ) <= 0 || god_grouprating( ch, gn ) <= 0 ) { send_to_char("That group is not available.\n\r",ch); return TRUE; } sprintf(buf,"{W%s group added.{x\n\r",group_table[gn].name); send_to_char(buf,ch); ch->gen_data->group_chosen[gn] = TRUE; ch->gen_data->points_chosen += class_grouprating( ch->bstat(classes), gn ); gn_add(ch,gn); ch->pcdata->points += class_grouprating( ch->bstat(classes), gn ); return TRUE; } sn = ability_lookup(argument); if (sn != -1) { // Modified by SinaC 2001 for god skill if (ch->gen_data->ability_chosen[sn] || get_raceability( ch, sn ) || get_clanability( ch, sn ) /*|| get_godskill( ch, sn ) removed by SinaC 2003*/ || ch->pcdata->ability_info[sn].learned > 0) { send_to_char("You already know that skill/spell/power/song!\n\r",ch); return TRUE; } // Modified by SinaC 2003 if (class_gainabilityrating(ch, sn, ch->pcdata->ability_info[sn].casting_level ) <= 0 // Removed by SinaC 2001 so spells can be gained one by one // not only by group /*|| ability_table[sn].spell_fun != spell_null*/) { send_to_char("That skill/spell/power/song is not available.\n\r",ch); return TRUE; } // Added by SinaC 2001 if ( !can_gain_creation( ch, sn ) ) { send_to_charf( ch, "You don't fit the prereqs for %s.\n\r", ability_table[sn].name); return TRUE; } sprintf(buf, "{W%s skill/spell/power/song added.{x\n\r",ability_table[sn].name); send_to_char(buf,ch); ch->gen_data->ability_chosen[sn] = TRUE; ch->gen_data->points_chosen += class_abilityrating( ch, sn, ch->pcdata->ability_info[sn].casting_level ); //ch->pcdata->ability_info[sn].learned = 1; SinaC 2003, casting level need to be set group_add( ch, ability_table[sn].name, FALSE ); ch->pcdata->points += class_abilityrating( ch, sn, ch->pcdata->ability_info[sn].casting_level ); return TRUE; } send_to_char("No skills/spells/powers/songs or groups by that name...\n\r",ch); return TRUE; } if (!str_cmp(arg,"drop")) { if (argument[0] == '\0') { send_to_char("You must provide a skill/spell/power/song or group to drop.\n\r",ch); return TRUE; } gn = group_lookup(argument); if (gn != -1 && ch->gen_data->group_chosen[gn]) { send_to_char("{WGroup dropped.{x\n\r",ch); ch->gen_data->group_chosen[gn] = FALSE; ch->gen_data->points_chosen -= class_grouprating( ch->bstat(classes), gn ); gn_remove(ch,gn); for (i = 0; i < MAX_GROUP; i++) { if (ch->gen_data->group_chosen[gn]) gn_add(ch,gn); } ch->pcdata->points -= class_grouprating( ch->bstat(classes), gn ); // To avoid losing basic abilities which would be included in the group we just removed // we re-add basics group_add( ch, class_table[ class_firstclass( ch->bstat(classes) ) ].base_group, FALSE ); return TRUE; } sn = ability_lookup(argument); if (sn != -1 && ch->gen_data->ability_chosen[sn]) { send_to_char("{WSkill/spell/power/song dropped.{x\n\r",ch); ch->gen_data->ability_chosen[sn] = FALSE; ch->gen_data->points_chosen -= class_abilityrating( ch, sn, ch->pcdata->ability_info[sn].casting_level ); ch->pcdata->ability_info[sn].learned = 0; ch->pcdata->points -= class_abilityrating( ch, sn, ch->pcdata->ability_info[sn].casting_level ); return TRUE; } send_to_char("You haven't bought any such skill/spell/power/song or group.\n\r",ch); return TRUE; } if (!str_prefix(arg,"premise")) { do_help(ch,"premise"); return TRUE; } if (!str_prefix(arg,"list")) { list_group_costs(ch); return TRUE; } if (!str_prefix(arg,"learned")) { list_group_chosen(ch); return TRUE; } // Added by SinaC 2000 if (!str_prefix(arg,"known")){ list_group_known(ch); } if (!str_prefix(arg,"info")) { do_groups(ch,argument); return TRUE; } return FALSE; }
/* this procedure handles the input parsing for the skill generator */ bool parse_gen_groups(CHAR_DATA *ch,char *argument) { char arg[MAX_INPUT_LENGTH]={'\0'}; int gn,sn; if (argument[0] == '\0') return FALSE; argument = one_argument(argument,arg); if (!str_prefix(arg,"help")) { if (argument[0] == '\0') { do_function(ch, &do_help, "group help"); return TRUE; } do_function(ch, &do_help, argument); return TRUE; } if (!str_prefix(arg,"add")) { if (argument[0] == '\0') { send_to_char("You must provide a skill name.\n\r",ch); return TRUE; } gn = group_lookup(argument); if (gn != -1) { if (ch->gen_data->group_chosen[gn] || ch->pcdata->group_known[gn]) { send_to_char("You already know that group!\n\r",ch); return TRUE; } if (group_table[gn].rating[ch->iclass] < 1) { send_to_char("That group is not available.\n\r",ch); return TRUE; } /* Close security hole */ if (ch->gen_data->points_chosen + group_table[gn].rating[ch->iclass] > 300) { send_to_char( "You cannot take more than 300 creation points.\n\r", ch); return TRUE; } send_to_char( Format("%s group added\n\r",group_table[gn].name), ch); ch->gen_data->group_chosen[gn] = TRUE; ch->gen_data->points_chosen += group_table[gn].rating[ch->iclass]; gn_add(ch,gn); ch->pcdata->points += group_table[gn].rating[ch->iclass]; return TRUE; } sn = skill_lookup(argument); if (sn != -1) { if (ch->gen_data->skill_chosen[sn] || ch->pcdata->learned[sn] > 0) { send_to_char("You already know that skill!\n\r",ch); return TRUE; } if (skill_table[sn].rating[ch->iclass] < 1 || skill_table[sn].spell_fun != spell_null) { send_to_char("That skill is not available.\n\r",ch); return TRUE; } /* Close security hole */ if (ch->gen_data->points_chosen + skill_table[sn].rating[ch->iclass] > 300) { send_to_char("You cannot take more than 300 creation points.\n\r", ch); return TRUE; } send_to_char( Format("%s skill added\n\r",skill_table[sn].name), ch); ch->gen_data->skill_chosen[sn] = TRUE; ch->gen_data->points_chosen += skill_table[sn].rating[ch->iclass]; ch->pcdata->learned[sn] = 1; ch->pcdata->points += skill_table[sn].rating[ch->iclass]; return TRUE; } send_to_char("No skills or groups by that name...\n\r",ch); return TRUE; } if (!strcmp(arg,"drop")) { if (argument[0] == '\0') { send_to_char("You must provide a skill to drop.\n\r",ch); return TRUE; } gn = group_lookup(argument); if (gn != -1 && ch->gen_data->group_chosen[gn]) { int i = 0; send_to_char("Group dropped.\n\r",ch); ch->gen_data->group_chosen[gn] = FALSE; ch->gen_data->points_chosen -= group_table[gn].rating[ch->iclass]; gn_remove(ch,gn); for (i = 0; i < MAX_GROUP; i++) { if (ch->gen_data->group_chosen[gn]) gn_add(ch,gn); } ch->pcdata->points -= group_table[gn].rating[ch->iclass]; return TRUE; } sn = skill_lookup(argument); if (sn != -1 && ch->gen_data->skill_chosen[sn]) { send_to_char("Skill dropped.\n\r",ch); ch->gen_data->skill_chosen[sn] = FALSE; ch->gen_data->points_chosen -= skill_table[sn].rating[ch->iclass]; ch->pcdata->learned[sn] = 0; ch->pcdata->points -= skill_table[sn].rating[ch->iclass]; return TRUE; } send_to_char("You haven't bought any such skill or group.\n\r",ch); return TRUE; } if (!str_prefix(arg,"premise")) { do_function(ch, &do_help, "premise"); return TRUE; } if (!str_prefix(arg,"list")) { list_group_costs(ch); return TRUE; } if (!str_prefix(arg,"learned")) { list_group_chosen(ch); return TRUE; } if (!str_prefix(arg,"info")) { do_function(ch, &do_groups, argument); return TRUE; } return FALSE; }
/* used to get new skills */ void do_gain(CHAR_DATA *ch, char *argument) { char arg[MIL]={'\0'}; CHAR_DATA *trainer; int gn = 0, sn = 0; if (IS_NPC(ch)) { return; } /* 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_function(trainer, &do_say, "Pardon me?"); return; } if (!str_prefix(arg,"list")) { int col = 0; send_to_char( Format("%-18s %-5s %-18s %-5s %-18s %-5s\n\r", "group","cost","group","cost","group","cost"), ch); for (gn = 0; gn < MAX_GROUP; gn++) { if (group_table[gn].name == NULL) break; if (!ch->pcdata->group_known[gn] && group_table[gn].rating[ch->iclass] > 0) { send_to_char( Format("%-18s %-5d ", group_table[gn].name,group_table[gn].rating[ch->iclass]), ch); if (++col % 3 == 0) send_to_char("\n\r",ch); } } if (col % 3 != 0) send_to_char("\n\r",ch); send_to_char("\n\r",ch); col = 0; send_to_char( Format("%-18s %-5s %-18s %-5s %-18s %-5s\n\r", "skill","cost","skill","cost","skill","cost"), ch); for (sn = 0; sn < MAX_SKILL; sn++) { if (skill_table[sn].name == NULL) break; if (!ch->pcdata->learned[sn] && skill_table[sn].rating[ch->iclass] > 0 && skill_table[sn].spell_fun == spell_null) { send_to_char( Format("%-18s %-5d ", skill_table[sn].name,skill_table[sn].rating[ch->iclass]), ch); if (++col % 3 == 0) send_to_char("\n\r",ch); } } if (col % 3 != 0) send_to_char("\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; } if (!str_prefix(arg,"points")) { 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; ch->exp = exp_per_level(ch,ch->pcdata->points) * ch->level; 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 (group_table[gn].rating[ch->iclass] <= 0) { act("$N tells you 'That group is beyond your powers.'", ch,NULL,trainer,TO_CHAR); return; } if (ch->train < group_table[gn].rating[ch->iclass]) { 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 -= group_table[gn].rating[ch->iclass]; return; } sn = skill_lookup(argument); if (sn > -1) { if (skill_table[sn].spell_fun != spell_null) { act("$N tells you 'You must learn the full group.'", ch,NULL,trainer,TO_CHAR); return; } if (ch->pcdata->learned[sn]) { act("$N tells you 'You already know that skill!'", ch,NULL,trainer,TO_CHAR); return; } if (skill_table[sn].rating[ch->iclass] <= 0) { act("$N tells you 'That skill is beyond your powers.'", ch,NULL,trainer,TO_CHAR); return; } if (ch->train < skill_table[sn].rating[ch->iclass]) { act("$N tells you 'You are not yet ready for that skill.'", ch,NULL,trainer,TO_CHAR); return; } /* add the skill */ ch->pcdata->learned[sn] = 1; act("$N trains you in the art of $t", ch,skill_table[sn].name,trainer,TO_CHAR); ch->train -= skill_table[sn].rating[ch->iclass]; return; } act("$N tells you 'I do not understand...'",ch,NULL,trainer,TO_CHAR); }