From d6c996ae31d1875950783ecf25f055975281150d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 20 Sep 2017 05:16:09 +0300 Subject: Change char server packets for 20170830 and newer clients. --- src/char/char.c | 27 ++++++++++++++++++++------- src/common/mmo.h | 2 +- src/map/clif.c | 4 ++-- 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: -- cgit v1.2.3-70-g09d2