diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-04 17:53:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-04 17:56:38 +0300 |
commit | b83f07275fb87c61f4664a384f3de2a4938ab76c (patch) | |
tree | 39ee2247bc8d4934df5c8d5ecfc1e317c7aef35c /src | |
parent | 0cff16e9883c633d8ef21228ec2991e53da54cd7 (diff) | |
download | evol-hercules-b83f07275fb87c61f4664a384f3de2a4938ab76c.tar.gz evol-hercules-b83f07275fb87c61f4664a384f3de2a4938ab76c.tar.bz2 evol-hercules-b83f07275fb87c61f4664a384f3de2a4938ab76c.tar.xz evol-hercules-b83f07275fb87c61f4664a384f3de2a4938ab76c.zip |
add support for race selection in char creation packet.
Change server version to 4.
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 28 | ||||
-rw-r--r-- | src/char/char.h | 2 | ||||
-rw-r--r-- | src/char/init.c | 1 | ||||
-rw-r--r-- | src/login/send.c | 2 |
4 files changed, 32 insertions, 1 deletions
diff --git a/src/char/char.c b/src/char/char.c index ffb093f..fcb4535 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -31,3 +31,31 @@ void echar_parse_char_login_map_server(int *fd) hookStop(); } } + +void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd) +{ + // ignore char creation disable option + const int fd = *fdPtr; + 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) + { + chr->creation_failed(fd, result); + } + else + { + // retrieve data + 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); + char_dat.class_ = race; + chr->mmo_char_tosql(result, &char_dat); + + chr->creation_ok(fd, &char_dat); + + // 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); + hookStop(); +} diff --git a/src/char/char.h b/src/char/char.h index f1be161..2ebbdb3 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -6,4 +6,6 @@ void echar_parse_char_login_map_server(int *fd); +void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd); + #endif // EVOL_CHAR_CHAR diff --git a/src/char/init.c b/src/char/init.c index 64f6a29..5193101 100644 --- a/src/char/init.c +++ b/src/char/init.c @@ -60,6 +60,7 @@ HPExport void plugin_init (void) mapif = GET_SYMBOL("mapif"); addHookPre("chr->parse_char_login_map_server", echar_parse_char_login_map_server); + addHookPre("chr->parse_char_create_new_char", echar_parse_char_create_new_char); } HPExport void server_preinit (void) diff --git a/src/login/send.c b/src/login/send.c index 7bc08e4..937ce85 100644 --- a/src/login/send.c +++ b/src/login/send.c @@ -21,7 +21,7 @@ void send_server_version(int fd) WFIFOW(fd, 0) = 0x7531; WFIFOW(fd, 2) = 4 + 8; WFIFOL(fd, 4) = 0; // unused - WFIFOL(fd, 8) = 3; // server version + WFIFOL(fd, 8) = 4; // server version WFIFOSET(fd, WFIFOW(fd,2)); } |