summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-20 05:16:09 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-21 20:21:20 +0300
commitd6c996ae31d1875950783ecf25f055975281150d (patch)
treed614b936df1bab97483ed801297be6f696662ded
parent7cbd35644b73f254fc976070cd1e993aa43a7cfc (diff)
downloadhercules-d6c996ae31d1875950783ecf25f055975281150d.tar.gz
hercules-d6c996ae31d1875950783ecf25f055975281150d.tar.bz2
hercules-d6c996ae31d1875950783ecf25f055975281150d.tar.xz
hercules-d6c996ae31d1875950783ecf25f055975281150d.zip
Change char server packets for 20170830 and newer clients.
-rw-r--r--src/char/char.c27
-rw-r--r--src/common/mmo.h2
-rw-r--r--src/map/clif.c4
3 files changed, 23 insertions, 10 deletions
diff --git a/src/char/char.c b/src/char/char.c
index fc2f28997..78b2d19fa 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -476,7 +476,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p)
opt |= OPT_SHOW_EQUIP;
if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d',"
- "`base_exp`='%u', `job_exp`='%u', `zeny`='%d',"
+ "`base_exp`='%"PRIu64"', `job_exp`='%"PRIu64"', `zeny`='%d',"
"`max_hp`='%d',`hp`='%d',`max_sp`='%d',`sp`='%d',`status_point`='%d',`skill_point`='%d',"
"`str`='%d',`agi`='%d',`vit`='%d',`int`='%d',`dex`='%d',`luk`='%d',"
"`option`='%u',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d',"
@@ -1072,8 +1072,8 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p.base_level, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p.job_level, 0, NULL, NULL)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, NULL, NULL)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p.job_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT64, &p.base_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT64, &p.job_exp, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, NULL, NULL)
@@ -1181,8 +1181,8 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p->base_level, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_INT, &p->job_level, 0, NULL, NULL)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, NULL, NULL)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT, &p->job_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT64, &p->base_exp, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT64, &p->job_exp, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, NULL, NULL)
@@ -1909,10 +1909,23 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) {
return 0;
buf = WBUFP(buffer,0);
+
WBUFL(buf,0) = p->char_id;
- WBUFL(buf,4) = min(p->base_exp, INT32_MAX);
+#if PACKETVER >= 20170830
+ WBUFQ(buf,4) = min(p->base_exp, INT64_MAX);
+ offset += 4;
+ buf = WBUFP(buffer, offset);
+#else
+ WBUFL(buf,4) = min((uint32)(p->base_exp), INT32_MAX);
+#endif
WBUFL(buf,8) = p->zeny;
- WBUFL(buf,12) = min(p->job_exp, INT32_MAX);
+#if PACKETVER >= 20170830
+ WBUFQ(buf,12) = min(p->job_exp, INT64_MAX);
+ offset += 4;
+ buf = WBUFP(buffer, offset);
+#else
+ WBUFL(buf,12) = min((uint32)(p->job_exp), INT32_MAX);
+#endif
WBUFL(buf,16) = p->job_level;
WBUFL(buf,20) = 0; // probably opt1
WBUFL(buf,24) = 0; // probably opt2
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 85e0a83ae..fe67d6efb 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -593,7 +593,7 @@ struct mmo_charstatus {
int mother;
int child;
- unsigned int base_exp,job_exp;
+ uint64 base_exp, job_exp;
int zeny;
int bank_vault;
diff --git a/src/map/clif.c b/src/map/clif.c
index 5454bed2d..171e0c71e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -3035,12 +3035,12 @@ void clif_updatestatus(struct map_session_data *sd,int type)
break;
case SP_BASEEXP:
WFIFOW(fd,0)=0xb1;
- WFIFOL(fd,4)=sd->status.base_exp;
+ WFIFOL(fd,4)=(uint32)(sd->status.base_exp);
len = packet_len(0xb1);
break;
case SP_JOBEXP:
WFIFOW(fd,0)=0xb1;
- WFIFOL(fd,4)=sd->status.job_exp;
+ WFIFOL(fd,4)=(uint32)(sd->status.job_exp);
len = packet_len(0xb1);
break;
case SP_NEXTBASEEXP: