From d64c4227eba0d93267b1bd85af009018d872e554 Mon Sep 17 00:00:00 2001 From: Protimus Date: Sun, 11 Mar 2012 05:28:50 +0000 Subject: * Added packets for clients 2012-03-07+ Not is recommended use this version yet, there are small packets structures to do changes. * Added support for packet 0x970. New schema of character creation. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15675 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char/char.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/char') diff --git a/src/char/char.c b/src/char/char.c index a6e5d39c8..fb413be82 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1320,8 +1320,14 @@ int check_char_name(char * name, char * esc_name) //----------------------------------- // Function to create a new character //----------------------------------- +#if PACKETVER >= 20120307 +int make_new_char_sql(struct char_session_data* sd, char* name_, int slot, int hair_color, int hair_style) +{ + int str = 5, agi = 5, vit = 5, int_ = 5, dex = 5,luk = 5; +#else int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style) { +#endif char name[NAME_LENGTH]; char esc_name[NAME_LENGTH*2+1]; int char_id, flag; @@ -1335,10 +1341,14 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag return flag; //check other inputs +#if PACKETVER >= 20120307 + if(slot >= MAX_CHARS) +#else if((slot >= MAX_CHARS) // slots || (str + agi + vit + int_ + dex + luk != 6*5 ) // stats || (str < 1 || str > 9 || agi < 1 || agi > 9 || vit < 1 || vit > 9 || int_ < 1 || int_ > 9 || dex < 1 || dex > 9 || luk < 1 || luk > 9) // individual stat values || (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) // pairs +#endif return -2; // invalid input // check the number of already existing chars in this account @@ -3672,14 +3682,24 @@ int parse_char(int fd) break; // create new char +#if PACKETVER >= 20120307 + // S 0970 .24B .B .W .W + case 0x970: + FIFOSD_CHECK(31); +#else // S 0067 .24B .B .B .B .B .B .B .B .W .W case 0x67: FIFOSD_CHECK(37); +#endif if( !char_new ) //turn character creation on/off [Kevin] i = -2; else +#if PACKETVER >= 20120307 + i = make_new_char_sql(sd, (char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29)); +#else i = make_new_char_sql(sd, (char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35)); +#endif //'Charname already exists' (-1), 'Char creation denied' (-2) and 'You are underaged' (-3) if (i < 0) @@ -3711,8 +3731,11 @@ int parse_char(int fd) if( ch < MAX_CHARS ) sd->found_char[ch] = i; // the char_id of the new char } - +#if PACKETVER >= 20120307 + RFIFOSKIP(fd,31); +#else RFIFOSKIP(fd,37); +#endif break; // delete char -- cgit v1.2.3-60-g2f50