|
Races vs. Classes [by Nashak] |
|
|
|
Posted Wednesday, August 12th @ 11:34:46 PM, by George Greer in the Players dept.
Added Dec 3, 1996. Click the link below to read it or download it.
From: Brian Williams <bmw@efn.org>
Subject: Race/Class Restrictions
-=-=-=-=-=-=-=-=-=-
interpreter.c
-=-=-=-=-=-=-=-=-=-
Search for:
int Valid_Name(char *newname);
Below it, add:
int class_ok_race[NUM_RACES][NUM_CLASSES];
extern char *class_display[];
Search for:
int parse_class(char arg);
Change to:
int parse_class(struct char_data *ch, char arg);
Search for:
int is_abbrev(char *arg1, char *arg2)
{
if (!*arg1)
return 0;
for (; *arg1 && *arg2; arg1++, arg2++)
if (LOWER(*arg1) != LOWER(*arg2))
return 0;
if (!*arg1)
return 1;
else
return 0;
}
Below it, add:
void display_classes(struct descriptor_data *d) {
int x;
send_to_char("Class selection menu - please choose a class\r\n---------------
-----\r\n", d->character);
for (x = 0; x < NUM_CLASSES; x++)
if (class_ok_race[(int)GET_RACE(ch)][x]])
send_to_char(class_display[x], d->character);
send_to_char("\nClass: ", d->character);
}
Search for:
SEND_TO_Q(class_menu, d);
SEND_TO_Q("Class: ", d);
Change to:
display_classes(d);
Search for:
load_result = parse_class(*arg);
Change to:
load_result = parse_class(d->character, *arg);
-=-=-=-=-=-=-=-=-=-
class.c
-=-=-=-=-=-=-=-=-=-
Search for:
#include "interpreter.h"
Below it, add:
char *class_display[NUM_CLASSES] = {
"a) Sorcerer\r\n",
"b) Cleric\r\n",
"c) Thief\r\n",
"d) Warrior\r\n"
};
Search for:
const char *pc_class_types[] = {
"Sorcerer",
"Cleric",
"Thief",
"Warrior",
"\n"
};
Below it, add:
#define Y TRUE
#define N FALSE
int class_ok_race[NUM_RACES][NUM_CLASSES] = {
/* S, C, T, W */
/* Human */ { Y, Y, Y, Y },
/* Elf */ { Y, Y, Y, N },
/* Gnome */ { Y, Y, N, Y },
/* Dwarf */ { N, Y, N, Y }
};
Search for:
int parse_class(char arg) {
.....
}
Change to:
int parse_class(struct char_data *ch, char arg) {
int class = CLASS_UNDEFINED;
switch (LOWER(arg)) {
case 'a': class = CLASS_MAGIC_USER; break;
case 'b': class = CLASS_CLERIC ; break;
case 'c': class = CLASS_THIEF
; break;
case 'd': class = CLASS_WARRIOR ; break;
default : class = CLASS_UNDEFINED ; break;
}
if (class >= 0 && class < NUM_CLASSES)
if (!class_ok_race[(int)GET_RACE(ch)][class])
class = CLASS_UNDEFINED;
return (class);
}
Search for:
long find_class_bitvector(char arg)
{
arg = LOWER(arg);
switch (arg) {
case 'm': <--- Change to: case 'a':
return (1 << 0);
break;
case 'c': <--- Change to: case 'b':
return (1 << 1);
break;
case 't': <--- Change to: case 'c':
return (1 << 2);
break;
case 'w': <--- Change to: case 'd':
return (1 << 3);
break;
default:
return 0;
break;
}
}
-=-=-=-=-=-=-=-=-=-
act.wizard.c
-=-=-=-=-=-=-=-=-=-
Search for:
int parse_class(char arg);
Change to:
int parse_class(struct char_data *ch, char arg);
Search for:
if ((i = parse_class(*val_arg)) == CLASS_UNDEFINED) {
Change to:
if ((i = parse_class(vict, *val_arg)) == CLASS_UNDEFINED) {
That's all you need. Simple, eh? Hope this helps... - Nashak
<< Races [by Nashak] | Reply | View as text | Flattened | Recall Command [by Quinn] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|