Re: [GUILD] Individual Trainers?

From: Stephen Wolfe (siv@CYBERENET.NET)
Date: 07/13/98


>   I am looking to add in something like Gmaster on the circle ftp site. I
> want to let only certain guildmasters be able to train people in
> certain spells/skills. That way people will have to search out the martial
> artist of the mountain to learn second attack (you get the idea). And
> maybe even having different masters train to different degrees in a
> certain skill. Does anyone have a decent thought out way to accomplish
> this? Gmaster, I believe, does not do all this, and the directions for it
> are not clear on exactly what it allows. Any help for I could build my own
> system would be highly helpful.

hrm..psuedo code to follow..

siv

ACMD(do_train)
{
  bool found;
  int i, j, skill_num = -1;
  struct char_data *mob;

  struct {
    sh_int master;      /* vnum of the master                   */
    int skills[5];      /* skills that this mob can train       */
  } masters[] = {
    { 13107, {SKILL_SECOND_ATT, SKILL_THIRD_ATT, -1, -1, -1}},
    { 1458, {SPELL_FIREBALL, SPELL_INCINERATE, SPELL_IMPLOSION, -1, -1}},
    {-1, {-1, -1, -1, -1, -1}}
  };
  /* change the first number to the vnum of the trainer mob, and add up to
     five skills that the master can teach (-1 means not used)  */

  for (mob = world[ch->in_room].people; mob && !found; mob = mob->next_in_room)
    for (i = 0; masters[i].master != -1; i++)
      if (GET_MOB_VNUM(mob) == masters[i].master)
      {
        found = TRUE;
        break;
      }

  if (!mob) {
    send_to_char("There is no one here to train you.\r\n", ch);
    return;
  }

  one_argument(argument, arg);

  if (!*arg) {
    sprintf(buf, "I can teach you these skills:\r\n");
    for (j = 0; masters[i].skills[j] != -1 && j < 5; j++)
      sprintf(buf + strlen(buf), "%s\r\n", spells[masters[i].skills[j]]);
    return;
  }

  /* ok, we were given an argument (ie, train fireball)..find out
        if it's one of the skills offered, and if the char
        qualifies */

  for (j = 0; masters[i].skills[j] != -1 && j < 5; j++)
    if (!str_cmp(arg, spells[masters[i].skills[j]]) {
      skill_num = masters[i].skills[j];
      break;
    }

  if (skill_num == -1) {
    do_say(mob, "I cannot train you in that skill.", 0, 0);
    return;
  }
  if (GET_LEVEL(ch) < spell_info[skill_num].min_level[(int) GET_CLASS(ch)]) {
    do_say(mob, "You are not ready to train in that skill.", 0, 0);
    return;
  }
  if (GET_SKILL(ch, skill_num) >= LEARNED(ch)) {
    do_say(mob, "You are already learned in that skill.", 0, 0);
    return;
  }
  send_to_char("You train for a while...\r\n", ch);
  GET_PRACTICES(ch)--;

  percent = GET_SKILL(ch, skill_num);
  percent += MIN(MAXGAIN(ch), MAX(MINGAIN(ch), int_app[GET_INT(ch)].learn));

  SET_SKILL(ch, skill_num, MIN(LEARNED(ch), percent));

  if (GET_SKILL(ch, skill_num) >= LEARNED(ch))
    send_to_char("You are now learned in that area.\r\n", ch);
}


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST