Finished basic race handling
This commit is contained in:
parent
0ec7dd3b79
commit
a922f0812d
@ -45,6 +45,7 @@ void appear(struct char_data *ch);
|
||||
void reset_zone(zone_rnum zone);
|
||||
void roll_real_abils(struct char_data *ch);
|
||||
int parse_class(char arg);
|
||||
int parse_race(char *arg);
|
||||
void run_autowiz(void);
|
||||
|
||||
/* local functions */
|
||||
@ -2171,6 +2172,7 @@ ACMD(do_show)
|
||||
{ "age", LVL_GRGOD, BOTH, NUMBER },
|
||||
{ "height", LVL_GOD, BOTH, NUMBER },
|
||||
{ "weight", LVL_GOD, BOTH, NUMBER }, /* 50 */
|
||||
{ "race", LVL_GRGOD, PC, MISC },
|
||||
{ "\n", 0, BOTH, MISC }
|
||||
};
|
||||
|
||||
@ -2497,6 +2499,15 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode,
|
||||
affect_total(vict);
|
||||
break;
|
||||
|
||||
case 51:
|
||||
if ((i == parse_race(val_arg)) == RACE_UNDEFINED)
|
||||
{
|
||||
send_to_char(ch, "That is not a race.\r\n");
|
||||
return (0);
|
||||
}
|
||||
GET_RACE(vict) = i;
|
||||
break;
|
||||
|
||||
default:
|
||||
send_to_char(ch, "Can't set that!\r\n");
|
||||
return (0);
|
||||
|
2202
src/class.c
2202
src/class.c
File diff suppressed because it is too large
Load Diff
@ -238,6 +238,7 @@ const char *connected_types[] = {
|
||||
"Changing PW 3",
|
||||
"Self-Delete 1",
|
||||
"Self-Delete 2",
|
||||
"Select race",
|
||||
"Disconnecting",
|
||||
"\n"
|
||||
};
|
||||
|
2
src/db.c
2
src/db.c
@ -2217,6 +2217,7 @@ void store_to_char(struct char_file_u *st, struct char_data *ch)
|
||||
|
||||
GET_SEX(ch) = st->sex;
|
||||
GET_CLASS(ch) = st->chclass;
|
||||
GET_RACE(ch) = st->race;
|
||||
GET_LEVEL(ch) = st->level;
|
||||
|
||||
ch->player.short_descr = NULL;
|
||||
@ -2335,6 +2336,7 @@ void char_to_store(struct char_data *ch, struct char_file_u *st)
|
||||
st->height = GET_HEIGHT(ch);
|
||||
st->sex = GET_SEX(ch);
|
||||
st->chclass = GET_CLASS(ch);
|
||||
st->race = GET_RACE(ch);
|
||||
st->level = GET_LEVEL(ch);
|
||||
st->abilities = ch->real_abils;
|
||||
st->points = ch->points;
|
||||
|
@ -29,6 +29,7 @@ extern room_rnum r_mortal_start_room;
|
||||
extern room_rnum r_immort_start_room;
|
||||
extern room_rnum r_frozen_start_room;
|
||||
extern const char *class_menu;
|
||||
extern const char *race_menu;
|
||||
extern char *motd;
|
||||
extern char *imotd;
|
||||
extern char *background;
|
||||
@ -46,6 +47,7 @@ void echo_on(struct descriptor_data *d);
|
||||
void echo_off(struct descriptor_data *d);
|
||||
void do_start(struct char_data *ch);
|
||||
int parse_class(char arg);
|
||||
int parse_race(char *arg);
|
||||
int special(struct char_data *ch, int cmd, char *arg);
|
||||
int isbanned(char *hostname);
|
||||
int Valid_Name(char *newname);
|
||||
@ -1511,6 +1513,19 @@ void nanny(struct descriptor_data *d, char *arg)
|
||||
return;
|
||||
}
|
||||
|
||||
write_to_output(d, "%s\r\nRace: ", race_menu);
|
||||
STATE(d) = CON_QRACE;
|
||||
break;
|
||||
case CON_QRACE:
|
||||
load_result = parse_race(arg);
|
||||
if (load_result == RACE_UNDEFINED)
|
||||
{
|
||||
write_to_output(d, "\r\nThat's not a race.\r\nRace: ");
|
||||
return;
|
||||
}
|
||||
else
|
||||
GET_RACE(d->character) = load_result;
|
||||
|
||||
write_to_output(d, "%s\r\nClass: ", class_menu);
|
||||
STATE(d) = CON_QCLASS;
|
||||
break;
|
||||
|
39
src/races.c
39
src/races.c
@ -1,5 +1,7 @@
|
||||
#include "sysdep.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
#include "interpreter.h"
|
||||
#include "utils.h"
|
||||
@ -20,30 +22,27 @@ const char *pc_race_types[] = {
|
||||
|
||||
const char *race_menu = "\r\n"
|
||||
"Select race:\r\n"
|
||||
"(1) Haoon\r\n"
|
||||
"(2) Utnir\r\n"
|
||||
"(3) Duaron\r\n";
|
||||
"( 1) Haoon\r\n"
|
||||
"( 2) Utnir\r\n"
|
||||
"( 3) Duaron\r\n";
|
||||
|
||||
int
|
||||
parse_race(char arg)
|
||||
parse_race(char *arg)
|
||||
{
|
||||
arg = LOWER(arg);
|
||||
|
||||
switch (arg)
|
||||
if (strcmp(arg, "1") == 0)
|
||||
{
|
||||
case '1':
|
||||
return RACE_HAOON;
|
||||
break;
|
||||
case '2':
|
||||
return RACE_UTNIR;
|
||||
break;
|
||||
case '3':
|
||||
return RACE_DUARON;
|
||||
break;
|
||||
default:
|
||||
return RACE_UNDEFINED;
|
||||
break;
|
||||
return RACE_HAOON;
|
||||
}
|
||||
else if (strcmp(arg, "2") == 0)
|
||||
{
|
||||
return RACE_UTNIR;
|
||||
}
|
||||
else if (strcmp(arg, "3") == 0)
|
||||
{
|
||||
return RACE_DUARON;
|
||||
}
|
||||
|
||||
return RACE_UNDEFINED;
|
||||
}
|
||||
|
||||
long
|
||||
|
Loading…
Reference in New Issue
Block a user