From 70b5e954990b857946d81750263bcf11b06414ce Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 9 May 2019 18:12:01 +0300 Subject: Use separate field hotkey_rowshift for each hotkeys group --- sql-files/main.sql | 2 ++ sql-files/upgrades/2019-05-09--18-07.sql | 22 ++++++++++++++++++++++ sql-files/upgrades/index.txt | 1 + src/char/char.c | 21 +++++++++++---------- src/common/mmo.h | 1 + src/map/clif.c | 11 ++++++++--- 6 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 sql-files/upgrades/2019-05-09--18-07.sql diff --git a/sql-files/main.sql b/sql-files/main.sql index 241efd39b..e364ec778 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -241,6 +241,7 @@ CREATE TABLE IF NOT EXISTS `char` ( `uniqueitem_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', `sex` ENUM('M','F','U') NOT NULL DEFAULT 'U', `hotkey_rowshift` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `hotkey_rowshift2` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', `attendance_count` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', `attendance_timer` BIGINT(20) NULL DEFAULT '0', `title_id` INT(11) UNSIGNED NOT NULL DEFAULT '0', @@ -928,6 +929,7 @@ INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1544738447); -- 2018-12-1 INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1546059075); -- 2018-12-29--07-51.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1554760320); -- 2019-04-08--21-52.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1556147483); -- 2019-04-25--02-12.sql +INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1557414445); -- 2019-05-09--18-07.sql -- -- Table structure for table `storage` diff --git a/sql-files/upgrades/2019-05-09--18-07.sql b/sql-files/upgrades/2019-05-09--18-07.sql new file mode 100644 index 000000000..96d80c29c --- /dev/null +++ b/sql-files/upgrades/2019-05-09--18-07.sql @@ -0,0 +1,22 @@ +#1557414445 + +-- This file is part of Hercules. +-- http://herc.ws - http://github.com/HerculesWS/Hercules +-- +-- Copyright (C) 2015 Hercules Dev Team +-- +-- Hercules is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +ALTER TABLE `char` ADD COLUMN `hotkey_rowshift2` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `hotkey_rowshift`; +INSERT INTO `sql_updates` (`timestamp`) VALUES (1557414445); diff --git a/sql-files/upgrades/index.txt b/sql-files/upgrades/index.txt index a820f3b0d..3025a728c 100644 --- a/sql-files/upgrades/index.txt +++ b/sql-files/upgrades/index.txt @@ -54,3 +54,4 @@ 2018-12-29--07-51.sql 2019-04-08--21-52.sql 2019-04-25--02-12.sql +2019-05-09--18-07.sql diff --git a/src/char/char.c b/src/char/char.c index 81856a25d..cad28b373 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -477,7 +477,7 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) (p->look.head_mid != cp->look.head_mid) || (p->look.head_bottom != cp->look.head_bottom) || (p->delete_date != cp->delete_date) || (p->rename != cp->rename) || (p->slotchange != cp->slotchange) || (p->look.robe != cp->look.robe) || (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || - (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) || + (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) || (p->hotkey_rowshift2 != cp->hotkey_rowshift2) || (p->clan_id != cp->clan_id) || (p->last_login != cp->last_login) || (p->attendance_count != cp->attendance_count) || (p->attendance_timer != cp->attendance_timer) || (p->title_id != cp->title_id) || (p->inventorySize != cp->inventorySize) || (p->allow_call != cp->allow_call) @@ -507,7 +507,7 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) "`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',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," - "`hotkey_rowshift`='%d',`clan_id`='%d',`last_login`='%"PRId64"',`attendance_count`='%d',`attendance_timer`='%"PRId64"'," + "`hotkey_rowshift`='%d',`hotkey_rowshift2`='%d',`clan_id`='%d',`last_login`='%"PRId64"',`attendance_count`='%d',`attendance_timer`='%"PRId64"'," "`title_id`='%d', `inventory_size`='%d'" " WHERE `account_id`='%d' AND `char_id` = '%d'", char_db, p->base_level, p->job_level, @@ -520,7 +520,7 @@ static int char_mmo_char_tosql(int 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->look.robe,p->slotchange,opt,p->font,p->uniqueitem_counter, - p->hotkey_rowshift,p->clan_id,p->last_login, p->attendance_count, p->attendance_timer, + p->hotkey_rowshift,p->hotkey_rowshift2,p->clan_id,p->last_login, p->attendance_count, p->attendance_timer, p->title_id, p->inventorySize, p->account_id, p->char_id) ) { @@ -1215,7 +1215,7 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa "`status_point`,`skill_point`,`option`,`karma`,`manner`,`party_id`,`guild_id`,`pet_id`,`homun_id`,`elemental_id`,`hair`," "`hair_color`,`clothes_color`,`body`,`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`,`slotchange`," - "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`,`clan_id`,`last_login`, `attendance_count`, `attendance_timer`," + "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`,`hotkey_rowshift2`,`clan_id`,`last_login`, `attendance_count`, `attendance_timer`," "`title_id`, `inventory_size`" " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, sizeof char_id) @@ -1279,12 +1279,13 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa || SQL_ERROR == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT32, &p->uniqueitem_counter, sizeof p->uniqueitem_counter, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof sex, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, sizeof p->hotkey_rowshift, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 59, SQLDT_INT, &p->clan_id, sizeof p->clan_id, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 60, SQLDT_INT64, &p->last_login, sizeof p->last_login, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 61, SQLDT_SHORT, &p->attendance_count, sizeof p->attendance_count, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 62, SQLDT_INT64, &p->attendance_timer, sizeof p->attendance_timer, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 63, SQLDT_INT, &p->title_id, sizeof p->title_id, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 64, SQLDT_INT, &p->inventorySize, sizeof p->inventorySize, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 59, SQLDT_UCHAR, &p->hotkey_rowshift2, sizeof p->hotkey_rowshift2, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 60, SQLDT_INT, &p->clan_id, sizeof p->clan_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 61, SQLDT_INT64, &p->last_login, sizeof p->last_login, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 62, SQLDT_SHORT, &p->attendance_count, sizeof p->attendance_count, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 63, SQLDT_INT64, &p->attendance_timer, sizeof p->attendance_timer, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 64, SQLDT_INT, &p->title_id, sizeof p->title_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 65, SQLDT_INT, &p->inventorySize, sizeof p->inventorySize, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); diff --git a/src/common/mmo.h b/src/common/mmo.h index 3af414fdb..9594a39eb 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -764,6 +764,7 @@ struct mmo_charstatus { short attendance_count; unsigned char hotkey_rowshift; + unsigned char hotkey_rowshift2; int32 title_id; // Achievement Title[Dastgir/Hercules] }; diff --git a/src/map/clif.c b/src/map/clif.c index 9f751a68d..f5fcc7d9d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10849,7 +10849,10 @@ static void clif_hotkeys_send(struct map_session_data *sd, int tab) struct PACKET_ZC_SHORTCUT_KEY_LIST p; p.packetType = HEADER_ZC_SHORTCUT_KEY_LIST; #if PACKETVER_MAIN_NUM >= 20141022 || PACKETVER_RE_NUM >= 20141015 || defined(PACKETVER_ZERO) - p.rotate = sd->status.hotkey_rowshift; + if (tab == 0) + p.rotate = sd->status.hotkey_rowshift; + else + p.rotate = sd->status.hotkey_rowshift2; #endif #if PACKETVER_RE_NUM >= 20190508 p.tab = tab; @@ -10878,8 +10881,10 @@ static void clif_parse_HotkeyRowShift2(int fd, struct map_session_data *sd) { #if PACKETVER_RE_NUM >= 20190508 const struct PACKET_CZ_SHORTCUTKEYBAR_ROTATE2 *p = RFIFOP(fd, 0); - // need use p->tab - sd->status.hotkey_rowshift = p->rowshift; + if (p->tab == 0) + sd->status.hotkey_rowshift = p->rowshift; + else + sd->status.hotkey_rowshift2 = p->rowshift; #endif } -- cgit v1.2.3-60-g2f50