Ejemplo n.º 1
0
void list_skills(struct char_data *ch)
{
  const char *overflow = "\r\n**OVERFLOW**\r\n";
  int i, sortpos;
  size_t len = 0, nlen;
  char buf2[MAX_STRING_LENGTH];

  len = snprintf(buf2, sizeof(buf2), "You have %d practice session%s remaining.\r\n"
	"You know of the following %ss:\r\n", GET_PRACTICES(ch),
	GET_PRACTICES(ch) == 1 ? "" : "s", SPLSKL(ch));

  int cnt = 0;
  for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) {
    i = spell_sort_info[sortpos];
    if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
      cnt += 1;
      nlen = snprintf(buf2 + len, sizeof(buf2) - len, (cnt%2) ? "%-20s %s | " : "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i)));
      if (len + nlen >= sizeof(buf2) || nlen < 0)
        break;
      len += nlen;
    }
  }
  if (len >= sizeof(buf2))
    strcpy(buf2 + sizeof(buf2) - strlen(overflow) - 1, overflow); /* strcpy: OK */

  parse_at(buf2);
  page_string(ch->desc, buf2, TRUE);
}
Ejemplo n.º 2
0
void list_skills(Character * ch, Character *teacher)
{
	int i, sortpos, has_pracs;
	std::string HowGood, PracType;
	Weave* weave;

	*buf = 0;
	if(!IS_NPC(ch))
	{
		has_pracs = MAX(0, ch->PlayerData->skillpracs) + MAX(0, ch->PlayerData->tradepracs);

		if(IS_CHANNELER(ch) || IS_DREADLORD(ch) || IS_DREADGUARD(ch))
			has_pracs += MAX(0, ch->PlayerData->spellpracs);

		if(!has_pracs)
			strcpy(buf, "You have no practice sessions remaining.\r\n");
		else
		{
			sprintf(buf, "You have %d practice session%s remaining, ",
				ch->PlayerData->skillpracs, (ch->PlayerData->skillpracs == 1 ? "" : "s"));

			if(IS_CHANNELER(ch) || IS_DREADLORD(ch) || IS_DREADGUARD(ch))
			{
				sprintf(buf + strlen(buf), "%d spell practice%s remaining, ",
					ch->PlayerData->spellpracs, (ch->PlayerData->spellpracs == 1 ? "" : "s"));
			}
			sprintf(buf + strlen(buf), "and %d trade practice%s remaining.\r\n",
				ch->PlayerData->tradepracs, (ch->PlayerData->tradepracs == 1 ? "" : "s"));
		}
	}

	sprintf(buf + strlen(buf), "You are skilled in the following:\r\n");
	strcpy(buf2, buf);

	std::list<int> WeaveVnums = WeaveManager::GetManager().GetListOfWeaveVnums();
	for ( std::list<int>::iterator vI = WeaveVnums.begin();vI != WeaveVnums.end();++vI)
	{
		sortpos = i = (*vI);
		Weave* weave = WeaveManager::GetManager().GetWeave(i);

		if( weave == NULL ) continue;

		if (strlen(buf2) >= MAX_STRING_LENGTH - 32)
		{
			strcat(buf2, "**OVERFLOW**\r\n");
			break;
		}

		if( (GET_SKILL(ch, i) <= 0 && !teacher) || !ch->CanPractice(weave))
			continue;

		if( teacher && teacher->CanTeach( weave ) == false )
			continue;

		if(weave->levels())
			sprintf(HowGood, "(Level %d)", ch->GetSkillLevel(i));
		else
			HowGood = how_good(GET_SKILL(ch, i));

		char costStr[256];
		sprintf(costStr, "(Cost: %d)", calc_price(ch, i));

		if( weave->isElement() )
			sprintf(buf2 + strlen(buf2), "%-17s %10s, (Level %d)\r\n",
				weave->getName().c_str(), costStr, ch->GetSkillLevel(i));
		else
			sprintf(buf2 + strlen(buf2), "%-17s %10s, (%d%%), %s\r\n",
				weave->getName().c_str(), costStr, GET_SKILL(ch, i), HowGood.c_str());
	}

	page_string(ch->desc, buf2, 1);
}
Ejemplo n.º 3
0
void 
do_info_sp_sk (CHAR_DATA * ch, SPELL_DATA * spell)
{
char buffy[500];
char hg[300];
bool prereq = FALSE;
bool found_mana = FALSE;
if (IS_MOB (ch))
  {
    send_to_char ("NPC's cannot do this!\n\r", ch);
    return;
  }

if (spell == NULL)
  {
    send_to_char ("Does not exist.\n\r", ch);
    return;
  }
sprintf(buffy,"\x1b[0;35m-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\x1b[0;37m\n\r");
send_to_char(buffy, ch);
sprintf(buffy, "\x1b[1;30mLevel \x1b[1;34m%2d\x1b[0;37m:\n\r",spell->spell_level);
send_to_char(buffy, ch);
sprintf(buffy, "\x1b[1;36m%s   ", capitalize(spell->spell_funky_name));
send_to_char(buffy, ch);
if (spell->slot == 0)
  {
    sprintf(buffy, "    \x1b[1;30m(\x1b[1;36mSkill\x1b[1;30m)\n\r");
    send_to_char(buffy, ch);
  }
else if (spell->slot == 2)
  {
    sprintf(buffy, "    \x1b[1;30m(\x1b[1;36mProficiency\x1b[1;30m)\n\r");
    send_to_char(buffy, ch);
  }
else
  { 
    sprintf(buffy, "\x1b[1;30m(");
    send_to_char(buffy, ch);
    if (spell->spell_type == TAR_CHAR_OFFENSIVE)
      send_to_char("\x1b[1;36mOffensive ", ch);
    else if (spell->spell_type == TAR_CHAR_DEFENSIVE)
      send_to_char("\x1b[1;36mDefensive ", ch);
    else if (spell->spell_type == TAR_CHAR_SELF)
      send_to_char("\x1b[1;36mSelf Only ", ch);
    else
      send_to_char("\x1b[1;36mSpecial ", ch);
    if (IS_SET(spell->spell_bits, SPELL_ALL_IN_ROOM))
      send_to_char("Area ", ch);
    send_to_char("Spell\x1b[1;30m)\n\r", ch);
    sprintf(buffy, "\x1b[0;32m{\x1b[1;37m%d\x1b[0;32m} ",spell->mana);
    send_to_char(buffy, ch);
    {
      int i;
      for (i = 0; str_cmp(mana_data[i].what_you_type, "end_of_list") && !found_mana; i ++)
	{
	  if (spell->mana_type == mana_data[i].flagname)
	    {
	      sprintf(buffy, "%s%s\x1b[0;37m", mana_data[i].color, mana_data[i].what_you_type);
	      found_mana = TRUE;
	      
	    }
	}
    }
    if (!found_mana)
      sprintf(buffy, "Unknown");
    send_to_char (buffy, ch);
    send_to_char("\x1b[0;32m mana is required to cast this spell.\x1b[0;37m\n\r", ch);
  }  
send_to_char("\x1b[1;30mPrerequisites\x1b[0;37m:  ", ch);
if (spell->prereq_1 && str_cmp(spell->prereq_1, "none") &&str_cmp(spell->prereq_1, "None"))
  {
    sprintf (buffy, "\x1b[0;36m%s", spell->prereq_1);
    send_to_char(buffy, ch); 
    prereq = TRUE;
  }
if (spell->prereq_2 && str_cmp(spell->prereq_2, "none") &&str_cmp(spell->prereq_2,"None"))
  {
    if (prereq)
      send_to_char(", ", ch);
    sprintf (buffy, "\x1b[0;36m%s", spell->prereq_2);
    send_to_char(buffy, ch);
    prereq = TRUE;
  }
if (!prereq)
  send_to_char("\x1b[0;36mNone", ch);
send_to_char(".\n\r",ch);  


if (spell->slot == 0)
  {
    strcpy (hg, how_good (ch, spell->gsn));
    sprintf (buffy, "Your proficiency in this skill is \x1B[1;37m%s\x1B[0m.\n\r", hg);
  }
else if (spell->slot == 2)
    {
    strcpy (hg, how_good (ch, spell->gsn));
    sprintf (buffy, "Your ability in this proficiency is \x1B[1;37m%s\x1B[0m.\n\r", hg);
  }
else
  {
    strcpy (hg, how_good (ch, spell->gsn));
    sprintf (buffy, "Your proficiency in this spell is \x1B[1;37m%s\x1B[0;37m.\n\n\r", hg);
  }
send_to_char(buffy, ch);
if (spell->slot == 0)
  {
    sprintf(buffy, "This skill requires a minimum \x1b[1;34m%d\x1b[0;37m strength and \x1b[1;32m%d\x1b[0;37m dexterity to practice fully.\n\r", spell->min_int, spell->min_wis);
    send_to_char(buffy, ch);
  }
else if (spell->slot == 2)
  {
    sprintf(buffy, "This proficiency requires a minimum \x1b[1;34m%d\x1b[0;37m intelligence and \x1b[1;32m%d\x1b[0;37m dexterity to practice fully.\n\r", spell->min_int, spell->min_wis);
    send_to_char(buffy, ch);
  }
else
  {
    sprintf(buffy, "This skill requires a minimum \x1b[1;34m%d\x1b[0;37m intelligence and \x1b[1;32m%d\x1b[0;37m wisdom to practice fully.\n\r", spell->min_int, spell->min_wis);
    send_to_char(buffy, ch);
  }
   /*
if (spell->slot == 1)
  {
    if (spell->spell_type == TAR_CHAR_OFFENSIVE)
      {
	sprintf(buffy, "This spell requires a minimum of 
\x1b[1;34m%d\x1b[0;37m intelligence to cast effectively.\n\r", (17 + 
(spell->spell_level)/5));
	send_to_char(buffy, ch);
      } 
    else 
      if (IS_SET(spell->spell_bits, SPELL_HEALS_DAM) || IS_SET(spell->spell_bits, SPELL_ADD_MOVE))
	{
	  sprintf(buffy, "This spell requires a minimum of \x1b[1;34m%d\x1b[0;37m wisdom to cast effectively.\n\r", (10+(spell->spell_level)*2/5));
	  send_to_char(buffy, ch);  
	} 
  }
*/
if (spell->guilds != 0)
  {
    int i=0;
    bool prev= FALSE; 
    sprintf(buffy, "This %s requires:\x1b[1;36m",(spell->slot == 0 ? "skill" :  (spell->slot == 1 ?  "spell" : "proficiency")));
    send_to_char(buffy, ch);
    for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++)
      {
	if (IS_SET(spell->guilds, guild_data[i].mob_guildmaster_bit))
	  {
	    if (prev)
	      send_to_char(",", ch);
	    sprintf(buffy, guild_data[i].what_you_see);
	    send_to_char(buffy, ch);
	    prev = TRUE;
	  }
      }
    send_to_char("\x1b[0;37m to learn and use.\n\r", ch);
  }
  
