Remove redundant skillset command

This commit is contained in:
kinther 2025-08-19 07:15:18 -07:00
parent 5aec076135
commit f5cae94e14
4 changed files with 2 additions and 113 deletions

View file

@ -1022,21 +1022,6 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
snprintf(str, slen, "%s", genders[(int)GET_SEX(c)]);
else if (!str_cmp(field, "skill"))
snprintf(str, slen, "%s", skill_percent(c, subfield));
else if (!str_cmp(field, "skillset")) {
if (!IS_NPC(c) && subfield && *subfield) {
char skillname[MAX_INPUT_LENGTH], *amount;
amount = one_word(subfield, skillname);
skip_spaces(&amount);
if (amount && *amount && is_number(amount)) {
int skillnum = find_skill_num(skillname);
if (skillnum > 0) {
int new_value = MAX(0, MIN(100, atoi(amount)));
SET_SKILL(c, skillnum, new_value);
}
}
}
*str = '\0'; /* so the parser know we recognize 'skillset' as a field */
}
else if (!str_cmp(field, "str")) {
if (subfield && *subfield) {
int addition = atoi(subfield);

View file

@ -31,7 +31,6 @@
#include "hedit.h"
#include "house.h"
#include "config.h"
#include "modify.h" /* for do_skillset... */
#include "quest.h"
#include "asciimap.h"
#include "prefedit.h"
@ -287,7 +286,6 @@ cpp_extern const struct command_info cmd_info[] = {
{ "shutdow" , "shutdow" , POS_DEAD , do_shutdown , LVL_IMPL, 0 },
{ "shutdown" , "shutdown", POS_DEAD , do_shutdown , LVL_IMPL, SCMD_SHUTDOWN },
{ "sip" , "sip" , POS_RESTING , do_drink , 0, SCMD_SIP },
{ "skillset" , "skillset", POS_SLEEPING, do_skillset , LVL_GRGOD, 0 },
{ "sleep" , "sl" , POS_SLEEPING, do_sleep , 0, 0 },
{ "slist" , "slist" , POS_SLEEPING, do_oasis_list, LVL_BUILDER, SCMD_OASIS_SLIST },
{ "sneak" , "sneak" , POS_STANDING, do_sneak , 1, 0 },
@ -1607,9 +1605,9 @@ void nanny(struct descriptor_data *d, char *arg)
if (load_result == CLASS_UNDEFINED) {
write_to_output(d, "\r\nThat's not a class.\r\nClass: ");
return;
} else
} else {
GET_CLASS(d->character) = load_result;
}
if (d->olc) {
free(d->olc);
d->olc = NULL;

View file

@ -303,98 +303,6 @@ static void exdesc_string_cleanup(struct descriptor_data *d, int action)
STATE(d) = CON_MENU;
}
/* Modification of character skills. */
ACMD(do_skillset)
{
struct char_data *vict;
char name[MAX_INPUT_LENGTH];
char buf[MAX_INPUT_LENGTH], helpbuf[MAX_STRING_LENGTH];
int skill, value, i, qend, pc, pl;
argument = one_argument(argument, name);
if (!*name) { /* no arguments. print an informative text */
send_to_char(ch, "Syntax: skillset <name> '<skill>' <value>\r\n"
"Skill being one of the following:\r\n");
for (qend = 0, i = 0; i <= TOP_SPELL_DEFINE; i++) {
if (spell_info[i].name == unused_spellname) /* This is valid. */
continue;
send_to_char(ch, "%18s", spell_info[i].name);
if (qend++ % 4 == 3)
send_to_char(ch, "\r\n");
}
if (qend % 4 != 0)
send_to_char(ch, "\r\n");
return;
}
if (!(vict = get_char_vis(ch, name, NULL, FIND_CHAR_WORLD))) {
send_to_char(ch, "%s", CONFIG_NOPERSON);
return;
}
skip_spaces(&argument);
pc = GET_CLASS(vict);
pl = GET_LEVEL(vict);
/* If there is no chars in argument */
if (!*argument) {
send_to_char(ch, "Skill name expected.\r\n");
return;
}
if (*argument != '\'') {
send_to_char(ch, "Skill must be enclosed in: ''\r\n");
return;
}
/* Locate the last quote and lowercase the magic words (if any) */
for (qend = 1; argument[qend] && argument[qend] != '\''; qend++)
argument[qend] = LOWER(argument[qend]);
if (argument[qend] != '\'') {
send_to_char(ch, "Skill must be enclosed in: ''\r\n");
return;
}
strcpy(helpbuf, (argument + 1)); /* strcpy: OK (MAX_INPUT_LENGTH <= MAX_STRING_LENGTH) */
helpbuf[qend - 1] = '\0';
if ((skill = find_skill_num(helpbuf)) <= 0) {
send_to_char(ch, "Unrecognized skill.\r\n");
return;
}
argument += qend + 1; /* skip to next parameter */
argument = one_argument(argument, buf);
if (!*buf) {
send_to_char(ch, "Learned value expected.\r\n");
return;
}
value = atoi(buf);
if (value < 0) {
send_to_char(ch, "Minimum value for learned is 0.\r\n");
return;
}
if (value > 100) {
send_to_char(ch, "Max value for learned is 100.\r\n");
return;
}
if (IS_NPC(vict)) {
send_to_char(ch, "You can't set NPC skills.\r\n");
return;
}
if ((spell_info[skill].min_level[(pc)] >= LVL_IMMORT) && (pl < LVL_IMMORT)) {
send_to_char(ch, "%s cannot be learned by mortals.\r\n", spell_info[skill].name);
return;
} else if (spell_info[skill].min_level[(pc)] > pl) {
send_to_char(ch, "%s is a level %d %s.\r\n", GET_NAME(vict), pl, pc_class_types[pc]);
send_to_char(ch, "The minimum level for %s is %d for %ss.\r\n", spell_info[skill].name, spell_info[skill].min_level[(pc)], pc_class_types[pc]);
}
/* find_skill_num() guarantees a valid spell_info[] index, or -1, and we
* checked for the -1 above so we are safe here. */
SET_SKILL(vict, skill, value);
mudlog(BRF, LVL_IMMORT, TRUE, "%s changed %s's %s to %d.", GET_NAME(ch), GET_NAME(vict), spell_info[skill].name, value);
send_to_char(ch, "You change %s's %s to %d.\r\n", GET_NAME(vict), spell_info[skill].name, value);
}
/* By Michael Buselli. Traverse down the string until the begining of the next
* page has been reached. Return NULL if this is the last page of the string. */
static char *next_page(char *str, struct char_data *ch)

View file

@ -25,8 +25,6 @@ void smash_tilde(char *str);
void parse_at(char *str);
void parse_tab(char *str);
void paginate_string(char *str, struct descriptor_data *d);
/** @todo should this really be in modify.c? */
ACMD(do_skillset);
/* Following function prototypes moved here from comm.h */
void string_write(struct descriptor_data *d, char **txt, size_t len, long mailto, void *data);
void string_add(struct descriptor_data *d, char *str);