diff options
author | Guilherme Menaldo <guilherme.menaldo@outlook.com> | 2019-10-05 18:59:25 -0300 |
---|---|---|
committer | Guilherme Menaldo <guilherme.menaldo@outlook.com> | 2019-10-06 21:54:53 -0300 |
commit | 2ce755870486262f8d147565f8df70ec608a3974 (patch) | |
tree | 77e2661d7d3141789722bf13ca3f4c5fd904531a /src/char | |
parent | 6766e7327eae2d37dcd719528fc1155938800fcc (diff) | |
download | hercules-2ce755870486262f8d147565f8df70ec608a3974.tar.gz hercules-2ce755870486262f8d147565f8df70ec608a3974.tar.bz2 hercules-2ce755870486262f8d147565f8df70ec608a3974.tar.xz hercules-2ce755870486262f8d147565f8df70ec608a3974.zip |
Updates status changes to also keep their total time
- This allows clients to continue the "timer" display after you login
again
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/char/char.c b/src/char/char.c index c5afc0f63..37db77300 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -3149,7 +3149,7 @@ static void char_parse_frommap_map_names(int fd, int id) static void char_send_scdata(int fd, int aid, int cid) { #ifdef ENABLE_SC_SAVING - if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `val1`, `val2`, `val3`, `val4` " + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `type`, `tick`, `total_tick`, `val1`, `val2`, `val3`, `val4` " "FROM `%s` WHERE `account_id` = '%d' AND `char_id`='%d'", scdata_db, aid, cid) ) { @@ -3170,10 +3170,11 @@ static void char_send_scdata(int fd, int aid, int cid) { SQL->GetData(inter->sql_handle, 0, &data, NULL); scdata.type = atoi(data); SQL->GetData(inter->sql_handle, 1, &data, NULL); scdata.tick = atoi(data); - SQL->GetData(inter->sql_handle, 2, &data, NULL); scdata.val1 = atoi(data); - SQL->GetData(inter->sql_handle, 3, &data, NULL); scdata.val2 = atoi(data); - SQL->GetData(inter->sql_handle, 4, &data, NULL); scdata.val3 = atoi(data); - SQL->GetData(inter->sql_handle, 5, &data, NULL); scdata.val4 = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); scdata.total_tick = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); scdata.val1 = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); scdata.val2 = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); scdata.val3 = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); scdata.val4 = atoi(data); memcpy(WFIFOP(fd, 14+count*sizeof(struct status_change_data)), &scdata, sizeof(struct status_change_data)); } if (count >= 50) @@ -3743,14 +3744,14 @@ static void char_parse_frommap_save_status_change_data(int fd) int i; StrBuf->Init(&buf); - StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); + StrBuf->Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `type`, `tick`, `total_tick`, `val1`, `val2`, `val3`, `val4`) VALUES ", scdata_db); for( i = 0; i < count; ++i ) { memcpy (&data, RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data)); if( i > 0 ) StrBuf->AppendStr(&buf, ", "); - StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d')", aid, cid, - data.type, data.tick, data.val1, data.val2, data.val3, data.val4); + StrBuf->Printf(&buf, "('%d','%d','%hu','%d','%d','%d','%d','%d','%d')", aid, cid, + data.type, data.tick, data.total_tick, data.val1, data.val2, data.val3, data.val4); } if( SQL_ERROR == SQL->QueryStr(inter->sql_handle, StrBuf->Value(&buf)) ) Sql_ShowDebug(inter->sql_handle); @@ -3883,9 +3884,9 @@ static void char_parse_frommap_scdata_update(int fd) short type = RFIFOW(fd, 10); if (SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s`" - " (`account_id`,`char_id`,`type`,`tick`,`val1`,`val2`,`val3`,`val4`)" - " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d')", - scdata_db, account_id, char_id, type, INFINITE_DURATION, val1, val2, val3, val4) + " (`account_id`,`char_id`,`type`,`tick`,`total_tick`,`val1`,`val2`,`val3`,`val4`)" + " VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d')", + scdata_db, account_id, char_id, type, INFINITE_DURATION, INFINITE_DURATION, val1, val2, val3, val4) ) { Sql_ShowDebug(inter->sql_handle); } |