send_to_char("\n\r", ch);
do_help_two (ch, spell->spell_funky_name);
sprintf(buffy,"\x1b[0;35m-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\x1b[0;37m\n\r");
send_to_char(buffy, ch);
return;
}
Ejemplo n.º 4
0
void 
do_spells (CHAR_DATA * ch, char *argy)
{
  char buf[STD_LENGTH];
  char bbb[50];
  char hg[300];
  SPELL_DATA *spell;
  bool fnd = FALSE;
  int sn;
  int col;
  DEFINE_COMMAND ("spells", do_spells, POSITION_DEAD, 0, LOG_NORMAL, "This command shows you all the spells you currently know.")
    hugebuf_o[0] = '\0';
  if (IS_MOB (ch))
    {
      send_to_char ("You do not know how to cast spells!\n\r", ch);
      return;
    }

  hugebuf_o[0] = '\0';
  col = 0;
  for (sn = 0; sn < SKILL_COUNT; sn++)
    {
      if ((spell = skill_lookup (NULL, sn)) == NULL)
	continue;
      if ((LEVEL (ch) < spell->spell_level)
	  || (spell->spell_level > 80))
	continue;
      if (spell->slot != 1)
	continue;
      if (ch->pcdata->learned[sn] == -100)
	continue;
      fnd = TRUE;
     
      {
	bool found = FALSE;
	int i;
	for (i = 0; str_cmp(mana_data[i].what_you_type, "end_of_list") && !found; i ++)
	  {
	    if (spell->mana_type == mana_data[i].flagname)
	      {
		char buf[50];
		sprintf (buf, "%s%s\x1b[0;37m", mana_data[i].color, mana_data[i].letter);
		strcpy(bbb, buf);
		found = TRUE;
	      }
	  }
	if (!found)
	  strcpy(bbb, " ");
      }
      
      strcpy (hg, how_good (ch, sn));
      if (LEVEL (ch) >= 100)
	sprintf (buf, "%s %3dM (%3d) %-20s ",
	    bbb, ((2 + LEVEL (ch) - spell->spell_level == 0) ? spell->mana :
		  (UMAX (spell->mana,
			 100 / (2 + LEVEL (ch) - spell->spell_level)))),
		 ch->pcdata->learned[sn], spell->spell_funky_name);
      else
	sprintf (buf, "%s %3dM %10s %-20s ",
	    bbb, ((2 + LEVEL (ch) - spell->spell_level == 0) ? spell->mana :
	 (UMAX (spell->mana, 100 / (2 + LEVEL (ch) - spell->spell_level)))),
		 hg, spell->spell_funky_name);
      strcat (hugebuf_o, buf);
      if (++col % 2 == 0)
	strcat (hugebuf_o, "\n\r");
    }

  if (col % 2 != 0)
    strcat (hugebuf_o, "\n\r");
  if (!fnd)
    strcpy (hugebuf_o, "You know no spells at the moment.\n\r");
  page_to_char (hugebuf_o, ch);
  return;
}
Ejemplo n.º 5
0
void 
do_practice (CHAR_DATA * ch, char *argy)
{
  char buf[STD_LENGTH];
  char hg[500];
  bool found;
  int sn;
  int cnttt;
  SPELL_DATA *spell;
  CHAR_DATA *mob;
  int adept;
  DEFINE_COMMAND ("practice", do_practice, POSITION_STANDING, 0, LOG_NORMAL, "This command can be used to list all skills/spells you know, or, at a practitioner, can be used to practice a spell or skill.")
    hugebuf_o[0] = '\0';
  cnttt = 0;
  if (IS_MOB (ch))
    return;
  
  for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
    {
      if (IS_MOB (mob) && IS_SET (mob->act, ACT_PRACTICE) && mob->pIndexData->opt)
	break;
    }

  if (mob != NULL && (!IS_SET (mob->act, ACT_PRACTICE) || IS_PLAYER (mob)))
    {
      if (argy[0] != '\0')
	{
	  send_to_char ("You cannot practice here!\n\r", ch);
	  return;
	}
    }
  if (mob == NULL && argy[0] == '\0')
    {
      int col;
      int oldtrack;
      int oldtrap;
      int oldpick;
      sprintf (hugebuf_o, "You have knowledge in the following:\n\r\n\r");
      sprintf (hugebuf_o,"\x1B[1;37mYou have knowledge in the following:\x1B[37;0m\n\r");
      sprintf (hugebuf_o+strlen(hugebuf_o),"\x1B[1;34m------------------------------------\x1B[37;0m\n\r");
      col = 0;
      
      oldtrack = ch->pcdata->learned[gsn_track]; 
      if (is_member (ch, GUILD_RANGER))
	ch->pcdata->learned[gsn_track] = 100;
      oldtrap = ch->pcdata->learned[gsn_trapset]; 
      if (is_member (ch, GUILD_RANGER) && is_member(ch, GUILD_THIEFG) &&
	  is_member(ch, GUILD_TINKER))
	ch->pcdata->learned[gsn_trapset] = 100;
      oldpick = ch->pcdata->learned[gsn_pick_lock];
      if (is_member (ch, GUILD_THIEFG))
	ch->pcdata->learned[gsn_pick_lock] = 100;
      ch->pcdata->learned[gsn_sneak] += ch->pcdata->plus_sneak;
      ch->pcdata->learned[gsn_hide] += ch->pcdata->plus_hide;
      for (sn = 0; sn < SKILL_COUNT; sn++)
	{
	  if ((spell = skill_lookup (NULL, sn)) == NULL)
	    continue;
	  if ((LEVEL (ch) < spell->spell_level)
	      || (ch->pcdata->learned[sn] < -1))
	    continue;
	  strcpy (hg, how_good (ch, sn));
	  if (LEVEL (ch) >= 100)
	    sprintf (buf, "%22s %3d%% ", spell->spell_funky_name,
		     ch->pcdata->learned[sn]);
	  else
	    sprintf (buf, " %22s %10s", spell->spell_funky_name, hg);
	  strcat (hugebuf_o, buf);
	  if (++col % 2 == 0)
	    strcat (hugebuf_o, "\n\r");
	}
      ch->pcdata->learned[gsn_track] = oldtrack;
      ch->pcdata->learned[gsn_trapset] = oldtrap;
      ch->pcdata->learned[gsn_pick_lock] = oldpick;
      ch->pcdata->learned[gsn_sneak] -= ch->pcdata->plus_sneak;
      ch->pcdata->learned[gsn_hide] -= ch->pcdata->plus_hide;
      if (col % 2 != 0)
	strcat (hugebuf_o, "\n\r");
      sprintf (buf, "\n\rYou have %d practices and %d learns left.\x1B[0m\n\r",
	       ch->pcdata->practice, ch->pcdata->learn);
      strcat (hugebuf_o, buf);
      page_to_char (hugebuf_o, ch);
      return;
    }

  if (!IS_AWAKE (ch))
    {
      send_to_char ("In your dreams?  Good luck!\n\r", ch);
      return;
    }

  if (argy[0] == '\0')
    {
      int col;
      int oldtrack; 
      int oldtrap;
      int oldpick;
      hugebuf_o[0] = '\0';
      send_to_char("\x1B[1;37mYou have knowledge in the following:\x1B[37;0m\n\r", ch);
      send_to_char("\x1B[1;34m------------------------------------\x1B[37;0m\n\r", ch);
      found = FALSE;
      col = 0;
      if (mob == NULL || IS_PLAYER (mob))
	return;
      oldpick = ch->pcdata->learned[gsn_pick_lock];
      if (is_member (ch, GUILD_THIEFG))
	ch->pcdata->learned[gsn_pick_lock] = 100;
      oldtrack = ch->pcdata->learned[gsn_track];
      if (is_member (ch, GUILD_RANGER) && is_member(ch, GUILD_THIEFG) &&
is_member(ch, GUILD_TINKER))
	ch->pcdata->learned[gsn_trapset] = 100;
      oldtrap = ch->pcdata->learned[gsn_trapset]; 
      if (is_member (ch, GUILD_RANGER))
	ch->pcdata->learned[gsn_track] = 100;
      ch->pcdata->learned[gsn_sneak] += ch->pcdata->plus_sneak;
      ch->pcdata->learned[gsn_hide] += ch->pcdata->plus_hide;
      for (sn = 0; sn <= 28; sn++)
	{
	  if (mob->pIndexData->opt->skltaught[sn] > 0 &&
	      (spell = skill_lookup (NULL, mob->pIndexData->opt->skltaught[sn])) != NULL)
	    {
	    
	      if (LEVEL (ch) >= spell->spell_level)
		{
		  char hg[300];
		  found = TRUE;
		  strcpy (hg, how_good (ch, spell->gsn));
		  sprintf (buf, " %22s %10s", spell->spell_funky_name, hg);
		  strcat (hugebuf_o, buf);
		  if (++col % 2 == 0)
		    strcat (hugebuf_o, "\n\r");
		}
	    }
	}
      ch->pcdata->learned[gsn_trapset] = oldtrap;
      ch->pcdata->learned[gsn_track] = oldtrack;
      ch->pcdata->learned[gsn_pick_lock] = oldpick;
      ch->pcdata->learned[gsn_sneak] -= ch->pcdata->plus_sneak;
      ch->pcdata->learned[gsn_hide] -= ch->pcdata->plus_hide;
      if (!found)
	strcat (hugebuf_o, "Nothing.\n\r");
      if (col % 2 != 0)
	strcat (hugebuf_o, "\n\r");
      sprintf (buf, "\n\rYou have %d practice sessions left.\n\r",
	       ch->pcdata->practice);
      strcat (hugebuf_o, buf);
      page_to_char (hugebuf_o, ch);
      return;
    }

  spell = skill_lookup (argy, -1);
  if (spell == NULL)
    {
      send_to_char ("What's that?\n\r", ch);
      return;
    }

  if (spell == NULL
      || (IS_PLAYER (ch)
	  && (LEVEL (ch) < spell->spell_level ||
	      ch->pcdata->learned[spell->gsn] == -100)))
    {
      if (spell->gsn > 0 && spell->gsn < SKILL_COUNT && ch->pcdata->learned[spell->gsn] == -100)
	{
	  do_learn (ch, argy);
	  if (ch->pcdata->learned[spell->gsn] == -100)
	    {
	      send_to_char ("For some reason or another, you could not LEARN this spell/skill.\n\r", ch);
	      send_to_char ("Perhaps you are out of learns?  Type 'learn' for more information.\n\r", ch);
	      return;
	    }
	  goto lerned_it;
	}

      send_to_char ("I have no knowledge in that area.\n\r", ch);
      return;
    }
lerned_it:
  if (mob == NULL)
    return;
  while (cnttt <= 30)
    {
      if (IS_MOB (mob) && mob->pIndexData->opt->skltaught[cnttt] == spell->gsn)
	{
	  cnttt = 50;
	  break;
	}
      cnttt++;
    }

  if (cnttt != 50)
    {
      send_to_char ("I have too little knowledge in that area to help you practice.\n\r", ch);
      return;
    }

  
  if (ch->pcdata->practice < 1)
    {
      send_to_char ("You have no practice sessions left!\n\r", ch);
      return;
    }

  if (spell->slot != 0)
    adept = pow.max_prac_spells;
  else
    adept = pow.max_prac_skills;
  if (spell->slot == 0)
    {
      if(get_curr_dex (ch) < spell->min_wis)
	{
	  adept -= (spell->min_wis - get_curr_dex (ch)) * 8;
	}
      if(get_curr_str (ch) < spell->min_int)
	{
	  adept -= (spell->min_int - get_curr_str (ch)) * 8;
	  if (adept < 20)
	    adept = 20;
	}
    }
  else if (spell->slot == 1)
    { 
      if (get_curr_wis (ch) < spell->min_wis)
	{
	  adept -= (spell->min_wis - get_curr_wis (ch)) * 8;
	}
      if (get_curr_int (ch) < spell->min_int)
	{
	  adept -= (spell->min_int - get_curr_int (ch)) * 8;
	  if (adept < 20)
	    adept = 20;
	}
    }
  else if (spell->slot == 2)
    {
      if (get_curr_dex (ch) < spell->min_wis)
	{
	  adept -= (spell->min_wis - get_curr_dex (ch)) * 8;
	}
      if (get_curr_int (ch) < spell->min_int)
	{
	  adept -= (spell->min_int - get_curr_int (ch)) * 8;
	  if (adept < 20)
	    adept = 20;
	}
    }
  
  if (IS_PLAYER (ch))
    {
      SPELL_DATA *spl;
      if (spell->prereq_1 != NULL && (spl = skill_lookup(spell->prereq_1, -1)) != NULL && ch->pcdata->learned[spl->gsn] < pow.prereq)
	{
	  sprintf (buf, "You need to be skilled in %s first.\n\r", spl->spell_funky_name);
	  send_to_char (buf, ch);
	  return;
	}
      if (spell->prereq_2 != NULL && (spl = skill_lookup(spell->prereq_2, -1)) != NULL && ch->pcdata->learned[spl->gsn] < pow.prereq)
	{
	  sprintf (buf, "You need to be skilled in %s first.\n\r", spl->spell_funky_name);
	  send_to_char (buf, ch);
	  return;
	}
    }
  
  if (ch->pcdata->learned[spell->gsn] >= adept)
    {
      sprintf (buf, "You are already quite good at %s.\n\r", spell->spell_funky_name);
      send_to_char (buf, ch);
      return;
    }
  if (spell->guilds != 0)
    {
      int i;
      for (i = 0; str_cmp(guild_data[i].what_you_type, "end_of_list"); i++)
	{
	  if(IS_SET(spell->guilds, guild_data[i].mob_guildmaster_bit) && !IS_SET(ch->pcdata->guilds, guild_data[i].mob_guildmaster_bit))
	    {
	      send_to_char("You do not have the proper guilds to practice this!\n\r", ch);
	      return;
	    }
	}
    }

    
      ch->pcdata->practice--;
      if (spell->slot == 1)
	ch->pcdata->learned[spell->gsn] += int_app[get_curr_int (ch) - 1].learn;
      if (spell->slot != 1)
	ch->pcdata->learned[spell->gsn] += int_app[get_curr_int (ch) - 1].learn - 1;
      if (ch->pcdata->learned[spell->gsn] < adept)
	{
	  act ("You practice $T.",
	       ch, NULL, spell->spell_funky_name, TO_CHAR);
	}
      else
	{
	  ch->pcdata->learned[spell->gsn] = adept;
	  act ("You now have a good understanding of $T.",
	       ch, NULL, spell->spell_funky_name, TO_CHAR);
	  if (spell->gsn > 549 && IS_PLAYER(ch) && !str_cmp(race_info[ch->pcdata->race].name, "orc") && adept == pow.max_prac_skills)
	    ch->pcdata->learned[spell->gsn]+= 15;
	}
    

  return;
}
Ejemplo n.º 6
0
void 
do_skill (CHAR_DATA * ch, char *argy)
{
  char buf[STD_LENGTH];
  char hg[300];
  SPELL_DATA *spell;
  int sn;
  int col;
  int oldtrack;
  int oldtrap;
  int oldpick;
  DEFINE_COMMAND ("skills", do_skill, POSITION_DEAD, 0, LOG_NORMAL, "This command shows you what skills you know, if any.")

    if (IS_MOB (ch))
    return;
  hugebuf_o[0] = '\0';
  send_to_char ("\x1B[1;37mYou have knowledge in the following skills:\x1B[37;0m\n\r", ch);
  send_to_char ("\x1B[1;34m-------------------------------------------\x1B[37;0m\n\r", ch);
  col = 0;
  oldtrack = ch->pcdata->learned[gsn_track];
  oldtrap = ch->pcdata->learned[gsn_trapset];
  oldpick = ch->pcdata->learned[gsn_pick_lock];
  if (is_member (ch, GUILD_THIEFG))
    ch->pcdata->learned[gsn_pick_lock] = 100;
  if (is_member (ch, GUILD_RANGER) && is_member(ch, GUILD_THIEFG) &&
is_member(ch, GUILD_TINKER))
    ch->pcdata->learned[gsn_trapset] = 100;
 if (is_member (ch, GUILD_RANGER))
    ch->pcdata->learned[gsn_track] = 100; 
  ch->pcdata->learned[gsn_sneak] += ch->pcdata->plus_sneak;
  ch->pcdata->learned[gsn_hide] += ch->pcdata->plus_hide;
  for (sn = 0; sn < SKILL_COUNT; sn++)
    {
      spell = skill_lookup (NULL, sn);
      if (spell == NULL)
	continue;
      if ((LEVEL (ch) < spell->spell_level)
	  || (ch->pcdata->learned[sn] == -100) || spell->slot == 1)
	continue;
      strcpy (hg, how_good (ch, sn));
      if (LEVEL (ch) >= 100)
	sprintf (buf, "%s%22s %3d%%\x1b[0;37m ",(spell->slot == 2 ? "\x1b[1;36m" : ""), spell->spell_funky_name, ch->pcdata->learned[sn]);
      else
	sprintf (buf, "%s%22s %10s",(spell->slot == 2 ? "\x1b[1;36m" :
"\x1b[0;37m"), spell->spell_funky_name, hg);
      strcat (hugebuf_o, buf);
      if (++col % 2 == 0)
	strcat (hugebuf_o, "\n\r");
    }

  ch->pcdata->learned[gsn_track] = oldtrack; 
  ch->pcdata->learned[gsn_trapset] = oldtrap;
  ch->pcdata->learned[gsn_pick_lock] = oldpick;
  ch->pcdata->learned[gsn_sneak] -= ch->pcdata->plus_sneak;
  ch->pcdata->learned[gsn_hide] -= ch->pcdata->plus_hide;
  if (col % 2 != 0)
    strcat (hugebuf_o, "\n\r");
  sprintf (buf, "\n\rYou have %d practice sessions left.\n\r",
	   ch->pcdata->practice);
  strcat (hugebuf_o, buf);
  page_to_char (hugebuf_o, ch);
  return;
}
Ejemplo n.º 7
0
int guild(struct char_data *ch, int cmd, char *arg) {

	char arg1[MAX_STRING_LENGTH];
	char buf[MAX_STRING_LENGTH];
	int number, i, percent;

	extern char *spells[];
	extern struct spell_info_type spell_info[MAX_SPL_LIST];
	extern struct int_app_type int_app[26];

	static char *w_skills[] = {
		"kick",  /* No. 50 */
		"bash",
		"rescue",
		"\n"
	};

	static char *t_skills[] = {
		"sneak",   /* No. 45 */
		"hide",
		"steal",
		"backstab",
		"pick",
		"\n"
	};

	if ((cmd != 164) && (cmd != 170)) return(FALSE);

	for(; *arg==' '; arg++);

	switch (GET_CLASS(ch)) {
		case CLASS_MAGIC_USER :{
			if (!*arg) {
				sprintf(buf,"You have got %d practice sessions left.\n\r", ch->specials.spells_to_learn);
				send_to_char(buf, ch);
				send_to_char("You can practise any of these spells:\n\r", ch);
				for(i=0; *spells[i] != '\n'; i++)
					if (spell_info[i+1].spell_pointer &&
					    (spell_info[i+1].min_level_magic <= GET_LEVEL(ch))) {
						send_to_char(spells[i], ch);
						send_to_char(how_good(ch->skills[i+1].learned), ch);
						send_to_char("\n\r", ch);
				}
				return(TRUE);
			}

			number = old_search_block(arg,0,strlen(arg),spells,FALSE);
			if(number == -1) {
				send_to_char("You do not know of this spell...\n\r", ch);
				return(TRUE);
			}
			if (GET_LEVEL(ch) < spell_info[number].min_level_magic) {
				send_to_char("You do not know of this spell...\n\r", ch);
				return(TRUE);
			}
			if (ch->specials.spells_to_learn <= 0) {
				send_to_char("You do not seem to be able to practice now.\n\r", ch);
				return(TRUE);
			}
			if (ch->skills[number].learned >= 95) {
				send_to_char("You are already learned in this area.\n\r", ch);
				return(TRUE);
			}

			send_to_char("You Practice for a while...\n\r", ch);
			ch->specials.spells_to_learn--;

			percent = ch->skills[number].learned+MAX(25,int_app[GET_INT(ch)].learn);
			ch->skills[number].learned = MIN(95, percent);

			if (ch->skills[number].learned >= 95) {
				send_to_char("You are now learned in this area.\n\r", ch);
				return(TRUE);
			}

		} break;

		case CLASS_THIEF: {
			if (!*arg) {
				sprintf(buf,"You have got %d practice sessions left.\n\r", ch->specials.spells_to_learn);
				send_to_char(buf, ch);
				send_to_char("You can practise any of these skills:\n\r", ch);
				for(i=0; *t_skills[i] != '\n';i++) {
					send_to_char(t_skills[i], ch);
					send_to_char(how_good(ch->skills[i+45].learned), ch);
					send_to_char("\n\r", ch);
				}
				return(TRUE);
			}
			number = search_block(arg,t_skills,FALSE);
			if(number == -1) {
				send_to_char("You do not know of this spell...\n\r", ch);
				return(TRUE);
			}
			if (ch->specials.spells_to_learn <= 0) {
				send_to_char("You do not seem to be able to practice now.\n\r", ch);
				return(TRUE);
			}
			if (ch->skills[number+SKILL_SNEAK].learned >= 85) {
				send_to_char("You are already learned in this area.\n\r", ch);
				return(TRUE);
			}
			send_to_char("You Practice for a while...\n\r", ch);
			ch->specials.spells_to_learn--;

			percent = ch->skills[number+SKILL_SNEAK].learned +
			          MIN(int_app[GET_INT(ch)].learn, 12);
			ch->skills[number+SKILL_SNEAK].learned = MIN(85, percent);

			if (ch->skills[number+SKILL_SNEAK].learned >= 85) {
				send_to_char("You are now learned in this area.\n\r", ch);
				return(TRUE);
			}

		} break;

		case CLASS_CLERIC     :{
			if (!*arg) {
				sprintf(buf,"You have got %d practice sessions left.\n\r", ch->specials.spells_to_learn);
				send_to_char(buf, ch);
				send_to_char("You can practise any of these spells:\n\r", ch);
				for(i=0; *spells[i] != '\n'; i++)
					if (spell_info[i+1].spell_pointer &&
					   (spell_info[i+1].min_level_cleric <= GET_LEVEL(ch))) {
						send_to_char(spells[i], ch);
						send_to_char(how_good(ch->skills[i+1].learned), ch);
						send_to_char("\n\r", ch);
				}
				return(TRUE);
			}
			number = old_search_block(arg,0,strlen(arg),spells,FALSE);
			if(number == -1) {
				send_to_char("You do not know of this spell...\n\r", ch);
				return(TRUE);
			}
			if (GET_LEVEL(ch) < spell_info[number].min_level_cleric) {
				send_to_char("You do not know of this spell...\n\r", ch);
				return(TRUE);
			}
			if (ch->specials.spells_to_learn <= 0) {
				send_to_char("You do not seem to be able to practice now.\n\r", ch);
				return(TRUE);
			}
			if (ch->skills[number].learned >= 95) {
				send_to_char("You are already learned in this area.\n\r", ch);
				return(TRUE);
			}
			send_to_char("You Practice for a while...\n\r", ch);
			ch->specials.spells_to_learn--;

			percent = ch->skills[number].learned+MAX(25,int_app[GET_INT(ch)].learn);
			ch->skills[number].learned = MIN(95, percent);

			if (ch->skills[number].learned >= 95) {
				send_to_char("You are now learned in this area.\n\r", ch);
				return(TRUE);
			}
		} break;

		case CLASS_WARRIOR: {
			if (!*arg) {
				sprintf(buf,"You have got %d practice sessions left.\n\r", ch->specials.spells_to_learn);
				send_to_char(buf, ch);
				send_to_char("You can practise any of these skills:\n\r", ch);
				for(i=0; *w_skills[i] != '\n';i++) {
					send_to_char(w_skills[i], ch);
					send_to_char(how_good(ch->skills[i+SKILL_KICK].learned), ch);
					send_to_char("\n\r", ch);
				}
				return(TRUE);
			}
			number = search_block(arg, w_skills, FALSE);
			if(number == -1) {
				send_to_char("You do not have ability to practise this skill!\n\r", ch);
				return(TRUE);
			}
			if (ch->specials.spells_to_learn <= 0) {
				send_to_char("You do not seem to be able to practice now.\n\r", ch);
				return(TRUE);
			}
			if (ch->skills[number+SKILL_KICK].learned >= 80) {
				send_to_char("You are already learned in this area.\n\r", ch);
				return(TRUE);
			}
			send_to_char("You Practice for a while...\n\r", ch);
			ch->specials.spells_to_learn--;

			percent = ch->skills[number+SKILL_KICK].learned +
			          MIN(12, int_app[GET_INT(ch)].learn);
			ch->skills[number+SKILL_KICK].learned = MIN(80, percent);

			if (ch->skills[number+SKILL_KICK].learned >= 80) {
				send_to_char("You are now learned in this area.\n\r", ch);
				return(TRUE);
			}
		} break;
	}
}