From e444270b0a9aa0e5038b2dcebd2b06e3eb8ace0f Mon Sep 17 00:00:00 2001 From: Napster Date: Fri, 28 Aug 2015 16:27:34 +0700 Subject: [PATCH] Follow up to 53868d5 * Fixed #600, Hotkey Rotate Packet Implemented, Thank You @dastgir Credits : Hercules https://github.com/HerculesWS/Hercules/commit/2b4b33b06a964e83bf5df9f7f0b795ddf76f9dd0 --- db/packet_db.txt | 5 +++-- sql-files/main.sql | 1 + sql-files/upgrades/upgrade_20150828.sql | 1 + src/char/char.c | 13 +++++++++---- src/common/mmo.h | 2 ++ src/map/clif.c | 12 ++++++++++++ 6 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 sql-files/upgrades/upgrade_20150828.sql diff --git a/db/packet_db.txt b/db/packet_db.txt index 10a11ba5dd..53d2f91b4f 100644 --- a/db/packet_db.txt +++ b/db/packet_db.txt @@ -2361,9 +2361,10 @@ packet_keys: 0x2DFF467C,0x444B37EE,0x2C1B634F // [YomRawr] 0x0364,5,hommenu,2:4 0x0936,36,storagepassword,0 0x09DF,7 -0x0a00,269 +0x0A00,269 +0x0A01,3,hotkeyrowshift,2 + // Roulette System [Yommy] -0x0A01,3,rouletteopen,0 0x0A19,2,rouletteopen,0 // HEADER_CZ_REQ_OPEN_ROULETTE 0x0A1A,23 // HEADER_ZC_ACK_OPEN_ROULETTE 0x0A1B,2,rouletteinfo,0 // HEADER_CZ_REQ_ROULETTE_INFO diff --git a/sql-files/main.sql b/sql-files/main.sql index d69e1fc505..6aeb6062fe 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -126,6 +126,7 @@ CREATE TABLE IF NOT EXISTS `char` ( `font` tinyint(3) unsigned NOT NULL default '0', `uniqueitem_counter` int(11) unsigned NOT NULL default '0', `sex` ENUM('M','F','U') NOT NULL default 'U', + `hotkey_rowshift` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`char_id`), UNIQUE KEY `name_key` (`name`), KEY `account_id` (`account_id`), diff --git a/sql-files/upgrades/upgrade_20150828.sql b/sql-files/upgrades/upgrade_20150828.sql new file mode 100644 index 0000000000..dce17b39e5 --- /dev/null +++ b/sql-files/upgrades/upgrade_20150828.sql @@ -0,0 +1 @@ +ALTER TABLE `char` ADD COLUMN `hotkey_rowshift` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'; \ No newline at end of file diff --git a/src/char/char.c b/src/char/char.c index 0a48fc1b67..52544423cc 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -328,7 +328,8 @@ int char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p){ (p->ele_id != cp->ele_id) || (p->shield != cp->shield) || (p->head_top != cp->head_top) || (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->delete_date != cp->delete_date) || (p->rename != cp->rename) || (p->robe != cp->robe) || (p->character_moves != cp->character_moves) || - (p->unban_time != cp->unban_time) || (p->font != cp->font) || (p->uniqueitem_counter != cp->uniqueitem_counter) + (p->unban_time != cp->unban_time) || (p->font != cp->font) || (p->uniqueitem_counter != cp->uniqueitem_counter) || + (p->hotkey_rowshift != cp->hotkey_rowshift) ) { //Save status if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `base_level`='%d', `job_level`='%d'," @@ -338,7 +339,8 @@ int char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p){ "`option`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d',`homun_id`='%d',`elemental_id`='%d'," "`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," - "`delete_date`='%lu',`robe`='%d',`moves`='%d',`font`='%u',`uniqueitem_counter`='%u'" + "`delete_date`='%lu',`robe`='%d',`moves`='%d',`font`='%u',`uniqueitem_counter`='%u'," + "`hotkey_rowshift`='%d'" " WHERE `account_id`='%d' AND `char_id` = '%d'", schema_config.char_db, p->base_level, p->job_level, p->base_exp, p->job_exp, p->zeny, @@ -350,6 +352,7 @@ int char_mmo_char_tosql(uint32 char_id, struct mmo_charstatus* p){ mapindex_id2name(p->save_point.map), p->save_point.x, p->save_point.y, p->rename, (unsigned long)p->delete_date, // FIXME: platform-dependent size p->robe,p->character_moves,p->font, p->uniqueitem_counter, + p->hotkey_rowshift, p->account_id, p->char_id) ) { Sql_ShowDebug(sql_handle); @@ -919,7 +922,7 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) { "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," "`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," - "`robe`,`moves`,`unban_time`,`font`,`uniqueitem_counter`,`sex`" + "`robe`,`moves`,`unban_time`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", schema_config.char_db, sd->account_id, MAX_CHARS) || SQL_ERROR == SqlStmt_Execute(stmt) || SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL) @@ -963,6 +966,7 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) { || SQL_ERROR == SqlStmt_BindColumn(stmt, 38, SQLDT_UCHAR, &p.font, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 39, SQLDT_UINT, &p.uniqueitem_counter, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 40, SQLDT_ENUM, &sex, sizeof(sex), NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 41, SQLDT_UCHAR, &p.hotkey_rowshift, 0, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); @@ -1028,7 +1032,7 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," "`hair_color`,`clothes_color`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`, `moves`," - "`unban_time`,`font`,`uniqueitem_counter`,`sex`" + "`unban_time`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" " FROM `%s` WHERE `char_id`=? LIMIT 1", schema_config.char_db) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0) || SQL_ERROR == SqlStmt_Execute(stmt) @@ -1089,6 +1093,7 @@ int char_mmo_char_fromsql(uint32 char_id, struct mmo_charstatus* p, bool load_ev || SQL_ERROR == SqlStmt_BindColumn(stmt, 54, SQLDT_UCHAR, &p->font, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 55, SQLDT_UINT, &p->uniqueitem_counter, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 56, SQLDT_ENUM, &sex, sizeof(sex), NULL, NULL) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 57, SQLDT_UCHAR, &p->hotkey_rowshift, 0, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); diff --git a/src/common/mmo.h b/src/common/mmo.h index e34fd2ba61..2d7ed7c5a3 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -431,6 +431,8 @@ struct mmo_charstatus { bool cashshop_sent; // Whether the player has received the CashShop list uint32 uniqueitem_counter; + + unsigned char hotkey_rowshift; }; typedef enum mail_status { diff --git a/src/map/clif.c b/src/map/clif.c index 5cbec48885..863d4aacd7 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10146,6 +10146,7 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) /// 02b9 { .B .L .W }*27 (ZC_SHORTCUT_KEY_LIST) /// 07d9 { .B .L .W }*36 (ZC_SHORTCUT_KEY_LIST_V2, PACKETVER >= 20090603) /// 07d9 { .B .L .W }*38 (ZC_SHORTCUT_KEY_LIST_V2, PACKETVER >= 20090617) +/// 0a00 .B { .B .L .W }*38 (ZC_SHORTCUT_KEY_LIST_V3, PACKETVER >= 20141022) void clif_hotkeys_send(struct map_session_data *sd) { #ifdef HOTKEY_SAVING const int fd = sd->fd; @@ -10156,12 +10157,16 @@ void clif_hotkeys_send(struct map_session_data *sd) { #elif PACKETVER < 20141022 const int cmd = 0x7d9; #else + char Rotate = sd->status.hotkey_rowshift; const int cmd = 0xa00; offset = 3; #endif if (!fd) return; WFIFOHEAD(fd, offset + MAX_HOTKEYS * 7); WFIFOW(fd, 0) = cmd; +#if PACKETVER >= 20141022 + WFIFOB(fd, 2) = Rotate; +#endif for(i = 0; i < MAX_HOTKEYS; i++) { WFIFOB(fd, offset + 0 + i * 7) = sd->status.hotkeys[i].type; // type: 0: item, 1: skill WFIFOL(fd, offset + 1 + i * 7) = sd->status.hotkeys[i].id; // item or skill ID @@ -10171,6 +10176,11 @@ void clif_hotkeys_send(struct map_session_data *sd) { #endif } +/// Request to update a position on the hotkey row bar +void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) { + int cmd = RFIFOW(fd, 0); + sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[sd->packet_ver][cmd].pos[0]); +} /// Request to update a position on the hotkey bar (CZ_SHORTCUT_KEY_CHANGE). /// 02ba .W .B .L .W @@ -18871,6 +18881,8 @@ void packetdb_readdb(bool reload) // Merge Item { clif_parse_merge_item_req, "mergeitem_req"}, { clif_parse_merge_item_cancel, "mergeitem_cancel"}, + // HotkeyRowShift + { clif_parse_HotkeyRowShift, "hotkeyrowshift"}, {NULL,NULL} }; struct {