diff options
author | Haru <haru@dotalux.com> | 2019-09-22 21:06:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-22 21:06:08 +0200 |
commit | d3d7e84cde670e6ac2ea0fbf1b93b35ff83b5e5f (patch) | |
tree | 5461c6d855ed41d870067351c50223bccf82e5ec | |
parent | 76896e85057760d7f412293b912dce77d9016415 (diff) | |
parent | 3cbec0a83b20c88ceb7c68fea532b79260c583a8 (diff) | |
download | hercules-d3d7e84cde670e6ac2ea0fbf1b93b35ff83b5e5f.tar.gz hercules-d3d7e84cde670e6ac2ea0fbf1b93b35ff83b5e5f.tar.bz2 hercules-d3d7e84cde670e6ac2ea0fbf1b93b35ff83b5e5f.tar.xz hercules-d3d7e84cde670e6ac2ea0fbf1b93b35ff83b5e5f.zip |
Merge pull request #2519 from Asheraf/guildcastlesupdate
Implementation of new guild ui client features
-rw-r--r-- | db/castle_db.conf | 382 | ||||
-rw-r--r-- | sql-files/main.sql | 1 | ||||
-rw-r--r-- | sql-files/upgrades/2019-08-08--19-43.sql | 95 | ||||
-rw-r--r-- | sql-files/upgrades/index.txt | 1 | ||||
-rw-r--r-- | src/common/mmo.h | 8 | ||||
-rw-r--r-- | src/map/clif.c | 126 | ||||
-rw-r--r-- | src/map/clif.h | 12 | ||||
-rw-r--r-- | src/map/guild.c | 52 | ||||
-rw-r--r-- | src/map/guild.h | 1 | ||||
-rw-r--r-- | src/map/packets.h | 5 | ||||
-rw-r--r-- | src/map/packets_struct.h | 43 | ||||
-rw-r--r-- | src/map/script.c | 5 | ||||
-rw-r--r-- | src/map/script.h | 10 |
13 files changed, 650 insertions, 91 deletions
diff --git a/db/castle_db.conf b/db/castle_db.conf index 907754954..c50d04c48 100644 --- a/db/castle_db.conf +++ b/db/castle_db.conf @@ -39,231 +39,433 @@ castle_db: ( CastleName: (string) Name of the castle (used by scripts and guardian name tags) OnGuildBreakEventName: (string) NPC unique name to invoke ::OnGuildBreak on, when a occupied castle is abandoned during guild break. + // ================ Optional fields =============================== + SiegeType: (string, default to SIEGE_TYPE_FE) define siege type + EnableClientWarp: (bool, default to false) enable or disable client teleport features + ClientWarp: { + Position: (int, int) x, y position of warp request + ZenyCost: (int) The zeny cost of warp + ZenyCostSiegeTime: (int) The zeny cost of warp durring woe + } }, **************************************************************************/ //================ +// Prontera +//================ +{ + CastleID: 1 + MapName: "prtg_cas01" + CastleName: "Kriemhild" // kRO : Creamhilt + OnGuildBreakEventName: "Agit#prtg_cas01" + EnableClientWarp: true + ClientWarp: { + Position: (107, 180) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } +}, +{ + CastleID: 2 + MapName: "prtg_cas02" + CastleName: "Swanhild" // kRO : Sbanhealt + OnGuildBreakEventName: "Agit#prtg_cas02" + EnableClientWarp: true + ClientWarp: { + Position: (94, 56) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } +}, +{ + CastleID: 3 + MapName: "prtg_cas03" + CastleName: "Fadhgridh" // kRO : Lazrigees + OnGuildBreakEventName: "Agit#prtg_cas03" + EnableClientWarp: true + ClientWarp: { + Position: (46, 97) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } +}, +{ + CastleID: 4 + MapName: "prtg_cas04" + CastleName: "Skoegul" // kRO : Squagul + OnGuildBreakEventName: "Agit#prtg_cas04" + EnableClientWarp: true + ClientWarp: { + Position: (260, 262) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } +}, +{ + CastleID: 5 + MapName: "prtg_cas05" + CastleName: "Gondul" // kRO : Guindull + OnGuildBreakEventName: "Agit#prtg_cas05" + EnableClientWarp: true + ClientWarp: { + Position: (26, 38) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } +}, +//================ // Al De Baran //================ { - CastleID: 0 + CastleID: 6 MapName: "aldeg_cas01" CastleName: "Neuschwanstein" // kRO : Noisyubantian OnGuildBreakEventName: "Agit#aldeg_cas01" + EnableClientWarp: true + ClientWarp: { + Position: (212, 175) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 1 + CastleID: 7 MapName: "aldeg_cas02" CastleName: "Hohenschwangau" // kRO : Hohensyubangawoo OnGuildBreakEventName: "Agit#aldeg_cas02" + EnableClientWarp: true + ClientWarp: { + Position: (82, 71) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 2 + CastleID: 8 MapName: "aldeg_cas03" CastleName: "Nuernberg" // kRO : Nyirenverk OnGuildBreakEventName: "Agit#aldeg_cas03" + EnableClientWarp: true + ClientWarp: { + Position: (109, 112) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 3 + CastleID: 9 MapName: "aldeg_cas04" CastleName: "Wuerzburg" // kRO : Byirtsburi OnGuildBreakEventName: "Agit#aldeg_cas04" + EnableClientWarp: true + ClientWarp: { + Position: (60, 116) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 4 + CastleID: 10 MapName: "aldeg_cas05" CastleName: "Rothenburg" // kRO : Rotenburk OnGuildBreakEventName: "Agit#aldeg_cas05" + EnableClientWarp: true + ClientWarp: { + Position: (61, 185) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, //================ // Geffen //================ { - CastleID: 5 + CastleID: 11 MapName: "gefg_cas01" CastleName: "Repherion" // kRO : Reprion OnGuildBreakEventName: "Agit#gefg_cas01" + EnableClientWarp: true + ClientWarp: { + Position: (40, 43) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 6 + CastleID: 12 MapName: "gefg_cas02" CastleName: "Eeyolbriggar" // kRO : Yolbriger OnGuildBreakEventName: "Agit#gefg_cas02" + EnableClientWarp: true + ClientWarp: { + Position: (22, 66) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 7 + CastleID: 13 MapName: "gefg_cas03" CastleName: "Yesnelph" // kRO : Isinlife OnGuildBreakEventName: "Agit#gefg_cas03" + EnableClientWarp: true + ClientWarp: { + Position: (112, 23) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 8 + CastleID: 14 MapName: "gefg_cas04" CastleName: "Bergel" // kRO : Berigel OnGuildBreakEventName: "Agit#gefg_cas04" + EnableClientWarp: true + ClientWarp: { + Position: (58, 46) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 9 + CastleID: 15 MapName: "gefg_cas05" CastleName: "Mersetzdeitz" // kRO : Melsedetsu OnGuildBreakEventName: "Agit#gefg_cas05" + EnableClientWarp: true + ClientWarp: { + Position: (66, 48) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, //================ // Payon //================ { - CastleID: 10 + CastleID: 16 MapName: "payg_cas01" CastleName: "Bright Arbor" // kRO : Mingting OnGuildBreakEventName: "Agit#payg_cas01" + EnableClientWarp: true + ClientWarp: { + Position: (115, 57) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 11 + CastleID: 17 MapName: "payg_cas02" CastleName: "Scarlet Palace" // kRO : Tiantan OnGuildBreakEventName: "Agit#payg_cas02" + EnableClientWarp: true + ClientWarp: { + Position: (26, 265) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 12 + CastleID: 18 MapName: "payg_cas03" CastleName: "Holy Shadow" // kRO : Fuying OnGuildBreakEventName: "Agit#payg_cas03" + EnableClientWarp: true + ClientWarp: { + Position: (43, 264) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 13 + CastleID: 19 MapName: "payg_cas04" CastleName: "Sacred Altar" // kRO : Honglou OnGuildBreakEventName: "Agit#payg_cas04" + EnableClientWarp: true + ClientWarp: { + Position: (36, 272) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 14 + CastleID: 20 MapName: "payg_cas05" CastleName: "Bamboo Grove Hill" // kRO : Zhulinxian OnGuildBreakEventName: "Agit#payg_cas05" + EnableClientWarp: true + ClientWarp: { + Position: (274, 246) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, //================ -// Prontera +// Rachel //================ { - CastleID: 15 - MapName: "prtg_cas01" - CastleName: "Kriemhild" // kRO : Creamhilt - OnGuildBreakEventName: "Agit#prtg_cas01" -}, -{ - CastleID: 16 - MapName: "prtg_cas02" - CastleName: "Swanhild" // kRO : Sbanhealt - OnGuildBreakEventName: "Agit#prtg_cas02" -}, -{ - CastleID: 17 - MapName: "prtg_cas03" - CastleName: "Fadhgridh" // kRO : Lazrigees - OnGuildBreakEventName: "Agit#prtg_cas03" -}, -{ - CastleID: 18 - MapName: "prtg_cas04" - CastleName: "Skoegul" // kRO : Squagul - OnGuildBreakEventName: "Agit#prtg_cas04" -}, -{ - CastleID: 19 - MapName: "prtg_cas05" - CastleName: "Gondul" // kRO : Guindull - OnGuildBreakEventName: "Agit#prtg_cas05" + CastleID: 21 + MapName: "arug_cas01" + CastleName: "Mardol" // kRO : Mardol + OnGuildBreakEventName: "Manager#arug_cas01" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (77, 371) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, -//================ -// Novice Guilds -//================ { - CastleID: 20 - MapName: "nguild_alde" - CastleName: "Earth" - OnGuildBreakEventName: "Agit_N01" + CastleID: 22 + MapName: "arug_cas02" + CastleName: "Cyr" // kRO : Cyr + OnGuildBreakEventName: "Manager#arug_cas02" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (301, 332) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 21 - MapName: "nguild_gef" - CastleName: "Air" - OnGuildBreakEventName: "Agit_N02" + CastleID: 23 + MapName: "arug_cas03" + CastleName: "Horn" // kRO : Horn + OnGuildBreakEventName: "Manager#arug_cas03" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (322, 91) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 22 - MapName: "nguild_pay" - CastleName: "Water" - OnGuildBreakEventName: "Agit_N03" + CastleID: 24 + MapName: "arug_cas04" + CastleName: "Gefn" // kRO : Gefn + OnGuildBreakEventName: "Manager#arug_cas04" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (322, 91) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 23 - MapName: "nguild_prt" - CastleName: "Fire" - OnGuildBreakEventName: "Agit_N04" + CastleID: 25 + MapName: "arug_cas05" + CastleName: "Bandis" // kRO : Bandis + OnGuildBreakEventName: "Manager#arug_cas05" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (322, 91) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, //================ // Yuno //================ { - CastleID: 24 + CastleID: 26 MapName: "schg_cas01" CastleName: "Himinn" // kRO : Himinn OnGuildBreakEventName: "Manager#schg_cas01" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (233, 300) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 25 + CastleID: 27 MapName: "schg_cas02" CastleName: "Andlangr" // kRO : Andlangr OnGuildBreakEventName: "Manager#schg_cas02" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (101, 372) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 26 + CastleID: 28 MapName: "schg_cas03" CastleName: "Viblainn" // kRO : Viblainn OnGuildBreakEventName: "Manager#schg_cas03" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (81, 94) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 27 + CastleID: 29 MapName: "schg_cas04" CastleName: "Hljod" // kRO : Hljod OnGuildBreakEventName: "Manager#schg_cas04" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (233, 300) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, { - CastleID: 28 + CastleID: 30 MapName: "schg_cas05" CastleName: "Skidbladnir" // kRO : Skidbladnir OnGuildBreakEventName: "Manager#schg_cas05" + SiegeType: "SIEGE_TYPE_SE" + EnableClientWarp: true + ClientWarp: { + Position: (233, 300) + ZenyCost: 100 + ZenyCostSiegeTime: 100000 + } }, //================ -// Rachel +// Novice Guilds //================ { - CastleID: 29 - MapName: "arug_cas01" - CastleName: "Mardol" // kRO : Mardol - OnGuildBreakEventName: "Manager#arug_cas01" -}, -{ - CastleID: 30 - MapName: "arug_cas02" - CastleName: "Cyr" // kRO : Cyr - OnGuildBreakEventName: "Manager#arug_cas02" -}, -{ CastleID: 31 - MapName: "arug_cas03" - CastleName: "Horn" // kRO : Horn - OnGuildBreakEventName: "Manager#arug_cas03" + MapName: "nguild_prt" + CastleName: "Fire" + OnGuildBreakEventName: "Agit_N04" + SiegeType: "SIEGE_TYPE_TE" }, { CastleID: 32 - MapName: "arug_cas04" - CastleName: "Gefn" // kRO : Gefn - OnGuildBreakEventName: "Manager#arug_cas04" + MapName: "nguild_alde" + CastleName: "Earth" + OnGuildBreakEventName: "Agit_N01" + SiegeType: "SIEGE_TYPE_TE" }, { CastleID: 33 - MapName: "arug_cas05" - CastleName: "Bandis" // kRO : Bandis - OnGuildBreakEventName: "Manager#arug_cas05" + MapName: "nguild_gef" + CastleName: "Air" + OnGuildBreakEventName: "Agit_N02" + SiegeType: "SIEGE_TYPE_TE" +}, +{ + CastleID: 34 + MapName: "nguild_pay" + CastleName: "Water" + OnGuildBreakEventName: "Agit_N03" + SiegeType: "SIEGE_TYPE_TE" }, ) diff --git a/sql-files/main.sql b/sql-files/main.sql index e364ec778..27839afa3 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -930,6 +930,7 @@ INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1546059075); -- 2018-12-2 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 +INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1565293394); -- 2019-08-08--19-43.sql -- -- Table structure for table `storage` diff --git a/sql-files/upgrades/2019-08-08--19-43.sql b/sql-files/upgrades/2019-08-08--19-43.sql new file mode 100644 index 000000000..35faf4ace --- /dev/null +++ b/sql-files/upgrades/2019-08-08--19-43.sql @@ -0,0 +1,95 @@ +#1565293394 + +-- This file is part of Hercules. +-- http://herc.ws - http://github.com/HerculesWS/Hercules +-- +-- Copyright (C) 2019 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 <http://www.gnu.org/licenses/>. + +ALTER TABLE `guild_castle` DROP PRIMARY KEY; +ALTER TABLE `guild_castle` ADD COLUMN `castle_name` VARCHAR(24) AFTER `castle_id`; +UPDATE `guild_castle` SET `castle_name` = 'aldeg_cas01' WHERE castle_id = 0; +UPDATE `guild_castle` SET `castle_name` = 'aldeg_cas02' WHERE castle_id = 1; +UPDATE `guild_castle` SET `castle_name` = 'aldeg_cas03' WHERE castle_id = 2; +UPDATE `guild_castle` SET `castle_name` = 'aldeg_cas04' WHERE castle_id = 3; +UPDATE `guild_castle` SET `castle_name` = 'aldeg_cas05' WHERE castle_id = 4; +UPDATE `guild_castle` SET `castle_name` = 'gefg_cas01' WHERE castle_id = 5; +UPDATE `guild_castle` SET `castle_name` = 'gefg_cas02' WHERE castle_id = 6; +UPDATE `guild_castle` SET `castle_name` = 'gefg_cas03' WHERE castle_id = 7; +UPDATE `guild_castle` SET `castle_name` = 'gefg_cas04' WHERE castle_id = 8; +UPDATE `guild_castle` SET `castle_name` = 'gefg_cas05' WHERE castle_id = 9; +UPDATE `guild_castle` SET `castle_name` = 'payg_cas01' WHERE castle_id = 10; +UPDATE `guild_castle` SET `castle_name` = 'payg_cas02' WHERE castle_id = 11; +UPDATE `guild_castle` SET `castle_name` = 'payg_cas03' WHERE castle_id = 12; +UPDATE `guild_castle` SET `castle_name` = 'payg_cas04' WHERE castle_id = 13; +UPDATE `guild_castle` SET `castle_name` = 'payg_cas05' WHERE castle_id = 14; +UPDATE `guild_castle` SET `castle_name` = 'prtg_cas01' WHERE castle_id = 15; +UPDATE `guild_castle` SET `castle_name` = 'prtg_cas02' WHERE castle_id = 16; +UPDATE `guild_castle` SET `castle_name` = 'prtg_cas03' WHERE castle_id = 17; +UPDATE `guild_castle` SET `castle_name` = 'prtg_cas04' WHERE castle_id = 18; +UPDATE `guild_castle` SET `castle_name` = 'prtg_cas05' WHERE castle_id = 19; +UPDATE `guild_castle` SET `castle_name` = 'nguild_alde' WHERE castle_id = 20; +UPDATE `guild_castle` SET `castle_name` = 'nguild_gef' WHERE castle_id = 21; +UPDATE `guild_castle` SET `castle_name` = 'nguild_pay' WHERE castle_id = 22; +UPDATE `guild_castle` SET `castle_name` = 'nguild_prt' WHERE castle_id = 23; +UPDATE `guild_castle` SET `castle_name` = 'schg_cas01' WHERE castle_id = 24; +UPDATE `guild_castle` SET `castle_name` = 'schg_cas02' WHERE castle_id = 25; +UPDATE `guild_castle` SET `castle_name` = 'schg_cas03' WHERE castle_id = 26; +UPDATE `guild_castle` SET `castle_name` = 'schg_cas04' WHERE castle_id = 27; +UPDATE `guild_castle` SET `castle_name` = 'schg_cas05' WHERE castle_id = 28; +UPDATE `guild_castle` SET `castle_name` = 'arug_cas01' WHERE castle_id = 29; +UPDATE `guild_castle` SET `castle_name` = 'arug_cas02' WHERE castle_id = 30; +UPDATE `guild_castle` SET `castle_name` = 'arug_cas03' WHERE castle_id = 31; +UPDATE `guild_castle` SET `castle_name` = 'arug_cas04' WHERE castle_id = 32; +UPDATE `guild_castle` SET `castle_name` = 'arug_cas05' WHERE castle_id = 33; + +-- Change the castle ids +UPDATE `guild_castle` SET `castle_id` = 1 WHERE castle_name = 'prtg_cas01'; +UPDATE `guild_castle` SET `castle_id` = 2 WHERE castle_name = 'prtg_cas02'; +UPDATE `guild_castle` SET `castle_id` = 3 WHERE castle_name = 'prtg_cas03'; +UPDATE `guild_castle` SET `castle_id` = 4 WHERE castle_name = 'prtg_cas04'; +UPDATE `guild_castle` SET `castle_id` = 5 WHERE castle_name = 'prtg_cas05'; +UPDATE `guild_castle` SET `castle_id` = 6 WHERE castle_name = 'aldeg_cas01'; +UPDATE `guild_castle` SET `castle_id` = 7 WHERE castle_name = 'aldeg_cas02'; +UPDATE `guild_castle` SET `castle_id` = 8 WHERE castle_name = 'aldeg_cas03'; +UPDATE `guild_castle` SET `castle_id` = 9 WHERE castle_name = 'aldeg_cas04'; +UPDATE `guild_castle` SET `castle_id` = 10 WHERE castle_name = 'aldeg_cas05'; +UPDATE `guild_castle` SET `castle_id` = 11 WHERE castle_name = 'gefg_cas01'; +UPDATE `guild_castle` SET `castle_id` = 12 WHERE castle_name = 'gefg_cas02'; +UPDATE `guild_castle` SET `castle_id` = 13 WHERE castle_name = 'gefg_cas03'; +UPDATE `guild_castle` SET `castle_id` = 14 WHERE castle_name = 'gefg_cas04'; +UPDATE `guild_castle` SET `castle_id` = 15 WHERE castle_name = 'gefg_cas05'; +UPDATE `guild_castle` SET `castle_id` = 16 WHERE castle_name = 'payg_cas01'; +UPDATE `guild_castle` SET `castle_id` = 17 WHERE castle_name = 'payg_cas02'; +UPDATE `guild_castle` SET `castle_id` = 18 WHERE castle_name = 'payg_cas03'; +UPDATE `guild_castle` SET `castle_id` = 19 WHERE castle_name = 'payg_cas04'; +UPDATE `guild_castle` SET `castle_id` = 20 WHERE castle_name = 'payg_cas05'; +UPDATE `guild_castle` SET `castle_id` = 21 WHERE castle_name = 'arug_cas01'; +UPDATE `guild_castle` SET `castle_id` = 22 WHERE castle_name = 'arug_cas02'; +UPDATE `guild_castle` SET `castle_id` = 23 WHERE castle_name = 'arug_cas03'; +UPDATE `guild_castle` SET `castle_id` = 24 WHERE castle_name = 'arug_cas04'; +UPDATE `guild_castle` SET `castle_id` = 25 WHERE castle_name = 'arug_cas05'; +UPDATE `guild_castle` SET `castle_id` = 26 WHERE castle_name = 'schg_cas01'; +UPDATE `guild_castle` SET `castle_id` = 27 WHERE castle_name = 'schg_cas02'; +UPDATE `guild_castle` SET `castle_id` = 29 WHERE castle_name = 'schg_cas04'; +UPDATE `guild_castle` SET `castle_id` = 28 WHERE castle_name = 'schg_cas03'; +UPDATE `guild_castle` SET `castle_id` = 30 WHERE castle_name = 'schg_cas05'; +UPDATE `guild_castle` SET `castle_id` = 31 WHERE castle_name = 'nguild_prt'; +UPDATE `guild_castle` SET `castle_id` = 32 WHERE castle_name = 'nguild_alde'; +UPDATE `guild_castle` SET `castle_id` = 33 WHERE castle_name = 'nguild_gef'; +UPDATE `guild_castle` SET `castle_id` = 34 WHERE castle_name = 'nguild_pay'; +ALTER TABLE `guild_castle` ADD PRIMARY KEY (`castle_id`); +ALTER TABLE `guild_castle` DROP COLUMN `castle_name`; +INSERT INTO `sql_updates` (`timestamp`) VALUES (1565293394); diff --git a/sql-files/upgrades/index.txt b/sql-files/upgrades/index.txt index 3025a728c..85bd2a245 100644 --- a/sql-files/upgrades/index.txt +++ b/sql-files/upgrades/index.txt @@ -55,3 +55,4 @@ 2019-04-08--21-52.sql 2019-04-25--02-12.sql 2019-05-09--18-07.sql +2019-08-08--19-43.sql diff --git a/src/common/mmo.h b/src/common/mmo.h index 1fa6fadc8..66736bff0 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -907,6 +907,14 @@ struct guild_castle { int mapindex; char castle_name[NAME_LENGTH]; char castle_event[NAME_LENGTH]; + int siege_type; + bool enable_client_warp; + struct { + int x; + int y; + int zeny; + int zeny_siege; + } client_warp; int guild_id; int economy; int defense; diff --git a/src/map/clif.c b/src/map/clif.c index c7f81a471..33c003321 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8106,6 +8106,54 @@ static void clif_guild_allianceinfo(struct map_session_data *sd) WFIFOSET(fd,WFIFOW(fd,2)); } +static void clif_guild_castlelist(struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814 + nullpo_retv(sd); + + struct guild *g = sd->guild; + if (g == NULL) + return; + + int castle_count = guild->checkcastles(g); + if (castle_count > 0) { + int len = sizeof(struct PACKET_ZC_GUILD_CASTLE_LIST) + castle_count; + struct PACKET_ZC_GUILD_CASTLE_LIST *p = aMalloc(len); + p->packetType = HEADER_ZC_GUILD_CASTLE_LIST; + p->packetLength = len; + + int i = 0; + struct DBIterator *iter = db_iterator(guild->castle_db); + for (struct guild_castle *gc = dbi_first(iter); dbi_exists(iter); gc = dbi_next(iter)) { + if (gc->guild_id == g->guild_id) { + p->castle_list[i] = gc->castle_id; + ++i; + } + } + dbi_destroy(iter); + + clif->send(p, len, &sd->bl, SELF); + aFree(p); + } +#endif +} + +static void clif_guild_castleinfo(struct map_session_data *sd, struct guild_castle *gc) +{ +#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814 + + nullpo_retv(sd); + nullpo_retv(gc); + + struct PACKET_ZC_CASTLE_INFO p = { 0 }; + p.packetType = HEADER_ZC_CASTLE_INFO; + p.castle_id = gc->castle_id; + p.economy = gc->economy; + p.defense = gc->defense; + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} + /// Guild member manager information (ZC_MEMBERMGR_INFO). /// 0154 <packet len>.W { <account>.L <char id>.L <hair style>.W <hair color>.W <gender>.W <class>.W <level>.W <contrib exp>.L <state>.L <position>.L <memo>.50B <name>.24B }* /// state: @@ -14407,6 +14455,7 @@ static void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) case 0: // Basic Information Guild, hostile alliance information clif->guild_basicinfo(sd); clif->guild_allianceinfo(sd); + clif->guild_castlelist(sd); break; case 1: // Members list, list job title clif->guild_positionnamelist(sd); @@ -23211,6 +23260,78 @@ static void clif_announce_refine_status(struct map_session_data *sd, int item_id #endif } +static void clif_parse_GuildCastleTeleportRequest(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_GuildCastleTeleportRequest(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515 + const struct PACKET_CZ_CASTLE_TELEPORT_REQUEST *p = RFIFO2PTR(fd); + struct guild *g = sd->guild; + + if (g == NULL) + return; + + struct guild_castle *gc = guild->castle_search(p->castle_id); + if (gc == NULL) + return; + if (gc->enable_client_warp == false) + return; + if (gc->guild_id != g->guild_id) + return; + + if (map->list[sd->bl.m].flag.gvg_castle == 1) + return; + + int zeny = gc->client_warp.zeny; + if (gc->siege_type == SIEGE_TYPE_FE && map->agit_flag == 1) { + zeny = gc->client_warp.zeny_siege; + } else if (gc->siege_type == SIEGE_TYPE_SE && map->agit2_flag == 1) { + zeny = gc->client_warp.zeny_siege; + } else if (gc->siege_type == SIEGE_TYPE_TE) { + clif->guild_castleteleport_res(sd, SIEGE_TP_INVALID_MODE); + return; + } + + if (sd->status.zeny < zeny) { + clif->guild_castleteleport_res(sd, SIEGE_TP_NOT_ENOUGH_ZENY); + return; + } + sd->status.zeny -= zeny; + clif->updatestatus(sd, SP_ZENY); + pc->setpos(sd, gc->mapindex, gc->client_warp.x, gc->client_warp.y, CLR_OUTSIGHT); +#endif +} + +static void clif_guild_castleteleport_res(struct map_session_data *sd, enum siege_teleport_result result) +{ +#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814 + + nullpo_retv(sd); + + struct PACKET_ZC_CASTLE_TELEPORT_RESPONSE p = { 0 }; + p.packetType = HEADER_ZC_CASTLE_TELEPORT_RESPONSE; + p.result = (int16)result; + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} +static void clif_parse_GuildCastleInfoRequest(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); +static void clif_parse_GuildCastleInfoRequest(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515 + const struct PACKET_CZ_CASTLE_INFO_REQUEST *p = RFIFO2PTR(fd); + struct guild *g = sd->guild; + + if (g == NULL) + return; + + struct guild_castle *gc = guild->castle_search(p->castle_id); + if (gc == NULL) + return; + if (gc->guild_id != g->guild_id) + return; + clif->guild_castleinfo(sd, gc); +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -23895,6 +24016,8 @@ void clif_defaults(void) clif->guild_masterormember = clif_guild_masterormember; clif->guild_basicinfo = clif_guild_basicinfo; clif->guild_allianceinfo = clif_guild_allianceinfo; + clif->guild_castlelist = clif_guild_castlelist; + clif->guild_castleinfo = clif_guild_castleinfo; clif->guild_memberlist = clif_guild_memberlist; clif->guild_skillinfo = clif_guild_skillinfo; clif->guild_send_onlineinfo = clif_guild_send_onlineinfo; @@ -24436,4 +24559,7 @@ void clif_defaults(void) clif->pRefineryUIClose = clif_parse_RefineryUIClose; clif->pRefineryUIRefine = clif_parse_RefineryUIRefine; clif->announce_refine_status = clif_announce_refine_status; + clif->pGuildCastleTeleportRequest = clif_parse_GuildCastleTeleportRequest; + clif->pGuildCastleInfoRequest = clif_parse_GuildCastleInfoRequest; + clif->guild_castleteleport_res = clif_guild_castleteleport_res; } diff --git a/src/map/clif.h b/src/map/clif.h index f3d7c78eb..245352b9c 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -633,6 +633,13 @@ enum inventory_type { INVTYPE_GUILD_STORAGE = 3, }; +/** Guild Teleport Results */ +enum siege_teleport_result { + SIEGE_TP_SUCCESS = 0x0, + SIEGE_TP_NOT_ENOUGH_ZENY = 0x1, + SIEGE_TP_INVALID_MODE = 0x2 +}; + /** * Structures **/ @@ -1114,6 +1121,8 @@ struct clif_interface { void (*guild_masterormember) (struct map_session_data *sd); void (*guild_basicinfo) (struct map_session_data *sd); void (*guild_allianceinfo) (struct map_session_data *sd); + void (*guild_castlelist) (struct map_session_data *sd); + void (*guild_castleinfo) (struct map_session_data *sd, struct guild_castle *gc); void (*guild_memberlist) (struct map_session_data *sd); void (*guild_skillinfo) (struct map_session_data* sd); void (*guild_send_onlineinfo) (struct map_session_data *sd); //[LuzZza] @@ -1647,6 +1656,9 @@ struct clif_interface { void (*pRefineryUIClose) (int fd, struct map_session_data *sd); void (*pRefineryUIRefine) (int fd, struct map_session_data *sd); void (*announce_refine_status) (struct map_session_data *sd, int item_id, int refine_level, bool success, enum send_target target); + void (*pGuildCastleTeleportRequest) (int fd, struct map_session_data *sd); + void (*pGuildCastleInfoRequest) (int fd, struct map_session_data *sd); + void (*guild_castleteleport_res) (struct map_session_data *sd, enum siege_teleport_result result); }; #ifdef HERCULES_CORE diff --git a/src/map/guild.c b/src/map/guild.c index 415a46db5..3191515f7 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -169,7 +169,7 @@ static bool guild_read_castledb_libconfig(void) } libconfig->destroy(&castle_conf); - ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, config_filename); + ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(guild->castle_db), config_filename); return true; } @@ -217,10 +217,59 @@ static bool guild_read_castledb_libconfig_sub(struct config_setting_t *it, int i } safestrncpy(gc->castle_event, name, sizeof(gc->castle_event)); + if (itemdb->lookup_const(it, "SiegeType", &i32) && (i32 >= SIEGE_TYPE_MAX || i32 < 0)) { + ShowWarning("guild_read_castledb_libconfig_sub: Invalid SiegeType in \"%s\", entry #%d, defaulting to SIEGE_TYPE_FE.\n", source, idx); + gc->siege_type = SIEGE_TYPE_FE; + } else { + gc->siege_type = i32; + } + + libconfig->setting_lookup_bool_real(it, "EnableClientWarp", &gc->enable_client_warp); + if (gc->enable_client_warp == true) { + struct config_setting_t *wd = libconfig->setting_get_member(it, "ClientWarp"); + guild->read_castledb_libconfig_sub_warp(wd, source, gc); + } idb_put(guild->castle_db, gc->castle_id, gc); return true; } +static bool guild_read_castledb_libconfig_sub_warp(struct config_setting_t *wd, const char *source, struct guild_castle *gc) +{ + nullpo_retr(false, wd); + nullpo_retr(false, gc); + nullpo_retr(false, source); + + int64 i64 = 0; + struct config_setting_t *it = libconfig->setting_get_member(wd, "Position"); + if (config_setting_is_list(it)) { + int m = map->mapindex2mapid(gc->mapindex); + + gc->client_warp.x = libconfig->setting_get_int_elem(it, 0); + gc->client_warp.y = libconfig->setting_get_int_elem(it, 1); + if (gc->client_warp.x < 0 || gc->client_warp.x >= map->list[m].xs || gc->client_warp.y < 0 || gc->client_warp.y >= map->list[m].ys) { + ShowWarning("guild_read_castledb_libconfig_sub_warp: Invalid Position in \"%s\", for castle (%d).\n", source, gc->castle_id); + return false; + } + } else { + ShowWarning("guild_read_castledb_libconfig_sub_warp: Invalid format for Position in \"%s\", for castle (%d).\n", source, gc->castle_id); + return false; + } + + if (libconfig->setting_lookup_int64(wd, "ZenyCost", &i64)) { + if (i64 > MAX_ZENY) { + ShowWarning("guild_read_castledb_libconfig_sub_warp: ZenyCost is too big in \"%s\", for castle (%d), capping to MAX_ZENY.\n", source, gc->castle_id); + } + gc->client_warp.zeny = cap_value((int)i64, 0, MAX_ZENY); + } + if (libconfig->setting_lookup_int64(wd, "ZenyCostSiegeTime", &i64)) { + if (i64 > MAX_ZENY) { + ShowWarning("guild_read_castledb_libconfig_sub_warp: ZenyCostSiegeTime is too big in \"%s\", for castle (%d), capping to MAX_ZENY.\n", source, gc->castle_id); + } + gc->client_warp.zeny_siege = cap_value((int)i64, 0, MAX_ZENY); + } + return true; +} + /// lookup: guild id -> guild* static struct guild *guild_search(int guild_id) { @@ -2497,6 +2546,7 @@ void guild_defaults(void) guild->read_guildskill_tree_db = guild_read_guildskill_tree_db; guild->read_castledb_libconfig = guild_read_castledb_libconfig; guild->read_castledb_libconfig_sub = guild_read_castledb_libconfig_sub; + guild->read_castledb_libconfig_sub_warp = guild_read_castledb_libconfig_sub_warp; guild->payexp_timer_sub = guild_payexp_timer_sub; guild->send_xy_timer_sub = guild_send_xy_timer_sub; guild->send_xy_timer = guild_send_xy_timer; diff --git a/src/map/guild.h b/src/map/guild.h index d0374103f..41f52711d 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -166,6 +166,7 @@ struct guild_interface { bool (*read_guildskill_tree_db) (char* split[], int columns, int current); bool (*read_castledb_libconfig) (void); bool (*read_castledb_libconfig_sub) (struct config_setting_t *it, int idx, const char *source); + bool (*read_castledb_libconfig_sub_warp) (struct config_setting_t *wd, const char *source, struct guild_castle *gc); int (*payexp_timer_sub) (union DBKey key, struct DBData *data, va_list ap); int (*send_xy_timer_sub) (union DBKey key, struct DBData *data, va_list ap); int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data); diff --git a/src/map/packets.h b/src/map/packets.h index 83a9d0322..e91421cfc 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1954,4 +1954,9 @@ packet(0x96e,clif->ackmergeitems); packet(0x0b22,clif->pHotkeyRowShift2); // CZ_SHORTCUTKEYBAR_ROTATE #endif +#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515 + packet(0x0b28,clif->pGuildCastleTeleportRequest); + packet(0x0b2c,clif->pGuildCastleInfoRequest); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 93b4abcca..24bb718da 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3626,6 +3626,49 @@ struct PACKET_ZC_TALKBOX_CHATCONTENTS { } __attribute__((packed)); DEFINE_PACKET_HEADER(ZC_TALKBOX_CHATCONTENTS, 0x0191); +#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814 +struct PACKET_ZC_GUILD_CASTLE_LIST { + int16 packetType; + int16 packetLength; + int8 castle_list[]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_GUILD_CASTLE_LIST, 0x0b27); +#endif + +#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515 +struct PACKET_CZ_CASTLE_TELEPORT_REQUEST { + int16 packetType; + int8 castle_id; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_CASTLE_TELEPORT_REQUEST, 0x0b28); +#endif + +#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814 +struct PACKET_ZC_CASTLE_TELEPORT_RESPONSE { + int16 packetType; + int16 result; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_CASTLE_TELEPORT_RESPONSE, 0x0b2e); +#endif + +#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814 +struct PACKET_ZC_CASTLE_INFO { + int16 packetType; + int8 castle_id; + int32 economy; + int32 defense; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_CASTLE_INFO, 0x0b2d); +#endif + +#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515 +struct PACKET_CZ_CASTLE_INFO_REQUEST { + int16 packetType; + int8 castle_id; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_CASTLE_INFO_REQUEST, 0x0b2c); +#endif + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris diff --git a/src/map/script.c b/src/map/script.c index 4bd8f2c85..de00f66be 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -27078,6 +27078,11 @@ static void script_hardcoded_constants(void) script->set_constant("GUILD_ONLINE_VENDOR", GUILD_ONLINE_VENDOR, false, false); script->set_constant("GUILD_ONLINE_NO_VENDOR", GUILD_ONLINE_NO_VENDOR, false, false); + script->constdb_comment("Siege Types"); + script->set_constant("SIEGE_TYPE_FE", SIEGE_TYPE_FE, false, false); + script->set_constant("SIEGE_TYPE_SE", SIEGE_TYPE_SE, false, false); + script->set_constant("SIEGE_TYPE_TE", SIEGE_TYPE_TE, false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); diff --git a/src/map/script.h b/src/map/script.h index 5dc480a15..64e709a27 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -542,6 +542,16 @@ enum pcblock_action_flag { }; /** + * Types of Siege (WoE) + */ +enum siege_type { + SIEGE_TYPE_FE, + SIEGE_TYPE_SE, + SIEGE_TYPE_TE, + SIEGE_TYPE_MAX +}; + +/** * Structures **/ |