summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-19 18:19:09 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-19 18:19:09 +0000
commit30c8d7704026aa450b64997c2996ee8d9d4f2cec (patch)
treedae267b2e016111da192de4dbf67679878e73409 /src/char_sql
parent620ea0643c3bcbfed5dd7c84e8d65fc8941997a7 (diff)
downloadhercules-30c8d7704026aa450b64997c2996ee8d9d4f2cec.tar.gz
hercules-30c8d7704026aa450b64997c2996ee8d9d4f2cec.tar.bz2
hercules-30c8d7704026aa450b64997c2996ee8d9d4f2cec.tar.xz
hercules-30c8d7704026aa450b64997c2996ee8d9d4f2cec.zip
- Applied the renewal client support patch from Diablo (eA forum topic 222623)
- Added support for strcharinfo(3) to retrieve the player's map - Added script command "searchitem" for name item searches. - Moved PACKETVER to src/common/mmo.h as it's needed by the char-server now - Changed the status valX from int to long so that it won't break for pointer-storage in other architectures. - Moved the change party leader code to party.c - A few bugfixes or packet field completions based on my past experience messing around with my server. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14155 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/char.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 85e7d83c0..ee1e08bdb 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -132,7 +132,6 @@ struct char_session_data {
char new_name[NAME_LENGTH];
};
-int char_num, char_max;
int max_connect_user = 0;
int gm_allow_level = 99;
int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
@@ -811,6 +810,7 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit
return 0;
}
+#define MAX_CHAR_BUF 110 //Max size (for WFIFOHEAD calls)
int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p);
#ifndef TXT_SQL_CONVERT
@@ -1538,14 +1538,16 @@ int count_users(void)
/// Writes char data to the buffer in the format used by the client.
/// Used in packets 0x6b (chars info) and 0x6d (new char info)
-/// Returns the size (106 or 108)
-int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p)
+// Returns the size
+int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p)
{
- int size = 106;
+ unsigned short offset = 0;
+ uint8* buf;
- if( buf == NULL || p == NULL )
+ if( buffer == NULL || p == NULL )
return 0;
+ buf = WBUFP(buffer,0);
WBUFL(buf,0) = p->char_id;
WBUFL(buf,4) = min(p->base_exp, LONG_MAX);
WBUFL(buf,8) = p->zeny;
@@ -1557,8 +1559,15 @@ int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p)
WBUFL(buf,32) = p->karma;
WBUFL(buf,36) = p->manner;
WBUFW(buf,40) = min(p->status_point, SHRT_MAX);
+#if PACKETVER > 20081217
+ WBUFL(buf,42) = p->hp;
+ WBUFL(buf,46) = p->max_hp;
+ offset+=4;
+ buf = WBUFP(buffer,offset);
+#else
WBUFW(buf,42) = min(p->hp, SHRT_MAX);
WBUFW(buf,44) = min(p->max_hp, SHRT_MAX);
+#endif
WBUFW(buf,46) = min(p->sp, SHRT_MAX);
WBUFW(buf,48) = min(p->max_sp, SHRT_MAX);
WBUFW(buf,50) = DEFAULT_WALK_SPEED; // p->speed;
@@ -1583,10 +1592,9 @@ int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p)
WBUFW(buf,104) = p->slot;
#if PACKETVER >= 20061023
WBUFW(buf,106) = ( p->rename > 0 ) ? 0 : 1;
- size += 2;
+ offset+=2;
#endif
-
- return size;
+ return 106+offset;
}
int mmo_char_send006b(int fd, struct char_session_data* sd)
@@ -1597,7 +1605,7 @@ int mmo_char_send006b(int fd, struct char_session_data* sd)
ShowInfo("Loading Char Data ("CL_BOLD"%d"CL_RESET")\n",sd->account_id);
j = 24; // offset
- WFIFOHEAD(fd,j + MAX_CHARS*108); // or 106(!)
+ WFIFOHEAD(fd,j + MAX_CHARS*MAX_CHAR_BUF);
WFIFOW(fd,0) = 0x6b;
memset(WFIFOP(fd,4), 0, 20); // unknown bytes
j+=mmo_chars_fromsql(sd, WFIFOP(fd,j));
@@ -3204,7 +3212,7 @@ int parse_char(int fd)
mmo_char_fromsql(i, &char_dat, false); //Only the short data is needed.
// send to player
- WFIFOHEAD(fd,110);
+ WFIFOHEAD(fd,2+MAX_CHAR_BUF);
WFIFOW(fd,0) = 0x6d;
len = 2 + mmo_char_tobuf(WFIFOP(fd,2), &char_dat);
WFIFOSET(fd,len);
@@ -3345,6 +3353,28 @@ int parse_char(int fd)
}
break;
+ // captcha code request (not implemented)
+ // R 07e5 <?>.w <aid>.l
+ case 0x7e5:
+ WFIFOHEAD(fd,5);
+ WFIFOW(fd,0) = 0x7e9;
+ WFIFOW(fd,2) = 5;
+ WFIFOB(fd,4) = 1;
+ WFIFOSET(fd,5);
+ RFIFOSKIP(fd,8);
+ break;
+
+ // captcha code check (not implemented)
+ // R 07e7 <len>.w <aid>.l <code>.b10 <?>.b14
+ case 0x7e7:
+ WFIFOHEAD(fd,5);
+ WFIFOW(fd,0) = 0x7e9;
+ WFIFOW(fd,2) = 5;
+ WFIFOB(fd,4) = 1;
+ WFIFOSET(fd,5);
+ RFIFOSKIP(fd,32);
+ break;
+
// log in as map-server
case 0x2af8:
if (RFIFOREST(fd) < 60)