summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c25
1 files changed, 24 insertions, 1 deletions
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 <name>.24B <slot>.B <hair color>.W <hair style>.W
+ case 0x970:
+ FIFOSD_CHECK(31);
+#else
// S 0067 <name>.24B <str>.B <agi>.B <vit>.B <int>.B <dex>.B <luk>.B <slot>.B <hair color>.W <hair style>.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