From beefec1e41cb13833dece662a5d5086f64e27daf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 5 Jan 2015 16:29:09 +0300 Subject: char: allow set gender from char creation dialog. --- src/char/char.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/char/char.c') diff --git a/src/char/char.c b/src/char/char.c index 4b59b67..1a982a8 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -36,6 +36,22 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd) { // ignore char creation disable option const int fd = *fdPtr; + + const uint16 race = RFIFOW(fd, 31); + if (race > max_char_class) + { + chr->creation_failed(fd, 10); + hookStop(); + return; + } + const uint8 sex = RFIFOB(fd, 33); + if (sex > 1 && sex != 99) + { + chr->creation_failed(fd, 11); + hookStop(); + return; + } + const int result = chr->make_new_char_sql(sd, (char*)RFIFOP(fd, 2), 1, 1, 1, 1, 1, 1, RFIFOB(fd, 26), RFIFOW(fd, 27), RFIFOW(fd, 29)); if (result < 0) { @@ -47,14 +63,9 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd) struct mmo_charstatus char_dat; chr->mmo_char_fromsql(result, &char_dat, false); //Only the short data is needed. - const uint16 race = RFIFOW(fd, 31); - if (race > max_char_class) - { - chr->creation_failed(fd, 10); - hookStop(); - return; - } char_dat.class_ = race; + char_dat.sex = sex; + chr->mmo_char_tosql(result, &char_dat); chr->creation_ok(fd, &char_dat); @@ -62,6 +73,6 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd) // add new entry to the chars list sd->found_char[char_dat.slot] = result; // the char_id of the new char } - RFIFOSKIP(fd, 31 + 2); + RFIFOSKIP(fd, 31 + 3); hookStop(); } -- cgit v1.2.3-60-g2f50